##// END OF EJS Templates
Fix profiler stats problem with python2.5
fperez -
Show More
@@ -1,3085 +1,3096 b''
1 1 # -*- coding: utf-8 -*-
2 2 """Magic functions for InteractiveShell.
3 3
4 $Id: Magic.py 2122 2007-03-01 02:27:11Z fperez $"""
4 $Id: Magic.py 2153 2007-03-18 22:53:18Z 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 #print 'oname_rest:', oname_rest # dbg
214 214 for part in oname_rest:
215 215 try:
216 216 parent = obj
217 217 obj = getattr(obj,part)
218 218 except:
219 219 # Blanket except b/c some badly implemented objects
220 220 # allow __getattr__ to raise exceptions other than
221 221 # AttributeError, which then crashes IPython.
222 222 break
223 223 else:
224 224 # If we finish the for loop (no break), we got all members
225 225 found = 1
226 226 ospace = nsname
227 227 if ns == alias_ns:
228 228 isalias = 1
229 229 break # namespace loop
230 230
231 231 # Try to see if it's magic
232 232 if not found:
233 233 if oname.startswith(self.shell.ESC_MAGIC):
234 234 oname = oname[1:]
235 235 obj = getattr(self,'magic_'+oname,None)
236 236 if obj is not None:
237 237 found = 1
238 238 ospace = 'IPython internal'
239 239 ismagic = 1
240 240
241 241 # Last try: special-case some literals like '', [], {}, etc:
242 242 if not found and oname_head in ["''",'""','[]','{}','()']:
243 243 obj = eval(oname_head)
244 244 found = 1
245 245 ospace = 'Interactive'
246 246
247 247 return {'found':found, 'obj':obj, 'namespace':ospace,
248 248 'ismagic':ismagic, 'isalias':isalias, 'parent':parent}
249 249
250 250 def arg_err(self,func):
251 251 """Print docstring if incorrect arguments were passed"""
252 252 print 'Error in arguments:'
253 253 print OInspect.getdoc(func)
254 254
255 255 def format_latex(self,strng):
256 256 """Format a string for latex inclusion."""
257 257
258 258 # Characters that need to be escaped for latex:
259 259 escape_re = re.compile(r'(%|_|\$|#|&)',re.MULTILINE)
260 260 # Magic command names as headers:
261 261 cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC,
262 262 re.MULTILINE)
263 263 # Magic commands
264 264 cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC,
265 265 re.MULTILINE)
266 266 # Paragraph continue
267 267 par_re = re.compile(r'\\$',re.MULTILINE)
268 268
269 269 # The "\n" symbol
270 270 newline_re = re.compile(r'\\n')
271 271
272 272 # Now build the string for output:
273 273 #strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng)
274 274 strng = cmd_name_re.sub(r'\n\\bigskip\n\\texttt{\\textbf{ \1}}:',
275 275 strng)
276 276 strng = cmd_re.sub(r'\\texttt{\g<cmd>}',strng)
277 277 strng = par_re.sub(r'\\\\',strng)
278 278 strng = escape_re.sub(r'\\\1',strng)
279 279 strng = newline_re.sub(r'\\textbackslash{}n',strng)
280 280 return strng
281 281
282 282 def format_screen(self,strng):
283 283 """Format a string for screen printing.
284 284
285 285 This removes some latex-type format codes."""
286 286 # Paragraph continue
287 287 par_re = re.compile(r'\\$',re.MULTILINE)
288 288 strng = par_re.sub('',strng)
289 289 return strng
290 290
291 291 def parse_options(self,arg_str,opt_str,*long_opts,**kw):
292 292 """Parse options passed to an argument string.
293 293
294 294 The interface is similar to that of getopt(), but it returns back a
295 295 Struct with the options as keys and the stripped argument string still
296 296 as a string.
297 297
298 298 arg_str is quoted as a true sys.argv vector by using shlex.split.
299 299 This allows us to easily expand variables, glob files, quote
300 300 arguments, etc.
301 301
302 302 Options:
303 303 -mode: default 'string'. If given as 'list', the argument string is
304 304 returned as a list (split on whitespace) instead of a string.
305 305
306 306 -list_all: put all option values in lists. Normally only options
307 307 appearing more than once are put in a list.
308 308
309 309 -posix (True): whether to split the input line in POSIX mode or not,
310 310 as per the conventions outlined in the shlex module from the
311 311 standard library."""
312 312
313 313 # inject default options at the beginning of the input line
314 314 caller = sys._getframe(1).f_code.co_name.replace('magic_','')
315 315 arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str)
316 316
317 317 mode = kw.get('mode','string')
318 318 if mode not in ['string','list']:
319 319 raise ValueError,'incorrect mode given: %s' % mode
320 320 # Get options
321 321 list_all = kw.get('list_all',0)
322 322 posix = kw.get('posix',True)
323 323
324 324 # Check if we have more than one argument to warrant extra processing:
325 325 odict = {} # Dictionary with options
326 326 args = arg_str.split()
327 327 if len(args) >= 1:
328 328 # If the list of inputs only has 0 or 1 thing in it, there's no
329 329 # need to look for options
330 330 argv = arg_split(arg_str,posix)
331 331 # Do regular option processing
332 332 try:
333 333 opts,args = getopt(argv,opt_str,*long_opts)
334 334 except GetoptError,e:
335 335 raise GetoptError('%s ( allowed: "%s" %s)' % (e.msg,opt_str,
336 336 " ".join(long_opts)))
337 337 for o,a in opts:
338 338 if o.startswith('--'):
339 339 o = o[2:]
340 340 else:
341 341 o = o[1:]
342 342 try:
343 343 odict[o].append(a)
344 344 except AttributeError:
345 345 odict[o] = [odict[o],a]
346 346 except KeyError:
347 347 if list_all:
348 348 odict[o] = [a]
349 349 else:
350 350 odict[o] = a
351 351
352 352 # Prepare opts,args for return
353 353 opts = Struct(odict)
354 354 if mode == 'string':
355 355 args = ' '.join(args)
356 356
357 357 return opts,args
358 358
359 359 #......................................................................
360 360 # And now the actual magic functions
361 361
362 362 # Functions for IPython shell work (vars,funcs, config, etc)
363 363 def magic_lsmagic(self, parameter_s = ''):
364 364 """List currently available magic functions."""
365 365 mesc = self.shell.ESC_MAGIC
366 366 print 'Available magic functions:\n'+mesc+\
367 367 (' '+mesc).join(self.lsmagic())
368 368 print '\n' + Magic.auto_status[self.shell.rc.automagic]
369 369 return None
370 370
371 371 def magic_magic(self, parameter_s = ''):
372 372 """Print information about the magic function system."""
373 373
374 374 mode = ''
375 375 try:
376 376 if parameter_s.split()[0] == '-latex':
377 377 mode = 'latex'
378 378 if parameter_s.split()[0] == '-brief':
379 379 mode = 'brief'
380 380 except:
381 381 pass
382 382
383 383 magic_docs = []
384 384 for fname in self.lsmagic():
385 385 mname = 'magic_' + fname
386 386 for space in (Magic,self,self.__class__):
387 387 try:
388 388 fn = space.__dict__[mname]
389 389 except KeyError:
390 390 pass
391 391 else:
392 392 break
393 393 if mode == 'brief':
394 394 # only first line
395 395 fndoc = fn.__doc__.split('\n',1)[0]
396 396 else:
397 397 fndoc = fn.__doc__
398 398
399 399 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
400 400 fname,fndoc))
401 401 magic_docs = ''.join(magic_docs)
402 402
403 403 if mode == 'latex':
404 404 print self.format_latex(magic_docs)
405 405 return
406 406 else:
407 407 magic_docs = self.format_screen(magic_docs)
408 408 if mode == 'brief':
409 409 return magic_docs
410 410
411 411 outmsg = """
412 412 IPython's 'magic' functions
413 413 ===========================
414 414
415 415 The magic function system provides a series of functions which allow you to
416 416 control the behavior of IPython itself, plus a lot of system-type
417 417 features. All these functions are prefixed with a % character, but parameters
418 418 are given without parentheses or quotes.
419 419
420 420 NOTE: If you have 'automagic' enabled (via the command line option or with the
421 421 %automagic function), you don't need to type in the % explicitly. By default,
422 422 IPython ships with automagic on, so you should only rarely need the % escape.
423 423
424 424 Example: typing '%cd mydir' (without the quotes) changes you working directory
425 425 to 'mydir', if it exists.
426 426
427 427 You can define your own magic functions to extend the system. See the supplied
428 428 ipythonrc and example-magic.py files for details (in your ipython
429 429 configuration directory, typically $HOME/.ipython/).
430 430
431 431 You can also define your own aliased names for magic functions. In your
432 432 ipythonrc file, placing a line like:
433 433
434 434 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
435 435
436 436 will define %pf as a new name for %profile.
437 437
438 438 You can also call magics in code using the ipmagic() function, which IPython
439 439 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
440 440
441 441 For a list of the available magic functions, use %lsmagic. For a description
442 442 of any of them, type %magic_name?, e.g. '%cd?'.
443 443
444 444 Currently the magic system has the following functions:\n"""
445 445
446 446 mesc = self.shell.ESC_MAGIC
447 447 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
448 448 "\n\n%s%s\n\n%s" % (outmsg,
449 449 magic_docs,mesc,mesc,
450 450 (' '+mesc).join(self.lsmagic()),
451 451 Magic.auto_status[self.shell.rc.automagic] ) )
452 452
453 453 page(outmsg,screen_lines=self.shell.rc.screen_length)
454 454
455 455 def magic_automagic(self, parameter_s = ''):
456 456 """Make magic functions callable without having to type the initial %.
457 457
458 458 Without argumentsl toggles on/off (when off, you must call it as
459 459 %automagic, of course). With arguments it sets the value, and you can
460 460 use any of (case insensitive):
461 461
462 462 - on,1,True: to activate
463 463
464 464 - off,0,False: to deactivate.
465 465
466 466 Note that magic functions have lowest priority, so if there's a
467 467 variable whose name collides with that of a magic fn, automagic won't
468 468 work for that function (you get the variable instead). However, if you
469 469 delete the variable (del var), the previously shadowed magic function
470 470 becomes visible to automagic again."""
471 471
472 472 rc = self.shell.rc
473 473 arg = parameter_s.lower()
474 474 if parameter_s in ('on','1','true'):
475 475 rc.automagic = True
476 476 elif parameter_s in ('off','0','false'):
477 477 rc.automagic = False
478 478 else:
479 479 rc.automagic = not rc.automagic
480 480 print '\n' + Magic.auto_status[rc.automagic]
481 481
482 482 def magic_autocall(self, parameter_s = ''):
483 483 """Make functions callable without having to type parentheses.
484 484
485 485 Usage:
486 486
487 487 %autocall [mode]
488 488
489 489 The mode can be one of: 0->Off, 1->Smart, 2->Full. If not given, the
490 490 value is toggled on and off (remembering the previous state)."""
491 491
492 492 rc = self.shell.rc
493 493
494 494 if parameter_s:
495 495 arg = int(parameter_s)
496 496 else:
497 497 arg = 'toggle'
498 498
499 499 if not arg in (0,1,2,'toggle'):
500 500 error('Valid modes: (0->Off, 1->Smart, 2->Full')
501 501 return
502 502
503 503 if arg in (0,1,2):
504 504 rc.autocall = arg
505 505 else: # toggle
506 506 if rc.autocall:
507 507 self._magic_state.autocall_save = rc.autocall
508 508 rc.autocall = 0
509 509 else:
510 510 try:
511 511 rc.autocall = self._magic_state.autocall_save
512 512 except AttributeError:
513 513 rc.autocall = self._magic_state.autocall_save = 1
514 514
515 515 print "Automatic calling is:",['OFF','Smart','Full'][rc.autocall]
516 516
517 517 def magic_autoindent(self, parameter_s = ''):
518 518 """Toggle autoindent on/off (if available)."""
519 519
520 520 self.shell.set_autoindent()
521 521 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
522 522
523 523 def magic_system_verbose(self, parameter_s = ''):
524 524 """Set verbose printing of system calls.
525 525
526 526 If called without an argument, act as a toggle"""
527 527
528 528 if parameter_s:
529 529 val = bool(eval(parameter_s))
530 530 else:
531 531 val = None
532 532
533 533 self.shell.rc_set_toggle('system_verbose',val)
534 534 print "System verbose printing is:",\
535 535 ['OFF','ON'][self.shell.rc.system_verbose]
536 536
537 537 def magic_history(self, parameter_s = ''):
538 538 """Print input history (_i<n> variables), with most recent last.
539 539
540 540 %history -> print at most 40 inputs (some may be multi-line)\\
541 541 %history n -> print at most n inputs\\
542 542 %history n1 n2 -> print inputs between n1 and n2 (n2 not included)\\
543 543
544 544 Each input's number <n> is shown, and is accessible as the
545 545 automatically generated variable _i<n>. Multi-line statements are
546 546 printed starting at a new line for easy copy/paste.
547 547
548 548
549 549 Options:
550 550
551 551 -n: do NOT print line numbers. This is useful if you want to get a
552 552 printout of many lines which can be directly pasted into a text
553 553 editor.
554 554
555 555 This feature is only available if numbered prompts are in use.
556 556
557 557 -r: print the 'raw' history. IPython filters your input and
558 558 converts it all into valid Python source before executing it (things
559 559 like magics or aliases are turned into function calls, for
560 560 example). With this option, you'll see the unfiltered history
561 561 instead of the filtered version: '%cd /' will be seen as '%cd /'
562 562 instead of '_ip.magic("%cd /")'.
563 563 """
564 564
565 565 shell = self.shell
566 566 if not shell.outputcache.do_full_cache:
567 567 print 'This feature is only available if numbered prompts are in use.'
568 568 return
569 569 opts,args = self.parse_options(parameter_s,'nr',mode='list')
570 570
571 571 if opts.has_key('r'):
572 572 input_hist = shell.input_hist_raw
573 573 else:
574 574 input_hist = shell.input_hist
575 575
576 576 default_length = 40
577 577 if len(args) == 0:
578 578 final = len(input_hist)
579 579 init = max(1,final-default_length)
580 580 elif len(args) == 1:
581 581 final = len(input_hist)
582 582 init = max(1,final-int(args[0]))
583 583 elif len(args) == 2:
584 584 init,final = map(int,args)
585 585 else:
586 586 warn('%hist takes 0, 1 or 2 arguments separated by spaces.')
587 587 print self.magic_hist.__doc__
588 588 return
589 589 width = len(str(final))
590 590 line_sep = ['','\n']
591 591 print_nums = not opts.has_key('n')
592 592 for in_num in range(init,final):
593 593 inline = input_hist[in_num]
594 594 multiline = int(inline.count('\n') > 1)
595 595 if print_nums:
596 596 print '%s:%s' % (str(in_num).ljust(width),line_sep[multiline]),
597 597 print inline,
598 598
599 599 def magic_hist(self, parameter_s=''):
600 600 """Alternate name for %history."""
601 601 return self.magic_history(parameter_s)
602 602
603 603 def magic_p(self, parameter_s=''):
604 604 """Just a short alias for Python's 'print'."""
605 605 exec 'print ' + parameter_s in self.shell.user_ns
606 606
607 607 def magic_r(self, parameter_s=''):
608 608 """Repeat previous input.
609 609
610 610 If given an argument, repeats the previous command which starts with
611 611 the same string, otherwise it just repeats the previous input.
612 612
613 613 Shell escaped commands (with ! as first character) are not recognized
614 614 by this system, only pure python code and magic commands.
615 615 """
616 616
617 617 start = parameter_s.strip()
618 618 esc_magic = self.shell.ESC_MAGIC
619 619 # Identify magic commands even if automagic is on (which means
620 620 # the in-memory version is different from that typed by the user).
621 621 if self.shell.rc.automagic:
622 622 start_magic = esc_magic+start
623 623 else:
624 624 start_magic = start
625 625 # Look through the input history in reverse
626 626 for n in range(len(self.shell.input_hist)-2,0,-1):
627 627 input = self.shell.input_hist[n]
628 628 # skip plain 'r' lines so we don't recurse to infinity
629 629 if input != '_ip.magic("r")\n' and \
630 630 (input.startswith(start) or input.startswith(start_magic)):
631 631 #print 'match',`input` # dbg
632 632 print 'Executing:',input,
633 633 self.shell.runlines(input)
634 634 return
635 635 print 'No previous input matching `%s` found.' % start
636 636
637 637 def magic_page(self, parameter_s=''):
638 638 """Pretty print the object and display it through a pager.
639 639
640 640 %page [options] OBJECT
641 641
642 642 If no object is given, use _ (last output).
643 643
644 644 Options:
645 645
646 646 -r: page str(object), don't pretty-print it."""
647 647
648 648 # After a function contributed by Olivier Aubert, slightly modified.
649 649
650 650 # Process options/args
651 651 opts,args = self.parse_options(parameter_s,'r')
652 652 raw = 'r' in opts
653 653
654 654 oname = args and args or '_'
655 655 info = self._ofind(oname)
656 656 if info['found']:
657 657 txt = (raw and str or pformat)( info['obj'] )
658 658 page(txt)
659 659 else:
660 660 print 'Object `%s` not found' % oname
661 661
662 662 def magic_profile(self, parameter_s=''):
663 663 """Print your currently active IPyhton profile."""
664 664 if self.shell.rc.profile:
665 665 printpl('Current IPython profile: $self.shell.rc.profile.')
666 666 else:
667 667 print 'No profile active.'
668 668
669 669 def _inspect(self,meth,oname,namespaces=None,**kw):
670 670 """Generic interface to the inspector system.
671 671
672 672 This function is meant to be called by pdef, pdoc & friends."""
673 673
674 674 oname = oname.strip()
675 675 info = Struct(self._ofind(oname, namespaces))
676 676
677 677 if info.found:
678 678 # Get the docstring of the class property if it exists.
679 679 path = oname.split('.')
680 680 root = '.'.join(path[:-1])
681 681 if info.parent is not None:
682 682 try:
683 683 target = getattr(info.parent, '__class__')
684 684 # The object belongs to a class instance.
685 685 try:
686 686 target = getattr(target, path[-1])
687 687 # The class defines the object.
688 688 if isinstance(target, property):
689 689 oname = root + '.__class__.' + path[-1]
690 690 info = Struct(self._ofind(oname))
691 691 except AttributeError: pass
692 692 except AttributeError: pass
693 693
694 694 pmethod = getattr(self.shell.inspector,meth)
695 695 formatter = info.ismagic and self.format_screen or None
696 696 if meth == 'pdoc':
697 697 pmethod(info.obj,oname,formatter)
698 698 elif meth == 'pinfo':
699 699 pmethod(info.obj,oname,formatter,info,**kw)
700 700 else:
701 701 pmethod(info.obj,oname)
702 702 else:
703 703 print 'Object `%s` not found.' % oname
704 704 return 'not found' # so callers can take other action
705 705
706 706 def magic_pdef(self, parameter_s='', namespaces=None):
707 707 """Print the definition header for any callable object.
708 708
709 709 If the object is a class, print the constructor information."""
710 710 self._inspect('pdef',parameter_s, namespaces)
711 711
712 712 def magic_pdoc(self, parameter_s='', namespaces=None):
713 713 """Print the docstring for an object.
714 714
715 715 If the given object is a class, it will print both the class and the
716 716 constructor docstrings."""
717 717 self._inspect('pdoc',parameter_s, namespaces)
718 718
719 719 def magic_psource(self, parameter_s='', namespaces=None):
720 720 """Print (or run through pager) the source code for an object."""
721 721 self._inspect('psource',parameter_s, namespaces)
722 722
723 723 def magic_pfile(self, parameter_s=''):
724 724 """Print (or run through pager) the file where an object is defined.
725 725
726 726 The file opens at the line where the object definition begins. IPython
727 727 will honor the environment variable PAGER if set, and otherwise will
728 728 do its best to print the file in a convenient form.
729 729
730 730 If the given argument is not an object currently defined, IPython will
731 731 try to interpret it as a filename (automatically adding a .py extension
732 732 if needed). You can thus use %pfile as a syntax highlighting code
733 733 viewer."""
734 734
735 735 # first interpret argument as an object name
736 736 out = self._inspect('pfile',parameter_s)
737 737 # if not, try the input as a filename
738 738 if out == 'not found':
739 739 try:
740 740 filename = get_py_filename(parameter_s)
741 741 except IOError,msg:
742 742 print msg
743 743 return
744 744 page(self.shell.inspector.format(file(filename).read()))
745 745
746 746 def magic_pinfo(self, parameter_s='', namespaces=None):
747 747 """Provide detailed information about an object.
748 748
749 749 '%pinfo object' is just a synonym for object? or ?object."""
750 750
751 751 #print 'pinfo par: <%s>' % parameter_s # dbg
752 752
753 753 # detail_level: 0 -> obj? , 1 -> obj??
754 754 detail_level = 0
755 755 # We need to detect if we got called as 'pinfo pinfo foo', which can
756 756 # happen if the user types 'pinfo foo?' at the cmd line.
757 757 pinfo,qmark1,oname,qmark2 = \
758 758 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
759 759 if pinfo or qmark1 or qmark2:
760 760 detail_level = 1
761 761 if "*" in oname:
762 762 self.magic_psearch(oname)
763 763 else:
764 764 self._inspect('pinfo', oname, detail_level=detail_level,
765 765 namespaces=namespaces)
766 766
767 767 def magic_psearch(self, parameter_s=''):
768 768 """Search for object in namespaces by wildcard.
769 769
770 770 %psearch [options] PATTERN [OBJECT TYPE]
771 771
772 772 Note: ? can be used as a synonym for %psearch, at the beginning or at
773 773 the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the
774 774 rest of the command line must be unchanged (options come first), so
775 775 for example the following forms are equivalent
776 776
777 777 %psearch -i a* function
778 778 -i a* function?
779 779 ?-i a* function
780 780
781 781 Arguments:
782 782
783 783 PATTERN
784 784
785 785 where PATTERN is a string containing * as a wildcard similar to its
786 786 use in a shell. The pattern is matched in all namespaces on the
787 787 search path. By default objects starting with a single _ are not
788 788 matched, many IPython generated objects have a single
789 789 underscore. The default is case insensitive matching. Matching is
790 790 also done on the attributes of objects and not only on the objects
791 791 in a module.
792 792
793 793 [OBJECT TYPE]
794 794
795 795 Is the name of a python type from the types module. The name is
796 796 given in lowercase without the ending type, ex. StringType is
797 797 written string. By adding a type here only objects matching the
798 798 given type are matched. Using all here makes the pattern match all
799 799 types (this is the default).
800 800
801 801 Options:
802 802
803 803 -a: makes the pattern match even objects whose names start with a
804 804 single underscore. These names are normally ommitted from the
805 805 search.
806 806
807 807 -i/-c: make the pattern case insensitive/sensitive. If neither of
808 808 these options is given, the default is read from your ipythonrc
809 809 file. The option name which sets this value is
810 810 'wildcards_case_sensitive'. If this option is not specified in your
811 811 ipythonrc file, IPython's internal default is to do a case sensitive
812 812 search.
813 813
814 814 -e/-s NAMESPACE: exclude/search a given namespace. The pattern you
815 815 specifiy can be searched in any of the following namespaces:
816 816 'builtin', 'user', 'user_global','internal', 'alias', where
817 817 'builtin' and 'user' are the search defaults. Note that you should
818 818 not use quotes when specifying namespaces.
819 819
820 820 'Builtin' contains the python module builtin, 'user' contains all
821 821 user data, 'alias' only contain the shell aliases and no python
822 822 objects, 'internal' contains objects used by IPython. The
823 823 'user_global' namespace is only used by embedded IPython instances,
824 824 and it contains module-level globals. You can add namespaces to the
825 825 search with -s or exclude them with -e (these options can be given
826 826 more than once).
827 827
828 828 Examples:
829 829
830 830 %psearch a* -> objects beginning with an a
831 831 %psearch -e builtin a* -> objects NOT in the builtin space starting in a
832 832 %psearch a* function -> all functions beginning with an a
833 833 %psearch re.e* -> objects beginning with an e in module re
834 834 %psearch r*.e* -> objects that start with e in modules starting in r
835 835 %psearch r*.* string -> all strings in modules beginning with r
836 836
837 837 Case sensitve search:
838 838
839 839 %psearch -c a* list all object beginning with lower case a
840 840
841 841 Show objects beginning with a single _:
842 842
843 843 %psearch -a _* list objects beginning with a single underscore"""
844 844
845 845 # default namespaces to be searched
846 846 def_search = ['user','builtin']
847 847
848 848 # Process options/args
849 849 opts,args = self.parse_options(parameter_s,'cias:e:',list_all=True)
850 850 opt = opts.get
851 851 shell = self.shell
852 852 psearch = shell.inspector.psearch
853 853
854 854 # select case options
855 855 if opts.has_key('i'):
856 856 ignore_case = True
857 857 elif opts.has_key('c'):
858 858 ignore_case = False
859 859 else:
860 860 ignore_case = not shell.rc.wildcards_case_sensitive
861 861
862 862 # Build list of namespaces to search from user options
863 863 def_search.extend(opt('s',[]))
864 864 ns_exclude = ns_exclude=opt('e',[])
865 865 ns_search = [nm for nm in def_search if nm not in ns_exclude]
866 866
867 867 # Call the actual search
868 868 try:
869 869 psearch(args,shell.ns_table,ns_search,
870 870 show_all=opt('a'),ignore_case=ignore_case)
871 871 except:
872 872 shell.showtraceback()
873 873
874 874 def magic_who_ls(self, parameter_s=''):
875 875 """Return a sorted list of all interactive variables.
876 876
877 877 If arguments are given, only variables of types matching these
878 878 arguments are returned."""
879 879
880 880 user_ns = self.shell.user_ns
881 881 internal_ns = self.shell.internal_ns
882 882 user_config_ns = self.shell.user_config_ns
883 883 out = []
884 884 typelist = parameter_s.split()
885 885
886 886 for i in user_ns:
887 887 if not (i.startswith('_') or i.startswith('_i')) \
888 888 and not (i in internal_ns or i in user_config_ns):
889 889 if typelist:
890 890 if type(user_ns[i]).__name__ in typelist:
891 891 out.append(i)
892 892 else:
893 893 out.append(i)
894 894 out.sort()
895 895 return out
896 896
897 897 def magic_who(self, parameter_s=''):
898 898 """Print all interactive variables, with some minimal formatting.
899 899
900 900 If any arguments are given, only variables whose type matches one of
901 901 these are printed. For example:
902 902
903 903 %who function str
904 904
905 905 will only list functions and strings, excluding all other types of
906 906 variables. To find the proper type names, simply use type(var) at a
907 907 command line to see how python prints type names. For example:
908 908
909 909 In [1]: type('hello')\\
910 910 Out[1]: <type 'str'>
911 911
912 912 indicates that the type name for strings is 'str'.
913 913
914 914 %who always excludes executed names loaded through your configuration
915 915 file and things which are internal to IPython.
916 916
917 917 This is deliberate, as typically you may load many modules and the
918 918 purpose of %who is to show you only what you've manually defined."""
919 919
920 920 varlist = self.magic_who_ls(parameter_s)
921 921 if not varlist:
922 922 print 'Interactive namespace is empty.'
923 923 return
924 924
925 925 # if we have variables, move on...
926 926
927 927 # stupid flushing problem: when prompts have no separators, stdout is
928 928 # getting lost. I'm starting to think this is a python bug. I'm having
929 929 # to force a flush with a print because even a sys.stdout.flush
930 930 # doesn't seem to do anything!
931 931
932 932 count = 0
933 933 for i in varlist:
934 934 print i+'\t',
935 935 count += 1
936 936 if count > 8:
937 937 count = 0
938 938 print
939 939 sys.stdout.flush() # FIXME. Why the hell isn't this flushing???
940 940
941 941 print # well, this does force a flush at the expense of an extra \n
942 942
943 943 def magic_whos(self, parameter_s=''):
944 944 """Like %who, but gives some extra information about each variable.
945 945
946 946 The same type filtering of %who can be applied here.
947 947
948 948 For all variables, the type is printed. Additionally it prints:
949 949
950 950 - For {},[],(): their length.
951 951
952 952 - For Numeric arrays, a summary with shape, number of elements,
953 953 typecode and size in memory.
954 954
955 955 - Everything else: a string representation, snipping their middle if
956 956 too long."""
957 957
958 958 varnames = self.magic_who_ls(parameter_s)
959 959 if not varnames:
960 960 print 'Interactive namespace is empty.'
961 961 return
962 962
963 963 # if we have variables, move on...
964 964
965 965 # for these types, show len() instead of data:
966 966 seq_types = [types.DictType,types.ListType,types.TupleType]
967 967
968 968 # for Numeric arrays, display summary info
969 969 try:
970 970 import Numeric
971 971 except ImportError:
972 972 array_type = None
973 973 else:
974 974 array_type = Numeric.ArrayType.__name__
975 975
976 976 # Find all variable names and types so we can figure out column sizes
977 977
978 978 def get_vars(i):
979 979 return self.shell.user_ns[i]
980 980
981 981 # some types are well known and can be shorter
982 982 abbrevs = {'IPython.macro.Macro' : 'Macro'}
983 983 def type_name(v):
984 984 tn = type(v).__name__
985 985 return abbrevs.get(tn,tn)
986 986
987 987 varlist = map(get_vars,varnames)
988 988
989 989 typelist = []
990 990 for vv in varlist:
991 991 tt = type_name(vv)
992 992
993 993 if tt=='instance':
994 994 typelist.append( abbrevs.get(str(vv.__class__),str(vv.__class__)))
995 995 else:
996 996 typelist.append(tt)
997 997
998 998 # column labels and # of spaces as separator
999 999 varlabel = 'Variable'
1000 1000 typelabel = 'Type'
1001 1001 datalabel = 'Data/Info'
1002 1002 colsep = 3
1003 1003 # variable format strings
1004 1004 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
1005 1005 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
1006 1006 aformat = "%s: %s elems, type `%s`, %s bytes"
1007 1007 # find the size of the columns to format the output nicely
1008 1008 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
1009 1009 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
1010 1010 # table header
1011 1011 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
1012 1012 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
1013 1013 # and the table itself
1014 1014 kb = 1024
1015 1015 Mb = 1048576 # kb**2
1016 1016 for vname,var,vtype in zip(varnames,varlist,typelist):
1017 1017 print itpl(vformat),
1018 1018 if vtype in seq_types:
1019 1019 print len(var)
1020 1020 elif vtype==array_type:
1021 1021 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
1022 1022 vsize = Numeric.size(var)
1023 1023 vbytes = vsize*var.itemsize()
1024 1024 if vbytes < 100000:
1025 1025 print aformat % (vshape,vsize,var.typecode(),vbytes)
1026 1026 else:
1027 1027 print aformat % (vshape,vsize,var.typecode(),vbytes),
1028 1028 if vbytes < Mb:
1029 1029 print '(%s kb)' % (vbytes/kb,)
1030 1030 else:
1031 1031 print '(%s Mb)' % (vbytes/Mb,)
1032 1032 else:
1033 1033 vstr = str(var).replace('\n','\\n')
1034 1034 if len(vstr) < 50:
1035 1035 print vstr
1036 1036 else:
1037 1037 printpl(vfmt_short)
1038 1038
1039 1039 def magic_reset(self, parameter_s=''):
1040 1040 """Resets the namespace by removing all names defined by the user.
1041 1041
1042 1042 Input/Output history are left around in case you need them."""
1043 1043
1044 1044 ans = self.shell.ask_yes_no(
1045 1045 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ")
1046 1046 if not ans:
1047 1047 print 'Nothing done.'
1048 1048 return
1049 1049 user_ns = self.shell.user_ns
1050 1050 for i in self.magic_who_ls():
1051 1051 del(user_ns[i])
1052 1052
1053 1053 def magic_logstart(self,parameter_s=''):
1054 1054 """Start logging anywhere in a session.
1055 1055
1056 1056 %logstart [-o|-r|-t] [log_name [log_mode]]
1057 1057
1058 1058 If no name is given, it defaults to a file named 'ipython_log.py' in your
1059 1059 current directory, in 'rotate' mode (see below).
1060 1060
1061 1061 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
1062 1062 history up to that point and then continues logging.
1063 1063
1064 1064 %logstart takes a second optional parameter: logging mode. This can be one
1065 1065 of (note that the modes are given unquoted):\\
1066 1066 append: well, that says it.\\
1067 1067 backup: rename (if exists) to name~ and start name.\\
1068 1068 global: single logfile in your home dir, appended to.\\
1069 1069 over : overwrite existing log.\\
1070 1070 rotate: create rotating logs name.1~, name.2~, etc.
1071 1071
1072 1072 Options:
1073 1073
1074 1074 -o: log also IPython's output. In this mode, all commands which
1075 1075 generate an Out[NN] prompt are recorded to the logfile, right after
1076 1076 their corresponding input line. The output lines are always
1077 1077 prepended with a '#[Out]# ' marker, so that the log remains valid
1078 1078 Python code.
1079 1079
1080 1080 Since this marker is always the same, filtering only the output from
1081 1081 a log is very easy, using for example a simple awk call:
1082 1082
1083 1083 awk -F'#\\[Out\\]# ' '{if($2) {print $2}}' ipython_log.py
1084 1084
1085 1085 -r: log 'raw' input. Normally, IPython's logs contain the processed
1086 1086 input, so that user lines are logged in their final form, converted
1087 1087 into valid Python. For example, %Exit is logged as
1088 1088 '_ip.magic("Exit"). If the -r flag is given, all input is logged
1089 1089 exactly as typed, with no transformations applied.
1090 1090
1091 1091 -t: put timestamps before each input line logged (these are put in
1092 1092 comments)."""
1093 1093
1094 1094 opts,par = self.parse_options(parameter_s,'ort')
1095 1095 log_output = 'o' in opts
1096 1096 log_raw_input = 'r' in opts
1097 1097 timestamp = 't' in opts
1098 1098
1099 1099 rc = self.shell.rc
1100 1100 logger = self.shell.logger
1101 1101
1102 1102 # if no args are given, the defaults set in the logger constructor by
1103 1103 # ipytohn remain valid
1104 1104 if par:
1105 1105 try:
1106 1106 logfname,logmode = par.split()
1107 1107 except:
1108 1108 logfname = par
1109 1109 logmode = 'backup'
1110 1110 else:
1111 1111 logfname = logger.logfname
1112 1112 logmode = logger.logmode
1113 1113 # put logfname into rc struct as if it had been called on the command
1114 1114 # line, so it ends up saved in the log header Save it in case we need
1115 1115 # to restore it...
1116 1116 old_logfile = rc.opts.get('logfile','')
1117 1117 if logfname:
1118 1118 logfname = os.path.expanduser(logfname)
1119 1119 rc.opts.logfile = logfname
1120 1120 loghead = self.shell.loghead_tpl % (rc.opts,rc.args)
1121 1121 try:
1122 1122 started = logger.logstart(logfname,loghead,logmode,
1123 1123 log_output,timestamp,log_raw_input)
1124 1124 except:
1125 1125 rc.opts.logfile = old_logfile
1126 1126 warn("Couldn't start log: %s" % sys.exc_info()[1])
1127 1127 else:
1128 1128 # log input history up to this point, optionally interleaving
1129 1129 # output if requested
1130 1130
1131 1131 if timestamp:
1132 1132 # disable timestamping for the previous history, since we've
1133 1133 # lost those already (no time machine here).
1134 1134 logger.timestamp = False
1135 1135
1136 1136 if log_raw_input:
1137 1137 input_hist = self.shell.input_hist_raw
1138 1138 else:
1139 1139 input_hist = self.shell.input_hist
1140 1140
1141 1141 if log_output:
1142 1142 log_write = logger.log_write
1143 1143 output_hist = self.shell.output_hist
1144 1144 for n in range(1,len(input_hist)-1):
1145 1145 log_write(input_hist[n].rstrip())
1146 1146 if n in output_hist:
1147 1147 log_write(repr(output_hist[n]),'output')
1148 1148 else:
1149 1149 logger.log_write(input_hist[1:])
1150 1150 if timestamp:
1151 1151 # re-enable timestamping
1152 1152 logger.timestamp = True
1153 1153
1154 1154 print ('Activating auto-logging. '
1155 1155 'Current session state plus future input saved.')
1156 1156 logger.logstate()
1157 1157
1158 1158 def magic_logoff(self,parameter_s=''):
1159 1159 """Temporarily stop logging.
1160 1160
1161 1161 You must have previously started logging."""
1162 1162 self.shell.logger.switch_log(0)
1163 1163
1164 1164 def magic_logon(self,parameter_s=''):
1165 1165 """Restart logging.
1166 1166
1167 1167 This function is for restarting logging which you've temporarily
1168 1168 stopped with %logoff. For starting logging for the first time, you
1169 1169 must use the %logstart function, which allows you to specify an
1170 1170 optional log filename."""
1171 1171
1172 1172 self.shell.logger.switch_log(1)
1173 1173
1174 1174 def magic_logstate(self,parameter_s=''):
1175 1175 """Print the status of the logging system."""
1176 1176
1177 1177 self.shell.logger.logstate()
1178 1178
1179 1179 def magic_pdb(self, parameter_s=''):
1180 1180 """Control the automatic calling of the pdb interactive debugger.
1181 1181
1182 1182 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
1183 1183 argument it works as a toggle.
1184 1184
1185 1185 When an exception is triggered, IPython can optionally call the
1186 1186 interactive pdb debugger after the traceback printout. %pdb toggles
1187 1187 this feature on and off.
1188 1188
1189 1189 The initial state of this feature is set in your ipythonrc
1190 1190 configuration file (the variable is called 'pdb').
1191 1191
1192 1192 If you want to just activate the debugger AFTER an exception has fired,
1193 1193 without having to type '%pdb on' and rerunning your code, you can use
1194 1194 the %debug magic."""
1195 1195
1196 1196 par = parameter_s.strip().lower()
1197 1197
1198 1198 if par:
1199 1199 try:
1200 1200 new_pdb = {'off':0,'0':0,'on':1,'1':1}[par]
1201 1201 except KeyError:
1202 1202 print ('Incorrect argument. Use on/1, off/0, '
1203 1203 'or nothing for a toggle.')
1204 1204 return
1205 1205 else:
1206 1206 # toggle
1207 1207 new_pdb = not self.shell.call_pdb
1208 1208
1209 1209 # set on the shell
1210 1210 self.shell.call_pdb = new_pdb
1211 1211 print 'Automatic pdb calling has been turned',on_off(new_pdb)
1212 1212
1213 1213 def magic_debug(self, parameter_s=''):
1214 1214 """Activate the interactive debugger in post-mortem mode.
1215 1215
1216 1216 If an exception has just occurred, this lets you inspect its stack
1217 1217 frames interactively. Note that this will always work only on the last
1218 1218 traceback that occurred, so you must call this quickly after an
1219 1219 exception that you wish to inspect has fired, because if another one
1220 1220 occurs, it clobbers the previous one.
1221 1221
1222 1222 If you want IPython to automatically do this on every exception, see
1223 1223 the %pdb magic for more details.
1224 1224 """
1225 1225
1226 1226 self.shell.debugger(force=True)
1227 1227
1228 1228 def magic_prun(self, parameter_s ='',user_mode=1,
1229 1229 opts=None,arg_lst=None,prog_ns=None):
1230 1230
1231 1231 """Run a statement through the python code profiler.
1232 1232
1233 1233 Usage:\\
1234 1234 %prun [options] statement
1235 1235
1236 1236 The given statement (which doesn't require quote marks) is run via the
1237 1237 python profiler in a manner similar to the profile.run() function.
1238 1238 Namespaces are internally managed to work correctly; profile.run
1239 1239 cannot be used in IPython because it makes certain assumptions about
1240 1240 namespaces which do not hold under IPython.
1241 1241
1242 1242 Options:
1243 1243
1244 1244 -l <limit>: you can place restrictions on what or how much of the
1245 1245 profile gets printed. The limit value can be:
1246 1246
1247 1247 * A string: only information for function names containing this string
1248 1248 is printed.
1249 1249
1250 1250 * An integer: only these many lines are printed.
1251 1251
1252 1252 * A float (between 0 and 1): this fraction of the report is printed
1253 1253 (for example, use a limit of 0.4 to see the topmost 40% only).
1254 1254
1255 1255 You can combine several limits with repeated use of the option. For
1256 1256 example, '-l __init__ -l 5' will print only the topmost 5 lines of
1257 1257 information about class constructors.
1258 1258
1259 1259 -r: return the pstats.Stats object generated by the profiling. This
1260 1260 object has all the information about the profile in it, and you can
1261 1261 later use it for further analysis or in other functions.
1262 1262
1263 1263 -s <key>: sort profile by given key. You can provide more than one key
1264 1264 by using the option several times: '-s key1 -s key2 -s key3...'. The
1265 1265 default sorting key is 'time'.
1266 1266
1267 1267 The following is copied verbatim from the profile documentation
1268 1268 referenced below:
1269 1269
1270 1270 When more than one key is provided, additional keys are used as
1271 1271 secondary criteria when the there is equality in all keys selected
1272 1272 before them.
1273 1273
1274 1274 Abbreviations can be used for any key names, as long as the
1275 1275 abbreviation is unambiguous. The following are the keys currently
1276 1276 defined:
1277 1277
1278 1278 Valid Arg Meaning\\
1279 1279 "calls" call count\\
1280 1280 "cumulative" cumulative time\\
1281 1281 "file" file name\\
1282 1282 "module" file name\\
1283 1283 "pcalls" primitive call count\\
1284 1284 "line" line number\\
1285 1285 "name" function name\\
1286 1286 "nfl" name/file/line\\
1287 1287 "stdname" standard name\\
1288 1288 "time" internal time
1289 1289
1290 1290 Note that all sorts on statistics are in descending order (placing
1291 1291 most time consuming items first), where as name, file, and line number
1292 1292 searches are in ascending order (i.e., alphabetical). The subtle
1293 1293 distinction between "nfl" and "stdname" is that the standard name is a
1294 1294 sort of the name as printed, which means that the embedded line
1295 1295 numbers get compared in an odd way. For example, lines 3, 20, and 40
1296 1296 would (if the file names were the same) appear in the string order
1297 1297 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1298 1298 line numbers. In fact, sort_stats("nfl") is the same as
1299 1299 sort_stats("name", "file", "line").
1300 1300
1301 1301 -T <filename>: save profile results as shown on screen to a text
1302 1302 file. The profile is still shown on screen.
1303 1303
1304 1304 -D <filename>: save (via dump_stats) profile statistics to given
1305 1305 filename. This data is in a format understod by the pstats module, and
1306 1306 is generated by a call to the dump_stats() method of profile
1307 1307 objects. The profile is still shown on screen.
1308 1308
1309 1309 If you want to run complete programs under the profiler's control, use
1310 1310 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1311 1311 contains profiler specific options as described here.
1312 1312
1313 1313 You can read the complete documentation for the profile module with:\\
1314 1314 In [1]: import profile; profile.help() """
1315 1315
1316 1316 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1317 1317 # protect user quote marks
1318 1318 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1319 1319
1320 1320 if user_mode: # regular user call
1321 1321 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1322 1322 list_all=1)
1323 1323 namespace = self.shell.user_ns
1324 1324 else: # called to run a program by %run -p
1325 1325 try:
1326 1326 filename = get_py_filename(arg_lst[0])
1327 1327 except IOError,msg:
1328 1328 error(msg)
1329 1329 return
1330 1330
1331 1331 arg_str = 'execfile(filename,prog_ns)'
1332 1332 namespace = locals()
1333 1333
1334 1334 opts.merge(opts_def)
1335 1335
1336 1336 prof = profile.Profile()
1337 1337 try:
1338 1338 prof = prof.runctx(arg_str,namespace,namespace)
1339 1339 sys_exit = ''
1340 1340 except SystemExit:
1341 1341 sys_exit = """*** SystemExit exception caught in code being profiled."""
1342 1342
1343 1343 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1344 1344
1345 1345 lims = opts.l
1346 1346 if lims:
1347 1347 lims = [] # rebuild lims with ints/floats/strings
1348 1348 for lim in opts.l:
1349 1349 try:
1350 1350 lims.append(int(lim))
1351 1351 except ValueError:
1352 1352 try:
1353 1353 lims.append(float(lim))
1354 1354 except ValueError:
1355 1355 lims.append(lim)
1356 1356
1357 # trap output
1358 sys_stdout = sys.stdout
1357 # Trap output.
1359 1358 stdout_trap = StringIO()
1360 try:
1361 sys.stdout = stdout_trap
1359
1360 if hasattr(stats,'stream'):
1361 # In newer versions of python, the stats object has a 'stream'
1362 # attribute to write into.
1363 stats.stream = stdout_trap
1362 1364 stats.print_stats(*lims)
1363 finally:
1364 sys.stdout = sys_stdout
1365 else:
1366 # For older versions, we manually redirect stdout during printing
1367 sys_stdout = sys.stdout
1368 try:
1369 sys.stdout = stdout_trap
1370 stats.print_stats(*lims)
1371 finally:
1372 sys.stdout = sys_stdout
1373
1365 1374 output = stdout_trap.getvalue()
1366 1375 output = output.rstrip()
1367 1376
1368 1377 page(output,screen_lines=self.shell.rc.screen_length)
1369 1378 print sys_exit,
1370 1379
1371 1380 dump_file = opts.D[0]
1372 1381 text_file = opts.T[0]
1373 1382 if dump_file:
1374 1383 prof.dump_stats(dump_file)
1375 1384 print '\n*** Profile stats marshalled to file',\
1376 1385 `dump_file`+'.',sys_exit
1377 1386 if text_file:
1378 file(text_file,'w').write(output)
1387 pfile = file(text_file,'w')
1388 pfile.write(output)
1389 pfile.close()
1379 1390 print '\n*** Profile printout saved to text file',\
1380 1391 `text_file`+'.',sys_exit
1381 1392
1382 1393 if opts.has_key('r'):
1383 1394 return stats
1384 1395 else:
1385 1396 return None
1386 1397
1387 1398 def magic_run(self, parameter_s ='',runner=None):
1388 1399 """Run the named file inside IPython as a program.
1389 1400
1390 1401 Usage:\\
1391 1402 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1392 1403
1393 1404 Parameters after the filename are passed as command-line arguments to
1394 1405 the program (put in sys.argv). Then, control returns to IPython's
1395 1406 prompt.
1396 1407
1397 1408 This is similar to running at a system prompt:\\
1398 1409 $ python file args\\
1399 1410 but with the advantage of giving you IPython's tracebacks, and of
1400 1411 loading all variables into your interactive namespace for further use
1401 1412 (unless -p is used, see below).
1402 1413
1403 1414 The file is executed in a namespace initially consisting only of
1404 1415 __name__=='__main__' and sys.argv constructed as indicated. It thus
1405 1416 sees its environment as if it were being run as a stand-alone
1406 1417 program. But after execution, the IPython interactive namespace gets
1407 1418 updated with all variables defined in the program (except for __name__
1408 1419 and sys.argv). This allows for very convenient loading of code for
1409 1420 interactive work, while giving each program a 'clean sheet' to run in.
1410 1421
1411 1422 Options:
1412 1423
1413 1424 -n: __name__ is NOT set to '__main__', but to the running file's name
1414 1425 without extension (as python does under import). This allows running
1415 1426 scripts and reloading the definitions in them without calling code
1416 1427 protected by an ' if __name__ == "__main__" ' clause.
1417 1428
1418 1429 -i: run the file in IPython's namespace instead of an empty one. This
1419 1430 is useful if you are experimenting with code written in a text editor
1420 1431 which depends on variables defined interactively.
1421 1432
1422 1433 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1423 1434 being run. This is particularly useful if IPython is being used to
1424 1435 run unittests, which always exit with a sys.exit() call. In such
1425 1436 cases you are interested in the output of the test results, not in
1426 1437 seeing a traceback of the unittest module.
1427 1438
1428 1439 -t: print timing information at the end of the run. IPython will give
1429 1440 you an estimated CPU time consumption for your script, which under
1430 1441 Unix uses the resource module to avoid the wraparound problems of
1431 1442 time.clock(). Under Unix, an estimate of time spent on system tasks
1432 1443 is also given (for Windows platforms this is reported as 0.0).
1433 1444
1434 1445 If -t is given, an additional -N<N> option can be given, where <N>
1435 1446 must be an integer indicating how many times you want the script to
1436 1447 run. The final timing report will include total and per run results.
1437 1448
1438 1449 For example (testing the script uniq_stable.py):
1439 1450
1440 1451 In [1]: run -t uniq_stable
1441 1452
1442 1453 IPython CPU timings (estimated):\\
1443 1454 User : 0.19597 s.\\
1444 1455 System: 0.0 s.\\
1445 1456
1446 1457 In [2]: run -t -N5 uniq_stable
1447 1458
1448 1459 IPython CPU timings (estimated):\\
1449 1460 Total runs performed: 5\\
1450 1461 Times : Total Per run\\
1451 1462 User : 0.910862 s, 0.1821724 s.\\
1452 1463 System: 0.0 s, 0.0 s.
1453 1464
1454 1465 -d: run your program under the control of pdb, the Python debugger.
1455 1466 This allows you to execute your program step by step, watch variables,
1456 1467 etc. Internally, what IPython does is similar to calling:
1457 1468
1458 1469 pdb.run('execfile("YOURFILENAME")')
1459 1470
1460 1471 with a breakpoint set on line 1 of your file. You can change the line
1461 1472 number for this automatic breakpoint to be <N> by using the -bN option
1462 1473 (where N must be an integer). For example:
1463 1474
1464 1475 %run -d -b40 myscript
1465 1476
1466 1477 will set the first breakpoint at line 40 in myscript.py. Note that
1467 1478 the first breakpoint must be set on a line which actually does
1468 1479 something (not a comment or docstring) for it to stop execution.
1469 1480
1470 1481 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1471 1482 first enter 'c' (without qoutes) to start execution up to the first
1472 1483 breakpoint.
1473 1484
1474 1485 Entering 'help' gives information about the use of the debugger. You
1475 1486 can easily see pdb's full documentation with "import pdb;pdb.help()"
1476 1487 at a prompt.
1477 1488
1478 1489 -p: run program under the control of the Python profiler module (which
1479 1490 prints a detailed report of execution times, function calls, etc).
1480 1491
1481 1492 You can pass other options after -p which affect the behavior of the
1482 1493 profiler itself. See the docs for %prun for details.
1483 1494
1484 1495 In this mode, the program's variables do NOT propagate back to the
1485 1496 IPython interactive namespace (because they remain in the namespace
1486 1497 where the profiler executes them).
1487 1498
1488 1499 Internally this triggers a call to %prun, see its documentation for
1489 1500 details on the options available specifically for profiling.
1490 1501
1491 1502 There is one special usage for which the text above doesn't apply:
1492 1503 if the filename ends with .ipy, the file is run as ipython script,
1493 1504 just as if the commands were written on IPython prompt.
1494 1505 """
1495 1506
1496 1507 # get arguments and set sys.argv for program to be run.
1497 1508 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1498 1509 mode='list',list_all=1)
1499 1510
1500 1511 try:
1501 1512 filename = get_py_filename(arg_lst[0])
1502 1513 except IndexError:
1503 1514 warn('you must provide at least a filename.')
1504 1515 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1505 1516 return
1506 1517 except IOError,msg:
1507 1518 error(msg)
1508 1519 return
1509 1520
1510 1521 if filename.lower().endswith('.ipy'):
1511 1522 self.api.runlines(open(filename).read())
1512 1523 return
1513 1524
1514 1525 # Control the response to exit() calls made by the script being run
1515 1526 exit_ignore = opts.has_key('e')
1516 1527
1517 1528 # Make sure that the running script gets a proper sys.argv as if it
1518 1529 # were run from a system shell.
1519 1530 save_argv = sys.argv # save it for later restoring
1520 1531 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1521 1532
1522 1533 if opts.has_key('i'):
1523 1534 prog_ns = self.shell.user_ns
1524 1535 __name__save = self.shell.user_ns['__name__']
1525 1536 prog_ns['__name__'] = '__main__'
1526 1537 else:
1527 1538 if opts.has_key('n'):
1528 1539 name = os.path.splitext(os.path.basename(filename))[0]
1529 1540 else:
1530 1541 name = '__main__'
1531 1542 prog_ns = {'__name__':name}
1532 1543
1533 1544 # Since '%run foo' emulates 'python foo.py' at the cmd line, we must
1534 1545 # set the __file__ global in the script's namespace
1535 1546 prog_ns['__file__'] = filename
1536 1547
1537 1548 # pickle fix. See iplib for an explanation. But we need to make sure
1538 1549 # that, if we overwrite __main__, we replace it at the end
1539 1550 if prog_ns['__name__'] == '__main__':
1540 1551 restore_main = sys.modules['__main__']
1541 1552 else:
1542 1553 restore_main = False
1543 1554
1544 1555 sys.modules[prog_ns['__name__']] = FakeModule(prog_ns)
1545 1556
1546 1557 stats = None
1547 1558 try:
1548 1559 if self.shell.has_readline:
1549 1560 self.shell.savehist()
1550 1561
1551 1562 if opts.has_key('p'):
1552 1563 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1553 1564 else:
1554 1565 if opts.has_key('d'):
1555 1566 deb = Debugger.Pdb(self.shell.rc.colors)
1556 1567 # reset Breakpoint state, which is moronically kept
1557 1568 # in a class
1558 1569 bdb.Breakpoint.next = 1
1559 1570 bdb.Breakpoint.bplist = {}
1560 1571 bdb.Breakpoint.bpbynumber = [None]
1561 1572 # Set an initial breakpoint to stop execution
1562 1573 maxtries = 10
1563 1574 bp = int(opts.get('b',[1])[0])
1564 1575 checkline = deb.checkline(filename,bp)
1565 1576 if not checkline:
1566 1577 for bp in range(bp+1,bp+maxtries+1):
1567 1578 if deb.checkline(filename,bp):
1568 1579 break
1569 1580 else:
1570 1581 msg = ("\nI failed to find a valid line to set "
1571 1582 "a breakpoint\n"
1572 1583 "after trying up to line: %s.\n"
1573 1584 "Please set a valid breakpoint manually "
1574 1585 "with the -b option." % bp)
1575 1586 error(msg)
1576 1587 return
1577 1588 # if we find a good linenumber, set the breakpoint
1578 1589 deb.do_break('%s:%s' % (filename,bp))
1579 1590 # Start file run
1580 1591 print "NOTE: Enter 'c' at the",
1581 1592 print "%s prompt to start your script." % deb.prompt
1582 1593 try:
1583 1594 deb.run('execfile("%s")' % filename,prog_ns)
1584 1595
1585 1596 except:
1586 1597 etype, value, tb = sys.exc_info()
1587 1598 # Skip three frames in the traceback: the %run one,
1588 1599 # one inside bdb.py, and the command-line typed by the
1589 1600 # user (run by exec in pdb itself).
1590 1601 self.shell.InteractiveTB(etype,value,tb,tb_offset=3)
1591 1602 else:
1592 1603 if runner is None:
1593 1604 runner = self.shell.safe_execfile
1594 1605 if opts.has_key('t'):
1595 1606 try:
1596 1607 nruns = int(opts['N'][0])
1597 1608 if nruns < 1:
1598 1609 error('Number of runs must be >=1')
1599 1610 return
1600 1611 except (KeyError):
1601 1612 nruns = 1
1602 1613 if nruns == 1:
1603 1614 t0 = clock2()
1604 1615 runner(filename,prog_ns,prog_ns,
1605 1616 exit_ignore=exit_ignore)
1606 1617 t1 = clock2()
1607 1618 t_usr = t1[0]-t0[0]
1608 1619 t_sys = t1[1]-t1[1]
1609 1620 print "\nIPython CPU timings (estimated):"
1610 1621 print " User : %10s s." % t_usr
1611 1622 print " System: %10s s." % t_sys
1612 1623 else:
1613 1624 runs = range(nruns)
1614 1625 t0 = clock2()
1615 1626 for nr in runs:
1616 1627 runner(filename,prog_ns,prog_ns,
1617 1628 exit_ignore=exit_ignore)
1618 1629 t1 = clock2()
1619 1630 t_usr = t1[0]-t0[0]
1620 1631 t_sys = t1[1]-t1[1]
1621 1632 print "\nIPython CPU timings (estimated):"
1622 1633 print "Total runs performed:",nruns
1623 1634 print " Times : %10s %10s" % ('Total','Per run')
1624 1635 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1625 1636 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1626 1637
1627 1638 else:
1628 1639 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1629 1640 if opts.has_key('i'):
1630 1641 self.shell.user_ns['__name__'] = __name__save
1631 1642 else:
1632 1643 # update IPython interactive namespace
1633 1644 del prog_ns['__name__']
1634 1645 self.shell.user_ns.update(prog_ns)
1635 1646 finally:
1636 1647 sys.argv = save_argv
1637 1648 if restore_main:
1638 1649 sys.modules['__main__'] = restore_main
1639 1650 if self.shell.has_readline:
1640 1651 self.shell.readline.read_history_file(self.shell.histfile)
1641 1652
1642 1653 return stats
1643 1654
1644 1655 def magic_runlog(self, parameter_s =''):
1645 1656 """Run files as logs.
1646 1657
1647 1658 Usage:\\
1648 1659 %runlog file1 file2 ...
1649 1660
1650 1661 Run the named files (treating them as log files) in sequence inside
1651 1662 the interpreter, and return to the prompt. This is much slower than
1652 1663 %run because each line is executed in a try/except block, but it
1653 1664 allows running files with syntax errors in them.
1654 1665
1655 1666 Normally IPython will guess when a file is one of its own logfiles, so
1656 1667 you can typically use %run even for logs. This shorthand allows you to
1657 1668 force any file to be treated as a log file."""
1658 1669
1659 1670 for f in parameter_s.split():
1660 1671 self.shell.safe_execfile(f,self.shell.user_ns,
1661 1672 self.shell.user_ns,islog=1)
1662 1673
1663 1674 def magic_timeit(self, parameter_s =''):
1664 1675 """Time execution of a Python statement or expression
1665 1676
1666 1677 Usage:\\
1667 1678 %timeit [-n<N> -r<R> [-t|-c]] statement
1668 1679
1669 1680 Time execution of a Python statement or expression using the timeit
1670 1681 module.
1671 1682
1672 1683 Options:
1673 1684 -n<N>: execute the given statement <N> times in a loop. If this value
1674 1685 is not given, a fitting value is chosen.
1675 1686
1676 1687 -r<R>: repeat the loop iteration <R> times and take the best result.
1677 1688 Default: 3
1678 1689
1679 1690 -t: use time.time to measure the time, which is the default on Unix.
1680 1691 This function measures wall time.
1681 1692
1682 1693 -c: use time.clock to measure the time, which is the default on
1683 1694 Windows and measures wall time. On Unix, resource.getrusage is used
1684 1695 instead and returns the CPU user time.
1685 1696
1686 1697 -p<P>: use a precision of <P> digits to display the timing result.
1687 1698 Default: 3
1688 1699
1689 1700
1690 1701 Examples:\\
1691 1702 In [1]: %timeit pass
1692 1703 10000000 loops, best of 3: 53.3 ns per loop
1693 1704
1694 1705 In [2]: u = None
1695 1706
1696 1707 In [3]: %timeit u is None
1697 1708 10000000 loops, best of 3: 184 ns per loop
1698 1709
1699 1710 In [4]: %timeit -r 4 u == None
1700 1711 1000000 loops, best of 4: 242 ns per loop
1701 1712
1702 1713 In [5]: import time
1703 1714
1704 1715 In [6]: %timeit -n1 time.sleep(2)
1705 1716 1 loops, best of 3: 2 s per loop
1706 1717
1707 1718
1708 1719 The times reported by %timeit will be slightly higher than those
1709 1720 reported by the timeit.py script when variables are accessed. This is
1710 1721 due to the fact that %timeit executes the statement in the namespace
1711 1722 of the shell, compared with timeit.py, which uses a single setup
1712 1723 statement to import function or create variables. Generally, the bias
1713 1724 does not matter as long as results from timeit.py are not mixed with
1714 1725 those from %timeit."""
1715 1726
1716 1727 import timeit
1717 1728 import math
1718 1729
1719 1730 units = ["s", "ms", "\xc2\xb5s", "ns"]
1720 1731 scaling = [1, 1e3, 1e6, 1e9]
1721 1732
1722 1733 opts, stmt = self.parse_options(parameter_s,'n:r:tcp:',
1723 1734 posix=False)
1724 1735 if stmt == "":
1725 1736 return
1726 1737 timefunc = timeit.default_timer
1727 1738 number = int(getattr(opts, "n", 0))
1728 1739 repeat = int(getattr(opts, "r", timeit.default_repeat))
1729 1740 precision = int(getattr(opts, "p", 3))
1730 1741 if hasattr(opts, "t"):
1731 1742 timefunc = time.time
1732 1743 if hasattr(opts, "c"):
1733 1744 timefunc = clock
1734 1745
1735 1746 timer = timeit.Timer(timer=timefunc)
1736 1747 # this code has tight coupling to the inner workings of timeit.Timer,
1737 1748 # but is there a better way to achieve that the code stmt has access
1738 1749 # to the shell namespace?
1739 1750
1740 1751 src = timeit.template % {'stmt': timeit.reindent(stmt, 8),
1741 1752 'setup': "pass"}
1742 1753 code = compile(src, "<magic-timeit>", "exec")
1743 1754 ns = {}
1744 1755 exec code in self.shell.user_ns, ns
1745 1756 timer.inner = ns["inner"]
1746 1757
1747 1758 if number == 0:
1748 1759 # determine number so that 0.2 <= total time < 2.0
1749 1760 number = 1
1750 1761 for i in range(1, 10):
1751 1762 number *= 10
1752 1763 if timer.timeit(number) >= 0.2:
1753 1764 break
1754 1765
1755 1766 best = min(timer.repeat(repeat, number)) / number
1756 1767
1757 1768 if best > 0.0:
1758 1769 order = min(-int(math.floor(math.log10(best)) // 3), 3)
1759 1770 else:
1760 1771 order = 3
1761 1772 print "%d loops, best of %d: %.*g %s per loop" % (number, repeat,
1762 1773 precision,
1763 1774 best * scaling[order],
1764 1775 units[order])
1765 1776
1766 1777 def magic_time(self,parameter_s = ''):
1767 1778 """Time execution of a Python statement or expression.
1768 1779
1769 1780 The CPU and wall clock times are printed, and the value of the
1770 1781 expression (if any) is returned. Note that under Win32, system time
1771 1782 is always reported as 0, since it can not be measured.
1772 1783
1773 1784 This function provides very basic timing functionality. In Python
1774 1785 2.3, the timeit module offers more control and sophistication, so this
1775 1786 could be rewritten to use it (patches welcome).
1776 1787
1777 1788 Some examples:
1778 1789
1779 1790 In [1]: time 2**128
1780 1791 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1781 1792 Wall time: 0.00
1782 1793 Out[1]: 340282366920938463463374607431768211456L
1783 1794
1784 1795 In [2]: n = 1000000
1785 1796
1786 1797 In [3]: time sum(range(n))
1787 1798 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1788 1799 Wall time: 1.37
1789 1800 Out[3]: 499999500000L
1790 1801
1791 1802 In [4]: time print 'hello world'
1792 1803 hello world
1793 1804 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1794 1805 Wall time: 0.00
1795 1806 """
1796 1807
1797 1808 # fail immediately if the given expression can't be compiled
1798 1809 try:
1799 1810 mode = 'eval'
1800 1811 code = compile(parameter_s,'<timed eval>',mode)
1801 1812 except SyntaxError:
1802 1813 mode = 'exec'
1803 1814 code = compile(parameter_s,'<timed exec>',mode)
1804 1815 # skew measurement as little as possible
1805 1816 glob = self.shell.user_ns
1806 1817 clk = clock2
1807 1818 wtime = time.time
1808 1819 # time execution
1809 1820 wall_st = wtime()
1810 1821 if mode=='eval':
1811 1822 st = clk()
1812 1823 out = eval(code,glob)
1813 1824 end = clk()
1814 1825 else:
1815 1826 st = clk()
1816 1827 exec code in glob
1817 1828 end = clk()
1818 1829 out = None
1819 1830 wall_end = wtime()
1820 1831 # Compute actual times and report
1821 1832 wall_time = wall_end-wall_st
1822 1833 cpu_user = end[0]-st[0]
1823 1834 cpu_sys = end[1]-st[1]
1824 1835 cpu_tot = cpu_user+cpu_sys
1825 1836 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1826 1837 (cpu_user,cpu_sys,cpu_tot)
1827 1838 print "Wall time: %.2f" % wall_time
1828 1839 return out
1829 1840
1830 1841 def magic_macro(self,parameter_s = ''):
1831 1842 """Define a set of input lines as a macro for future re-execution.
1832 1843
1833 1844 Usage:\\
1834 1845 %macro [options] name n1-n2 n3-n4 ... n5 .. n6 ...
1835 1846
1836 1847 Options:
1837 1848
1838 1849 -r: use 'raw' input. By default, the 'processed' history is used,
1839 1850 so that magics are loaded in their transformed version to valid
1840 1851 Python. If this option is given, the raw input as typed as the
1841 1852 command line is used instead.
1842 1853
1843 1854 This will define a global variable called `name` which is a string
1844 1855 made of joining the slices and lines you specify (n1,n2,... numbers
1845 1856 above) from your input history into a single string. This variable
1846 1857 acts like an automatic function which re-executes those lines as if
1847 1858 you had typed them. You just type 'name' at the prompt and the code
1848 1859 executes.
1849 1860
1850 1861 The notation for indicating number ranges is: n1-n2 means 'use line
1851 1862 numbers n1,...n2' (the endpoint is included). That is, '5-7' means
1852 1863 using the lines numbered 5,6 and 7.
1853 1864
1854 1865 Note: as a 'hidden' feature, you can also use traditional python slice
1855 1866 notation, where N:M means numbers N through M-1.
1856 1867
1857 1868 For example, if your history contains (%hist prints it):
1858 1869
1859 1870 44: x=1\\
1860 1871 45: y=3\\
1861 1872 46: z=x+y\\
1862 1873 47: print x\\
1863 1874 48: a=5\\
1864 1875 49: print 'x',x,'y',y\\
1865 1876
1866 1877 you can create a macro with lines 44 through 47 (included) and line 49
1867 1878 called my_macro with:
1868 1879
1869 1880 In [51]: %macro my_macro 44-47 49
1870 1881
1871 1882 Now, typing `my_macro` (without quotes) will re-execute all this code
1872 1883 in one pass.
1873 1884
1874 1885 You don't need to give the line-numbers in order, and any given line
1875 1886 number can appear multiple times. You can assemble macros with any
1876 1887 lines from your input history in any order.
1877 1888
1878 1889 The macro is a simple object which holds its value in an attribute,
1879 1890 but IPython's display system checks for macros and executes them as
1880 1891 code instead of printing them when you type their name.
1881 1892
1882 1893 You can view a macro's contents by explicitly printing it with:
1883 1894
1884 1895 'print macro_name'.
1885 1896
1886 1897 For one-off cases which DON'T contain magic function calls in them you
1887 1898 can obtain similar results by explicitly executing slices from your
1888 1899 input history with:
1889 1900
1890 1901 In [60]: exec In[44:48]+In[49]"""
1891 1902
1892 1903 opts,args = self.parse_options(parameter_s,'r',mode='list')
1893 1904 name,ranges = args[0], args[1:]
1894 1905 #print 'rng',ranges # dbg
1895 1906 lines = self.extract_input_slices(ranges,opts.has_key('r'))
1896 1907 macro = Macro(lines)
1897 1908 self.shell.user_ns.update({name:macro})
1898 1909 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1899 1910 print 'Macro contents:'
1900 1911 print macro,
1901 1912
1902 1913 def magic_save(self,parameter_s = ''):
1903 1914 """Save a set of lines to a given filename.
1904 1915
1905 1916 Usage:\\
1906 1917 %save [options] filename n1-n2 n3-n4 ... n5 .. n6 ...
1907 1918
1908 1919 Options:
1909 1920
1910 1921 -r: use 'raw' input. By default, the 'processed' history is used,
1911 1922 so that magics are loaded in their transformed version to valid
1912 1923 Python. If this option is given, the raw input as typed as the
1913 1924 command line is used instead.
1914 1925
1915 1926 This function uses the same syntax as %macro for line extraction, but
1916 1927 instead of creating a macro it saves the resulting string to the
1917 1928 filename you specify.
1918 1929
1919 1930 It adds a '.py' extension to the file if you don't do so yourself, and
1920 1931 it asks for confirmation before overwriting existing files."""
1921 1932
1922 1933 opts,args = self.parse_options(parameter_s,'r',mode='list')
1923 1934 fname,ranges = args[0], args[1:]
1924 1935 if not fname.endswith('.py'):
1925 1936 fname += '.py'
1926 1937 if os.path.isfile(fname):
1927 1938 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
1928 1939 if ans.lower() not in ['y','yes']:
1929 1940 print 'Operation cancelled.'
1930 1941 return
1931 1942 cmds = ''.join(self.extract_input_slices(ranges,opts.has_key('r')))
1932 1943 f = file(fname,'w')
1933 1944 f.write(cmds)
1934 1945 f.close()
1935 1946 print 'The following commands were written to file `%s`:' % fname
1936 1947 print cmds
1937 1948
1938 1949 def _edit_macro(self,mname,macro):
1939 1950 """open an editor with the macro data in a file"""
1940 1951 filename = self.shell.mktempfile(macro.value)
1941 1952 self.shell.hooks.editor(filename)
1942 1953
1943 1954 # and make a new macro object, to replace the old one
1944 1955 mfile = open(filename)
1945 1956 mvalue = mfile.read()
1946 1957 mfile.close()
1947 1958 self.shell.user_ns[mname] = Macro(mvalue)
1948 1959
1949 1960 def magic_ed(self,parameter_s=''):
1950 1961 """Alias to %edit."""
1951 1962 return self.magic_edit(parameter_s)
1952 1963
1953 1964 def magic_edit(self,parameter_s='',last_call=['','']):
1954 1965 """Bring up an editor and execute the resulting code.
1955 1966
1956 1967 Usage:
1957 1968 %edit [options] [args]
1958 1969
1959 1970 %edit runs IPython's editor hook. The default version of this hook is
1960 1971 set to call the __IPYTHON__.rc.editor command. This is read from your
1961 1972 environment variable $EDITOR. If this isn't found, it will default to
1962 1973 vi under Linux/Unix and to notepad under Windows. See the end of this
1963 1974 docstring for how to change the editor hook.
1964 1975
1965 1976 You can also set the value of this editor via the command line option
1966 1977 '-editor' or in your ipythonrc file. This is useful if you wish to use
1967 1978 specifically for IPython an editor different from your typical default
1968 1979 (and for Windows users who typically don't set environment variables).
1969 1980
1970 1981 This command allows you to conveniently edit multi-line code right in
1971 1982 your IPython session.
1972 1983
1973 1984 If called without arguments, %edit opens up an empty editor with a
1974 1985 temporary file and will execute the contents of this file when you
1975 1986 close it (don't forget to save it!).
1976 1987
1977 1988
1978 1989 Options:
1979 1990
1980 1991 -n <number>: open the editor at a specified line number. By default,
1981 1992 the IPython editor hook uses the unix syntax 'editor +N filename', but
1982 1993 you can configure this by providing your own modified hook if your
1983 1994 favorite editor supports line-number specifications with a different
1984 1995 syntax.
1985 1996
1986 1997 -p: this will call the editor with the same data as the previous time
1987 1998 it was used, regardless of how long ago (in your current session) it
1988 1999 was.
1989 2000
1990 2001 -r: use 'raw' input. This option only applies to input taken from the
1991 2002 user's history. By default, the 'processed' history is used, so that
1992 2003 magics are loaded in their transformed version to valid Python. If
1993 2004 this option is given, the raw input as typed as the command line is
1994 2005 used instead. When you exit the editor, it will be executed by
1995 2006 IPython's own processor.
1996 2007
1997 2008 -x: do not execute the edited code immediately upon exit. This is
1998 2009 mainly useful if you are editing programs which need to be called with
1999 2010 command line arguments, which you can then do using %run.
2000 2011
2001 2012
2002 2013 Arguments:
2003 2014
2004 2015 If arguments are given, the following possibilites exist:
2005 2016
2006 2017 - The arguments are numbers or pairs of colon-separated numbers (like
2007 2018 1 4:8 9). These are interpreted as lines of previous input to be
2008 2019 loaded into the editor. The syntax is the same of the %macro command.
2009 2020
2010 2021 - If the argument doesn't start with a number, it is evaluated as a
2011 2022 variable and its contents loaded into the editor. You can thus edit
2012 2023 any string which contains python code (including the result of
2013 2024 previous edits).
2014 2025
2015 2026 - If the argument is the name of an object (other than a string),
2016 2027 IPython will try to locate the file where it was defined and open the
2017 2028 editor at the point where it is defined. You can use `%edit function`
2018 2029 to load an editor exactly at the point where 'function' is defined,
2019 2030 edit it and have the file be executed automatically.
2020 2031
2021 2032 If the object is a macro (see %macro for details), this opens up your
2022 2033 specified editor with a temporary file containing the macro's data.
2023 2034 Upon exit, the macro is reloaded with the contents of the file.
2024 2035
2025 2036 Note: opening at an exact line is only supported under Unix, and some
2026 2037 editors (like kedit and gedit up to Gnome 2.8) do not understand the
2027 2038 '+NUMBER' parameter necessary for this feature. Good editors like
2028 2039 (X)Emacs, vi, jed, pico and joe all do.
2029 2040
2030 2041 - If the argument is not found as a variable, IPython will look for a
2031 2042 file with that name (adding .py if necessary) and load it into the
2032 2043 editor. It will execute its contents with execfile() when you exit,
2033 2044 loading any code in the file into your interactive namespace.
2034 2045
2035 2046 After executing your code, %edit will return as output the code you
2036 2047 typed in the editor (except when it was an existing file). This way
2037 2048 you can reload the code in further invocations of %edit as a variable,
2038 2049 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
2039 2050 the output.
2040 2051
2041 2052 Note that %edit is also available through the alias %ed.
2042 2053
2043 2054 This is an example of creating a simple function inside the editor and
2044 2055 then modifying it. First, start up the editor:
2045 2056
2046 2057 In [1]: ed\\
2047 2058 Editing... done. Executing edited code...\\
2048 2059 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
2049 2060
2050 2061 We can then call the function foo():
2051 2062
2052 2063 In [2]: foo()\\
2053 2064 foo() was defined in an editing session
2054 2065
2055 2066 Now we edit foo. IPython automatically loads the editor with the
2056 2067 (temporary) file where foo() was previously defined:
2057 2068
2058 2069 In [3]: ed foo\\
2059 2070 Editing... done. Executing edited code...
2060 2071
2061 2072 And if we call foo() again we get the modified version:
2062 2073
2063 2074 In [4]: foo()\\
2064 2075 foo() has now been changed!
2065 2076
2066 2077 Here is an example of how to edit a code snippet successive
2067 2078 times. First we call the editor:
2068 2079
2069 2080 In [8]: ed\\
2070 2081 Editing... done. Executing edited code...\\
2071 2082 hello\\
2072 2083 Out[8]: "print 'hello'\\n"
2073 2084
2074 2085 Now we call it again with the previous output (stored in _):
2075 2086
2076 2087 In [9]: ed _\\
2077 2088 Editing... done. Executing edited code...\\
2078 2089 hello world\\
2079 2090 Out[9]: "print 'hello world'\\n"
2080 2091
2081 2092 Now we call it with the output #8 (stored in _8, also as Out[8]):
2082 2093
2083 2094 In [10]: ed _8\\
2084 2095 Editing... done. Executing edited code...\\
2085 2096 hello again\\
2086 2097 Out[10]: "print 'hello again'\\n"
2087 2098
2088 2099
2089 2100 Changing the default editor hook:
2090 2101
2091 2102 If you wish to write your own editor hook, you can put it in a
2092 2103 configuration file which you load at startup time. The default hook
2093 2104 is defined in the IPython.hooks module, and you can use that as a
2094 2105 starting example for further modifications. That file also has
2095 2106 general instructions on how to set a new hook for use once you've
2096 2107 defined it."""
2097 2108
2098 2109 # FIXME: This function has become a convoluted mess. It needs a
2099 2110 # ground-up rewrite with clean, simple logic.
2100 2111
2101 2112 def make_filename(arg):
2102 2113 "Make a filename from the given args"
2103 2114 try:
2104 2115 filename = get_py_filename(arg)
2105 2116 except IOError:
2106 2117 if args.endswith('.py'):
2107 2118 filename = arg
2108 2119 else:
2109 2120 filename = None
2110 2121 return filename
2111 2122
2112 2123 # custom exceptions
2113 2124 class DataIsObject(Exception): pass
2114 2125
2115 2126 opts,args = self.parse_options(parameter_s,'prxn:')
2116 2127 # Set a few locals from the options for convenience:
2117 2128 opts_p = opts.has_key('p')
2118 2129 opts_r = opts.has_key('r')
2119 2130
2120 2131 # Default line number value
2121 2132 lineno = opts.get('n',None)
2122 2133
2123 2134 if opts_p:
2124 2135 args = '_%s' % last_call[0]
2125 2136 if not self.shell.user_ns.has_key(args):
2126 2137 args = last_call[1]
2127 2138
2128 2139 # use last_call to remember the state of the previous call, but don't
2129 2140 # let it be clobbered by successive '-p' calls.
2130 2141 try:
2131 2142 last_call[0] = self.shell.outputcache.prompt_count
2132 2143 if not opts_p:
2133 2144 last_call[1] = parameter_s
2134 2145 except:
2135 2146 pass
2136 2147
2137 2148 # by default this is done with temp files, except when the given
2138 2149 # arg is a filename
2139 2150 use_temp = 1
2140 2151
2141 2152 if re.match(r'\d',args):
2142 2153 # Mode where user specifies ranges of lines, like in %macro.
2143 2154 # This means that you can't edit files whose names begin with
2144 2155 # numbers this way. Tough.
2145 2156 ranges = args.split()
2146 2157 data = ''.join(self.extract_input_slices(ranges,opts_r))
2147 2158 elif args.endswith('.py'):
2148 2159 filename = make_filename(args)
2149 2160 data = ''
2150 2161 use_temp = 0
2151 2162 elif args:
2152 2163 try:
2153 2164 # Load the parameter given as a variable. If not a string,
2154 2165 # process it as an object instead (below)
2155 2166
2156 2167 #print '*** args',args,'type',type(args) # dbg
2157 2168 data = eval(args,self.shell.user_ns)
2158 2169 if not type(data) in StringTypes:
2159 2170 raise DataIsObject
2160 2171
2161 2172 except (NameError,SyntaxError):
2162 2173 # given argument is not a variable, try as a filename
2163 2174 filename = make_filename(args)
2164 2175 if filename is None:
2165 2176 warn("Argument given (%s) can't be found as a variable "
2166 2177 "or as a filename." % args)
2167 2178 return
2168 2179
2169 2180 data = ''
2170 2181 use_temp = 0
2171 2182 except DataIsObject:
2172 2183
2173 2184 # macros have a special edit function
2174 2185 if isinstance(data,Macro):
2175 2186 self._edit_macro(args,data)
2176 2187 return
2177 2188
2178 2189 # For objects, try to edit the file where they are defined
2179 2190 try:
2180 2191 filename = inspect.getabsfile(data)
2181 2192 datafile = 1
2182 2193 except TypeError:
2183 2194 filename = make_filename(args)
2184 2195 datafile = 1
2185 2196 warn('Could not find file where `%s` is defined.\n'
2186 2197 'Opening a file named `%s`' % (args,filename))
2187 2198 # Now, make sure we can actually read the source (if it was in
2188 2199 # a temp file it's gone by now).
2189 2200 if datafile:
2190 2201 try:
2191 2202 if lineno is None:
2192 2203 lineno = inspect.getsourcelines(data)[1]
2193 2204 except IOError:
2194 2205 filename = make_filename(args)
2195 2206 if filename is None:
2196 2207 warn('The file `%s` where `%s` was defined cannot '
2197 2208 'be read.' % (filename,data))
2198 2209 return
2199 2210 use_temp = 0
2200 2211 else:
2201 2212 data = ''
2202 2213
2203 2214 if use_temp:
2204 2215 filename = self.shell.mktempfile(data)
2205 2216 print 'IPython will make a temporary file named:',filename
2206 2217
2207 2218 # do actual editing here
2208 2219 print 'Editing...',
2209 2220 sys.stdout.flush()
2210 2221 self.shell.hooks.editor(filename,lineno)
2211 2222 if opts.has_key('x'): # -x prevents actual execution
2212 2223 print
2213 2224 else:
2214 2225 print 'done. Executing edited code...'
2215 2226 if opts_r:
2216 2227 self.shell.runlines(file_read(filename))
2217 2228 else:
2218 2229 self.shell.safe_execfile(filename,self.shell.user_ns)
2219 2230 if use_temp:
2220 2231 try:
2221 2232 return open(filename).read()
2222 2233 except IOError,msg:
2223 2234 if msg.filename == filename:
2224 2235 warn('File not found. Did you forget to save?')
2225 2236 return
2226 2237 else:
2227 2238 self.shell.showtraceback()
2228 2239
2229 2240 def magic_xmode(self,parameter_s = ''):
2230 2241 """Switch modes for the exception handlers.
2231 2242
2232 2243 Valid modes: Plain, Context and Verbose.
2233 2244
2234 2245 If called without arguments, acts as a toggle."""
2235 2246
2236 2247 def xmode_switch_err(name):
2237 2248 warn('Error changing %s exception modes.\n%s' %
2238 2249 (name,sys.exc_info()[1]))
2239 2250
2240 2251 shell = self.shell
2241 2252 new_mode = parameter_s.strip().capitalize()
2242 2253 try:
2243 2254 shell.InteractiveTB.set_mode(mode=new_mode)
2244 2255 print 'Exception reporting mode:',shell.InteractiveTB.mode
2245 2256 except:
2246 2257 xmode_switch_err('user')
2247 2258
2248 2259 # threaded shells use a special handler in sys.excepthook
2249 2260 if shell.isthreaded:
2250 2261 try:
2251 2262 shell.sys_excepthook.set_mode(mode=new_mode)
2252 2263 except:
2253 2264 xmode_switch_err('threaded')
2254 2265
2255 2266 def magic_colors(self,parameter_s = ''):
2256 2267 """Switch color scheme for prompts, info system and exception handlers.
2257 2268
2258 2269 Currently implemented schemes: NoColor, Linux, LightBG.
2259 2270
2260 2271 Color scheme names are not case-sensitive."""
2261 2272
2262 2273 def color_switch_err(name):
2263 2274 warn('Error changing %s color schemes.\n%s' %
2264 2275 (name,sys.exc_info()[1]))
2265 2276
2266 2277
2267 2278 new_scheme = parameter_s.strip()
2268 2279 if not new_scheme:
2269 2280 print 'You must specify a color scheme.'
2270 2281 return
2271 2282 import IPython.rlineimpl as readline
2272 2283 if not readline.have_readline:
2273 2284 msg = """\
2274 2285 Proper color support under MS Windows requires the pyreadline library.
2275 2286 You can find it at:
2276 2287 http://ipython.scipy.org/moin/PyReadline/Intro
2277 2288 Gary's readline needs the ctypes module, from:
2278 2289 http://starship.python.net/crew/theller/ctypes
2279 2290 (Note that ctypes is already part of Python versions 2.5 and newer).
2280 2291
2281 2292 Defaulting color scheme to 'NoColor'"""
2282 2293 new_scheme = 'NoColor'
2283 2294 warn(msg)
2284 2295 # local shortcut
2285 2296 shell = self.shell
2286 2297
2287 2298 # Set prompt colors
2288 2299 try:
2289 2300 shell.outputcache.set_colors(new_scheme)
2290 2301 except:
2291 2302 color_switch_err('prompt')
2292 2303 else:
2293 2304 shell.rc.colors = \
2294 2305 shell.outputcache.color_table.active_scheme_name
2295 2306 # Set exception colors
2296 2307 try:
2297 2308 shell.InteractiveTB.set_colors(scheme = new_scheme)
2298 2309 shell.SyntaxTB.set_colors(scheme = new_scheme)
2299 2310 except:
2300 2311 color_switch_err('exception')
2301 2312
2302 2313 # threaded shells use a verbose traceback in sys.excepthook
2303 2314 if shell.isthreaded:
2304 2315 try:
2305 2316 shell.sys_excepthook.set_colors(scheme=new_scheme)
2306 2317 except:
2307 2318 color_switch_err('system exception handler')
2308 2319
2309 2320 # Set info (for 'object?') colors
2310 2321 if shell.rc.color_info:
2311 2322 try:
2312 2323 shell.inspector.set_active_scheme(new_scheme)
2313 2324 except:
2314 2325 color_switch_err('object inspector')
2315 2326 else:
2316 2327 shell.inspector.set_active_scheme('NoColor')
2317 2328
2318 2329 def magic_color_info(self,parameter_s = ''):
2319 2330 """Toggle color_info.
2320 2331
2321 2332 The color_info configuration parameter controls whether colors are
2322 2333 used for displaying object details (by things like %psource, %pfile or
2323 2334 the '?' system). This function toggles this value with each call.
2324 2335
2325 2336 Note that unless you have a fairly recent pager (less works better
2326 2337 than more) in your system, using colored object information displays
2327 2338 will not work properly. Test it and see."""
2328 2339
2329 2340 self.shell.rc.color_info = 1 - self.shell.rc.color_info
2330 2341 self.magic_colors(self.shell.rc.colors)
2331 2342 print 'Object introspection functions have now coloring:',
2332 2343 print ['OFF','ON'][self.shell.rc.color_info]
2333 2344
2334 2345 def magic_Pprint(self, parameter_s=''):
2335 2346 """Toggle pretty printing on/off."""
2336 2347
2337 2348 self.shell.rc.pprint = 1 - self.shell.rc.pprint
2338 2349 print 'Pretty printing has been turned', \
2339 2350 ['OFF','ON'][self.shell.rc.pprint]
2340 2351
2341 2352 def magic_exit(self, parameter_s=''):
2342 2353 """Exit IPython, confirming if configured to do so.
2343 2354
2344 2355 You can configure whether IPython asks for confirmation upon exit by
2345 2356 setting the confirm_exit flag in the ipythonrc file."""
2346 2357
2347 2358 self.shell.exit()
2348 2359
2349 2360 def magic_quit(self, parameter_s=''):
2350 2361 """Exit IPython, confirming if configured to do so (like %exit)"""
2351 2362
2352 2363 self.shell.exit()
2353 2364
2354 2365 def magic_Exit(self, parameter_s=''):
2355 2366 """Exit IPython without confirmation."""
2356 2367
2357 2368 self.shell.exit_now = True
2358 2369
2359 2370 def magic_Quit(self, parameter_s=''):
2360 2371 """Exit IPython without confirmation (like %Exit)."""
2361 2372
2362 2373 self.shell.exit_now = True
2363 2374
2364 2375 #......................................................................
2365 2376 # Functions to implement unix shell-type things
2366 2377
2367 2378 def magic_alias(self, parameter_s = ''):
2368 2379 """Define an alias for a system command.
2369 2380
2370 2381 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
2371 2382
2372 2383 Then, typing 'alias_name params' will execute the system command 'cmd
2373 2384 params' (from your underlying operating system).
2374 2385
2375 2386 Aliases have lower precedence than magic functions and Python normal
2376 2387 variables, so if 'foo' is both a Python variable and an alias, the
2377 2388 alias can not be executed until 'del foo' removes the Python variable.
2378 2389
2379 2390 You can use the %l specifier in an alias definition to represent the
2380 2391 whole line when the alias is called. For example:
2381 2392
2382 2393 In [2]: alias all echo "Input in brackets: <%l>"\\
2383 2394 In [3]: all hello world\\
2384 2395 Input in brackets: <hello world>
2385 2396
2386 2397 You can also define aliases with parameters using %s specifiers (one
2387 2398 per parameter):
2388 2399
2389 2400 In [1]: alias parts echo first %s second %s\\
2390 2401 In [2]: %parts A B\\
2391 2402 first A second B\\
2392 2403 In [3]: %parts A\\
2393 2404 Incorrect number of arguments: 2 expected.\\
2394 2405 parts is an alias to: 'echo first %s second %s'
2395 2406
2396 2407 Note that %l and %s are mutually exclusive. You can only use one or
2397 2408 the other in your aliases.
2398 2409
2399 2410 Aliases expand Python variables just like system calls using ! or !!
2400 2411 do: all expressions prefixed with '$' get expanded. For details of
2401 2412 the semantic rules, see PEP-215:
2402 2413 http://www.python.org/peps/pep-0215.html. This is the library used by
2403 2414 IPython for variable expansion. If you want to access a true shell
2404 2415 variable, an extra $ is necessary to prevent its expansion by IPython:
2405 2416
2406 2417 In [6]: alias show echo\\
2407 2418 In [7]: PATH='A Python string'\\
2408 2419 In [8]: show $PATH\\
2409 2420 A Python string\\
2410 2421 In [9]: show $$PATH\\
2411 2422 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2412 2423
2413 2424 You can use the alias facility to acess all of $PATH. See the %rehash
2414 2425 and %rehashx functions, which automatically create aliases for the
2415 2426 contents of your $PATH.
2416 2427
2417 2428 If called with no parameters, %alias prints the current alias table."""
2418 2429
2419 2430 par = parameter_s.strip()
2420 2431 if not par:
2421 2432 stored = self.db.get('stored_aliases', {} )
2422 2433 atab = self.shell.alias_table
2423 2434 aliases = atab.keys()
2424 2435 aliases.sort()
2425 2436 res = []
2426 2437 showlast = []
2427 2438 for alias in aliases:
2428 2439 tgt = atab[alias][1]
2429 2440 # 'interesting' aliases
2430 2441 if (alias in stored or
2431 2442 alias != os.path.splitext(tgt)[0] or
2432 2443 ' ' in tgt):
2433 2444 showlast.append((alias, tgt))
2434 2445 else:
2435 2446 res.append((alias, tgt ))
2436 2447
2437 2448 # show most interesting aliases last
2438 2449 res.extend(showlast)
2439 2450 print "Total number of aliases:",len(aliases)
2440 2451 return res
2441 2452 try:
2442 2453 alias,cmd = par.split(None,1)
2443 2454 except:
2444 2455 print OInspect.getdoc(self.magic_alias)
2445 2456 else:
2446 2457 nargs = cmd.count('%s')
2447 2458 if nargs>0 and cmd.find('%l')>=0:
2448 2459 error('The %s and %l specifiers are mutually exclusive '
2449 2460 'in alias definitions.')
2450 2461 else: # all looks OK
2451 2462 self.shell.alias_table[alias] = (nargs,cmd)
2452 2463 self.shell.alias_table_validate(verbose=0)
2453 2464 # end magic_alias
2454 2465
2455 2466 def magic_unalias(self, parameter_s = ''):
2456 2467 """Remove an alias"""
2457 2468
2458 2469 aname = parameter_s.strip()
2459 2470 if aname in self.shell.alias_table:
2460 2471 del self.shell.alias_table[aname]
2461 2472 stored = self.db.get('stored_aliases', {} )
2462 2473 if aname in stored:
2463 2474 print "Removing %stored alias",aname
2464 2475 del stored[aname]
2465 2476 self.db['stored_aliases'] = stored
2466 2477
2467 2478 def magic_rehash(self, parameter_s = ''):
2468 2479 """Update the alias table with all entries in $PATH.
2469 2480
2470 2481 This version does no checks on execute permissions or whether the
2471 2482 contents of $PATH are truly files (instead of directories or something
2472 2483 else). For such a safer (but slower) version, use %rehashx."""
2473 2484
2474 2485 # This function (and rehashx) manipulate the alias_table directly
2475 2486 # rather than calling magic_alias, for speed reasons. A rehash on a
2476 2487 # typical Linux box involves several thousand entries, so efficiency
2477 2488 # here is a top concern.
2478 2489
2479 2490 path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep))
2480 2491 alias_table = self.shell.alias_table
2481 2492 for pdir in path:
2482 2493 for ff in os.listdir(pdir):
2483 2494 # each entry in the alias table must be (N,name), where
2484 2495 # N is the number of positional arguments of the alias.
2485 2496 alias_table[ff] = (0,ff)
2486 2497 # Make sure the alias table doesn't contain keywords or builtins
2487 2498 self.shell.alias_table_validate()
2488 2499 # Call again init_auto_alias() so we get 'rm -i' and other modified
2489 2500 # aliases since %rehash will probably clobber them
2490 2501 self.shell.init_auto_alias()
2491 2502
2492 2503 def magic_rehashx(self, parameter_s = ''):
2493 2504 """Update the alias table with all executable files in $PATH.
2494 2505
2495 2506 This version explicitly checks that every entry in $PATH is a file
2496 2507 with execute access (os.X_OK), so it is much slower than %rehash.
2497 2508
2498 2509 Under Windows, it checks executability as a match agains a
2499 2510 '|'-separated string of extensions, stored in the IPython config
2500 2511 variable win_exec_ext. This defaults to 'exe|com|bat'. """
2501 2512
2502 2513 path = [os.path.abspath(os.path.expanduser(p)) for p in
2503 2514 os.environ['PATH'].split(os.pathsep)]
2504 2515 path = filter(os.path.isdir,path)
2505 2516
2506 2517 alias_table = self.shell.alias_table
2507 2518 syscmdlist = []
2508 2519 if os.name == 'posix':
2509 2520 isexec = lambda fname:os.path.isfile(fname) and \
2510 2521 os.access(fname,os.X_OK)
2511 2522 else:
2512 2523
2513 2524 try:
2514 2525 winext = os.environ['pathext'].replace(';','|').replace('.','')
2515 2526 except KeyError:
2516 2527 winext = 'exe|com|bat|py'
2517 2528 if 'py' not in winext:
2518 2529 winext += '|py'
2519 2530 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2520 2531 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2521 2532 savedir = os.getcwd()
2522 2533 try:
2523 2534 # write the whole loop for posix/Windows so we don't have an if in
2524 2535 # the innermost part
2525 2536 if os.name == 'posix':
2526 2537 for pdir in path:
2527 2538 os.chdir(pdir)
2528 2539 for ff in os.listdir(pdir):
2529 2540 if isexec(ff) and ff not in self.shell.no_alias:
2530 2541 # each entry in the alias table must be (N,name),
2531 2542 # where N is the number of positional arguments of the
2532 2543 # alias.
2533 2544 alias_table[ff] = (0,ff)
2534 2545 syscmdlist.append(ff)
2535 2546 else:
2536 2547 for pdir in path:
2537 2548 os.chdir(pdir)
2538 2549 for ff in os.listdir(pdir):
2539 2550 base, ext = os.path.splitext(ff)
2540 2551 if isexec(ff) and base not in self.shell.no_alias:
2541 2552 if ext.lower() == '.exe':
2542 2553 ff = base
2543 2554 alias_table[base] = (0,ff)
2544 2555 syscmdlist.append(ff)
2545 2556 # Make sure the alias table doesn't contain keywords or builtins
2546 2557 self.shell.alias_table_validate()
2547 2558 # Call again init_auto_alias() so we get 'rm -i' and other
2548 2559 # modified aliases since %rehashx will probably clobber them
2549 2560 self.shell.init_auto_alias()
2550 2561 db = self.getapi().db
2551 2562 db['syscmdlist'] = syscmdlist
2552 2563 finally:
2553 2564 os.chdir(savedir)
2554 2565
2555 2566 def magic_pwd(self, parameter_s = ''):
2556 2567 """Return the current working directory path."""
2557 2568 return os.getcwd()
2558 2569
2559 2570 def magic_cd(self, parameter_s=''):
2560 2571 """Change the current working directory.
2561 2572
2562 2573 This command automatically maintains an internal list of directories
2563 2574 you visit during your IPython session, in the variable _dh. The
2564 2575 command %dhist shows this history nicely formatted. You can also
2565 2576 do 'cd -<tab>' to see directory history conveniently.
2566 2577
2567 2578 Usage:
2568 2579
2569 2580 cd 'dir': changes to directory 'dir'.
2570 2581
2571 2582 cd -: changes to the last visited directory.
2572 2583
2573 2584 cd -<n>: changes to the n-th directory in the directory history.
2574 2585
2575 2586 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2576 2587 (note: cd <bookmark_name> is enough if there is no
2577 2588 directory <bookmark_name>, but a bookmark with the name exists.)
2578 2589 'cd -b <tab>' allows you to tab-complete bookmark names.
2579 2590
2580 2591 Options:
2581 2592
2582 2593 -q: quiet. Do not print the working directory after the cd command is
2583 2594 executed. By default IPython's cd command does print this directory,
2584 2595 since the default prompts do not display path information.
2585 2596
2586 2597 Note that !cd doesn't work for this purpose because the shell where
2587 2598 !command runs is immediately discarded after executing 'command'."""
2588 2599
2589 2600 parameter_s = parameter_s.strip()
2590 2601 #bkms = self.shell.persist.get("bookmarks",{})
2591 2602
2592 2603 numcd = re.match(r'(-)(\d+)$',parameter_s)
2593 2604 # jump in directory history by number
2594 2605 if numcd:
2595 2606 nn = int(numcd.group(2))
2596 2607 try:
2597 2608 ps = self.shell.user_ns['_dh'][nn]
2598 2609 except IndexError:
2599 2610 print 'The requested directory does not exist in history.'
2600 2611 return
2601 2612 else:
2602 2613 opts = {}
2603 2614 else:
2604 2615 #turn all non-space-escaping backslashes to slashes,
2605 2616 # for c:\windows\directory\names\
2606 2617 parameter_s = re.sub(r'\\(?! )','/', parameter_s)
2607 2618 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2608 2619 # jump to previous
2609 2620 if ps == '-':
2610 2621 try:
2611 2622 ps = self.shell.user_ns['_dh'][-2]
2612 2623 except IndexError:
2613 2624 print 'No previous directory to change to.'
2614 2625 return
2615 2626 # jump to bookmark if needed
2616 2627 else:
2617 2628 if not os.path.isdir(ps) or opts.has_key('b'):
2618 2629 bkms = self.db.get('bookmarks', {})
2619 2630
2620 2631 if bkms.has_key(ps):
2621 2632 target = bkms[ps]
2622 2633 print '(bookmark:%s) -> %s' % (ps,target)
2623 2634 ps = target
2624 2635 else:
2625 2636 if opts.has_key('b'):
2626 2637 error("Bookmark '%s' not found. "
2627 2638 "Use '%%bookmark -l' to see your bookmarks." % ps)
2628 2639 return
2629 2640
2630 2641 # at this point ps should point to the target dir
2631 2642 if ps:
2632 2643 try:
2633 2644 os.chdir(os.path.expanduser(ps))
2634 2645 if self.shell.rc.term_title:
2635 2646 #print 'set term title:',self.shell.rc.term_title # dbg
2636 2647 ttitle = ("IPy:" + (
2637 2648 os.getcwd() == '/' and '/' or \
2638 2649 os.path.basename(os.getcwd())))
2639 2650 platutils.set_term_title(ttitle)
2640 2651 except OSError:
2641 2652 print sys.exc_info()[1]
2642 2653 else:
2643 2654 self.shell.user_ns['_dh'].append(os.getcwd())
2644 2655 else:
2645 2656 os.chdir(self.shell.home_dir)
2646 2657 if self.shell.rc.term_title:
2647 2658 platutils.set_term_title("IPy:~")
2648 2659 self.shell.user_ns['_dh'].append(os.getcwd())
2649 2660 if not 'q' in opts:
2650 2661 print self.shell.user_ns['_dh'][-1]
2651 2662
2652 2663 def magic_dhist(self, parameter_s=''):
2653 2664 """Print your history of visited directories.
2654 2665
2655 2666 %dhist -> print full history\\
2656 2667 %dhist n -> print last n entries only\\
2657 2668 %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\
2658 2669
2659 2670 This history is automatically maintained by the %cd command, and
2660 2671 always available as the global list variable _dh. You can use %cd -<n>
2661 2672 to go to directory number <n>."""
2662 2673
2663 2674 dh = self.shell.user_ns['_dh']
2664 2675 if parameter_s:
2665 2676 try:
2666 2677 args = map(int,parameter_s.split())
2667 2678 except:
2668 2679 self.arg_err(Magic.magic_dhist)
2669 2680 return
2670 2681 if len(args) == 1:
2671 2682 ini,fin = max(len(dh)-(args[0]),0),len(dh)
2672 2683 elif len(args) == 2:
2673 2684 ini,fin = args
2674 2685 else:
2675 2686 self.arg_err(Magic.magic_dhist)
2676 2687 return
2677 2688 else:
2678 2689 ini,fin = 0,len(dh)
2679 2690 nlprint(dh,
2680 2691 header = 'Directory history (kept in _dh)',
2681 2692 start=ini,stop=fin)
2682 2693
2683 2694 def magic_env(self, parameter_s=''):
2684 2695 """List environment variables."""
2685 2696
2686 2697 return os.environ.data
2687 2698
2688 2699 def magic_pushd(self, parameter_s=''):
2689 2700 """Place the current dir on stack and change directory.
2690 2701
2691 2702 Usage:\\
2692 2703 %pushd ['dirname']
2693 2704
2694 2705 %pushd with no arguments does a %pushd to your home directory.
2695 2706 """
2696 2707 if parameter_s == '': parameter_s = '~'
2697 2708 dir_s = self.shell.dir_stack
2698 2709 if len(dir_s)>0 and os.path.expanduser(parameter_s) != \
2699 2710 os.path.expanduser(self.shell.dir_stack[0]):
2700 2711 try:
2701 2712 self.magic_cd(parameter_s)
2702 2713 dir_s.insert(0,os.getcwd().replace(self.home_dir,'~'))
2703 2714 self.magic_dirs()
2704 2715 except:
2705 2716 print 'Invalid directory'
2706 2717 else:
2707 2718 print 'You are already there!'
2708 2719
2709 2720 def magic_popd(self, parameter_s=''):
2710 2721 """Change to directory popped off the top of the stack.
2711 2722 """
2712 2723 if len (self.shell.dir_stack) > 1:
2713 2724 self.shell.dir_stack.pop(0)
2714 2725 self.magic_cd(self.shell.dir_stack[0])
2715 2726 print self.shell.dir_stack[0]
2716 2727 else:
2717 2728 print "You can't remove the starting directory from the stack:",\
2718 2729 self.shell.dir_stack
2719 2730
2720 2731 def magic_dirs(self, parameter_s=''):
2721 2732 """Return the current directory stack."""
2722 2733
2723 2734 return self.shell.dir_stack[:]
2724 2735
2725 2736 def magic_sc(self, parameter_s=''):
2726 2737 """Shell capture - execute a shell command and capture its output.
2727 2738
2728 2739 DEPRECATED. Suboptimal, retained for backwards compatibility.
2729 2740
2730 2741 You should use the form 'var = !command' instead. Example:
2731 2742
2732 2743 "%sc -l myfiles = ls ~" should now be written as
2733 2744
2734 2745 "myfiles = !ls ~"
2735 2746
2736 2747 myfiles.s, myfiles.l and myfiles.n still apply as documented
2737 2748 below.
2738 2749
2739 2750 --
2740 2751 %sc [options] varname=command
2741 2752
2742 2753 IPython will run the given command using commands.getoutput(), and
2743 2754 will then update the user's interactive namespace with a variable
2744 2755 called varname, containing the value of the call. Your command can
2745 2756 contain shell wildcards, pipes, etc.
2746 2757
2747 2758 The '=' sign in the syntax is mandatory, and the variable name you
2748 2759 supply must follow Python's standard conventions for valid names.
2749 2760
2750 2761 (A special format without variable name exists for internal use)
2751 2762
2752 2763 Options:
2753 2764
2754 2765 -l: list output. Split the output on newlines into a list before
2755 2766 assigning it to the given variable. By default the output is stored
2756 2767 as a single string.
2757 2768
2758 2769 -v: verbose. Print the contents of the variable.
2759 2770
2760 2771 In most cases you should not need to split as a list, because the
2761 2772 returned value is a special type of string which can automatically
2762 2773 provide its contents either as a list (split on newlines) or as a
2763 2774 space-separated string. These are convenient, respectively, either
2764 2775 for sequential processing or to be passed to a shell command.
2765 2776
2766 2777 For example:
2767 2778
2768 2779 # Capture into variable a
2769 2780 In [9]: sc a=ls *py
2770 2781
2771 2782 # a is a string with embedded newlines
2772 2783 In [10]: a
2773 2784 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2774 2785
2775 2786 # which can be seen as a list:
2776 2787 In [11]: a.l
2777 2788 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2778 2789
2779 2790 # or as a whitespace-separated string:
2780 2791 In [12]: a.s
2781 2792 Out[12]: 'setup.py win32_manual_post_install.py'
2782 2793
2783 2794 # a.s is useful to pass as a single command line:
2784 2795 In [13]: !wc -l $a.s
2785 2796 146 setup.py
2786 2797 130 win32_manual_post_install.py
2787 2798 276 total
2788 2799
2789 2800 # while the list form is useful to loop over:
2790 2801 In [14]: for f in a.l:
2791 2802 ....: !wc -l $f
2792 2803 ....:
2793 2804 146 setup.py
2794 2805 130 win32_manual_post_install.py
2795 2806
2796 2807 Similiarly, the lists returned by the -l option are also special, in
2797 2808 the sense that you can equally invoke the .s attribute on them to
2798 2809 automatically get a whitespace-separated string from their contents:
2799 2810
2800 2811 In [1]: sc -l b=ls *py
2801 2812
2802 2813 In [2]: b
2803 2814 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2804 2815
2805 2816 In [3]: b.s
2806 2817 Out[3]: 'setup.py win32_manual_post_install.py'
2807 2818
2808 2819 In summary, both the lists and strings used for ouptut capture have
2809 2820 the following special attributes:
2810 2821
2811 2822 .l (or .list) : value as list.
2812 2823 .n (or .nlstr): value as newline-separated string.
2813 2824 .s (or .spstr): value as space-separated string.
2814 2825 """
2815 2826
2816 2827 opts,args = self.parse_options(parameter_s,'lv')
2817 2828 # Try to get a variable name and command to run
2818 2829 try:
2819 2830 # the variable name must be obtained from the parse_options
2820 2831 # output, which uses shlex.split to strip options out.
2821 2832 var,_ = args.split('=',1)
2822 2833 var = var.strip()
2823 2834 # But the the command has to be extracted from the original input
2824 2835 # parameter_s, not on what parse_options returns, to avoid the
2825 2836 # quote stripping which shlex.split performs on it.
2826 2837 _,cmd = parameter_s.split('=',1)
2827 2838 except ValueError:
2828 2839 var,cmd = '',''
2829 2840 # If all looks ok, proceed
2830 2841 out,err = self.shell.getoutputerror(cmd)
2831 2842 if err:
2832 2843 print >> Term.cerr,err
2833 2844 if opts.has_key('l'):
2834 2845 out = SList(out.split('\n'))
2835 2846 else:
2836 2847 out = LSString(out)
2837 2848 if opts.has_key('v'):
2838 2849 print '%s ==\n%s' % (var,pformat(out))
2839 2850 if var:
2840 2851 self.shell.user_ns.update({var:out})
2841 2852 else:
2842 2853 return out
2843 2854
2844 2855 def magic_sx(self, parameter_s=''):
2845 2856 """Shell execute - run a shell command and capture its output.
2846 2857
2847 2858 %sx command
2848 2859
2849 2860 IPython will run the given command using commands.getoutput(), and
2850 2861 return the result formatted as a list (split on '\\n'). Since the
2851 2862 output is _returned_, it will be stored in ipython's regular output
2852 2863 cache Out[N] and in the '_N' automatic variables.
2853 2864
2854 2865 Notes:
2855 2866
2856 2867 1) If an input line begins with '!!', then %sx is automatically
2857 2868 invoked. That is, while:
2858 2869 !ls
2859 2870 causes ipython to simply issue system('ls'), typing
2860 2871 !!ls
2861 2872 is a shorthand equivalent to:
2862 2873 %sx ls
2863 2874
2864 2875 2) %sx differs from %sc in that %sx automatically splits into a list,
2865 2876 like '%sc -l'. The reason for this is to make it as easy as possible
2866 2877 to process line-oriented shell output via further python commands.
2867 2878 %sc is meant to provide much finer control, but requires more
2868 2879 typing.
2869 2880
2870 2881 3) Just like %sc -l, this is a list with special attributes:
2871 2882
2872 2883 .l (or .list) : value as list.
2873 2884 .n (or .nlstr): value as newline-separated string.
2874 2885 .s (or .spstr): value as whitespace-separated string.
2875 2886
2876 2887 This is very useful when trying to use such lists as arguments to
2877 2888 system commands."""
2878 2889
2879 2890 if parameter_s:
2880 2891 out,err = self.shell.getoutputerror(parameter_s)
2881 2892 if err:
2882 2893 print >> Term.cerr,err
2883 2894 return SList(out.split('\n'))
2884 2895
2885 2896 def magic_bg(self, parameter_s=''):
2886 2897 """Run a job in the background, in a separate thread.
2887 2898
2888 2899 For example,
2889 2900
2890 2901 %bg myfunc(x,y,z=1)
2891 2902
2892 2903 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2893 2904 execution starts, a message will be printed indicating the job
2894 2905 number. If your job number is 5, you can use
2895 2906
2896 2907 myvar = jobs.result(5) or myvar = jobs[5].result
2897 2908
2898 2909 to assign this result to variable 'myvar'.
2899 2910
2900 2911 IPython has a job manager, accessible via the 'jobs' object. You can
2901 2912 type jobs? to get more information about it, and use jobs.<TAB> to see
2902 2913 its attributes. All attributes not starting with an underscore are
2903 2914 meant for public use.
2904 2915
2905 2916 In particular, look at the jobs.new() method, which is used to create
2906 2917 new jobs. This magic %bg function is just a convenience wrapper
2907 2918 around jobs.new(), for expression-based jobs. If you want to create a
2908 2919 new job with an explicit function object and arguments, you must call
2909 2920 jobs.new() directly.
2910 2921
2911 2922 The jobs.new docstring also describes in detail several important
2912 2923 caveats associated with a thread-based model for background job
2913 2924 execution. Type jobs.new? for details.
2914 2925
2915 2926 You can check the status of all jobs with jobs.status().
2916 2927
2917 2928 The jobs variable is set by IPython into the Python builtin namespace.
2918 2929 If you ever declare a variable named 'jobs', you will shadow this
2919 2930 name. You can either delete your global jobs variable to regain
2920 2931 access to the job manager, or make a new name and assign it manually
2921 2932 to the manager (stored in IPython's namespace). For example, to
2922 2933 assign the job manager to the Jobs name, use:
2923 2934
2924 2935 Jobs = __builtins__.jobs"""
2925 2936
2926 2937 self.shell.jobs.new(parameter_s,self.shell.user_ns)
2927 2938
2928 2939
2929 2940 def magic_bookmark(self, parameter_s=''):
2930 2941 """Manage IPython's bookmark system.
2931 2942
2932 2943 %bookmark <name> - set bookmark to current dir
2933 2944 %bookmark <name> <dir> - set bookmark to <dir>
2934 2945 %bookmark -l - list all bookmarks
2935 2946 %bookmark -d <name> - remove bookmark
2936 2947 %bookmark -r - remove all bookmarks
2937 2948
2938 2949 You can later on access a bookmarked folder with:
2939 2950 %cd -b <name>
2940 2951 or simply '%cd <name>' if there is no directory called <name> AND
2941 2952 there is such a bookmark defined.
2942 2953
2943 2954 Your bookmarks persist through IPython sessions, but they are
2944 2955 associated with each profile."""
2945 2956
2946 2957 opts,args = self.parse_options(parameter_s,'drl',mode='list')
2947 2958 if len(args) > 2:
2948 2959 error('You can only give at most two arguments')
2949 2960 return
2950 2961
2951 2962 bkms = self.db.get('bookmarks',{})
2952 2963
2953 2964 if opts.has_key('d'):
2954 2965 try:
2955 2966 todel = args[0]
2956 2967 except IndexError:
2957 2968 error('You must provide a bookmark to delete')
2958 2969 else:
2959 2970 try:
2960 2971 del bkms[todel]
2961 2972 except:
2962 2973 error("Can't delete bookmark '%s'" % todel)
2963 2974 elif opts.has_key('r'):
2964 2975 bkms = {}
2965 2976 elif opts.has_key('l'):
2966 2977 bks = bkms.keys()
2967 2978 bks.sort()
2968 2979 if bks:
2969 2980 size = max(map(len,bks))
2970 2981 else:
2971 2982 size = 0
2972 2983 fmt = '%-'+str(size)+'s -> %s'
2973 2984 print 'Current bookmarks:'
2974 2985 for bk in bks:
2975 2986 print fmt % (bk,bkms[bk])
2976 2987 else:
2977 2988 if not args:
2978 2989 error("You must specify the bookmark name")
2979 2990 elif len(args)==1:
2980 2991 bkms[args[0]] = os.getcwd()
2981 2992 elif len(args)==2:
2982 2993 bkms[args[0]] = args[1]
2983 2994 self.db['bookmarks'] = bkms
2984 2995
2985 2996 def magic_pycat(self, parameter_s=''):
2986 2997 """Show a syntax-highlighted file through a pager.
2987 2998
2988 2999 This magic is similar to the cat utility, but it will assume the file
2989 3000 to be Python source and will show it with syntax highlighting. """
2990 3001
2991 3002 try:
2992 3003 filename = get_py_filename(parameter_s)
2993 3004 cont = file_read(filename)
2994 3005 except IOError:
2995 3006 try:
2996 3007 cont = eval(parameter_s,self.user_ns)
2997 3008 except NameError:
2998 3009 cont = None
2999 3010 if cont is None:
3000 3011 print "Error: no such file or variable"
3001 3012 return
3002 3013
3003 3014 page(self.shell.pycolorize(cont),
3004 3015 screen_lines=self.shell.rc.screen_length)
3005 3016
3006 3017 def magic_cpaste(self, parameter_s=''):
3007 3018 """Allows you to paste & execute a pre-formatted code block from clipboard
3008 3019
3009 3020 You must terminate the block with '--' (two minus-signs) alone on the
3010 3021 line. You can also provide your own sentinel with '%paste -s %%' ('%%'
3011 3022 is the new sentinel for this operation)
3012 3023
3013 3024 The block is dedented prior to execution to enable execution of
3014 3025 method definitions. '>' characters at the beginning of a line is
3015 3026 ignored, to allow pasting directly from e-mails. The executed block
3016 3027 is also assigned to variable named 'pasted_block' for later editing
3017 3028 with '%edit pasted_block'.
3018 3029
3019 3030 You can also pass a variable name as an argument, e.g. '%cpaste foo'.
3020 3031 This assigns the pasted block to variable 'foo' as string, without
3021 3032 dedenting or executing it.
3022 3033
3023 3034 Do not be alarmed by garbled output on Windows (it's a readline bug).
3024 3035 Just press enter and type -- (and press enter again) and the block
3025 3036 will be what was just pasted.
3026 3037
3027 3038 IPython statements (magics, shell escapes) are not supported (yet).
3028 3039 """
3029 3040 opts,args = self.parse_options(parameter_s,'s:',mode='string')
3030 3041 par = args.strip()
3031 3042 sentinel = opts.get('s','--')
3032 3043
3033 3044 from IPython import iplib
3034 3045 lines = []
3035 3046 print "Pasting code; enter '%s' alone on the line to stop." % sentinel
3036 3047 while 1:
3037 3048 l = iplib.raw_input_original(':')
3038 3049 if l ==sentinel:
3039 3050 break
3040 3051 lines.append(l.lstrip('>'))
3041 3052 block = "\n".join(lines) + '\n'
3042 3053 #print "block:\n",block
3043 3054 if not par:
3044 3055 b = textwrap.dedent(block)
3045 3056 exec b in self.user_ns
3046 3057 self.user_ns['pasted_block'] = b
3047 3058 else:
3048 3059 self.user_ns[par] = block
3049 3060 print "Block assigned to '%s'" % par
3050 3061
3051 3062 def magic_quickref(self,arg):
3052 3063 """ Show a quick reference sheet """
3053 3064 import IPython.usage
3054 3065 qr = IPython.usage.quick_reference + self.magic_magic('-brief')
3055 3066
3056 3067 page(qr)
3057 3068
3058 3069 def magic_upgrade(self,arg):
3059 3070 """ Upgrade your IPython installation
3060 3071
3061 3072 This will copy the config files that don't yet exist in your
3062 3073 ipython dir from the system config dir. Use this after upgrading
3063 3074 IPython if you don't wish to delete your .ipython dir.
3064 3075
3065 3076 Call with -nolegacy to get rid of ipythonrc* files (recommended for
3066 3077 new users)
3067 3078
3068 3079 """
3069 3080 ip = self.getapi()
3070 3081 ipinstallation = path(IPython.__file__).dirname()
3071 3082 upgrade_script = '%s "%s"' % (sys.executable,ipinstallation / 'upgrade_dir.py')
3072 3083 src_config = ipinstallation / 'UserConfig'
3073 3084 userdir = path(ip.options.ipythondir)
3074 3085 cmd = '%s "%s" "%s"' % (upgrade_script, src_config, userdir)
3075 3086 print ">",cmd
3076 3087 shell(cmd)
3077 3088 if arg == '-nolegacy':
3078 3089 legacy = userdir.files('ipythonrc*')
3079 3090 print "Nuking legacy files:",legacy
3080 3091
3081 3092 [p.remove() for p in legacy]
3082 3093 suffix = (sys.platform == 'win32' and '.ini' or '')
3083 3094 (userdir / ('ipythonrc' + suffix)).write_text('# Empty, see ipy_user_conf.py\n')
3084 3095
3085 3096 # end Magic
@@ -1,6332 +1,6336 b''
1 1 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
2 2
3 * IPython/Magic.py (magic_prun): Fix saving of profile info for
4 Python 2.5, where the stats object API changed a little. Thanks
5 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
6
3 7 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
4 8 Pernetty's patch to improve support for (X)Emacs under Win32.
5 9
6 10 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
7 11
8 12 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
9 13 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
10 14 a report by Nik Tautenhahn.
11 15
12 16 2007-03-16 Walter Doerwald <walter@livinglogic.de>
13 17
14 18 * setup.py: Add the igrid help files to the list of data files
15 19 to be installed alongside igrid.
16 20 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
17 21 Show the input object of the igrid browser as the window tile.
18 22 Show the object the cursor is on in the statusbar.
19 23
20 24 2007-03-15 Ville Vainio <vivainio@gmail.com>
21 25
22 26 * Extensions/ipy_stock_completers.py: Fixed exception
23 27 on mismatching quotes in %run completer. Patch by
24 28 JοΏ½rgen Stenarson. Closes #127.
25 29
26 30 2007-03-14 Ville Vainio <vivainio@gmail.com>
27 31
28 32 * Extensions/ext_rehashdir.py: Do not do auto_alias
29 33 in %rehashdir, it clobbers %store'd aliases.
30 34
31 35 * UserConfig/ipy_profile_sh.py: envpersist.py extension
32 36 (beefed up %env) imported for sh profile.
33 37
34 38 2007-03-10 Walter Doerwald <walter@livinglogic.de>
35 39
36 40 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
37 41 as the default browser.
38 42 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
39 43 As igrid displays all attributes it ever encounters, fetch() (which has
40 44 been renamed to _fetch()) doesn't have to recalculate the display attributes
41 45 every time a new item is fetched. This should speed up scrolling.
42 46
43 47 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
44 48
45 49 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
46 50 Schmolck's recently reported tab-completion bug (my previous one
47 51 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
48 52
49 53 2007-03-09 Walter Doerwald <walter@livinglogic.de>
50 54
51 55 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
52 56 Close help window if exiting igrid.
53 57
54 58 2007-03-02 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
55 59
56 60 * IPython/Extensions/ipy_defaults.py: Check if readline is available
57 61 before calling functions from readline.
58 62
59 63 2007-03-02 Walter Doerwald <walter@livinglogic.de>
60 64
61 65 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
62 66 igrid is a wxPython-based display object for ipipe. If your system has
63 67 wx installed igrid will be the default display. Without wx ipipe falls
64 68 back to ibrowse (which needs curses). If no curses is installed ipipe
65 69 falls back to idump.
66 70
67 71 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
68 72
69 73 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
70 74 my changes from yesterday, they introduced bugs. Will reactivate
71 75 once I get a correct solution, which will be much easier thanks to
72 76 Dan Milstein's new prefilter test suite.
73 77
74 78 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
75 79
76 80 * IPython/iplib.py (split_user_input): fix input splitting so we
77 81 don't attempt attribute accesses on things that can't possibly be
78 82 valid Python attributes. After a bug report by Alex Schmolck.
79 83 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
80 84 %magic with explicit % prefix.
81 85
82 86 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
83 87
84 88 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
85 89 avoid a DeprecationWarning from GTK.
86 90
87 91 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
88 92
89 93 * IPython/genutils.py (clock): I modified clock() to return total
90 94 time, user+system. This is a more commonly needed metric. I also
91 95 introduced the new clocku/clocks to get only user/system time if
92 96 one wants those instead.
93 97
94 98 ***WARNING: API CHANGE*** clock() used to return only user time,
95 99 so if you want exactly the same results as before, use clocku
96 100 instead.
97 101
98 102 2007-02-22 Ville Vainio <vivainio@gmail.com>
99 103
100 104 * IPython/Extensions/ipy_p4.py: Extension for improved
101 105 p4 (perforce version control system) experience.
102 106 Adds %p4 magic with p4 command completion and
103 107 automatic -G argument (marshall output as python dict)
104 108
105 109 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
106 110
107 111 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
108 112 stop marks.
109 113 (ClearingMixin): a simple mixin to easily make a Demo class clear
110 114 the screen in between blocks and have empty marquees. The
111 115 ClearDemo and ClearIPDemo classes that use it are included.
112 116
113 117 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
114 118
115 119 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
116 120 protect against exceptions at Python shutdown time. Patch
117 121 sumbmitted to upstream.
118 122
119 123 2007-02-14 Walter Doerwald <walter@livinglogic.de>
120 124
121 125 * IPython/Extensions/ibrowse.py: If entering the first object level
122 126 (i.e. the object for which the browser has been started) fails,
123 127 now the error is raised directly (aborting the browser) instead of
124 128 running into an empty levels list later.
125 129
126 130 2007-02-03 Walter Doerwald <walter@livinglogic.de>
127 131
128 132 * IPython/Extensions/ipipe.py: Add an xrepr implementation
129 133 for the noitem object.
130 134
131 135 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
132 136
133 137 * IPython/completer.py (Completer.attr_matches): Fix small
134 138 tab-completion bug with Enthought Traits objects with units.
135 139 Thanks to a bug report by Tom Denniston
136 140 <tom.denniston-AT-alum.dartmouth.org>.
137 141
138 142 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
139 143
140 144 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
141 145 bug where only .ipy or .py would be completed. Once the first
142 146 argument to %run has been given, all completions are valid because
143 147 they are the arguments to the script, which may well be non-python
144 148 filenames.
145 149
146 150 * IPython/irunner.py (InteractiveRunner.run_source): major updates
147 151 to irunner to allow it to correctly support real doctesting of
148 152 out-of-process ipython code.
149 153
150 154 * IPython/Magic.py (magic_cd): Make the setting of the terminal
151 155 title an option (-noterm_title) because it completely breaks
152 156 doctesting.
153 157
154 158 * IPython/demo.py: fix IPythonDemo class that was not actually working.
155 159
156 160 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
157 161
158 162 * IPython/irunner.py (main): fix small bug where extensions were
159 163 not being correctly recognized.
160 164
161 165 2007-01-23 Walter Doerwald <walter@livinglogic.de>
162 166
163 167 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
164 168 a string containing a single line yields the string itself as the
165 169 only item.
166 170
167 171 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
168 172 object if it's the same as the one on the last level (This avoids
169 173 infinite recursion for one line strings).
170 174
171 175 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
172 176
173 177 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
174 178 all output streams before printing tracebacks. This ensures that
175 179 user output doesn't end up interleaved with traceback output.
176 180
177 181 2007-01-10 Ville Vainio <vivainio@gmail.com>
178 182
179 183 * Extensions/envpersist.py: Turbocharged %env that remembers
180 184 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
181 185 "%env VISUAL=jed".
182 186
183 187 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
184 188
185 189 * IPython/iplib.py (showtraceback): ensure that we correctly call
186 190 custom handlers in all cases (some with pdb were slipping through,
187 191 but I'm not exactly sure why).
188 192
189 193 * IPython/Debugger.py (Tracer.__init__): added new class to
190 194 support set_trace-like usage of IPython's enhanced debugger.
191 195
192 196 2006-12-24 Ville Vainio <vivainio@gmail.com>
193 197
194 198 * ipmaker.py: more informative message when ipy_user_conf
195 199 import fails (suggest running %upgrade).
196 200
197 201 * tools/run_ipy_in_profiler.py: Utility to see where
198 202 the time during IPython startup is spent.
199 203
200 204 2006-12-20 Ville Vainio <vivainio@gmail.com>
201 205
202 206 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
203 207
204 208 * ipapi.py: Add new ipapi method, expand_alias.
205 209
206 210 * Release.py: Bump up version to 0.7.4.svn
207 211
208 212 2006-12-17 Ville Vainio <vivainio@gmail.com>
209 213
210 214 * Extensions/jobctrl.py: Fixed &cmd arg arg...
211 215 to work properly on posix too
212 216
213 217 * Release.py: Update revnum (version is still just 0.7.3).
214 218
215 219 2006-12-15 Ville Vainio <vivainio@gmail.com>
216 220
217 221 * scripts/ipython_win_post_install: create ipython.py in
218 222 prefix + "/scripts".
219 223
220 224 * Release.py: Update version to 0.7.3.
221 225
222 226 2006-12-14 Ville Vainio <vivainio@gmail.com>
223 227
224 228 * scripts/ipython_win_post_install: Overwrite old shortcuts
225 229 if they already exist
226 230
227 231 * Release.py: release 0.7.3rc2
228 232
229 233 2006-12-13 Ville Vainio <vivainio@gmail.com>
230 234
231 235 * Branch and update Release.py for 0.7.3rc1
232 236
233 237 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
234 238
235 239 * IPython/Shell.py (IPShellWX): update for current WX naming
236 240 conventions, to avoid a deprecation warning with current WX
237 241 versions. Thanks to a report by Danny Shevitz.
238 242
239 243 2006-12-12 Ville Vainio <vivainio@gmail.com>
240 244
241 245 * ipmaker.py: apply david cournapeau's patch to make
242 246 import_some work properly even when ipythonrc does
243 247 import_some on empty list (it was an old bug!).
244 248
245 249 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
246 250 Add deprecation note to ipythonrc and a url to wiki
247 251 in ipy_user_conf.py
248 252
249 253
250 254 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
251 255 as if it was typed on IPython command prompt, i.e.
252 256 as IPython script.
253 257
254 258 * example-magic.py, magic_grepl.py: remove outdated examples
255 259
256 260 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
257 261
258 262 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
259 263 is called before any exception has occurred.
260 264
261 265 2006-12-08 Ville Vainio <vivainio@gmail.com>
262 266
263 267 * Extensions/ipy_stock_completers.py: fix cd completer
264 268 to translate /'s to \'s again.
265 269
266 270 * completer.py: prevent traceback on file completions w/
267 271 backslash.
268 272
269 273 * Release.py: Update release number to 0.7.3b3 for release
270 274
271 275 2006-12-07 Ville Vainio <vivainio@gmail.com>
272 276
273 277 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
274 278 while executing external code. Provides more shell-like behaviour
275 279 and overall better response to ctrl + C / ctrl + break.
276 280
277 281 * tools/make_tarball.py: new script to create tarball straight from svn
278 282 (setup.py sdist doesn't work on win32).
279 283
280 284 * Extensions/ipy_stock_completers.py: fix cd completer to give up
281 285 on dirnames with spaces and use the default completer instead.
282 286
283 287 * Revision.py: Change version to 0.7.3b2 for release.
284 288
285 289 2006-12-05 Ville Vainio <vivainio@gmail.com>
286 290
287 291 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
288 292 pydb patch 4 (rm debug printing, py 2.5 checking)
289 293
290 294 2006-11-30 Walter Doerwald <walter@livinglogic.de>
291 295 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
292 296 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
293 297 "refreshfind" (mapped to "R") does the same but tries to go back to the same
294 298 object the cursor was on before the refresh. The command "markrange" is
295 299 mapped to "%" now.
296 300 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
297 301
298 302 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
299 303
300 304 * IPython/Magic.py (magic_debug): new %debug magic to activate the
301 305 interactive debugger on the last traceback, without having to call
302 306 %pdb and rerun your code. Made minor changes in various modules,
303 307 should automatically recognize pydb if available.
304 308
305 309 2006-11-28 Ville Vainio <vivainio@gmail.com>
306 310
307 311 * completer.py: If the text start with !, show file completions
308 312 properly. This helps when trying to complete command name
309 313 for shell escapes.
310 314
311 315 2006-11-27 Ville Vainio <vivainio@gmail.com>
312 316
313 317 * ipy_stock_completers.py: bzr completer submitted by Stefan van
314 318 der Walt. Clean up svn and hg completers by using a common
315 319 vcs_completer.
316 320
317 321 2006-11-26 Ville Vainio <vivainio@gmail.com>
318 322
319 323 * Remove ipconfig and %config; you should use _ip.options structure
320 324 directly instead!
321 325
322 326 * genutils.py: add wrap_deprecated function for deprecating callables
323 327
324 328 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
325 329 _ip.system instead. ipalias is redundant.
326 330
327 331 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
328 332 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
329 333 explicit.
330 334
331 335 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
332 336 completer. Try it by entering 'hg ' and pressing tab.
333 337
334 338 * macro.py: Give Macro a useful __repr__ method
335 339
336 340 * Magic.py: %whos abbreviates the typename of Macro for brevity.
337 341
338 342 2006-11-24 Walter Doerwald <walter@livinglogic.de>
339 343 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
340 344 we don't get a duplicate ipipe module, where registration of the xrepr
341 345 implementation for Text is useless.
342 346
343 347 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
344 348
345 349 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
346 350
347 351 2006-11-24 Ville Vainio <vivainio@gmail.com>
348 352
349 353 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
350 354 try to use "cProfile" instead of the slower pure python
351 355 "profile"
352 356
353 357 2006-11-23 Ville Vainio <vivainio@gmail.com>
354 358
355 359 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
356 360 Qt+IPython+Designer link in documentation.
357 361
358 362 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
359 363 correct Pdb object to %pydb.
360 364
361 365
362 366 2006-11-22 Walter Doerwald <walter@livinglogic.de>
363 367 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
364 368 generic xrepr(), otherwise the list implementation would kick in.
365 369
366 370 2006-11-21 Ville Vainio <vivainio@gmail.com>
367 371
368 372 * upgrade_dir.py: Now actually overwrites a nonmodified user file
369 373 with one from UserConfig.
370 374
371 375 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
372 376 it was missing which broke the sh profile.
373 377
374 378 * completer.py: file completer now uses explicit '/' instead
375 379 of os.path.join, expansion of 'foo' was broken on win32
376 380 if there was one directory with name 'foobar'.
377 381
378 382 * A bunch of patches from Kirill Smelkov:
379 383
380 384 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
381 385
382 386 * [patch 7/9] Implement %page -r (page in raw mode) -
383 387
384 388 * [patch 5/9] ScientificPython webpage has moved
385 389
386 390 * [patch 4/9] The manual mentions %ds, should be %dhist
387 391
388 392 * [patch 3/9] Kill old bits from %prun doc.
389 393
390 394 * [patch 1/9] Fix typos here and there.
391 395
392 396 2006-11-08 Ville Vainio <vivainio@gmail.com>
393 397
394 398 * completer.py (attr_matches): catch all exceptions raised
395 399 by eval of expr with dots.
396 400
397 401 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
398 402
399 403 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
400 404 input if it starts with whitespace. This allows you to paste
401 405 indented input from any editor without manually having to type in
402 406 the 'if 1:', which is convenient when working interactively.
403 407 Slightly modifed version of a patch by Bo Peng
404 408 <bpeng-AT-rice.edu>.
405 409
406 410 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
407 411
408 412 * IPython/irunner.py (main): modified irunner so it automatically
409 413 recognizes the right runner to use based on the extension (.py for
410 414 python, .ipy for ipython and .sage for sage).
411 415
412 416 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
413 417 visible in ipapi as ip.config(), to programatically control the
414 418 internal rc object. There's an accompanying %config magic for
415 419 interactive use, which has been enhanced to match the
416 420 funtionality in ipconfig.
417 421
418 422 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
419 423 so it's not just a toggle, it now takes an argument. Add support
420 424 for a customizable header when making system calls, as the new
421 425 system_header variable in the ipythonrc file.
422 426
423 427 2006-11-03 Walter Doerwald <walter@livinglogic.de>
424 428
425 429 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
426 430 generic functions (using Philip J. Eby's simplegeneric package).
427 431 This makes it possible to customize the display of third-party classes
428 432 without having to monkeypatch them. xiter() no longer supports a mode
429 433 argument and the XMode class has been removed. The same functionality can
430 434 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
431 435 One consequence of the switch to generic functions is that xrepr() and
432 436 xattrs() implementation must define the default value for the mode
433 437 argument themselves and xattrs() implementations must return real
434 438 descriptors.
435 439
436 440 * IPython/external: This new subpackage will contain all third-party
437 441 packages that are bundled with IPython. (The first one is simplegeneric).
438 442
439 443 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
440 444 directory which as been dropped in r1703.
441 445
442 446 * IPython/Extensions/ipipe.py (iless): Fixed.
443 447
444 448 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
445 449
446 450 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
447 451
448 452 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
449 453 handling in variable expansion so that shells and magics recognize
450 454 function local scopes correctly. Bug reported by Brian.
451 455
452 456 * scripts/ipython: remove the very first entry in sys.path which
453 457 Python auto-inserts for scripts, so that sys.path under IPython is
454 458 as similar as possible to that under plain Python.
455 459
456 460 * IPython/completer.py (IPCompleter.file_matches): Fix
457 461 tab-completion so that quotes are not closed unless the completion
458 462 is unambiguous. After a request by Stefan. Minor cleanups in
459 463 ipy_stock_completers.
460 464
461 465 2006-11-02 Ville Vainio <vivainio@gmail.com>
462 466
463 467 * ipy_stock_completers.py: Add %run and %cd completers.
464 468
465 469 * completer.py: Try running custom completer for both
466 470 "foo" and "%foo" if the command is just "foo". Ignore case
467 471 when filtering possible completions.
468 472
469 473 * UserConfig/ipy_user_conf.py: install stock completers as default
470 474
471 475 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
472 476 simplified readline history save / restore through a wrapper
473 477 function
474 478
475 479
476 480 2006-10-31 Ville Vainio <vivainio@gmail.com>
477 481
478 482 * strdispatch.py, completer.py, ipy_stock_completers.py:
479 483 Allow str_key ("command") in completer hooks. Implement
480 484 trivial completer for 'import' (stdlib modules only). Rename
481 485 ipy_linux_package_managers.py to ipy_stock_completers.py.
482 486 SVN completer.
483 487
484 488 * Extensions/ledit.py: %magic line editor for easily and
485 489 incrementally manipulating lists of strings. The magic command
486 490 name is %led.
487 491
488 492 2006-10-30 Ville Vainio <vivainio@gmail.com>
489 493
490 494 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
491 495 Bernsteins's patches for pydb integration.
492 496 http://bashdb.sourceforge.net/pydb/
493 497
494 498 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
495 499 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
496 500 custom completer hook to allow the users to implement their own
497 501 completers. See ipy_linux_package_managers.py for example. The
498 502 hook name is 'complete_command'.
499 503
500 504 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
501 505
502 506 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
503 507 Numeric leftovers.
504 508
505 509 * ipython.el (py-execute-region): apply Stefan's patch to fix
506 510 garbled results if the python shell hasn't been previously started.
507 511
508 512 * IPython/genutils.py (arg_split): moved to genutils, since it's a
509 513 pretty generic function and useful for other things.
510 514
511 515 * IPython/OInspect.py (getsource): Add customizable source
512 516 extractor. After a request/patch form W. Stein (SAGE).
513 517
514 518 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
515 519 window size to a more reasonable value from what pexpect does,
516 520 since their choice causes wrapping bugs with long input lines.
517 521
518 522 2006-10-28 Ville Vainio <vivainio@gmail.com>
519 523
520 524 * Magic.py (%run): Save and restore the readline history from
521 525 file around %run commands to prevent side effects from
522 526 %runned programs that might use readline (e.g. pydb).
523 527
524 528 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
525 529 invoking the pydb enhanced debugger.
526 530
527 531 2006-10-23 Walter Doerwald <walter@livinglogic.de>
528 532
529 533 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
530 534 call the base class method and propagate the return value to
531 535 ifile. This is now done by path itself.
532 536
533 537 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
534 538
535 539 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
536 540 api: set_crash_handler(), to expose the ability to change the
537 541 internal crash handler.
538 542
539 543 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
540 544 the various parameters of the crash handler so that apps using
541 545 IPython as their engine can customize crash handling. Ipmlemented
542 546 at the request of SAGE.
543 547
544 548 2006-10-14 Ville Vainio <vivainio@gmail.com>
545 549
546 550 * Magic.py, ipython.el: applied first "safe" part of Rocky
547 551 Bernstein's patch set for pydb integration.
548 552
549 553 * Magic.py (%unalias, %alias): %store'd aliases can now be
550 554 removed with '%unalias'. %alias w/o args now shows most
551 555 interesting (stored / manually defined) aliases last
552 556 where they catch the eye w/o scrolling.
553 557
554 558 * Magic.py (%rehashx), ext_rehashdir.py: files with
555 559 'py' extension are always considered executable, even
556 560 when not in PATHEXT environment variable.
557 561
558 562 2006-10-12 Ville Vainio <vivainio@gmail.com>
559 563
560 564 * jobctrl.py: Add new "jobctrl" extension for spawning background
561 565 processes with "&find /". 'import jobctrl' to try it out. Requires
562 566 'subprocess' module, standard in python 2.4+.
563 567
564 568 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
565 569 so if foo -> bar and bar -> baz, then foo -> baz.
566 570
567 571 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
568 572
569 573 * IPython/Magic.py (Magic.parse_options): add a new posix option
570 574 to allow parsing of input args in magics that doesn't strip quotes
571 575 (if posix=False). This also closes %timeit bug reported by
572 576 Stefan.
573 577
574 578 2006-10-03 Ville Vainio <vivainio@gmail.com>
575 579
576 580 * iplib.py (raw_input, interact): Return ValueError catching for
577 581 raw_input. Fixes infinite loop for sys.stdin.close() or
578 582 sys.stdout.close().
579 583
580 584 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
581 585
582 586 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
583 587 to help in handling doctests. irunner is now pretty useful for
584 588 running standalone scripts and simulate a full interactive session
585 589 in a format that can be then pasted as a doctest.
586 590
587 591 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
588 592 on top of the default (useless) ones. This also fixes the nasty
589 593 way in which 2.5's Quitter() exits (reverted [1785]).
590 594
591 595 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
592 596 2.5.
593 597
594 598 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
595 599 color scheme is updated as well when color scheme is changed
596 600 interactively.
597 601
598 602 2006-09-27 Ville Vainio <vivainio@gmail.com>
599 603
600 604 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
601 605 infinite loop and just exit. It's a hack, but will do for a while.
602 606
603 607 2006-08-25 Walter Doerwald <walter@livinglogic.de>
604 608
605 609 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
606 610 the constructor, this makes it possible to get a list of only directories
607 611 or only files.
608 612
609 613 2006-08-12 Ville Vainio <vivainio@gmail.com>
610 614
611 615 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
612 616 they broke unittest
613 617
614 618 2006-08-11 Ville Vainio <vivainio@gmail.com>
615 619
616 620 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
617 621 by resolving issue properly, i.e. by inheriting FakeModule
618 622 from types.ModuleType. Pickling ipython interactive data
619 623 should still work as usual (testing appreciated).
620 624
621 625 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
622 626
623 627 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
624 628 running under python 2.3 with code from 2.4 to fix a bug with
625 629 help(). Reported by the Debian maintainers, Norbert Tretkowski
626 630 <norbert-AT-tretkowski.de> and Alexandre Fayolle
627 631 <afayolle-AT-debian.org>.
628 632
629 633 2006-08-04 Walter Doerwald <walter@livinglogic.de>
630 634
631 635 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
632 636 (which was displaying "quit" twice).
633 637
634 638 2006-07-28 Walter Doerwald <walter@livinglogic.de>
635 639
636 640 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
637 641 the mode argument).
638 642
639 643 2006-07-27 Walter Doerwald <walter@livinglogic.de>
640 644
641 645 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
642 646 not running under IPython.
643 647
644 648 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
645 649 and make it iterable (iterating over the attribute itself). Add two new
646 650 magic strings for __xattrs__(): If the string starts with "-", the attribute
647 651 will not be displayed in ibrowse's detail view (but it can still be
648 652 iterated over). This makes it possible to add attributes that are large
649 653 lists or generator methods to the detail view. Replace magic attribute names
650 654 and _attrname() and _getattr() with "descriptors": For each type of magic
651 655 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
652 656 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
653 657 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
654 658 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
655 659 are still supported.
656 660
657 661 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
658 662 fails in ibrowse.fetch(), the exception object is added as the last item
659 663 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
660 664 a generator throws an exception midway through execution.
661 665
662 666 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
663 667 encoding into methods.
664 668
665 669 2006-07-26 Ville Vainio <vivainio@gmail.com>
666 670
667 671 * iplib.py: history now stores multiline input as single
668 672 history entries. Patch by Jorgen Cederlof.
669 673
670 674 2006-07-18 Walter Doerwald <walter@livinglogic.de>
671 675
672 676 * IPython/Extensions/ibrowse.py: Make cursor visible over
673 677 non existing attributes.
674 678
675 679 2006-07-14 Walter Doerwald <walter@livinglogic.de>
676 680
677 681 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
678 682 error output of the running command doesn't mess up the screen.
679 683
680 684 2006-07-13 Walter Doerwald <walter@livinglogic.de>
681 685
682 686 * IPython/Extensions/ipipe.py (isort): Make isort usable without
683 687 argument. This sorts the items themselves.
684 688
685 689 2006-07-12 Walter Doerwald <walter@livinglogic.de>
686 690
687 691 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
688 692 Compile expression strings into code objects. This should speed
689 693 up ifilter and friends somewhat.
690 694
691 695 2006-07-08 Ville Vainio <vivainio@gmail.com>
692 696
693 697 * Magic.py: %cpaste now strips > from the beginning of lines
694 698 to ease pasting quoted code from emails. Contributed by
695 699 Stefan van der Walt.
696 700
697 701 2006-06-29 Ville Vainio <vivainio@gmail.com>
698 702
699 703 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
700 704 mode, patch contributed by Darren Dale. NEEDS TESTING!
701 705
702 706 2006-06-28 Walter Doerwald <walter@livinglogic.de>
703 707
704 708 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
705 709 a blue background. Fix fetching new display rows when the browser
706 710 scrolls more than a screenful (e.g. by using the goto command).
707 711
708 712 2006-06-27 Ville Vainio <vivainio@gmail.com>
709 713
710 714 * Magic.py (_inspect, _ofind) Apply David Huard's
711 715 patch for displaying the correct docstring for 'property'
712 716 attributes.
713 717
714 718 2006-06-23 Walter Doerwald <walter@livinglogic.de>
715 719
716 720 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
717 721 commands into the methods implementing them.
718 722
719 723 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
720 724
721 725 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
722 726 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
723 727 autoindent support was authored by Jin Liu.
724 728
725 729 2006-06-22 Walter Doerwald <walter@livinglogic.de>
726 730
727 731 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
728 732 for keymaps with a custom class that simplifies handling.
729 733
730 734 2006-06-19 Walter Doerwald <walter@livinglogic.de>
731 735
732 736 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
733 737 resizing. This requires Python 2.5 to work.
734 738
735 739 2006-06-16 Walter Doerwald <walter@livinglogic.de>
736 740
737 741 * IPython/Extensions/ibrowse.py: Add two new commands to
738 742 ibrowse: "hideattr" (mapped to "h") hides the attribute under
739 743 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
740 744 attributes again. Remapped the help command to "?". Display
741 745 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
742 746 as keys for the "home" and "end" commands. Add three new commands
743 747 to the input mode for "find" and friends: "delend" (CTRL-K)
744 748 deletes to the end of line. "incsearchup" searches upwards in the
745 749 command history for an input that starts with the text before the cursor.
746 750 "incsearchdown" does the same downwards. Removed a bogus mapping of
747 751 the x key to "delete".
748 752
749 753 2006-06-15 Ville Vainio <vivainio@gmail.com>
750 754
751 755 * iplib.py, hooks.py: Added new generate_prompt hook that can be
752 756 used to create prompts dynamically, instead of the "old" way of
753 757 assigning "magic" strings to prompt_in1 and prompt_in2. The old
754 758 way still works (it's invoked by the default hook), of course.
755 759
756 760 * Prompts.py: added generate_output_prompt hook for altering output
757 761 prompt
758 762
759 763 * Release.py: Changed version string to 0.7.3.svn.
760 764
761 765 2006-06-15 Walter Doerwald <walter@livinglogic.de>
762 766
763 767 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
764 768 the call to fetch() always tries to fetch enough data for at least one
765 769 full screen. This makes it possible to simply call moveto(0,0,True) in
766 770 the constructor. Fix typos and removed the obsolete goto attribute.
767 771
768 772 2006-06-12 Ville Vainio <vivainio@gmail.com>
769 773
770 774 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
771 775 allowing $variable interpolation within multiline statements,
772 776 though so far only with "sh" profile for a testing period.
773 777 The patch also enables splitting long commands with \ but it
774 778 doesn't work properly yet.
775 779
776 780 2006-06-12 Walter Doerwald <walter@livinglogic.de>
777 781
778 782 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
779 783 input history and the position of the cursor in the input history for
780 784 the find, findbackwards and goto command.
781 785
782 786 2006-06-10 Walter Doerwald <walter@livinglogic.de>
783 787
784 788 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
785 789 implements the basic functionality of browser commands that require
786 790 input. Reimplement the goto, find and findbackwards commands as
787 791 subclasses of _CommandInput. Add an input history and keymaps to those
788 792 commands. Add "\r" as a keyboard shortcut for the enterdefault and
789 793 execute commands.
790 794
791 795 2006-06-07 Ville Vainio <vivainio@gmail.com>
792 796
793 797 * iplib.py: ipython mybatch.ipy exits ipython immediately after
794 798 running the batch files instead of leaving the session open.
795 799
796 800 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
797 801
798 802 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
799 803 the original fix was incomplete. Patch submitted by W. Maier.
800 804
801 805 2006-06-07 Ville Vainio <vivainio@gmail.com>
802 806
803 807 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
804 808 Confirmation prompts can be supressed by 'quiet' option.
805 809 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
806 810
807 811 2006-06-06 *** Released version 0.7.2
808 812
809 813 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
810 814
811 815 * IPython/Release.py (version): Made 0.7.2 final for release.
812 816 Repo tagged and release cut.
813 817
814 818 2006-06-05 Ville Vainio <vivainio@gmail.com>
815 819
816 820 * Magic.py (magic_rehashx): Honor no_alias list earlier in
817 821 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
818 822
819 823 * upgrade_dir.py: try import 'path' module a bit harder
820 824 (for %upgrade)
821 825
822 826 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
823 827
824 828 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
825 829 instead of looping 20 times.
826 830
827 831 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
828 832 correctly at initialization time. Bug reported by Krishna Mohan
829 833 Gundu <gkmohan-AT-gmail.com> on the user list.
830 834
831 835 * IPython/Release.py (version): Mark 0.7.2 version to start
832 836 testing for release on 06/06.
833 837
834 838 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
835 839
836 840 * scripts/irunner: thin script interface so users don't have to
837 841 find the module and call it as an executable, since modules rarely
838 842 live in people's PATH.
839 843
840 844 * IPython/irunner.py (InteractiveRunner.__init__): added
841 845 delaybeforesend attribute to control delays with newer versions of
842 846 pexpect. Thanks to detailed help from pexpect's author, Noah
843 847 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
844 848 correctly (it works in NoColor mode).
845 849
846 850 * IPython/iplib.py (handle_normal): fix nasty crash reported on
847 851 SAGE list, from improper log() calls.
848 852
849 853 2006-05-31 Ville Vainio <vivainio@gmail.com>
850 854
851 855 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
852 856 with args in parens to work correctly with dirs that have spaces.
853 857
854 858 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
855 859
856 860 * IPython/Logger.py (Logger.logstart): add option to log raw input
857 861 instead of the processed one. A -r flag was added to the
858 862 %logstart magic used for controlling logging.
859 863
860 864 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
861 865
862 866 * IPython/iplib.py (InteractiveShell.__init__): add check for the
863 867 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
864 868 recognize the option. After a bug report by Will Maier. This
865 869 closes #64 (will do it after confirmation from W. Maier).
866 870
867 871 * IPython/irunner.py: New module to run scripts as if manually
868 872 typed into an interactive environment, based on pexpect. After a
869 873 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
870 874 ipython-user list. Simple unittests in the tests/ directory.
871 875
872 876 * tools/release: add Will Maier, OpenBSD port maintainer, to
873 877 recepients list. We are now officially part of the OpenBSD ports:
874 878 http://www.openbsd.org/ports.html ! Many thanks to Will for the
875 879 work.
876 880
877 881 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
878 882
879 883 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
880 884 so that it doesn't break tkinter apps.
881 885
882 886 * IPython/iplib.py (_prefilter): fix bug where aliases would
883 887 shadow variables when autocall was fully off. Reported by SAGE
884 888 author William Stein.
885 889
886 890 * IPython/OInspect.py (Inspector.__init__): add a flag to control
887 891 at what detail level strings are computed when foo? is requested.
888 892 This allows users to ask for example that the string form of an
889 893 object is only computed when foo?? is called, or even never, by
890 894 setting the object_info_string_level >= 2 in the configuration
891 895 file. This new option has been added and documented. After a
892 896 request by SAGE to be able to control the printing of very large
893 897 objects more easily.
894 898
895 899 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
896 900
897 901 * IPython/ipmaker.py (make_IPython): remove the ipython call path
898 902 from sys.argv, to be 100% consistent with how Python itself works
899 903 (as seen for example with python -i file.py). After a bug report
900 904 by Jeffrey Collins.
901 905
902 906 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
903 907 nasty bug which was preventing custom namespaces with -pylab,
904 908 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
905 909 compatibility (long gone from mpl).
906 910
907 911 * IPython/ipapi.py (make_session): name change: create->make. We
908 912 use make in other places (ipmaker,...), it's shorter and easier to
909 913 type and say, etc. I'm trying to clean things before 0.7.2 so
910 914 that I can keep things stable wrt to ipapi in the chainsaw branch.
911 915
912 916 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
913 917 python-mode recognizes our debugger mode. Add support for
914 918 autoindent inside (X)emacs. After a patch sent in by Jin Liu
915 919 <m.liu.jin-AT-gmail.com> originally written by
916 920 doxgen-AT-newsmth.net (with minor modifications for xemacs
917 921 compatibility)
918 922
919 923 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
920 924 tracebacks when walking the stack so that the stack tracking system
921 925 in emacs' python-mode can identify the frames correctly.
922 926
923 927 * IPython/ipmaker.py (make_IPython): make the internal (and
924 928 default config) autoedit_syntax value false by default. Too many
925 929 users have complained to me (both on and off-list) about problems
926 930 with this option being on by default, so I'm making it default to
927 931 off. It can still be enabled by anyone via the usual mechanisms.
928 932
929 933 * IPython/completer.py (Completer.attr_matches): add support for
930 934 PyCrust-style _getAttributeNames magic method. Patch contributed
931 935 by <mscott-AT-goldenspud.com>. Closes #50.
932 936
933 937 * IPython/iplib.py (InteractiveShell.__init__): remove the
934 938 deletion of exit/quit from __builtin__, which can break
935 939 third-party tools like the Zope debugging console. The
936 940 %exit/%quit magics remain. In general, it's probably a good idea
937 941 not to delete anything from __builtin__, since we never know what
938 942 that will break. In any case, python now (for 2.5) will support
939 943 'real' exit/quit, so this issue is moot. Closes #55.
940 944
941 945 * IPython/genutils.py (with_obj): rename the 'with' function to
942 946 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
943 947 becomes a language keyword. Closes #53.
944 948
945 949 * IPython/FakeModule.py (FakeModule.__init__): add a proper
946 950 __file__ attribute to this so it fools more things into thinking
947 951 it is a real module. Closes #59.
948 952
949 953 * IPython/Magic.py (magic_edit): add -n option to open the editor
950 954 at a specific line number. After a patch by Stefan van der Walt.
951 955
952 956 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
953 957
954 958 * IPython/iplib.py (edit_syntax_error): fix crash when for some
955 959 reason the file could not be opened. After automatic crash
956 960 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
957 961 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
958 962 (_should_recompile): Don't fire editor if using %bg, since there
959 963 is no file in the first place. From the same report as above.
960 964 (raw_input): protect against faulty third-party prefilters. After
961 965 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
962 966 while running under SAGE.
963 967
964 968 2006-05-23 Ville Vainio <vivainio@gmail.com>
965 969
966 970 * ipapi.py: Stripped down ip.to_user_ns() to work only as
967 971 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
968 972 now returns None (again), unless dummy is specifically allowed by
969 973 ipapi.get(allow_dummy=True).
970 974
971 975 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
972 976
973 977 * IPython: remove all 2.2-compatibility objects and hacks from
974 978 everywhere, since we only support 2.3 at this point. Docs
975 979 updated.
976 980
977 981 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
978 982 Anything requiring extra validation can be turned into a Python
979 983 property in the future. I used a property for the db one b/c
980 984 there was a nasty circularity problem with the initialization
981 985 order, which right now I don't have time to clean up.
982 986
983 987 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
984 988 another locking bug reported by Jorgen. I'm not 100% sure though,
985 989 so more testing is needed...
986 990
987 991 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
988 992
989 993 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
990 994 local variables from any routine in user code (typically executed
991 995 with %run) directly into the interactive namespace. Very useful
992 996 when doing complex debugging.
993 997 (IPythonNotRunning): Changed the default None object to a dummy
994 998 whose attributes can be queried as well as called without
995 999 exploding, to ease writing code which works transparently both in
996 1000 and out of ipython and uses some of this API.
997 1001
998 1002 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
999 1003
1000 1004 * IPython/hooks.py (result_display): Fix the fact that our display
1001 1005 hook was using str() instead of repr(), as the default python
1002 1006 console does. This had gone unnoticed b/c it only happened if
1003 1007 %Pprint was off, but the inconsistency was there.
1004 1008
1005 1009 2006-05-15 Ville Vainio <vivainio@gmail.com>
1006 1010
1007 1011 * Oinspect.py: Only show docstring for nonexisting/binary files
1008 1012 when doing object??, closing ticket #62
1009 1013
1010 1014 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
1011 1015
1012 1016 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
1013 1017 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
1014 1018 was being released in a routine which hadn't checked if it had
1015 1019 been the one to acquire it.
1016 1020
1017 1021 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
1018 1022
1019 1023 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
1020 1024
1021 1025 2006-04-11 Ville Vainio <vivainio@gmail.com>
1022 1026
1023 1027 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
1024 1028 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
1025 1029 prefilters, allowing stuff like magics and aliases in the file.
1026 1030
1027 1031 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
1028 1032 added. Supported now are "%clear in" and "%clear out" (clear input and
1029 1033 output history, respectively). Also fixed CachedOutput.flush to
1030 1034 properly flush the output cache.
1031 1035
1032 1036 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
1033 1037 half-success (and fail explicitly).
1034 1038
1035 1039 2006-03-28 Ville Vainio <vivainio@gmail.com>
1036 1040
1037 1041 * iplib.py: Fix quoting of aliases so that only argless ones
1038 1042 are quoted
1039 1043
1040 1044 2006-03-28 Ville Vainio <vivainio@gmail.com>
1041 1045
1042 1046 * iplib.py: Quote aliases with spaces in the name.
1043 1047 "c:\program files\blah\bin" is now legal alias target.
1044 1048
1045 1049 * ext_rehashdir.py: Space no longer allowed as arg
1046 1050 separator, since space is legal in path names.
1047 1051
1048 1052 2006-03-16 Ville Vainio <vivainio@gmail.com>
1049 1053
1050 1054 * upgrade_dir.py: Take path.py from Extensions, correcting
1051 1055 %upgrade magic
1052 1056
1053 1057 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
1054 1058
1055 1059 * hooks.py: Only enclose editor binary in quotes if legal and
1056 1060 necessary (space in the name, and is an existing file). Fixes a bug
1057 1061 reported by Zachary Pincus.
1058 1062
1059 1063 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
1060 1064
1061 1065 * Manual: thanks to a tip on proper color handling for Emacs, by
1062 1066 Eric J Haywiser <ejh1-AT-MIT.EDU>.
1063 1067
1064 1068 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
1065 1069 by applying the provided patch. Thanks to Liu Jin
1066 1070 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
1067 1071 XEmacs/Linux, I'm trusting the submitter that it actually helps
1068 1072 under win32/GNU Emacs. Will revisit if any problems are reported.
1069 1073
1070 1074 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1071 1075
1072 1076 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
1073 1077 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
1074 1078
1075 1079 2006-03-12 Ville Vainio <vivainio@gmail.com>
1076 1080
1077 1081 * Magic.py (magic_timeit): Added %timeit magic, contributed by
1078 1082 Torsten Marek.
1079 1083
1080 1084 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1081 1085
1082 1086 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
1083 1087 line ranges works again.
1084 1088
1085 1089 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
1086 1090
1087 1091 * IPython/iplib.py (showtraceback): add back sys.last_traceback
1088 1092 and friends, after a discussion with Zach Pincus on ipython-user.
1089 1093 I'm not 100% sure, but after thinking about it quite a bit, it may
1090 1094 be OK. Testing with the multithreaded shells didn't reveal any
1091 1095 problems, but let's keep an eye out.
1092 1096
1093 1097 In the process, I fixed a few things which were calling
1094 1098 self.InteractiveTB() directly (like safe_execfile), which is a
1095 1099 mistake: ALL exception reporting should be done by calling
1096 1100 self.showtraceback(), which handles state and tab-completion and
1097 1101 more.
1098 1102
1099 1103 2006-03-01 Ville Vainio <vivainio@gmail.com>
1100 1104
1101 1105 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
1102 1106 To use, do "from ipipe import *".
1103 1107
1104 1108 2006-02-24 Ville Vainio <vivainio@gmail.com>
1105 1109
1106 1110 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
1107 1111 "cleanly" and safely than the older upgrade mechanism.
1108 1112
1109 1113 2006-02-21 Ville Vainio <vivainio@gmail.com>
1110 1114
1111 1115 * Magic.py: %save works again.
1112 1116
1113 1117 2006-02-15 Ville Vainio <vivainio@gmail.com>
1114 1118
1115 1119 * Magic.py: %Pprint works again
1116 1120
1117 1121 * Extensions/ipy_sane_defaults.py: Provide everything provided
1118 1122 in default ipythonrc, to make it possible to have a completely empty
1119 1123 ipythonrc (and thus completely rc-file free configuration)
1120 1124
1121 1125 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
1122 1126
1123 1127 * IPython/hooks.py (editor): quote the call to the editor command,
1124 1128 to allow commands with spaces in them. Problem noted by watching
1125 1129 Ian Oswald's video about textpad under win32 at
1126 1130 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
1127 1131
1128 1132 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
1129 1133 describing magics (we haven't used @ for a loong time).
1130 1134
1131 1135 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
1132 1136 contributed by marienz to close
1133 1137 http://www.scipy.net/roundup/ipython/issue53.
1134 1138
1135 1139 2006-02-10 Ville Vainio <vivainio@gmail.com>
1136 1140
1137 1141 * genutils.py: getoutput now works in win32 too
1138 1142
1139 1143 * completer.py: alias and magic completion only invoked
1140 1144 at the first "item" in the line, to avoid "cd %store"
1141 1145 nonsense.
1142 1146
1143 1147 2006-02-09 Ville Vainio <vivainio@gmail.com>
1144 1148
1145 1149 * test/*: Added a unit testing framework (finally).
1146 1150 '%run runtests.py' to run test_*.
1147 1151
1148 1152 * ipapi.py: Exposed runlines and set_custom_exc
1149 1153
1150 1154 2006-02-07 Ville Vainio <vivainio@gmail.com>
1151 1155
1152 1156 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
1153 1157 instead use "f(1 2)" as before.
1154 1158
1155 1159 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
1156 1160
1157 1161 * IPython/demo.py (IPythonDemo): Add new classes to the demo
1158 1162 facilities, for demos processed by the IPython input filter
1159 1163 (IPythonDemo), and for running a script one-line-at-a-time as a
1160 1164 demo, both for pure Python (LineDemo) and for IPython-processed
1161 1165 input (IPythonLineDemo). After a request by Dave Kohel, from the
1162 1166 SAGE team.
1163 1167 (Demo.edit): added an edit() method to the demo objects, to edit
1164 1168 the in-memory copy of the last executed block.
1165 1169
1166 1170 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
1167 1171 processing to %edit, %macro and %save. These commands can now be
1168 1172 invoked on the unprocessed input as it was typed by the user
1169 1173 (without any prefilters applied). After requests by the SAGE team
1170 1174 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1171 1175
1172 1176 2006-02-01 Ville Vainio <vivainio@gmail.com>
1173 1177
1174 1178 * setup.py, eggsetup.py: easy_install ipython==dev works
1175 1179 correctly now (on Linux)
1176 1180
1177 1181 * ipy_user_conf,ipmaker: user config changes, removed spurious
1178 1182 warnings
1179 1183
1180 1184 * iplib: if rc.banner is string, use it as is.
1181 1185
1182 1186 * Magic: %pycat accepts a string argument and pages it's contents.
1183 1187
1184 1188
1185 1189 2006-01-30 Ville Vainio <vivainio@gmail.com>
1186 1190
1187 1191 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1188 1192 Now %store and bookmarks work through PickleShare, meaning that
1189 1193 concurrent access is possible and all ipython sessions see the
1190 1194 same database situation all the time, instead of snapshot of
1191 1195 the situation when the session was started. Hence, %bookmark
1192 1196 results are immediately accessible from othes sessions. The database
1193 1197 is also available for use by user extensions. See:
1194 1198 http://www.python.org/pypi/pickleshare
1195 1199
1196 1200 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1197 1201
1198 1202 * aliases can now be %store'd
1199 1203
1200 1204 * path.py moved to Extensions so that pickleshare does not need
1201 1205 IPython-specific import. Extensions added to pythonpath right
1202 1206 at __init__.
1203 1207
1204 1208 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1205 1209 called with _ip.system and the pre-transformed command string.
1206 1210
1207 1211 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1208 1212
1209 1213 * IPython/iplib.py (interact): Fix that we were not catching
1210 1214 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1211 1215 logic here had to change, but it's fixed now.
1212 1216
1213 1217 2006-01-29 Ville Vainio <vivainio@gmail.com>
1214 1218
1215 1219 * iplib.py: Try to import pyreadline on Windows.
1216 1220
1217 1221 2006-01-27 Ville Vainio <vivainio@gmail.com>
1218 1222
1219 1223 * iplib.py: Expose ipapi as _ip in builtin namespace.
1220 1224 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1221 1225 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1222 1226 syntax now produce _ip.* variant of the commands.
1223 1227
1224 1228 * "_ip.options().autoedit_syntax = 2" automatically throws
1225 1229 user to editor for syntax error correction without prompting.
1226 1230
1227 1231 2006-01-27 Ville Vainio <vivainio@gmail.com>
1228 1232
1229 1233 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1230 1234 'ipython' at argv[0]) executed through command line.
1231 1235 NOTE: this DEPRECATES calling ipython with multiple scripts
1232 1236 ("ipython a.py b.py c.py")
1233 1237
1234 1238 * iplib.py, hooks.py: Added configurable input prefilter,
1235 1239 named 'input_prefilter'. See ext_rescapture.py for example
1236 1240 usage.
1237 1241
1238 1242 * ext_rescapture.py, Magic.py: Better system command output capture
1239 1243 through 'var = !ls' (deprecates user-visible %sc). Same notation
1240 1244 applies for magics, 'var = %alias' assigns alias list to var.
1241 1245
1242 1246 * ipapi.py: added meta() for accessing extension-usable data store.
1243 1247
1244 1248 * iplib.py: added InteractiveShell.getapi(). New magics should be
1245 1249 written doing self.getapi() instead of using the shell directly.
1246 1250
1247 1251 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
1248 1252 %store foo >> ~/myfoo.txt to store variables to files (in clean
1249 1253 textual form, not a restorable pickle).
1250 1254
1251 1255 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
1252 1256
1253 1257 * usage.py, Magic.py: added %quickref
1254 1258
1255 1259 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
1256 1260
1257 1261 * GetoptErrors when invoking magics etc. with wrong args
1258 1262 are now more helpful:
1259 1263 GetoptError: option -l not recognized (allowed: "qb" )
1260 1264
1261 1265 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
1262 1266
1263 1267 * IPython/demo.py (Demo.show): Flush stdout after each block, so
1264 1268 computationally intensive blocks don't appear to stall the demo.
1265 1269
1266 1270 2006-01-24 Ville Vainio <vivainio@gmail.com>
1267 1271
1268 1272 * iplib.py, hooks.py: 'result_display' hook can return a non-None
1269 1273 value to manipulate resulting history entry.
1270 1274
1271 1275 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
1272 1276 to instance methods of IPApi class, to make extending an embedded
1273 1277 IPython feasible. See ext_rehashdir.py for example usage.
1274 1278
1275 1279 * Merged 1071-1076 from branches/0.7.1
1276 1280
1277 1281
1278 1282 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
1279 1283
1280 1284 * tools/release (daystamp): Fix build tools to use the new
1281 1285 eggsetup.py script to build lightweight eggs.
1282 1286
1283 1287 * Applied changesets 1062 and 1064 before 0.7.1 release.
1284 1288
1285 1289 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
1286 1290 see the raw input history (without conversions like %ls ->
1287 1291 ipmagic("ls")). After a request from W. Stein, SAGE
1288 1292 (http://modular.ucsd.edu/sage) developer. This information is
1289 1293 stored in the input_hist_raw attribute of the IPython instance, so
1290 1294 developers can access it if needed (it's an InputList instance).
1291 1295
1292 1296 * Versionstring = 0.7.2.svn
1293 1297
1294 1298 * eggsetup.py: A separate script for constructing eggs, creates
1295 1299 proper launch scripts even on Windows (an .exe file in
1296 1300 \python24\scripts).
1297 1301
1298 1302 * ipapi.py: launch_new_instance, launch entry point needed for the
1299 1303 egg.
1300 1304
1301 1305 2006-01-23 Ville Vainio <vivainio@gmail.com>
1302 1306
1303 1307 * Added %cpaste magic for pasting python code
1304 1308
1305 1309 2006-01-22 Ville Vainio <vivainio@gmail.com>
1306 1310
1307 1311 * Merge from branches/0.7.1 into trunk, revs 1052-1057
1308 1312
1309 1313 * Versionstring = 0.7.2.svn
1310 1314
1311 1315 * eggsetup.py: A separate script for constructing eggs, creates
1312 1316 proper launch scripts even on Windows (an .exe file in
1313 1317 \python24\scripts).
1314 1318
1315 1319 * ipapi.py: launch_new_instance, launch entry point needed for the
1316 1320 egg.
1317 1321
1318 1322 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1319 1323
1320 1324 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1321 1325 %pfile foo would print the file for foo even if it was a binary.
1322 1326 Now, extensions '.so' and '.dll' are skipped.
1323 1327
1324 1328 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1325 1329 bug, where macros would fail in all threaded modes. I'm not 100%
1326 1330 sure, so I'm going to put out an rc instead of making a release
1327 1331 today, and wait for feedback for at least a few days.
1328 1332
1329 1333 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1330 1334 it...) the handling of pasting external code with autoindent on.
1331 1335 To get out of a multiline input, the rule will appear for most
1332 1336 users unchanged: two blank lines or change the indent level
1333 1337 proposed by IPython. But there is a twist now: you can
1334 1338 add/subtract only *one or two spaces*. If you add/subtract three
1335 1339 or more (unless you completely delete the line), IPython will
1336 1340 accept that line, and you'll need to enter a second one of pure
1337 1341 whitespace. I know it sounds complicated, but I can't find a
1338 1342 different solution that covers all the cases, with the right
1339 1343 heuristics. Hopefully in actual use, nobody will really notice
1340 1344 all these strange rules and things will 'just work'.
1341 1345
1342 1346 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1343 1347
1344 1348 * IPython/iplib.py (interact): catch exceptions which can be
1345 1349 triggered asynchronously by signal handlers. Thanks to an
1346 1350 automatic crash report, submitted by Colin Kingsley
1347 1351 <tercel-AT-gentoo.org>.
1348 1352
1349 1353 2006-01-20 Ville Vainio <vivainio@gmail.com>
1350 1354
1351 1355 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1352 1356 (%rehashdir, very useful, try it out) of how to extend ipython
1353 1357 with new magics. Also added Extensions dir to pythonpath to make
1354 1358 importing extensions easy.
1355 1359
1356 1360 * %store now complains when trying to store interactively declared
1357 1361 classes / instances of those classes.
1358 1362
1359 1363 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1360 1364 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1361 1365 if they exist, and ipy_user_conf.py with some defaults is created for
1362 1366 the user.
1363 1367
1364 1368 * Startup rehashing done by the config file, not InterpreterExec.
1365 1369 This means system commands are available even without selecting the
1366 1370 pysh profile. It's the sensible default after all.
1367 1371
1368 1372 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
1369 1373
1370 1374 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
1371 1375 multiline code with autoindent on working. But I am really not
1372 1376 sure, so this needs more testing. Will commit a debug-enabled
1373 1377 version for now, while I test it some more, so that Ville and
1374 1378 others may also catch any problems. Also made
1375 1379 self.indent_current_str() a method, to ensure that there's no
1376 1380 chance of the indent space count and the corresponding string
1377 1381 falling out of sync. All code needing the string should just call
1378 1382 the method.
1379 1383
1380 1384 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
1381 1385
1382 1386 * IPython/Magic.py (magic_edit): fix check for when users don't
1383 1387 save their output files, the try/except was in the wrong section.
1384 1388
1385 1389 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1386 1390
1387 1391 * IPython/Magic.py (magic_run): fix __file__ global missing from
1388 1392 script's namespace when executed via %run. After a report by
1389 1393 Vivian.
1390 1394
1391 1395 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
1392 1396 when using python 2.4. The parent constructor changed in 2.4, and
1393 1397 we need to track it directly (we can't call it, as it messes up
1394 1398 readline and tab-completion inside our pdb would stop working).
1395 1399 After a bug report by R. Bernstein <rocky-AT-panix.com>.
1396 1400
1397 1401 2006-01-16 Ville Vainio <vivainio@gmail.com>
1398 1402
1399 1403 * Ipython/magic.py: Reverted back to old %edit functionality
1400 1404 that returns file contents on exit.
1401 1405
1402 1406 * IPython/path.py: Added Jason Orendorff's "path" module to
1403 1407 IPython tree, http://www.jorendorff.com/articles/python/path/.
1404 1408 You can get path objects conveniently through %sc, and !!, e.g.:
1405 1409 sc files=ls
1406 1410 for p in files.paths: # or files.p
1407 1411 print p,p.mtime
1408 1412
1409 1413 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
1410 1414 now work again without considering the exclusion regexp -
1411 1415 hence, things like ',foo my/path' turn to 'foo("my/path")'
1412 1416 instead of syntax error.
1413 1417
1414 1418
1415 1419 2006-01-14 Ville Vainio <vivainio@gmail.com>
1416 1420
1417 1421 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
1418 1422 ipapi decorators for python 2.4 users, options() provides access to rc
1419 1423 data.
1420 1424
1421 1425 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
1422 1426 as path separators (even on Linux ;-). Space character after
1423 1427 backslash (as yielded by tab completer) is still space;
1424 1428 "%cd long\ name" works as expected.
1425 1429
1426 1430 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
1427 1431 as "chain of command", with priority. API stays the same,
1428 1432 TryNext exception raised by a hook function signals that
1429 1433 current hook failed and next hook should try handling it, as
1430 1434 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
1431 1435 requested configurable display hook, which is now implemented.
1432 1436
1433 1437 2006-01-13 Ville Vainio <vivainio@gmail.com>
1434 1438
1435 1439 * IPython/platutils*.py: platform specific utility functions,
1436 1440 so far only set_term_title is implemented (change terminal
1437 1441 label in windowing systems). %cd now changes the title to
1438 1442 current dir.
1439 1443
1440 1444 * IPython/Release.py: Added myself to "authors" list,
1441 1445 had to create new files.
1442 1446
1443 1447 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
1444 1448 shell escape; not a known bug but had potential to be one in the
1445 1449 future.
1446 1450
1447 1451 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
1448 1452 extension API for IPython! See the module for usage example. Fix
1449 1453 OInspect for docstring-less magic functions.
1450 1454
1451 1455
1452 1456 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
1453 1457
1454 1458 * IPython/iplib.py (raw_input): temporarily deactivate all
1455 1459 attempts at allowing pasting of code with autoindent on. It
1456 1460 introduced bugs (reported by Prabhu) and I can't seem to find a
1457 1461 robust combination which works in all cases. Will have to revisit
1458 1462 later.
1459 1463
1460 1464 * IPython/genutils.py: remove isspace() function. We've dropped
1461 1465 2.2 compatibility, so it's OK to use the string method.
1462 1466
1463 1467 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1464 1468
1465 1469 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
1466 1470 matching what NOT to autocall on, to include all python binary
1467 1471 operators (including things like 'and', 'or', 'is' and 'in').
1468 1472 Prompted by a bug report on 'foo & bar', but I realized we had
1469 1473 many more potential bug cases with other operators. The regexp is
1470 1474 self.re_exclude_auto, it's fairly commented.
1471 1475
1472 1476 2006-01-12 Ville Vainio <vivainio@gmail.com>
1473 1477
1474 1478 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
1475 1479 Prettified and hardened string/backslash quoting with ipsystem(),
1476 1480 ipalias() and ipmagic(). Now even \ characters are passed to
1477 1481 %magics, !shell escapes and aliases exactly as they are in the
1478 1482 ipython command line. Should improve backslash experience,
1479 1483 particularly in Windows (path delimiter for some commands that
1480 1484 won't understand '/'), but Unix benefits as well (regexps). %cd
1481 1485 magic still doesn't support backslash path delimiters, though. Also
1482 1486 deleted all pretense of supporting multiline command strings in
1483 1487 !system or %magic commands. Thanks to Jerry McRae for suggestions.
1484 1488
1485 1489 * doc/build_doc_instructions.txt added. Documentation on how to
1486 1490 use doc/update_manual.py, added yesterday. Both files contributed
1487 1491 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1488 1492 doc/*.sh for deprecation at a later date.
1489 1493
1490 1494 * /ipython.py Added ipython.py to root directory for
1491 1495 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1492 1496 ipython.py) and development convenience (no need to keep doing
1493 1497 "setup.py install" between changes).
1494 1498
1495 1499 * Made ! and !! shell escapes work (again) in multiline expressions:
1496 1500 if 1:
1497 1501 !ls
1498 1502 !!ls
1499 1503
1500 1504 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1501 1505
1502 1506 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1503 1507 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1504 1508 module in case-insensitive installation. Was causing crashes
1505 1509 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1506 1510
1507 1511 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1508 1512 <marienz-AT-gentoo.org>, closes
1509 1513 http://www.scipy.net/roundup/ipython/issue51.
1510 1514
1511 1515 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1512 1516
1513 1517 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1514 1518 problem of excessive CPU usage under *nix and keyboard lag under
1515 1519 win32.
1516 1520
1517 1521 2006-01-10 *** Released version 0.7.0
1518 1522
1519 1523 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1520 1524
1521 1525 * IPython/Release.py (revision): tag version number to 0.7.0,
1522 1526 ready for release.
1523 1527
1524 1528 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1525 1529 it informs the user of the name of the temp. file used. This can
1526 1530 help if you decide later to reuse that same file, so you know
1527 1531 where to copy the info from.
1528 1532
1529 1533 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1530 1534
1531 1535 * setup_bdist_egg.py: little script to build an egg. Added
1532 1536 support in the release tools as well.
1533 1537
1534 1538 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1535 1539
1536 1540 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1537 1541 version selection (new -wxversion command line and ipythonrc
1538 1542 parameter). Patch contributed by Arnd Baecker
1539 1543 <arnd.baecker-AT-web.de>.
1540 1544
1541 1545 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1542 1546 embedded instances, for variables defined at the interactive
1543 1547 prompt of the embedded ipython. Reported by Arnd.
1544 1548
1545 1549 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1546 1550 it can be used as a (stateful) toggle, or with a direct parameter.
1547 1551
1548 1552 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1549 1553 could be triggered in certain cases and cause the traceback
1550 1554 printer not to work.
1551 1555
1552 1556 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1553 1557
1554 1558 * IPython/iplib.py (_should_recompile): Small fix, closes
1555 1559 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1556 1560
1557 1561 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1558 1562
1559 1563 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1560 1564 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1561 1565 Moad for help with tracking it down.
1562 1566
1563 1567 * IPython/iplib.py (handle_auto): fix autocall handling for
1564 1568 objects which support BOTH __getitem__ and __call__ (so that f [x]
1565 1569 is left alone, instead of becoming f([x]) automatically).
1566 1570
1567 1571 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1568 1572 Ville's patch.
1569 1573
1570 1574 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1571 1575
1572 1576 * IPython/iplib.py (handle_auto): changed autocall semantics to
1573 1577 include 'smart' mode, where the autocall transformation is NOT
1574 1578 applied if there are no arguments on the line. This allows you to
1575 1579 just type 'foo' if foo is a callable to see its internal form,
1576 1580 instead of having it called with no arguments (typically a
1577 1581 mistake). The old 'full' autocall still exists: for that, you
1578 1582 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1579 1583
1580 1584 * IPython/completer.py (Completer.attr_matches): add
1581 1585 tab-completion support for Enthoughts' traits. After a report by
1582 1586 Arnd and a patch by Prabhu.
1583 1587
1584 1588 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1585 1589
1586 1590 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1587 1591 Schmolck's patch to fix inspect.getinnerframes().
1588 1592
1589 1593 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1590 1594 for embedded instances, regarding handling of namespaces and items
1591 1595 added to the __builtin__ one. Multiple embedded instances and
1592 1596 recursive embeddings should work better now (though I'm not sure
1593 1597 I've got all the corner cases fixed, that code is a bit of a brain
1594 1598 twister).
1595 1599
1596 1600 * IPython/Magic.py (magic_edit): added support to edit in-memory
1597 1601 macros (automatically creates the necessary temp files). %edit
1598 1602 also doesn't return the file contents anymore, it's just noise.
1599 1603
1600 1604 * IPython/completer.py (Completer.attr_matches): revert change to
1601 1605 complete only on attributes listed in __all__. I realized it
1602 1606 cripples the tab-completion system as a tool for exploring the
1603 1607 internals of unknown libraries (it renders any non-__all__
1604 1608 attribute off-limits). I got bit by this when trying to see
1605 1609 something inside the dis module.
1606 1610
1607 1611 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1608 1612
1609 1613 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1610 1614 namespace for users and extension writers to hold data in. This
1611 1615 follows the discussion in
1612 1616 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1613 1617
1614 1618 * IPython/completer.py (IPCompleter.complete): small patch to help
1615 1619 tab-completion under Emacs, after a suggestion by John Barnard
1616 1620 <barnarj-AT-ccf.org>.
1617 1621
1618 1622 * IPython/Magic.py (Magic.extract_input_slices): added support for
1619 1623 the slice notation in magics to use N-M to represent numbers N...M
1620 1624 (closed endpoints). This is used by %macro and %save.
1621 1625
1622 1626 * IPython/completer.py (Completer.attr_matches): for modules which
1623 1627 define __all__, complete only on those. After a patch by Jeffrey
1624 1628 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1625 1629 speed up this routine.
1626 1630
1627 1631 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1628 1632 don't know if this is the end of it, but the behavior now is
1629 1633 certainly much more correct. Note that coupled with macros,
1630 1634 slightly surprising (at first) behavior may occur: a macro will in
1631 1635 general expand to multiple lines of input, so upon exiting, the
1632 1636 in/out counters will both be bumped by the corresponding amount
1633 1637 (as if the macro's contents had been typed interactively). Typing
1634 1638 %hist will reveal the intermediate (silently processed) lines.
1635 1639
1636 1640 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1637 1641 pickle to fail (%run was overwriting __main__ and not restoring
1638 1642 it, but pickle relies on __main__ to operate).
1639 1643
1640 1644 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1641 1645 using properties, but forgot to make the main InteractiveShell
1642 1646 class a new-style class. Properties fail silently, and
1643 1647 mysteriously, with old-style class (getters work, but
1644 1648 setters don't do anything).
1645 1649
1646 1650 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1647 1651
1648 1652 * IPython/Magic.py (magic_history): fix history reporting bug (I
1649 1653 know some nasties are still there, I just can't seem to find a
1650 1654 reproducible test case to track them down; the input history is
1651 1655 falling out of sync...)
1652 1656
1653 1657 * IPython/iplib.py (handle_shell_escape): fix bug where both
1654 1658 aliases and system accesses where broken for indented code (such
1655 1659 as loops).
1656 1660
1657 1661 * IPython/genutils.py (shell): fix small but critical bug for
1658 1662 win32 system access.
1659 1663
1660 1664 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1661 1665
1662 1666 * IPython/iplib.py (showtraceback): remove use of the
1663 1667 sys.last_{type/value/traceback} structures, which are non
1664 1668 thread-safe.
1665 1669 (_prefilter): change control flow to ensure that we NEVER
1666 1670 introspect objects when autocall is off. This will guarantee that
1667 1671 having an input line of the form 'x.y', where access to attribute
1668 1672 'y' has side effects, doesn't trigger the side effect TWICE. It
1669 1673 is important to note that, with autocall on, these side effects
1670 1674 can still happen.
1671 1675 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1672 1676 trio. IPython offers these three kinds of special calls which are
1673 1677 not python code, and it's a good thing to have their call method
1674 1678 be accessible as pure python functions (not just special syntax at
1675 1679 the command line). It gives us a better internal implementation
1676 1680 structure, as well as exposing these for user scripting more
1677 1681 cleanly.
1678 1682
1679 1683 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1680 1684 file. Now that they'll be more likely to be used with the
1681 1685 persistance system (%store), I want to make sure their module path
1682 1686 doesn't change in the future, so that we don't break things for
1683 1687 users' persisted data.
1684 1688
1685 1689 * IPython/iplib.py (autoindent_update): move indentation
1686 1690 management into the _text_ processing loop, not the keyboard
1687 1691 interactive one. This is necessary to correctly process non-typed
1688 1692 multiline input (such as macros).
1689 1693
1690 1694 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1691 1695 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1692 1696 which was producing problems in the resulting manual.
1693 1697 (magic_whos): improve reporting of instances (show their class,
1694 1698 instead of simply printing 'instance' which isn't terribly
1695 1699 informative).
1696 1700
1697 1701 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1698 1702 (minor mods) to support network shares under win32.
1699 1703
1700 1704 * IPython/winconsole.py (get_console_size): add new winconsole
1701 1705 module and fixes to page_dumb() to improve its behavior under
1702 1706 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1703 1707
1704 1708 * IPython/Magic.py (Macro): simplified Macro class to just
1705 1709 subclass list. We've had only 2.2 compatibility for a very long
1706 1710 time, yet I was still avoiding subclassing the builtin types. No
1707 1711 more (I'm also starting to use properties, though I won't shift to
1708 1712 2.3-specific features quite yet).
1709 1713 (magic_store): added Ville's patch for lightweight variable
1710 1714 persistence, after a request on the user list by Matt Wilkie
1711 1715 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1712 1716 details.
1713 1717
1714 1718 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1715 1719 changed the default logfile name from 'ipython.log' to
1716 1720 'ipython_log.py'. These logs are real python files, and now that
1717 1721 we have much better multiline support, people are more likely to
1718 1722 want to use them as such. Might as well name them correctly.
1719 1723
1720 1724 * IPython/Magic.py: substantial cleanup. While we can't stop
1721 1725 using magics as mixins, due to the existing customizations 'out
1722 1726 there' which rely on the mixin naming conventions, at least I
1723 1727 cleaned out all cross-class name usage. So once we are OK with
1724 1728 breaking compatibility, the two systems can be separated.
1725 1729
1726 1730 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1727 1731 anymore, and the class is a fair bit less hideous as well. New
1728 1732 features were also introduced: timestamping of input, and logging
1729 1733 of output results. These are user-visible with the -t and -o
1730 1734 options to %logstart. Closes
1731 1735 http://www.scipy.net/roundup/ipython/issue11 and a request by
1732 1736 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1733 1737
1734 1738 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1735 1739
1736 1740 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1737 1741 better handle backslashes in paths. See the thread 'More Windows
1738 1742 questions part 2 - \/ characters revisited' on the iypthon user
1739 1743 list:
1740 1744 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1741 1745
1742 1746 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1743 1747
1744 1748 (InteractiveShell.__init__): change threaded shells to not use the
1745 1749 ipython crash handler. This was causing more problems than not,
1746 1750 as exceptions in the main thread (GUI code, typically) would
1747 1751 always show up as a 'crash', when they really weren't.
1748 1752
1749 1753 The colors and exception mode commands (%colors/%xmode) have been
1750 1754 synchronized to also take this into account, so users can get
1751 1755 verbose exceptions for their threaded code as well. I also added
1752 1756 support for activating pdb inside this exception handler as well,
1753 1757 so now GUI authors can use IPython's enhanced pdb at runtime.
1754 1758
1755 1759 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1756 1760 true by default, and add it to the shipped ipythonrc file. Since
1757 1761 this asks the user before proceeding, I think it's OK to make it
1758 1762 true by default.
1759 1763
1760 1764 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1761 1765 of the previous special-casing of input in the eval loop. I think
1762 1766 this is cleaner, as they really are commands and shouldn't have
1763 1767 a special role in the middle of the core code.
1764 1768
1765 1769 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1766 1770
1767 1771 * IPython/iplib.py (edit_syntax_error): added support for
1768 1772 automatically reopening the editor if the file had a syntax error
1769 1773 in it. Thanks to scottt who provided the patch at:
1770 1774 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1771 1775 version committed).
1772 1776
1773 1777 * IPython/iplib.py (handle_normal): add suport for multi-line
1774 1778 input with emtpy lines. This fixes
1775 1779 http://www.scipy.net/roundup/ipython/issue43 and a similar
1776 1780 discussion on the user list.
1777 1781
1778 1782 WARNING: a behavior change is necessarily introduced to support
1779 1783 blank lines: now a single blank line with whitespace does NOT
1780 1784 break the input loop, which means that when autoindent is on, by
1781 1785 default hitting return on the next (indented) line does NOT exit.
1782 1786
1783 1787 Instead, to exit a multiline input you can either have:
1784 1788
1785 1789 - TWO whitespace lines (just hit return again), or
1786 1790 - a single whitespace line of a different length than provided
1787 1791 by the autoindent (add or remove a space).
1788 1792
1789 1793 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1790 1794 module to better organize all readline-related functionality.
1791 1795 I've deleted FlexCompleter and put all completion clases here.
1792 1796
1793 1797 * IPython/iplib.py (raw_input): improve indentation management.
1794 1798 It is now possible to paste indented code with autoindent on, and
1795 1799 the code is interpreted correctly (though it still looks bad on
1796 1800 screen, due to the line-oriented nature of ipython).
1797 1801 (MagicCompleter.complete): change behavior so that a TAB key on an
1798 1802 otherwise empty line actually inserts a tab, instead of completing
1799 1803 on the entire global namespace. This makes it easier to use the
1800 1804 TAB key for indentation. After a request by Hans Meine
1801 1805 <hans_meine-AT-gmx.net>
1802 1806 (_prefilter): add support so that typing plain 'exit' or 'quit'
1803 1807 does a sensible thing. Originally I tried to deviate as little as
1804 1808 possible from the default python behavior, but even that one may
1805 1809 change in this direction (thread on python-dev to that effect).
1806 1810 Regardless, ipython should do the right thing even if CPython's
1807 1811 '>>>' prompt doesn't.
1808 1812 (InteractiveShell): removed subclassing code.InteractiveConsole
1809 1813 class. By now we'd overridden just about all of its methods: I've
1810 1814 copied the remaining two over, and now ipython is a standalone
1811 1815 class. This will provide a clearer picture for the chainsaw
1812 1816 branch refactoring.
1813 1817
1814 1818 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1815 1819
1816 1820 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1817 1821 failures for objects which break when dir() is called on them.
1818 1822
1819 1823 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1820 1824 distinct local and global namespaces in the completer API. This
1821 1825 change allows us to properly handle completion with distinct
1822 1826 scopes, including in embedded instances (this had never really
1823 1827 worked correctly).
1824 1828
1825 1829 Note: this introduces a change in the constructor for
1826 1830 MagicCompleter, as a new global_namespace parameter is now the
1827 1831 second argument (the others were bumped one position).
1828 1832
1829 1833 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1830 1834
1831 1835 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1832 1836 embedded instances (which can be done now thanks to Vivian's
1833 1837 frame-handling fixes for pdb).
1834 1838 (InteractiveShell.__init__): Fix namespace handling problem in
1835 1839 embedded instances. We were overwriting __main__ unconditionally,
1836 1840 and this should only be done for 'full' (non-embedded) IPython;
1837 1841 embedded instances must respect the caller's __main__. Thanks to
1838 1842 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1839 1843
1840 1844 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1841 1845
1842 1846 * setup.py: added download_url to setup(). This registers the
1843 1847 download address at PyPI, which is not only useful to humans
1844 1848 browsing the site, but is also picked up by setuptools (the Eggs
1845 1849 machinery). Thanks to Ville and R. Kern for the info/discussion
1846 1850 on this.
1847 1851
1848 1852 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1849 1853
1850 1854 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1851 1855 This brings a lot of nice functionality to the pdb mode, which now
1852 1856 has tab-completion, syntax highlighting, and better stack handling
1853 1857 than before. Many thanks to Vivian De Smedt
1854 1858 <vivian-AT-vdesmedt.com> for the original patches.
1855 1859
1856 1860 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1857 1861
1858 1862 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1859 1863 sequence to consistently accept the banner argument. The
1860 1864 inconsistency was tripping SAGE, thanks to Gary Zablackis
1861 1865 <gzabl-AT-yahoo.com> for the report.
1862 1866
1863 1867 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1864 1868
1865 1869 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1866 1870 Fix bug where a naked 'alias' call in the ipythonrc file would
1867 1871 cause a crash. Bug reported by Jorgen Stenarson.
1868 1872
1869 1873 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1870 1874
1871 1875 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1872 1876 startup time.
1873 1877
1874 1878 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1875 1879 instances had introduced a bug with globals in normal code. Now
1876 1880 it's working in all cases.
1877 1881
1878 1882 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1879 1883 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1880 1884 has been introduced to set the default case sensitivity of the
1881 1885 searches. Users can still select either mode at runtime on a
1882 1886 per-search basis.
1883 1887
1884 1888 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1885 1889
1886 1890 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1887 1891 attributes in wildcard searches for subclasses. Modified version
1888 1892 of a patch by Jorgen.
1889 1893
1890 1894 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1891 1895
1892 1896 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1893 1897 embedded instances. I added a user_global_ns attribute to the
1894 1898 InteractiveShell class to handle this.
1895 1899
1896 1900 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1897 1901
1898 1902 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1899 1903 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1900 1904 (reported under win32, but may happen also in other platforms).
1901 1905 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1902 1906
1903 1907 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1904 1908
1905 1909 * IPython/Magic.py (magic_psearch): new support for wildcard
1906 1910 patterns. Now, typing ?a*b will list all names which begin with a
1907 1911 and end in b, for example. The %psearch magic has full
1908 1912 docstrings. Many thanks to JΓΆrgen Stenarson
1909 1913 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1910 1914 implementing this functionality.
1911 1915
1912 1916 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1913 1917
1914 1918 * Manual: fixed long-standing annoyance of double-dashes (as in
1915 1919 --prefix=~, for example) being stripped in the HTML version. This
1916 1920 is a latex2html bug, but a workaround was provided. Many thanks
1917 1921 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1918 1922 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1919 1923 rolling. This seemingly small issue had tripped a number of users
1920 1924 when first installing, so I'm glad to see it gone.
1921 1925
1922 1926 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1923 1927
1924 1928 * IPython/Extensions/numeric_formats.py: fix missing import,
1925 1929 reported by Stephen Walton.
1926 1930
1927 1931 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1928 1932
1929 1933 * IPython/demo.py: finish demo module, fully documented now.
1930 1934
1931 1935 * IPython/genutils.py (file_read): simple little utility to read a
1932 1936 file and ensure it's closed afterwards.
1933 1937
1934 1938 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1935 1939
1936 1940 * IPython/demo.py (Demo.__init__): added support for individually
1937 1941 tagging blocks for automatic execution.
1938 1942
1939 1943 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1940 1944 syntax-highlighted python sources, requested by John.
1941 1945
1942 1946 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1943 1947
1944 1948 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1945 1949 finishing.
1946 1950
1947 1951 * IPython/genutils.py (shlex_split): moved from Magic to here,
1948 1952 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1949 1953
1950 1954 * IPython/demo.py (Demo.__init__): added support for silent
1951 1955 blocks, improved marks as regexps, docstrings written.
1952 1956 (Demo.__init__): better docstring, added support for sys.argv.
1953 1957
1954 1958 * IPython/genutils.py (marquee): little utility used by the demo
1955 1959 code, handy in general.
1956 1960
1957 1961 * IPython/demo.py (Demo.__init__): new class for interactive
1958 1962 demos. Not documented yet, I just wrote it in a hurry for
1959 1963 scipy'05. Will docstring later.
1960 1964
1961 1965 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1962 1966
1963 1967 * IPython/Shell.py (sigint_handler): Drastic simplification which
1964 1968 also seems to make Ctrl-C work correctly across threads! This is
1965 1969 so simple, that I can't beleive I'd missed it before. Needs more
1966 1970 testing, though.
1967 1971 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1968 1972 like this before...
1969 1973
1970 1974 * IPython/genutils.py (get_home_dir): add protection against
1971 1975 non-dirs in win32 registry.
1972 1976
1973 1977 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1974 1978 bug where dict was mutated while iterating (pysh crash).
1975 1979
1976 1980 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1977 1981
1978 1982 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1979 1983 spurious newlines added by this routine. After a report by
1980 1984 F. Mantegazza.
1981 1985
1982 1986 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1983 1987
1984 1988 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1985 1989 calls. These were a leftover from the GTK 1.x days, and can cause
1986 1990 problems in certain cases (after a report by John Hunter).
1987 1991
1988 1992 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1989 1993 os.getcwd() fails at init time. Thanks to patch from David Remahl
1990 1994 <chmod007-AT-mac.com>.
1991 1995 (InteractiveShell.__init__): prevent certain special magics from
1992 1996 being shadowed by aliases. Closes
1993 1997 http://www.scipy.net/roundup/ipython/issue41.
1994 1998
1995 1999 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1996 2000
1997 2001 * IPython/iplib.py (InteractiveShell.complete): Added new
1998 2002 top-level completion method to expose the completion mechanism
1999 2003 beyond readline-based environments.
2000 2004
2001 2005 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
2002 2006
2003 2007 * tools/ipsvnc (svnversion): fix svnversion capture.
2004 2008
2005 2009 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
2006 2010 attribute to self, which was missing. Before, it was set by a
2007 2011 routine which in certain cases wasn't being called, so the
2008 2012 instance could end up missing the attribute. This caused a crash.
2009 2013 Closes http://www.scipy.net/roundup/ipython/issue40.
2010 2014
2011 2015 2005-08-16 Fernando Perez <fperez@colorado.edu>
2012 2016
2013 2017 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
2014 2018 contains non-string attribute. Closes
2015 2019 http://www.scipy.net/roundup/ipython/issue38.
2016 2020
2017 2021 2005-08-14 Fernando Perez <fperez@colorado.edu>
2018 2022
2019 2023 * tools/ipsvnc: Minor improvements, to add changeset info.
2020 2024
2021 2025 2005-08-12 Fernando Perez <fperez@colorado.edu>
2022 2026
2023 2027 * IPython/iplib.py (runsource): remove self.code_to_run_src
2024 2028 attribute. I realized this is nothing more than
2025 2029 '\n'.join(self.buffer), and having the same data in two different
2026 2030 places is just asking for synchronization bugs. This may impact
2027 2031 people who have custom exception handlers, so I need to warn
2028 2032 ipython-dev about it (F. Mantegazza may use them).
2029 2033
2030 2034 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
2031 2035
2032 2036 * IPython/genutils.py: fix 2.2 compatibility (generators)
2033 2037
2034 2038 2005-07-18 Fernando Perez <fperez@colorado.edu>
2035 2039
2036 2040 * IPython/genutils.py (get_home_dir): fix to help users with
2037 2041 invalid $HOME under win32.
2038 2042
2039 2043 2005-07-17 Fernando Perez <fperez@colorado.edu>
2040 2044
2041 2045 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
2042 2046 some old hacks and clean up a bit other routines; code should be
2043 2047 simpler and a bit faster.
2044 2048
2045 2049 * IPython/iplib.py (interact): removed some last-resort attempts
2046 2050 to survive broken stdout/stderr. That code was only making it
2047 2051 harder to abstract out the i/o (necessary for gui integration),
2048 2052 and the crashes it could prevent were extremely rare in practice
2049 2053 (besides being fully user-induced in a pretty violent manner).
2050 2054
2051 2055 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
2052 2056 Nothing major yet, but the code is simpler to read; this should
2053 2057 make it easier to do more serious modifications in the future.
2054 2058
2055 2059 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
2056 2060 which broke in .15 (thanks to a report by Ville).
2057 2061
2058 2062 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
2059 2063 be quite correct, I know next to nothing about unicode). This
2060 2064 will allow unicode strings to be used in prompts, amongst other
2061 2065 cases. It also will prevent ipython from crashing when unicode
2062 2066 shows up unexpectedly in many places. If ascii encoding fails, we
2063 2067 assume utf_8. Currently the encoding is not a user-visible
2064 2068 setting, though it could be made so if there is demand for it.
2065 2069
2066 2070 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
2067 2071
2068 2072 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
2069 2073
2070 2074 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
2071 2075
2072 2076 * IPython/genutils.py: Add 2.2 compatibility here, so all other
2073 2077 code can work transparently for 2.2/2.3.
2074 2078
2075 2079 2005-07-16 Fernando Perez <fperez@colorado.edu>
2076 2080
2077 2081 * IPython/ultraTB.py (ExceptionColors): Make a global variable
2078 2082 out of the color scheme table used for coloring exception
2079 2083 tracebacks. This allows user code to add new schemes at runtime.
2080 2084 This is a minimally modified version of the patch at
2081 2085 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
2082 2086 for the contribution.
2083 2087
2084 2088 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
2085 2089 slightly modified version of the patch in
2086 2090 http://www.scipy.net/roundup/ipython/issue34, which also allows me
2087 2091 to remove the previous try/except solution (which was costlier).
2088 2092 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
2089 2093
2090 2094 2005-06-08 Fernando Perez <fperez@colorado.edu>
2091 2095
2092 2096 * IPython/iplib.py (write/write_err): Add methods to abstract all
2093 2097 I/O a bit more.
2094 2098
2095 2099 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
2096 2100 warning, reported by Aric Hagberg, fix by JD Hunter.
2097 2101
2098 2102 2005-06-02 *** Released version 0.6.15
2099 2103
2100 2104 2005-06-01 Fernando Perez <fperez@colorado.edu>
2101 2105
2102 2106 * IPython/iplib.py (MagicCompleter.file_matches): Fix
2103 2107 tab-completion of filenames within open-quoted strings. Note that
2104 2108 this requires that in ~/.ipython/ipythonrc, users change the
2105 2109 readline delimiters configuration to read:
2106 2110
2107 2111 readline_remove_delims -/~
2108 2112
2109 2113
2110 2114 2005-05-31 *** Released version 0.6.14
2111 2115
2112 2116 2005-05-29 Fernando Perez <fperez@colorado.edu>
2113 2117
2114 2118 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
2115 2119 with files not on the filesystem. Reported by Eliyahu Sandler
2116 2120 <eli@gondolin.net>
2117 2121
2118 2122 2005-05-22 Fernando Perez <fperez@colorado.edu>
2119 2123
2120 2124 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
2121 2125 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
2122 2126
2123 2127 2005-05-19 Fernando Perez <fperez@colorado.edu>
2124 2128
2125 2129 * IPython/iplib.py (safe_execfile): close a file which could be
2126 2130 left open (causing problems in win32, which locks open files).
2127 2131 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
2128 2132
2129 2133 2005-05-18 Fernando Perez <fperez@colorado.edu>
2130 2134
2131 2135 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
2132 2136 keyword arguments correctly to safe_execfile().
2133 2137
2134 2138 2005-05-13 Fernando Perez <fperez@colorado.edu>
2135 2139
2136 2140 * ipython.1: Added info about Qt to manpage, and threads warning
2137 2141 to usage page (invoked with --help).
2138 2142
2139 2143 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
2140 2144 new matcher (it goes at the end of the priority list) to do
2141 2145 tab-completion on named function arguments. Submitted by George
2142 2146 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
2143 2147 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
2144 2148 for more details.
2145 2149
2146 2150 * IPython/Magic.py (magic_run): Added new -e flag to ignore
2147 2151 SystemExit exceptions in the script being run. Thanks to a report
2148 2152 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
2149 2153 producing very annoying behavior when running unit tests.
2150 2154
2151 2155 2005-05-12 Fernando Perez <fperez@colorado.edu>
2152 2156
2153 2157 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
2154 2158 which I'd broken (again) due to a changed regexp. In the process,
2155 2159 added ';' as an escape to auto-quote the whole line without
2156 2160 splitting its arguments. Thanks to a report by Jerry McRae
2157 2161 <qrs0xyc02-AT-sneakemail.com>.
2158 2162
2159 2163 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
2160 2164 possible crashes caused by a TokenError. Reported by Ed Schofield
2161 2165 <schofield-AT-ftw.at>.
2162 2166
2163 2167 2005-05-06 Fernando Perez <fperez@colorado.edu>
2164 2168
2165 2169 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
2166 2170
2167 2171 2005-04-29 Fernando Perez <fperez@colorado.edu>
2168 2172
2169 2173 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2170 2174 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2171 2175 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2172 2176 which provides support for Qt interactive usage (similar to the
2173 2177 existing one for WX and GTK). This had been often requested.
2174 2178
2175 2179 2005-04-14 *** Released version 0.6.13
2176 2180
2177 2181 2005-04-08 Fernando Perez <fperez@colorado.edu>
2178 2182
2179 2183 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
2180 2184 from _ofind, which gets called on almost every input line. Now,
2181 2185 we only try to get docstrings if they are actually going to be
2182 2186 used (the overhead of fetching unnecessary docstrings can be
2183 2187 noticeable for certain objects, such as Pyro proxies).
2184 2188
2185 2189 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2186 2190 for completers. For some reason I had been passing them the state
2187 2191 variable, which completers never actually need, and was in
2188 2192 conflict with the rlcompleter API. Custom completers ONLY need to
2189 2193 take the text parameter.
2190 2194
2191 2195 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2192 2196 work correctly in pysh. I've also moved all the logic which used
2193 2197 to be in pysh.py here, which will prevent problems with future
2194 2198 upgrades. However, this time I must warn users to update their
2195 2199 pysh profile to include the line
2196 2200
2197 2201 import_all IPython.Extensions.InterpreterExec
2198 2202
2199 2203 because otherwise things won't work for them. They MUST also
2200 2204 delete pysh.py and the line
2201 2205
2202 2206 execfile pysh.py
2203 2207
2204 2208 from their ipythonrc-pysh.
2205 2209
2206 2210 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2207 2211 robust in the face of objects whose dir() returns non-strings
2208 2212 (which it shouldn't, but some broken libs like ITK do). Thanks to
2209 2213 a patch by John Hunter (implemented differently, though). Also
2210 2214 minor improvements by using .extend instead of + on lists.
2211 2215
2212 2216 * pysh.py:
2213 2217
2214 2218 2005-04-06 Fernando Perez <fperez@colorado.edu>
2215 2219
2216 2220 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2217 2221 by default, so that all users benefit from it. Those who don't
2218 2222 want it can still turn it off.
2219 2223
2220 2224 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2221 2225 config file, I'd forgotten about this, so users were getting it
2222 2226 off by default.
2223 2227
2224 2228 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2225 2229 consistency. Now magics can be called in multiline statements,
2226 2230 and python variables can be expanded in magic calls via $var.
2227 2231 This makes the magic system behave just like aliases or !system
2228 2232 calls.
2229 2233
2230 2234 2005-03-28 Fernando Perez <fperez@colorado.edu>
2231 2235
2232 2236 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
2233 2237 expensive string additions for building command. Add support for
2234 2238 trailing ';' when autocall is used.
2235 2239
2236 2240 2005-03-26 Fernando Perez <fperez@colorado.edu>
2237 2241
2238 2242 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
2239 2243 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
2240 2244 ipython.el robust against prompts with any number of spaces
2241 2245 (including 0) after the ':' character.
2242 2246
2243 2247 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
2244 2248 continuation prompt, which misled users to think the line was
2245 2249 already indented. Closes debian Bug#300847, reported to me by
2246 2250 Norbert Tretkowski <tretkowski-AT-inittab.de>.
2247 2251
2248 2252 2005-03-23 Fernando Perez <fperez@colorado.edu>
2249 2253
2250 2254 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
2251 2255 properly aligned if they have embedded newlines.
2252 2256
2253 2257 * IPython/iplib.py (runlines): Add a public method to expose
2254 2258 IPython's code execution machinery, so that users can run strings
2255 2259 as if they had been typed at the prompt interactively.
2256 2260 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
2257 2261 methods which can call the system shell, but with python variable
2258 2262 expansion. The three such methods are: __IPYTHON__.system,
2259 2263 .getoutput and .getoutputerror. These need to be documented in a
2260 2264 'public API' section (to be written) of the manual.
2261 2265
2262 2266 2005-03-20 Fernando Perez <fperez@colorado.edu>
2263 2267
2264 2268 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
2265 2269 for custom exception handling. This is quite powerful, and it
2266 2270 allows for user-installable exception handlers which can trap
2267 2271 custom exceptions at runtime and treat them separately from
2268 2272 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
2269 2273 Mantegazza <mantegazza-AT-ill.fr>.
2270 2274 (InteractiveShell.set_custom_completer): public API function to
2271 2275 add new completers at runtime.
2272 2276
2273 2277 2005-03-19 Fernando Perez <fperez@colorado.edu>
2274 2278
2275 2279 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
2276 2280 allow objects which provide their docstrings via non-standard
2277 2281 mechanisms (like Pyro proxies) to still be inspected by ipython's
2278 2282 ? system.
2279 2283
2280 2284 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
2281 2285 automatic capture system. I tried quite hard to make it work
2282 2286 reliably, and simply failed. I tried many combinations with the
2283 2287 subprocess module, but eventually nothing worked in all needed
2284 2288 cases (not blocking stdin for the child, duplicating stdout
2285 2289 without blocking, etc). The new %sc/%sx still do capture to these
2286 2290 magical list/string objects which make shell use much more
2287 2291 conveninent, so not all is lost.
2288 2292
2289 2293 XXX - FIX MANUAL for the change above!
2290 2294
2291 2295 (runsource): I copied code.py's runsource() into ipython to modify
2292 2296 it a bit. Now the code object and source to be executed are
2293 2297 stored in ipython. This makes this info accessible to third-party
2294 2298 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
2295 2299 Mantegazza <mantegazza-AT-ill.fr>.
2296 2300
2297 2301 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
2298 2302 history-search via readline (like C-p/C-n). I'd wanted this for a
2299 2303 long time, but only recently found out how to do it. For users
2300 2304 who already have their ipythonrc files made and want this, just
2301 2305 add:
2302 2306
2303 2307 readline_parse_and_bind "\e[A": history-search-backward
2304 2308 readline_parse_and_bind "\e[B": history-search-forward
2305 2309
2306 2310 2005-03-18 Fernando Perez <fperez@colorado.edu>
2307 2311
2308 2312 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
2309 2313 LSString and SList classes which allow transparent conversions
2310 2314 between list mode and whitespace-separated string.
2311 2315 (magic_r): Fix recursion problem in %r.
2312 2316
2313 2317 * IPython/genutils.py (LSString): New class to be used for
2314 2318 automatic storage of the results of all alias/system calls in _o
2315 2319 and _e (stdout/err). These provide a .l/.list attribute which
2316 2320 does automatic splitting on newlines. This means that for most
2317 2321 uses, you'll never need to do capturing of output with %sc/%sx
2318 2322 anymore, since ipython keeps this always done for you. Note that
2319 2323 only the LAST results are stored, the _o/e variables are
2320 2324 overwritten on each call. If you need to save their contents
2321 2325 further, simply bind them to any other name.
2322 2326
2323 2327 2005-03-17 Fernando Perez <fperez@colorado.edu>
2324 2328
2325 2329 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2326 2330 prompt namespace handling.
2327 2331
2328 2332 2005-03-16 Fernando Perez <fperez@colorado.edu>
2329 2333
2330 2334 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2331 2335 classic prompts to be '>>> ' (final space was missing, and it
2332 2336 trips the emacs python mode).
2333 2337 (BasePrompt.__str__): Added safe support for dynamic prompt
2334 2338 strings. Now you can set your prompt string to be '$x', and the
2335 2339 value of x will be printed from your interactive namespace. The
2336 2340 interpolation syntax includes the full Itpl support, so
2337 2341 ${foo()+x+bar()} is a valid prompt string now, and the function
2338 2342 calls will be made at runtime.
2339 2343
2340 2344 2005-03-15 Fernando Perez <fperez@colorado.edu>
2341 2345
2342 2346 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2343 2347 avoid name clashes in pylab. %hist still works, it just forwards
2344 2348 the call to %history.
2345 2349
2346 2350 2005-03-02 *** Released version 0.6.12
2347 2351
2348 2352 2005-03-02 Fernando Perez <fperez@colorado.edu>
2349 2353
2350 2354 * IPython/iplib.py (handle_magic): log magic calls properly as
2351 2355 ipmagic() function calls.
2352 2356
2353 2357 * IPython/Magic.py (magic_time): Improved %time to support
2354 2358 statements and provide wall-clock as well as CPU time.
2355 2359
2356 2360 2005-02-27 Fernando Perez <fperez@colorado.edu>
2357 2361
2358 2362 * IPython/hooks.py: New hooks module, to expose user-modifiable
2359 2363 IPython functionality in a clean manner. For now only the editor
2360 2364 hook is actually written, and other thigns which I intend to turn
2361 2365 into proper hooks aren't yet there. The display and prefilter
2362 2366 stuff, for example, should be hooks. But at least now the
2363 2367 framework is in place, and the rest can be moved here with more
2364 2368 time later. IPython had had a .hooks variable for a long time for
2365 2369 this purpose, but I'd never actually used it for anything.
2366 2370
2367 2371 2005-02-26 Fernando Perez <fperez@colorado.edu>
2368 2372
2369 2373 * IPython/ipmaker.py (make_IPython): make the default ipython
2370 2374 directory be called _ipython under win32, to follow more the
2371 2375 naming peculiarities of that platform (where buggy software like
2372 2376 Visual Sourcesafe breaks with .named directories). Reported by
2373 2377 Ville Vainio.
2374 2378
2375 2379 2005-02-23 Fernando Perez <fperez@colorado.edu>
2376 2380
2377 2381 * IPython/iplib.py (InteractiveShell.__init__): removed a few
2378 2382 auto_aliases for win32 which were causing problems. Users can
2379 2383 define the ones they personally like.
2380 2384
2381 2385 2005-02-21 Fernando Perez <fperez@colorado.edu>
2382 2386
2383 2387 * IPython/Magic.py (magic_time): new magic to time execution of
2384 2388 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
2385 2389
2386 2390 2005-02-19 Fernando Perez <fperez@colorado.edu>
2387 2391
2388 2392 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
2389 2393 into keys (for prompts, for example).
2390 2394
2391 2395 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
2392 2396 prompts in case users want them. This introduces a small behavior
2393 2397 change: ipython does not automatically add a space to all prompts
2394 2398 anymore. To get the old prompts with a space, users should add it
2395 2399 manually to their ipythonrc file, so for example prompt_in1 should
2396 2400 now read 'In [\#]: ' instead of 'In [\#]:'.
2397 2401 (BasePrompt.__init__): New option prompts_pad_left (only in rc
2398 2402 file) to control left-padding of secondary prompts.
2399 2403
2400 2404 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
2401 2405 the profiler can't be imported. Fix for Debian, which removed
2402 2406 profile.py because of License issues. I applied a slightly
2403 2407 modified version of the original Debian patch at
2404 2408 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
2405 2409
2406 2410 2005-02-17 Fernando Perez <fperez@colorado.edu>
2407 2411
2408 2412 * IPython/genutils.py (native_line_ends): Fix bug which would
2409 2413 cause improper line-ends under win32 b/c I was not opening files
2410 2414 in binary mode. Bug report and fix thanks to Ville.
2411 2415
2412 2416 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
2413 2417 trying to catch spurious foo[1] autocalls. My fix actually broke
2414 2418 ',/' autoquote/call with explicit escape (bad regexp).
2415 2419
2416 2420 2005-02-15 *** Released version 0.6.11
2417 2421
2418 2422 2005-02-14 Fernando Perez <fperez@colorado.edu>
2419 2423
2420 2424 * IPython/background_jobs.py: New background job management
2421 2425 subsystem. This is implemented via a new set of classes, and
2422 2426 IPython now provides a builtin 'jobs' object for background job
2423 2427 execution. A convenience %bg magic serves as a lightweight
2424 2428 frontend for starting the more common type of calls. This was
2425 2429 inspired by discussions with B. Granger and the BackgroundCommand
2426 2430 class described in the book Python Scripting for Computational
2427 2431 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
2428 2432 (although ultimately no code from this text was used, as IPython's
2429 2433 system is a separate implementation).
2430 2434
2431 2435 * IPython/iplib.py (MagicCompleter.python_matches): add new option
2432 2436 to control the completion of single/double underscore names
2433 2437 separately. As documented in the example ipytonrc file, the
2434 2438 readline_omit__names variable can now be set to 2, to omit even
2435 2439 single underscore names. Thanks to a patch by Brian Wong
2436 2440 <BrianWong-AT-AirgoNetworks.Com>.
2437 2441 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
2438 2442 be autocalled as foo([1]) if foo were callable. A problem for
2439 2443 things which are both callable and implement __getitem__.
2440 2444 (init_readline): Fix autoindentation for win32. Thanks to a patch
2441 2445 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
2442 2446
2443 2447 2005-02-12 Fernando Perez <fperez@colorado.edu>
2444 2448
2445 2449 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
2446 2450 which I had written long ago to sort out user error messages which
2447 2451 may occur during startup. This seemed like a good idea initially,
2448 2452 but it has proven a disaster in retrospect. I don't want to
2449 2453 change much code for now, so my fix is to set the internal 'debug'
2450 2454 flag to true everywhere, whose only job was precisely to control
2451 2455 this subsystem. This closes issue 28 (as well as avoiding all
2452 2456 sorts of strange hangups which occur from time to time).
2453 2457
2454 2458 2005-02-07 Fernando Perez <fperez@colorado.edu>
2455 2459
2456 2460 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
2457 2461 previous call produced a syntax error.
2458 2462
2459 2463 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2460 2464 classes without constructor.
2461 2465
2462 2466 2005-02-06 Fernando Perez <fperez@colorado.edu>
2463 2467
2464 2468 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
2465 2469 completions with the results of each matcher, so we return results
2466 2470 to the user from all namespaces. This breaks with ipython
2467 2471 tradition, but I think it's a nicer behavior. Now you get all
2468 2472 possible completions listed, from all possible namespaces (python,
2469 2473 filesystem, magics...) After a request by John Hunter
2470 2474 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2471 2475
2472 2476 2005-02-05 Fernando Perez <fperez@colorado.edu>
2473 2477
2474 2478 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
2475 2479 the call had quote characters in it (the quotes were stripped).
2476 2480
2477 2481 2005-01-31 Fernando Perez <fperez@colorado.edu>
2478 2482
2479 2483 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
2480 2484 Itpl.itpl() to make the code more robust against psyco
2481 2485 optimizations.
2482 2486
2483 2487 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
2484 2488 of causing an exception. Quicker, cleaner.
2485 2489
2486 2490 2005-01-28 Fernando Perez <fperez@colorado.edu>
2487 2491
2488 2492 * scripts/ipython_win_post_install.py (install): hardcode
2489 2493 sys.prefix+'python.exe' as the executable path. It turns out that
2490 2494 during the post-installation run, sys.executable resolves to the
2491 2495 name of the binary installer! I should report this as a distutils
2492 2496 bug, I think. I updated the .10 release with this tiny fix, to
2493 2497 avoid annoying the lists further.
2494 2498
2495 2499 2005-01-27 *** Released version 0.6.10
2496 2500
2497 2501 2005-01-27 Fernando Perez <fperez@colorado.edu>
2498 2502
2499 2503 * IPython/numutils.py (norm): Added 'inf' as optional name for
2500 2504 L-infinity norm, included references to mathworld.com for vector
2501 2505 norm definitions.
2502 2506 (amin/amax): added amin/amax for array min/max. Similar to what
2503 2507 pylab ships with after the recent reorganization of names.
2504 2508 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2505 2509
2506 2510 * ipython.el: committed Alex's recent fixes and improvements.
2507 2511 Tested with python-mode from CVS, and it looks excellent. Since
2508 2512 python-mode hasn't released anything in a while, I'm temporarily
2509 2513 putting a copy of today's CVS (v 4.70) of python-mode in:
2510 2514 http://ipython.scipy.org/tmp/python-mode.el
2511 2515
2512 2516 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2513 2517 sys.executable for the executable name, instead of assuming it's
2514 2518 called 'python.exe' (the post-installer would have produced broken
2515 2519 setups on systems with a differently named python binary).
2516 2520
2517 2521 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2518 2522 references to os.linesep, to make the code more
2519 2523 platform-independent. This is also part of the win32 coloring
2520 2524 fixes.
2521 2525
2522 2526 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2523 2527 lines, which actually cause coloring bugs because the length of
2524 2528 the line is very difficult to correctly compute with embedded
2525 2529 escapes. This was the source of all the coloring problems under
2526 2530 Win32. I think that _finally_, Win32 users have a properly
2527 2531 working ipython in all respects. This would never have happened
2528 2532 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2529 2533
2530 2534 2005-01-26 *** Released version 0.6.9
2531 2535
2532 2536 2005-01-25 Fernando Perez <fperez@colorado.edu>
2533 2537
2534 2538 * setup.py: finally, we have a true Windows installer, thanks to
2535 2539 the excellent work of Viktor Ransmayr
2536 2540 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2537 2541 Windows users. The setup routine is quite a bit cleaner thanks to
2538 2542 this, and the post-install script uses the proper functions to
2539 2543 allow a clean de-installation using the standard Windows Control
2540 2544 Panel.
2541 2545
2542 2546 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2543 2547 environment variable under all OSes (including win32) if
2544 2548 available. This will give consistency to win32 users who have set
2545 2549 this variable for any reason. If os.environ['HOME'] fails, the
2546 2550 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2547 2551
2548 2552 2005-01-24 Fernando Perez <fperez@colorado.edu>
2549 2553
2550 2554 * IPython/numutils.py (empty_like): add empty_like(), similar to
2551 2555 zeros_like() but taking advantage of the new empty() Numeric routine.
2552 2556
2553 2557 2005-01-23 *** Released version 0.6.8
2554 2558
2555 2559 2005-01-22 Fernando Perez <fperez@colorado.edu>
2556 2560
2557 2561 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2558 2562 automatic show() calls. After discussing things with JDH, it
2559 2563 turns out there are too many corner cases where this can go wrong.
2560 2564 It's best not to try to be 'too smart', and simply have ipython
2561 2565 reproduce as much as possible the default behavior of a normal
2562 2566 python shell.
2563 2567
2564 2568 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2565 2569 line-splitting regexp and _prefilter() to avoid calling getattr()
2566 2570 on assignments. This closes
2567 2571 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2568 2572 readline uses getattr(), so a simple <TAB> keypress is still
2569 2573 enough to trigger getattr() calls on an object.
2570 2574
2571 2575 2005-01-21 Fernando Perez <fperez@colorado.edu>
2572 2576
2573 2577 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2574 2578 docstring under pylab so it doesn't mask the original.
2575 2579
2576 2580 2005-01-21 *** Released version 0.6.7
2577 2581
2578 2582 2005-01-21 Fernando Perez <fperez@colorado.edu>
2579 2583
2580 2584 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2581 2585 signal handling for win32 users in multithreaded mode.
2582 2586
2583 2587 2005-01-17 Fernando Perez <fperez@colorado.edu>
2584 2588
2585 2589 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2586 2590 instances with no __init__. After a crash report by Norbert Nemec
2587 2591 <Norbert-AT-nemec-online.de>.
2588 2592
2589 2593 2005-01-14 Fernando Perez <fperez@colorado.edu>
2590 2594
2591 2595 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2592 2596 names for verbose exceptions, when multiple dotted names and the
2593 2597 'parent' object were present on the same line.
2594 2598
2595 2599 2005-01-11 Fernando Perez <fperez@colorado.edu>
2596 2600
2597 2601 * IPython/genutils.py (flag_calls): new utility to trap and flag
2598 2602 calls in functions. I need it to clean up matplotlib support.
2599 2603 Also removed some deprecated code in genutils.
2600 2604
2601 2605 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2602 2606 that matplotlib scripts called with %run, which don't call show()
2603 2607 themselves, still have their plotting windows open.
2604 2608
2605 2609 2005-01-05 Fernando Perez <fperez@colorado.edu>
2606 2610
2607 2611 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2608 2612 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2609 2613
2610 2614 2004-12-19 Fernando Perez <fperez@colorado.edu>
2611 2615
2612 2616 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2613 2617 parent_runcode, which was an eyesore. The same result can be
2614 2618 obtained with Python's regular superclass mechanisms.
2615 2619
2616 2620 2004-12-17 Fernando Perez <fperez@colorado.edu>
2617 2621
2618 2622 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2619 2623 reported by Prabhu.
2620 2624 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2621 2625 sys.stderr) instead of explicitly calling sys.stderr. This helps
2622 2626 maintain our I/O abstractions clean, for future GUI embeddings.
2623 2627
2624 2628 * IPython/genutils.py (info): added new utility for sys.stderr
2625 2629 unified info message handling (thin wrapper around warn()).
2626 2630
2627 2631 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2628 2632 composite (dotted) names on verbose exceptions.
2629 2633 (VerboseTB.nullrepr): harden against another kind of errors which
2630 2634 Python's inspect module can trigger, and which were crashing
2631 2635 IPython. Thanks to a report by Marco Lombardi
2632 2636 <mlombard-AT-ma010192.hq.eso.org>.
2633 2637
2634 2638 2004-12-13 *** Released version 0.6.6
2635 2639
2636 2640 2004-12-12 Fernando Perez <fperez@colorado.edu>
2637 2641
2638 2642 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2639 2643 generated by pygtk upon initialization if it was built without
2640 2644 threads (for matplotlib users). After a crash reported by
2641 2645 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2642 2646
2643 2647 * IPython/ipmaker.py (make_IPython): fix small bug in the
2644 2648 import_some parameter for multiple imports.
2645 2649
2646 2650 * IPython/iplib.py (ipmagic): simplified the interface of
2647 2651 ipmagic() to take a single string argument, just as it would be
2648 2652 typed at the IPython cmd line.
2649 2653 (ipalias): Added new ipalias() with an interface identical to
2650 2654 ipmagic(). This completes exposing a pure python interface to the
2651 2655 alias and magic system, which can be used in loops or more complex
2652 2656 code where IPython's automatic line mangling is not active.
2653 2657
2654 2658 * IPython/genutils.py (timing): changed interface of timing to
2655 2659 simply run code once, which is the most common case. timings()
2656 2660 remains unchanged, for the cases where you want multiple runs.
2657 2661
2658 2662 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2659 2663 bug where Python2.2 crashes with exec'ing code which does not end
2660 2664 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2661 2665 before.
2662 2666
2663 2667 2004-12-10 Fernando Perez <fperez@colorado.edu>
2664 2668
2665 2669 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2666 2670 -t to -T, to accomodate the new -t flag in %run (the %run and
2667 2671 %prun options are kind of intermixed, and it's not easy to change
2668 2672 this with the limitations of python's getopt).
2669 2673
2670 2674 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2671 2675 the execution of scripts. It's not as fine-tuned as timeit.py,
2672 2676 but it works from inside ipython (and under 2.2, which lacks
2673 2677 timeit.py). Optionally a number of runs > 1 can be given for
2674 2678 timing very short-running code.
2675 2679
2676 2680 * IPython/genutils.py (uniq_stable): new routine which returns a
2677 2681 list of unique elements in any iterable, but in stable order of
2678 2682 appearance. I needed this for the ultraTB fixes, and it's a handy
2679 2683 utility.
2680 2684
2681 2685 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2682 2686 dotted names in Verbose exceptions. This had been broken since
2683 2687 the very start, now x.y will properly be printed in a Verbose
2684 2688 traceback, instead of x being shown and y appearing always as an
2685 2689 'undefined global'. Getting this to work was a bit tricky,
2686 2690 because by default python tokenizers are stateless. Saved by
2687 2691 python's ability to easily add a bit of state to an arbitrary
2688 2692 function (without needing to build a full-blown callable object).
2689 2693
2690 2694 Also big cleanup of this code, which had horrendous runtime
2691 2695 lookups of zillions of attributes for colorization. Moved all
2692 2696 this code into a few templates, which make it cleaner and quicker.
2693 2697
2694 2698 Printout quality was also improved for Verbose exceptions: one
2695 2699 variable per line, and memory addresses are printed (this can be
2696 2700 quite handy in nasty debugging situations, which is what Verbose
2697 2701 is for).
2698 2702
2699 2703 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2700 2704 the command line as scripts to be loaded by embedded instances.
2701 2705 Doing so has the potential for an infinite recursion if there are
2702 2706 exceptions thrown in the process. This fixes a strange crash
2703 2707 reported by Philippe MULLER <muller-AT-irit.fr>.
2704 2708
2705 2709 2004-12-09 Fernando Perez <fperez@colorado.edu>
2706 2710
2707 2711 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2708 2712 to reflect new names in matplotlib, which now expose the
2709 2713 matlab-compatible interface via a pylab module instead of the
2710 2714 'matlab' name. The new code is backwards compatible, so users of
2711 2715 all matplotlib versions are OK. Patch by J. Hunter.
2712 2716
2713 2717 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2714 2718 of __init__ docstrings for instances (class docstrings are already
2715 2719 automatically printed). Instances with customized docstrings
2716 2720 (indep. of the class) are also recognized and all 3 separate
2717 2721 docstrings are printed (instance, class, constructor). After some
2718 2722 comments/suggestions by J. Hunter.
2719 2723
2720 2724 2004-12-05 Fernando Perez <fperez@colorado.edu>
2721 2725
2722 2726 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2723 2727 warnings when tab-completion fails and triggers an exception.
2724 2728
2725 2729 2004-12-03 Fernando Perez <fperez@colorado.edu>
2726 2730
2727 2731 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2728 2732 be triggered when using 'run -p'. An incorrect option flag was
2729 2733 being set ('d' instead of 'D').
2730 2734 (manpage): fix missing escaped \- sign.
2731 2735
2732 2736 2004-11-30 *** Released version 0.6.5
2733 2737
2734 2738 2004-11-30 Fernando Perez <fperez@colorado.edu>
2735 2739
2736 2740 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2737 2741 setting with -d option.
2738 2742
2739 2743 * setup.py (docfiles): Fix problem where the doc glob I was using
2740 2744 was COMPLETELY BROKEN. It was giving the right files by pure
2741 2745 accident, but failed once I tried to include ipython.el. Note:
2742 2746 glob() does NOT allow you to do exclusion on multiple endings!
2743 2747
2744 2748 2004-11-29 Fernando Perez <fperez@colorado.edu>
2745 2749
2746 2750 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2747 2751 the manpage as the source. Better formatting & consistency.
2748 2752
2749 2753 * IPython/Magic.py (magic_run): Added new -d option, to run
2750 2754 scripts under the control of the python pdb debugger. Note that
2751 2755 this required changing the %prun option -d to -D, to avoid a clash
2752 2756 (since %run must pass options to %prun, and getopt is too dumb to
2753 2757 handle options with string values with embedded spaces). Thanks
2754 2758 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2755 2759 (magic_who_ls): added type matching to %who and %whos, so that one
2756 2760 can filter their output to only include variables of certain
2757 2761 types. Another suggestion by Matthew.
2758 2762 (magic_whos): Added memory summaries in kb and Mb for arrays.
2759 2763 (magic_who): Improve formatting (break lines every 9 vars).
2760 2764
2761 2765 2004-11-28 Fernando Perez <fperez@colorado.edu>
2762 2766
2763 2767 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2764 2768 cache when empty lines were present.
2765 2769
2766 2770 2004-11-24 Fernando Perez <fperez@colorado.edu>
2767 2771
2768 2772 * IPython/usage.py (__doc__): document the re-activated threading
2769 2773 options for WX and GTK.
2770 2774
2771 2775 2004-11-23 Fernando Perez <fperez@colorado.edu>
2772 2776
2773 2777 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2774 2778 the -wthread and -gthread options, along with a new -tk one to try
2775 2779 and coordinate Tk threading with wx/gtk. The tk support is very
2776 2780 platform dependent, since it seems to require Tcl and Tk to be
2777 2781 built with threads (Fedora1/2 appears NOT to have it, but in
2778 2782 Prabhu's Debian boxes it works OK). But even with some Tk
2779 2783 limitations, this is a great improvement.
2780 2784
2781 2785 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2782 2786 info in user prompts. Patch by Prabhu.
2783 2787
2784 2788 2004-11-18 Fernando Perez <fperez@colorado.edu>
2785 2789
2786 2790 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2787 2791 EOFErrors and bail, to avoid infinite loops if a non-terminating
2788 2792 file is fed into ipython. Patch submitted in issue 19 by user,
2789 2793 many thanks.
2790 2794
2791 2795 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2792 2796 autoquote/parens in continuation prompts, which can cause lots of
2793 2797 problems. Closes roundup issue 20.
2794 2798
2795 2799 2004-11-17 Fernando Perez <fperez@colorado.edu>
2796 2800
2797 2801 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2798 2802 reported as debian bug #280505. I'm not sure my local changelog
2799 2803 entry has the proper debian format (Jack?).
2800 2804
2801 2805 2004-11-08 *** Released version 0.6.4
2802 2806
2803 2807 2004-11-08 Fernando Perez <fperez@colorado.edu>
2804 2808
2805 2809 * IPython/iplib.py (init_readline): Fix exit message for Windows
2806 2810 when readline is active. Thanks to a report by Eric Jones
2807 2811 <eric-AT-enthought.com>.
2808 2812
2809 2813 2004-11-07 Fernando Perez <fperez@colorado.edu>
2810 2814
2811 2815 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2812 2816 sometimes seen by win2k/cygwin users.
2813 2817
2814 2818 2004-11-06 Fernando Perez <fperez@colorado.edu>
2815 2819
2816 2820 * IPython/iplib.py (interact): Change the handling of %Exit from
2817 2821 trying to propagate a SystemExit to an internal ipython flag.
2818 2822 This is less elegant than using Python's exception mechanism, but
2819 2823 I can't get that to work reliably with threads, so under -pylab
2820 2824 %Exit was hanging IPython. Cross-thread exception handling is
2821 2825 really a bitch. Thaks to a bug report by Stephen Walton
2822 2826 <stephen.walton-AT-csun.edu>.
2823 2827
2824 2828 2004-11-04 Fernando Perez <fperez@colorado.edu>
2825 2829
2826 2830 * IPython/iplib.py (raw_input_original): store a pointer to the
2827 2831 true raw_input to harden against code which can modify it
2828 2832 (wx.py.PyShell does this and would otherwise crash ipython).
2829 2833 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2830 2834
2831 2835 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2832 2836 Ctrl-C problem, which does not mess up the input line.
2833 2837
2834 2838 2004-11-03 Fernando Perez <fperez@colorado.edu>
2835 2839
2836 2840 * IPython/Release.py: Changed licensing to BSD, in all files.
2837 2841 (name): lowercase name for tarball/RPM release.
2838 2842
2839 2843 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2840 2844 use throughout ipython.
2841 2845
2842 2846 * IPython/Magic.py (Magic._ofind): Switch to using the new
2843 2847 OInspect.getdoc() function.
2844 2848
2845 2849 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2846 2850 of the line currently being canceled via Ctrl-C. It's extremely
2847 2851 ugly, but I don't know how to do it better (the problem is one of
2848 2852 handling cross-thread exceptions).
2849 2853
2850 2854 2004-10-28 Fernando Perez <fperez@colorado.edu>
2851 2855
2852 2856 * IPython/Shell.py (signal_handler): add signal handlers to trap
2853 2857 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2854 2858 report by Francesc Alted.
2855 2859
2856 2860 2004-10-21 Fernando Perez <fperez@colorado.edu>
2857 2861
2858 2862 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2859 2863 to % for pysh syntax extensions.
2860 2864
2861 2865 2004-10-09 Fernando Perez <fperez@colorado.edu>
2862 2866
2863 2867 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2864 2868 arrays to print a more useful summary, without calling str(arr).
2865 2869 This avoids the problem of extremely lengthy computations which
2866 2870 occur if arr is large, and appear to the user as a system lockup
2867 2871 with 100% cpu activity. After a suggestion by Kristian Sandberg
2868 2872 <Kristian.Sandberg@colorado.edu>.
2869 2873 (Magic.__init__): fix bug in global magic escapes not being
2870 2874 correctly set.
2871 2875
2872 2876 2004-10-08 Fernando Perez <fperez@colorado.edu>
2873 2877
2874 2878 * IPython/Magic.py (__license__): change to absolute imports of
2875 2879 ipython's own internal packages, to start adapting to the absolute
2876 2880 import requirement of PEP-328.
2877 2881
2878 2882 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2879 2883 files, and standardize author/license marks through the Release
2880 2884 module instead of having per/file stuff (except for files with
2881 2885 particular licenses, like the MIT/PSF-licensed codes).
2882 2886
2883 2887 * IPython/Debugger.py: remove dead code for python 2.1
2884 2888
2885 2889 2004-10-04 Fernando Perez <fperez@colorado.edu>
2886 2890
2887 2891 * IPython/iplib.py (ipmagic): New function for accessing magics
2888 2892 via a normal python function call.
2889 2893
2890 2894 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2891 2895 from '@' to '%', to accomodate the new @decorator syntax of python
2892 2896 2.4.
2893 2897
2894 2898 2004-09-29 Fernando Perez <fperez@colorado.edu>
2895 2899
2896 2900 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2897 2901 matplotlib.use to prevent running scripts which try to switch
2898 2902 interactive backends from within ipython. This will just crash
2899 2903 the python interpreter, so we can't allow it (but a detailed error
2900 2904 is given to the user).
2901 2905
2902 2906 2004-09-28 Fernando Perez <fperez@colorado.edu>
2903 2907
2904 2908 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2905 2909 matplotlib-related fixes so that using @run with non-matplotlib
2906 2910 scripts doesn't pop up spurious plot windows. This requires
2907 2911 matplotlib >= 0.63, where I had to make some changes as well.
2908 2912
2909 2913 * IPython/ipmaker.py (make_IPython): update version requirement to
2910 2914 python 2.2.
2911 2915
2912 2916 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2913 2917 banner arg for embedded customization.
2914 2918
2915 2919 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2916 2920 explicit uses of __IP as the IPython's instance name. Now things
2917 2921 are properly handled via the shell.name value. The actual code
2918 2922 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2919 2923 is much better than before. I'll clean things completely when the
2920 2924 magic stuff gets a real overhaul.
2921 2925
2922 2926 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2923 2927 minor changes to debian dir.
2924 2928
2925 2929 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2926 2930 pointer to the shell itself in the interactive namespace even when
2927 2931 a user-supplied dict is provided. This is needed for embedding
2928 2932 purposes (found by tests with Michel Sanner).
2929 2933
2930 2934 2004-09-27 Fernando Perez <fperez@colorado.edu>
2931 2935
2932 2936 * IPython/UserConfig/ipythonrc: remove []{} from
2933 2937 readline_remove_delims, so that things like [modname.<TAB> do
2934 2938 proper completion. This disables [].TAB, but that's a less common
2935 2939 case than module names in list comprehensions, for example.
2936 2940 Thanks to a report by Andrea Riciputi.
2937 2941
2938 2942 2004-09-09 Fernando Perez <fperez@colorado.edu>
2939 2943
2940 2944 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2941 2945 blocking problems in win32 and osx. Fix by John.
2942 2946
2943 2947 2004-09-08 Fernando Perez <fperez@colorado.edu>
2944 2948
2945 2949 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2946 2950 for Win32 and OSX. Fix by John Hunter.
2947 2951
2948 2952 2004-08-30 *** Released version 0.6.3
2949 2953
2950 2954 2004-08-30 Fernando Perez <fperez@colorado.edu>
2951 2955
2952 2956 * setup.py (isfile): Add manpages to list of dependent files to be
2953 2957 updated.
2954 2958
2955 2959 2004-08-27 Fernando Perez <fperez@colorado.edu>
2956 2960
2957 2961 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2958 2962 for now. They don't really work with standalone WX/GTK code
2959 2963 (though matplotlib IS working fine with both of those backends).
2960 2964 This will neeed much more testing. I disabled most things with
2961 2965 comments, so turning it back on later should be pretty easy.
2962 2966
2963 2967 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2964 2968 autocalling of expressions like r'foo', by modifying the line
2965 2969 split regexp. Closes
2966 2970 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2967 2971 Riley <ipythonbugs-AT-sabi.net>.
2968 2972 (InteractiveShell.mainloop): honor --nobanner with banner
2969 2973 extensions.
2970 2974
2971 2975 * IPython/Shell.py: Significant refactoring of all classes, so
2972 2976 that we can really support ALL matplotlib backends and threading
2973 2977 models (John spotted a bug with Tk which required this). Now we
2974 2978 should support single-threaded, WX-threads and GTK-threads, both
2975 2979 for generic code and for matplotlib.
2976 2980
2977 2981 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2978 2982 -pylab, to simplify things for users. Will also remove the pylab
2979 2983 profile, since now all of matplotlib configuration is directly
2980 2984 handled here. This also reduces startup time.
2981 2985
2982 2986 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2983 2987 shell wasn't being correctly called. Also in IPShellWX.
2984 2988
2985 2989 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2986 2990 fine-tune banner.
2987 2991
2988 2992 * IPython/numutils.py (spike): Deprecate these spike functions,
2989 2993 delete (long deprecated) gnuplot_exec handler.
2990 2994
2991 2995 2004-08-26 Fernando Perez <fperez@colorado.edu>
2992 2996
2993 2997 * ipython.1: Update for threading options, plus some others which
2994 2998 were missing.
2995 2999
2996 3000 * IPython/ipmaker.py (__call__): Added -wthread option for
2997 3001 wxpython thread handling. Make sure threading options are only
2998 3002 valid at the command line.
2999 3003
3000 3004 * scripts/ipython: moved shell selection into a factory function
3001 3005 in Shell.py, to keep the starter script to a minimum.
3002 3006
3003 3007 2004-08-25 Fernando Perez <fperez@colorado.edu>
3004 3008
3005 3009 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
3006 3010 John. Along with some recent changes he made to matplotlib, the
3007 3011 next versions of both systems should work very well together.
3008 3012
3009 3013 2004-08-24 Fernando Perez <fperez@colorado.edu>
3010 3014
3011 3015 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
3012 3016 tried to switch the profiling to using hotshot, but I'm getting
3013 3017 strange errors from prof.runctx() there. I may be misreading the
3014 3018 docs, but it looks weird. For now the profiling code will
3015 3019 continue to use the standard profiler.
3016 3020
3017 3021 2004-08-23 Fernando Perez <fperez@colorado.edu>
3018 3022
3019 3023 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
3020 3024 threaded shell, by John Hunter. It's not quite ready yet, but
3021 3025 close.
3022 3026
3023 3027 2004-08-22 Fernando Perez <fperez@colorado.edu>
3024 3028
3025 3029 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
3026 3030 in Magic and ultraTB.
3027 3031
3028 3032 * ipython.1: document threading options in manpage.
3029 3033
3030 3034 * scripts/ipython: Changed name of -thread option to -gthread,
3031 3035 since this is GTK specific. I want to leave the door open for a
3032 3036 -wthread option for WX, which will most likely be necessary. This
3033 3037 change affects usage and ipmaker as well.
3034 3038
3035 3039 * IPython/Shell.py (matplotlib_shell): Add a factory function to
3036 3040 handle the matplotlib shell issues. Code by John Hunter
3037 3041 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3038 3042 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
3039 3043 broken (and disabled for end users) for now, but it puts the
3040 3044 infrastructure in place.
3041 3045
3042 3046 2004-08-21 Fernando Perez <fperez@colorado.edu>
3043 3047
3044 3048 * ipythonrc-pylab: Add matplotlib support.
3045 3049
3046 3050 * matplotlib_config.py: new files for matplotlib support, part of
3047 3051 the pylab profile.
3048 3052
3049 3053 * IPython/usage.py (__doc__): documented the threading options.
3050 3054
3051 3055 2004-08-20 Fernando Perez <fperez@colorado.edu>
3052 3056
3053 3057 * ipython: Modified the main calling routine to handle the -thread
3054 3058 and -mpthread options. This needs to be done as a top-level hack,
3055 3059 because it determines which class to instantiate for IPython
3056 3060 itself.
3057 3061
3058 3062 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
3059 3063 classes to support multithreaded GTK operation without blocking,
3060 3064 and matplotlib with all backends. This is a lot of still very
3061 3065 experimental code, and threads are tricky. So it may still have a
3062 3066 few rough edges... This code owes a lot to
3063 3067 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
3064 3068 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
3065 3069 to John Hunter for all the matplotlib work.
3066 3070
3067 3071 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
3068 3072 options for gtk thread and matplotlib support.
3069 3073
3070 3074 2004-08-16 Fernando Perez <fperez@colorado.edu>
3071 3075
3072 3076 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
3073 3077 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
3074 3078 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
3075 3079
3076 3080 2004-08-11 Fernando Perez <fperez@colorado.edu>
3077 3081
3078 3082 * setup.py (isfile): Fix build so documentation gets updated for
3079 3083 rpms (it was only done for .tgz builds).
3080 3084
3081 3085 2004-08-10 Fernando Perez <fperez@colorado.edu>
3082 3086
3083 3087 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
3084 3088
3085 3089 * iplib.py : Silence syntax error exceptions in tab-completion.
3086 3090
3087 3091 2004-08-05 Fernando Perez <fperez@colorado.edu>
3088 3092
3089 3093 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
3090 3094 'color off' mark for continuation prompts. This was causing long
3091 3095 continuation lines to mis-wrap.
3092 3096
3093 3097 2004-08-01 Fernando Perez <fperez@colorado.edu>
3094 3098
3095 3099 * IPython/ipmaker.py (make_IPython): Allow the shell class used
3096 3100 for building ipython to be a parameter. All this is necessary
3097 3101 right now to have a multithreaded version, but this insane
3098 3102 non-design will be cleaned up soon. For now, it's a hack that
3099 3103 works.
3100 3104
3101 3105 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
3102 3106 args in various places. No bugs so far, but it's a dangerous
3103 3107 practice.
3104 3108
3105 3109 2004-07-31 Fernando Perez <fperez@colorado.edu>
3106 3110
3107 3111 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
3108 3112 fix completion of files with dots in their names under most
3109 3113 profiles (pysh was OK because the completion order is different).
3110 3114
3111 3115 2004-07-27 Fernando Perez <fperez@colorado.edu>
3112 3116
3113 3117 * IPython/iplib.py (InteractiveShell.__init__): build dict of
3114 3118 keywords manually, b/c the one in keyword.py was removed in python
3115 3119 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
3116 3120 This is NOT a bug under python 2.3 and earlier.
3117 3121
3118 3122 2004-07-26 Fernando Perez <fperez@colorado.edu>
3119 3123
3120 3124 * IPython/ultraTB.py (VerboseTB.text): Add another
3121 3125 linecache.checkcache() call to try to prevent inspect.py from
3122 3126 crashing under python 2.3. I think this fixes
3123 3127 http://www.scipy.net/roundup/ipython/issue17.
3124 3128
3125 3129 2004-07-26 *** Released version 0.6.2
3126 3130
3127 3131 2004-07-26 Fernando Perez <fperez@colorado.edu>
3128 3132
3129 3133 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
3130 3134 fail for any number.
3131 3135 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
3132 3136 empty bookmarks.
3133 3137
3134 3138 2004-07-26 *** Released version 0.6.1
3135 3139
3136 3140 2004-07-26 Fernando Perez <fperez@colorado.edu>
3137 3141
3138 3142 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
3139 3143
3140 3144 * IPython/iplib.py (protect_filename): Applied Ville's patch for
3141 3145 escaping '()[]{}' in filenames.
3142 3146
3143 3147 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
3144 3148 Python 2.2 users who lack a proper shlex.split.
3145 3149
3146 3150 2004-07-19 Fernando Perez <fperez@colorado.edu>
3147 3151
3148 3152 * IPython/iplib.py (InteractiveShell.init_readline): Add support
3149 3153 for reading readline's init file. I follow the normal chain:
3150 3154 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
3151 3155 report by Mike Heeter. This closes
3152 3156 http://www.scipy.net/roundup/ipython/issue16.
3153 3157
3154 3158 2004-07-18 Fernando Perez <fperez@colorado.edu>
3155 3159
3156 3160 * IPython/iplib.py (__init__): Add better handling of '\' under
3157 3161 Win32 for filenames. After a patch by Ville.
3158 3162
3159 3163 2004-07-17 Fernando Perez <fperez@colorado.edu>
3160 3164
3161 3165 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3162 3166 autocalling would be triggered for 'foo is bar' if foo is
3163 3167 callable. I also cleaned up the autocall detection code to use a
3164 3168 regexp, which is faster. Bug reported by Alexander Schmolck.
3165 3169
3166 3170 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
3167 3171 '?' in them would confuse the help system. Reported by Alex
3168 3172 Schmolck.
3169 3173
3170 3174 2004-07-16 Fernando Perez <fperez@colorado.edu>
3171 3175
3172 3176 * IPython/GnuplotInteractive.py (__all__): added plot2.
3173 3177
3174 3178 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
3175 3179 plotting dictionaries, lists or tuples of 1d arrays.
3176 3180
3177 3181 * IPython/Magic.py (Magic.magic_hist): small clenaups and
3178 3182 optimizations.
3179 3183
3180 3184 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
3181 3185 the information which was there from Janko's original IPP code:
3182 3186
3183 3187 03.05.99 20:53 porto.ifm.uni-kiel.de
3184 3188 --Started changelog.
3185 3189 --make clear do what it say it does
3186 3190 --added pretty output of lines from inputcache
3187 3191 --Made Logger a mixin class, simplifies handling of switches
3188 3192 --Added own completer class. .string<TAB> expands to last history
3189 3193 line which starts with string. The new expansion is also present
3190 3194 with Ctrl-r from the readline library. But this shows, who this
3191 3195 can be done for other cases.
3192 3196 --Added convention that all shell functions should accept a
3193 3197 parameter_string This opens the door for different behaviour for
3194 3198 each function. @cd is a good example of this.
3195 3199
3196 3200 04.05.99 12:12 porto.ifm.uni-kiel.de
3197 3201 --added logfile rotation
3198 3202 --added new mainloop method which freezes first the namespace
3199 3203
3200 3204 07.05.99 21:24 porto.ifm.uni-kiel.de
3201 3205 --added the docreader classes. Now there is a help system.
3202 3206 -This is only a first try. Currently it's not easy to put new
3203 3207 stuff in the indices. But this is the way to go. Info would be
3204 3208 better, but HTML is every where and not everybody has an info
3205 3209 system installed and it's not so easy to change html-docs to info.
3206 3210 --added global logfile option
3207 3211 --there is now a hook for object inspection method pinfo needs to
3208 3212 be provided for this. Can be reached by two '??'.
3209 3213
3210 3214 08.05.99 20:51 porto.ifm.uni-kiel.de
3211 3215 --added a README
3212 3216 --bug in rc file. Something has changed so functions in the rc
3213 3217 file need to reference the shell and not self. Not clear if it's a
3214 3218 bug or feature.
3215 3219 --changed rc file for new behavior
3216 3220
3217 3221 2004-07-15 Fernando Perez <fperez@colorado.edu>
3218 3222
3219 3223 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3220 3224 cache was falling out of sync in bizarre manners when multi-line
3221 3225 input was present. Minor optimizations and cleanup.
3222 3226
3223 3227 (Logger): Remove old Changelog info for cleanup. This is the
3224 3228 information which was there from Janko's original code:
3225 3229
3226 3230 Changes to Logger: - made the default log filename a parameter
3227 3231
3228 3232 - put a check for lines beginning with !@? in log(). Needed
3229 3233 (even if the handlers properly log their lines) for mid-session
3230 3234 logging activation to work properly. Without this, lines logged
3231 3235 in mid session, which get read from the cache, would end up
3232 3236 'bare' (with !@? in the open) in the log. Now they are caught
3233 3237 and prepended with a #.
3234 3238
3235 3239 * IPython/iplib.py (InteractiveShell.init_readline): added check
3236 3240 in case MagicCompleter fails to be defined, so we don't crash.
3237 3241
3238 3242 2004-07-13 Fernando Perez <fperez@colorado.edu>
3239 3243
3240 3244 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
3241 3245 of EPS if the requested filename ends in '.eps'.
3242 3246
3243 3247 2004-07-04 Fernando Perez <fperez@colorado.edu>
3244 3248
3245 3249 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
3246 3250 escaping of quotes when calling the shell.
3247 3251
3248 3252 2004-07-02 Fernando Perez <fperez@colorado.edu>
3249 3253
3250 3254 * IPython/Prompts.py (CachedOutput.update): Fix problem with
3251 3255 gettext not working because we were clobbering '_'. Fixes
3252 3256 http://www.scipy.net/roundup/ipython/issue6.
3253 3257
3254 3258 2004-07-01 Fernando Perez <fperez@colorado.edu>
3255 3259
3256 3260 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
3257 3261 into @cd. Patch by Ville.
3258 3262
3259 3263 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3260 3264 new function to store things after ipmaker runs. Patch by Ville.
3261 3265 Eventually this will go away once ipmaker is removed and the class
3262 3266 gets cleaned up, but for now it's ok. Key functionality here is
3263 3267 the addition of the persistent storage mechanism, a dict for
3264 3268 keeping data across sessions (for now just bookmarks, but more can
3265 3269 be implemented later).
3266 3270
3267 3271 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
3268 3272 persistent across sections. Patch by Ville, I modified it
3269 3273 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
3270 3274 added a '-l' option to list all bookmarks.
3271 3275
3272 3276 * IPython/iplib.py (InteractiveShell.atexit_operations): new
3273 3277 center for cleanup. Registered with atexit.register(). I moved
3274 3278 here the old exit_cleanup(). After a patch by Ville.
3275 3279
3276 3280 * IPython/Magic.py (get_py_filename): added '~' to the accepted
3277 3281 characters in the hacked shlex_split for python 2.2.
3278 3282
3279 3283 * IPython/iplib.py (file_matches): more fixes to filenames with
3280 3284 whitespace in them. It's not perfect, but limitations in python's
3281 3285 readline make it impossible to go further.
3282 3286
3283 3287 2004-06-29 Fernando Perez <fperez@colorado.edu>
3284 3288
3285 3289 * IPython/iplib.py (file_matches): escape whitespace correctly in
3286 3290 filename completions. Bug reported by Ville.
3287 3291
3288 3292 2004-06-28 Fernando Perez <fperez@colorado.edu>
3289 3293
3290 3294 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
3291 3295 the history file will be called 'history-PROFNAME' (or just
3292 3296 'history' if no profile is loaded). I was getting annoyed at
3293 3297 getting my Numerical work history clobbered by pysh sessions.
3294 3298
3295 3299 * IPython/iplib.py (InteractiveShell.__init__): Internal
3296 3300 getoutputerror() function so that we can honor the system_verbose
3297 3301 flag for _all_ system calls. I also added escaping of #
3298 3302 characters here to avoid confusing Itpl.
3299 3303
3300 3304 * IPython/Magic.py (shlex_split): removed call to shell in
3301 3305 parse_options and replaced it with shlex.split(). The annoying
3302 3306 part was that in Python 2.2, shlex.split() doesn't exist, so I had
3303 3307 to backport it from 2.3, with several frail hacks (the shlex
3304 3308 module is rather limited in 2.2). Thanks to a suggestion by Ville
3305 3309 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
3306 3310 problem.
3307 3311
3308 3312 (Magic.magic_system_verbose): new toggle to print the actual
3309 3313 system calls made by ipython. Mainly for debugging purposes.
3310 3314
3311 3315 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
3312 3316 doesn't support persistence. Reported (and fix suggested) by
3313 3317 Travis Caldwell <travis_caldwell2000@yahoo.com>.
3314 3318
3315 3319 2004-06-26 Fernando Perez <fperez@colorado.edu>
3316 3320
3317 3321 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3318 3322 continue prompts.
3319 3323
3320 3324 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3321 3325 function (basically a big docstring) and a few more things here to
3322 3326 speedup startup. pysh.py is now very lightweight. We want because
3323 3327 it gets execfile'd, while InterpreterExec gets imported, so
3324 3328 byte-compilation saves time.
3325 3329
3326 3330 2004-06-25 Fernando Perez <fperez@colorado.edu>
3327 3331
3328 3332 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3329 3333 -NUM', which was recently broken.
3330 3334
3331 3335 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3332 3336 in multi-line input (but not !!, which doesn't make sense there).
3333 3337
3334 3338 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3335 3339 It's just too useful, and people can turn it off in the less
3336 3340 common cases where it's a problem.
3337 3341
3338 3342 2004-06-24 Fernando Perez <fperez@colorado.edu>
3339 3343
3340 3344 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3341 3345 special syntaxes (like alias calling) is now allied in multi-line
3342 3346 input. This is still _very_ experimental, but it's necessary for
3343 3347 efficient shell usage combining python looping syntax with system
3344 3348 calls. For now it's restricted to aliases, I don't think it
3345 3349 really even makes sense to have this for magics.
3346 3350
3347 3351 2004-06-23 Fernando Perez <fperez@colorado.edu>
3348 3352
3349 3353 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3350 3354 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3351 3355
3352 3356 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3353 3357 extensions under Windows (after code sent by Gary Bishop). The
3354 3358 extensions considered 'executable' are stored in IPython's rc
3355 3359 structure as win_exec_ext.
3356 3360
3357 3361 * IPython/genutils.py (shell): new function, like system() but
3358 3362 without return value. Very useful for interactive shell work.
3359 3363
3360 3364 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3361 3365 delete aliases.
3362 3366
3363 3367 * IPython/iplib.py (InteractiveShell.alias_table_update): make
3364 3368 sure that the alias table doesn't contain python keywords.
3365 3369
3366 3370 2004-06-21 Fernando Perez <fperez@colorado.edu>
3367 3371
3368 3372 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
3369 3373 non-existent items are found in $PATH. Reported by Thorsten.
3370 3374
3371 3375 2004-06-20 Fernando Perez <fperez@colorado.edu>
3372 3376
3373 3377 * IPython/iplib.py (complete): modified the completer so that the
3374 3378 order of priorities can be easily changed at runtime.
3375 3379
3376 3380 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
3377 3381 Modified to auto-execute all lines beginning with '~', '/' or '.'.
3378 3382
3379 3383 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
3380 3384 expand Python variables prepended with $ in all system calls. The
3381 3385 same was done to InteractiveShell.handle_shell_escape. Now all
3382 3386 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
3383 3387 expansion of python variables and expressions according to the
3384 3388 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
3385 3389
3386 3390 Though PEP-215 has been rejected, a similar (but simpler) one
3387 3391 seems like it will go into Python 2.4, PEP-292 -
3388 3392 http://www.python.org/peps/pep-0292.html.
3389 3393
3390 3394 I'll keep the full syntax of PEP-215, since IPython has since the
3391 3395 start used Ka-Ping Yee's reference implementation discussed there
3392 3396 (Itpl), and I actually like the powerful semantics it offers.
3393 3397
3394 3398 In order to access normal shell variables, the $ has to be escaped
3395 3399 via an extra $. For example:
3396 3400
3397 3401 In [7]: PATH='a python variable'
3398 3402
3399 3403 In [8]: !echo $PATH
3400 3404 a python variable
3401 3405
3402 3406 In [9]: !echo $$PATH
3403 3407 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
3404 3408
3405 3409 (Magic.parse_options): escape $ so the shell doesn't evaluate
3406 3410 things prematurely.
3407 3411
3408 3412 * IPython/iplib.py (InteractiveShell.call_alias): added the
3409 3413 ability for aliases to expand python variables via $.
3410 3414
3411 3415 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
3412 3416 system, now there's a @rehash/@rehashx pair of magics. These work
3413 3417 like the csh rehash command, and can be invoked at any time. They
3414 3418 build a table of aliases to everything in the user's $PATH
3415 3419 (@rehash uses everything, @rehashx is slower but only adds
3416 3420 executable files). With this, the pysh.py-based shell profile can
3417 3421 now simply call rehash upon startup, and full access to all
3418 3422 programs in the user's path is obtained.
3419 3423
3420 3424 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
3421 3425 functionality is now fully in place. I removed the old dynamic
3422 3426 code generation based approach, in favor of a much lighter one
3423 3427 based on a simple dict. The advantage is that this allows me to
3424 3428 now have thousands of aliases with negligible cost (unthinkable
3425 3429 with the old system).
3426 3430
3427 3431 2004-06-19 Fernando Perez <fperez@colorado.edu>
3428 3432
3429 3433 * IPython/iplib.py (__init__): extended MagicCompleter class to
3430 3434 also complete (last in priority) on user aliases.
3431 3435
3432 3436 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
3433 3437 call to eval.
3434 3438 (ItplNS.__init__): Added a new class which functions like Itpl,
3435 3439 but allows configuring the namespace for the evaluation to occur
3436 3440 in.
3437 3441
3438 3442 2004-06-18 Fernando Perez <fperez@colorado.edu>
3439 3443
3440 3444 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
3441 3445 better message when 'exit' or 'quit' are typed (a common newbie
3442 3446 confusion).
3443 3447
3444 3448 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
3445 3449 check for Windows users.
3446 3450
3447 3451 * IPython/iplib.py (InteractiveShell.user_setup): removed
3448 3452 disabling of colors for Windows. I'll test at runtime and issue a
3449 3453 warning if Gary's readline isn't found, as to nudge users to
3450 3454 download it.
3451 3455
3452 3456 2004-06-16 Fernando Perez <fperez@colorado.edu>
3453 3457
3454 3458 * IPython/genutils.py (Stream.__init__): changed to print errors
3455 3459 to sys.stderr. I had a circular dependency here. Now it's
3456 3460 possible to run ipython as IDLE's shell (consider this pre-alpha,
3457 3461 since true stdout things end up in the starting terminal instead
3458 3462 of IDLE's out).
3459 3463
3460 3464 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
3461 3465 users who haven't # updated their prompt_in2 definitions. Remove
3462 3466 eventually.
3463 3467 (multiple_replace): added credit to original ASPN recipe.
3464 3468
3465 3469 2004-06-15 Fernando Perez <fperez@colorado.edu>
3466 3470
3467 3471 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
3468 3472 list of auto-defined aliases.
3469 3473
3470 3474 2004-06-13 Fernando Perez <fperez@colorado.edu>
3471 3475
3472 3476 * setup.py (scriptfiles): Don't trigger win_post_install unless an
3473 3477 install was really requested (so setup.py can be used for other
3474 3478 things under Windows).
3475 3479
3476 3480 2004-06-10 Fernando Perez <fperez@colorado.edu>
3477 3481
3478 3482 * IPython/Logger.py (Logger.create_log): Manually remove any old
3479 3483 backup, since os.remove may fail under Windows. Fixes bug
3480 3484 reported by Thorsten.
3481 3485
3482 3486 2004-06-09 Fernando Perez <fperez@colorado.edu>
3483 3487
3484 3488 * examples/example-embed.py: fixed all references to %n (replaced
3485 3489 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
3486 3490 for all examples and the manual as well.
3487 3491
3488 3492 2004-06-08 Fernando Perez <fperez@colorado.edu>
3489 3493
3490 3494 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3491 3495 alignment and color management. All 3 prompt subsystems now
3492 3496 inherit from BasePrompt.
3493 3497
3494 3498 * tools/release: updates for windows installer build and tag rpms
3495 3499 with python version (since paths are fixed).
3496 3500
3497 3501 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3498 3502 which will become eventually obsolete. Also fixed the default
3499 3503 prompt_in2 to use \D, so at least new users start with the correct
3500 3504 defaults.
3501 3505 WARNING: Users with existing ipythonrc files will need to apply
3502 3506 this fix manually!
3503 3507
3504 3508 * setup.py: make windows installer (.exe). This is finally the
3505 3509 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3506 3510 which I hadn't included because it required Python 2.3 (or recent
3507 3511 distutils).
3508 3512
3509 3513 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3510 3514 usage of new '\D' escape.
3511 3515
3512 3516 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3513 3517 lacks os.getuid())
3514 3518 (CachedOutput.set_colors): Added the ability to turn coloring
3515 3519 on/off with @colors even for manually defined prompt colors. It
3516 3520 uses a nasty global, but it works safely and via the generic color
3517 3521 handling mechanism.
3518 3522 (Prompt2.__init__): Introduced new escape '\D' for continuation
3519 3523 prompts. It represents the counter ('\#') as dots.
3520 3524 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3521 3525 need to update their ipythonrc files and replace '%n' with '\D' in
3522 3526 their prompt_in2 settings everywhere. Sorry, but there's
3523 3527 otherwise no clean way to get all prompts to properly align. The
3524 3528 ipythonrc shipped with IPython has been updated.
3525 3529
3526 3530 2004-06-07 Fernando Perez <fperez@colorado.edu>
3527 3531
3528 3532 * setup.py (isfile): Pass local_icons option to latex2html, so the
3529 3533 resulting HTML file is self-contained. Thanks to
3530 3534 dryice-AT-liu.com.cn for the tip.
3531 3535
3532 3536 * pysh.py: I created a new profile 'shell', which implements a
3533 3537 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3534 3538 system shell, nor will it become one anytime soon. It's mainly
3535 3539 meant to illustrate the use of the new flexible bash-like prompts.
3536 3540 I guess it could be used by hardy souls for true shell management,
3537 3541 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3538 3542 profile. This uses the InterpreterExec extension provided by
3539 3543 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3540 3544
3541 3545 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3542 3546 auto-align itself with the length of the previous input prompt
3543 3547 (taking into account the invisible color escapes).
3544 3548 (CachedOutput.__init__): Large restructuring of this class. Now
3545 3549 all three prompts (primary1, primary2, output) are proper objects,
3546 3550 managed by the 'parent' CachedOutput class. The code is still a
3547 3551 bit hackish (all prompts share state via a pointer to the cache),
3548 3552 but it's overall far cleaner than before.
3549 3553
3550 3554 * IPython/genutils.py (getoutputerror): modified to add verbose,
3551 3555 debug and header options. This makes the interface of all getout*
3552 3556 functions uniform.
3553 3557 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3554 3558
3555 3559 * IPython/Magic.py (Magic.default_option): added a function to
3556 3560 allow registering default options for any magic command. This
3557 3561 makes it easy to have profiles which customize the magics globally
3558 3562 for a certain use. The values set through this function are
3559 3563 picked up by the parse_options() method, which all magics should
3560 3564 use to parse their options.
3561 3565
3562 3566 * IPython/genutils.py (warn): modified the warnings framework to
3563 3567 use the Term I/O class. I'm trying to slowly unify all of
3564 3568 IPython's I/O operations to pass through Term.
3565 3569
3566 3570 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3567 3571 the secondary prompt to correctly match the length of the primary
3568 3572 one for any prompt. Now multi-line code will properly line up
3569 3573 even for path dependent prompts, such as the new ones available
3570 3574 via the prompt_specials.
3571 3575
3572 3576 2004-06-06 Fernando Perez <fperez@colorado.edu>
3573 3577
3574 3578 * IPython/Prompts.py (prompt_specials): Added the ability to have
3575 3579 bash-like special sequences in the prompts, which get
3576 3580 automatically expanded. Things like hostname, current working
3577 3581 directory and username are implemented already, but it's easy to
3578 3582 add more in the future. Thanks to a patch by W.J. van der Laan
3579 3583 <gnufnork-AT-hetdigitalegat.nl>
3580 3584 (prompt_specials): Added color support for prompt strings, so
3581 3585 users can define arbitrary color setups for their prompts.
3582 3586
3583 3587 2004-06-05 Fernando Perez <fperez@colorado.edu>
3584 3588
3585 3589 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3586 3590 code to load Gary Bishop's readline and configure it
3587 3591 automatically. Thanks to Gary for help on this.
3588 3592
3589 3593 2004-06-01 Fernando Perez <fperez@colorado.edu>
3590 3594
3591 3595 * IPython/Logger.py (Logger.create_log): fix bug for logging
3592 3596 with no filename (previous fix was incomplete).
3593 3597
3594 3598 2004-05-25 Fernando Perez <fperez@colorado.edu>
3595 3599
3596 3600 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3597 3601 parens would get passed to the shell.
3598 3602
3599 3603 2004-05-20 Fernando Perez <fperez@colorado.edu>
3600 3604
3601 3605 * IPython/Magic.py (Magic.magic_prun): changed default profile
3602 3606 sort order to 'time' (the more common profiling need).
3603 3607
3604 3608 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3605 3609 so that source code shown is guaranteed in sync with the file on
3606 3610 disk (also changed in psource). Similar fix to the one for
3607 3611 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3608 3612 <yann.ledu-AT-noos.fr>.
3609 3613
3610 3614 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3611 3615 with a single option would not be correctly parsed. Closes
3612 3616 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3613 3617 introduced in 0.6.0 (on 2004-05-06).
3614 3618
3615 3619 2004-05-13 *** Released version 0.6.0
3616 3620
3617 3621 2004-05-13 Fernando Perez <fperez@colorado.edu>
3618 3622
3619 3623 * debian/: Added debian/ directory to CVS, so that debian support
3620 3624 is publicly accessible. The debian package is maintained by Jack
3621 3625 Moffit <jack-AT-xiph.org>.
3622 3626
3623 3627 * Documentation: included the notes about an ipython-based system
3624 3628 shell (the hypothetical 'pysh') into the new_design.pdf document,
3625 3629 so that these ideas get distributed to users along with the
3626 3630 official documentation.
3627 3631
3628 3632 2004-05-10 Fernando Perez <fperez@colorado.edu>
3629 3633
3630 3634 * IPython/Logger.py (Logger.create_log): fix recently introduced
3631 3635 bug (misindented line) where logstart would fail when not given an
3632 3636 explicit filename.
3633 3637
3634 3638 2004-05-09 Fernando Perez <fperez@colorado.edu>
3635 3639
3636 3640 * IPython/Magic.py (Magic.parse_options): skip system call when
3637 3641 there are no options to look for. Faster, cleaner for the common
3638 3642 case.
3639 3643
3640 3644 * Documentation: many updates to the manual: describing Windows
3641 3645 support better, Gnuplot updates, credits, misc small stuff. Also
3642 3646 updated the new_design doc a bit.
3643 3647
3644 3648 2004-05-06 *** Released version 0.6.0.rc1
3645 3649
3646 3650 2004-05-06 Fernando Perez <fperez@colorado.edu>
3647 3651
3648 3652 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3649 3653 operations to use the vastly more efficient list/''.join() method.
3650 3654 (FormattedTB.text): Fix
3651 3655 http://www.scipy.net/roundup/ipython/issue12 - exception source
3652 3656 extract not updated after reload. Thanks to Mike Salib
3653 3657 <msalib-AT-mit.edu> for pinning the source of the problem.
3654 3658 Fortunately, the solution works inside ipython and doesn't require
3655 3659 any changes to python proper.
3656 3660
3657 3661 * IPython/Magic.py (Magic.parse_options): Improved to process the
3658 3662 argument list as a true shell would (by actually using the
3659 3663 underlying system shell). This way, all @magics automatically get
3660 3664 shell expansion for variables. Thanks to a comment by Alex
3661 3665 Schmolck.
3662 3666
3663 3667 2004-04-04 Fernando Perez <fperez@colorado.edu>
3664 3668
3665 3669 * IPython/iplib.py (InteractiveShell.interact): Added a special
3666 3670 trap for a debugger quit exception, which is basically impossible
3667 3671 to handle by normal mechanisms, given what pdb does to the stack.
3668 3672 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3669 3673
3670 3674 2004-04-03 Fernando Perez <fperez@colorado.edu>
3671 3675
3672 3676 * IPython/genutils.py (Term): Standardized the names of the Term
3673 3677 class streams to cin/cout/cerr, following C++ naming conventions
3674 3678 (I can't use in/out/err because 'in' is not a valid attribute
3675 3679 name).
3676 3680
3677 3681 * IPython/iplib.py (InteractiveShell.interact): don't increment
3678 3682 the prompt if there's no user input. By Daniel 'Dang' Griffith
3679 3683 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3680 3684 Francois Pinard.
3681 3685
3682 3686 2004-04-02 Fernando Perez <fperez@colorado.edu>
3683 3687
3684 3688 * IPython/genutils.py (Stream.__init__): Modified to survive at
3685 3689 least importing in contexts where stdin/out/err aren't true file
3686 3690 objects, such as PyCrust (they lack fileno() and mode). However,
3687 3691 the recovery facilities which rely on these things existing will
3688 3692 not work.
3689 3693
3690 3694 2004-04-01 Fernando Perez <fperez@colorado.edu>
3691 3695
3692 3696 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3693 3697 use the new getoutputerror() function, so it properly
3694 3698 distinguishes stdout/err.
3695 3699
3696 3700 * IPython/genutils.py (getoutputerror): added a function to
3697 3701 capture separately the standard output and error of a command.
3698 3702 After a comment from dang on the mailing lists. This code is
3699 3703 basically a modified version of commands.getstatusoutput(), from
3700 3704 the standard library.
3701 3705
3702 3706 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3703 3707 '!!' as a special syntax (shorthand) to access @sx.
3704 3708
3705 3709 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3706 3710 command and return its output as a list split on '\n'.
3707 3711
3708 3712 2004-03-31 Fernando Perez <fperez@colorado.edu>
3709 3713
3710 3714 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3711 3715 method to dictionaries used as FakeModule instances if they lack
3712 3716 it. At least pydoc in python2.3 breaks for runtime-defined
3713 3717 functions without this hack. At some point I need to _really_
3714 3718 understand what FakeModule is doing, because it's a gross hack.
3715 3719 But it solves Arnd's problem for now...
3716 3720
3717 3721 2004-02-27 Fernando Perez <fperez@colorado.edu>
3718 3722
3719 3723 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3720 3724 mode would behave erratically. Also increased the number of
3721 3725 possible logs in rotate mod to 999. Thanks to Rod Holland
3722 3726 <rhh@StructureLABS.com> for the report and fixes.
3723 3727
3724 3728 2004-02-26 Fernando Perez <fperez@colorado.edu>
3725 3729
3726 3730 * IPython/genutils.py (page): Check that the curses module really
3727 3731 has the initscr attribute before trying to use it. For some
3728 3732 reason, the Solaris curses module is missing this. I think this
3729 3733 should be considered a Solaris python bug, but I'm not sure.
3730 3734
3731 3735 2004-01-17 Fernando Perez <fperez@colorado.edu>
3732 3736
3733 3737 * IPython/genutils.py (Stream.__init__): Changes to try to make
3734 3738 ipython robust against stdin/out/err being closed by the user.
3735 3739 This is 'user error' (and blocks a normal python session, at least
3736 3740 the stdout case). However, Ipython should be able to survive such
3737 3741 instances of abuse as gracefully as possible. To simplify the
3738 3742 coding and maintain compatibility with Gary Bishop's Term
3739 3743 contributions, I've made use of classmethods for this. I think
3740 3744 this introduces a dependency on python 2.2.
3741 3745
3742 3746 2004-01-13 Fernando Perez <fperez@colorado.edu>
3743 3747
3744 3748 * IPython/numutils.py (exp_safe): simplified the code a bit and
3745 3749 removed the need for importing the kinds module altogether.
3746 3750
3747 3751 2004-01-06 Fernando Perez <fperez@colorado.edu>
3748 3752
3749 3753 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3750 3754 a magic function instead, after some community feedback. No
3751 3755 special syntax will exist for it, but its name is deliberately
3752 3756 very short.
3753 3757
3754 3758 2003-12-20 Fernando Perez <fperez@colorado.edu>
3755 3759
3756 3760 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3757 3761 new functionality, to automagically assign the result of a shell
3758 3762 command to a variable. I'll solicit some community feedback on
3759 3763 this before making it permanent.
3760 3764
3761 3765 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3762 3766 requested about callables for which inspect couldn't obtain a
3763 3767 proper argspec. Thanks to a crash report sent by Etienne
3764 3768 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3765 3769
3766 3770 2003-12-09 Fernando Perez <fperez@colorado.edu>
3767 3771
3768 3772 * IPython/genutils.py (page): patch for the pager to work across
3769 3773 various versions of Windows. By Gary Bishop.
3770 3774
3771 3775 2003-12-04 Fernando Perez <fperez@colorado.edu>
3772 3776
3773 3777 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3774 3778 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3775 3779 While I tested this and it looks ok, there may still be corner
3776 3780 cases I've missed.
3777 3781
3778 3782 2003-12-01 Fernando Perez <fperez@colorado.edu>
3779 3783
3780 3784 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3781 3785 where a line like 'p,q=1,2' would fail because the automagic
3782 3786 system would be triggered for @p.
3783 3787
3784 3788 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3785 3789 cleanups, code unmodified.
3786 3790
3787 3791 * IPython/genutils.py (Term): added a class for IPython to handle
3788 3792 output. In most cases it will just be a proxy for stdout/err, but
3789 3793 having this allows modifications to be made for some platforms,
3790 3794 such as handling color escapes under Windows. All of this code
3791 3795 was contributed by Gary Bishop, with minor modifications by me.
3792 3796 The actual changes affect many files.
3793 3797
3794 3798 2003-11-30 Fernando Perez <fperez@colorado.edu>
3795 3799
3796 3800 * IPython/iplib.py (file_matches): new completion code, courtesy
3797 3801 of Jeff Collins. This enables filename completion again under
3798 3802 python 2.3, which disabled it at the C level.
3799 3803
3800 3804 2003-11-11 Fernando Perez <fperez@colorado.edu>
3801 3805
3802 3806 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3803 3807 for Numeric.array(map(...)), but often convenient.
3804 3808
3805 3809 2003-11-05 Fernando Perez <fperez@colorado.edu>
3806 3810
3807 3811 * IPython/numutils.py (frange): Changed a call from int() to
3808 3812 int(round()) to prevent a problem reported with arange() in the
3809 3813 numpy list.
3810 3814
3811 3815 2003-10-06 Fernando Perez <fperez@colorado.edu>
3812 3816
3813 3817 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3814 3818 prevent crashes if sys lacks an argv attribute (it happens with
3815 3819 embedded interpreters which build a bare-bones sys module).
3816 3820 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3817 3821
3818 3822 2003-09-24 Fernando Perez <fperez@colorado.edu>
3819 3823
3820 3824 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3821 3825 to protect against poorly written user objects where __getattr__
3822 3826 raises exceptions other than AttributeError. Thanks to a bug
3823 3827 report by Oliver Sander <osander-AT-gmx.de>.
3824 3828
3825 3829 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3826 3830 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3827 3831
3828 3832 2003-09-09 Fernando Perez <fperez@colorado.edu>
3829 3833
3830 3834 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3831 3835 unpacking a list whith a callable as first element would
3832 3836 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3833 3837 Collins.
3834 3838
3835 3839 2003-08-25 *** Released version 0.5.0
3836 3840
3837 3841 2003-08-22 Fernando Perez <fperez@colorado.edu>
3838 3842
3839 3843 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3840 3844 improperly defined user exceptions. Thanks to feedback from Mark
3841 3845 Russell <mrussell-AT-verio.net>.
3842 3846
3843 3847 2003-08-20 Fernando Perez <fperez@colorado.edu>
3844 3848
3845 3849 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3846 3850 printing so that it would print multi-line string forms starting
3847 3851 with a new line. This way the formatting is better respected for
3848 3852 objects which work hard to make nice string forms.
3849 3853
3850 3854 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3851 3855 autocall would overtake data access for objects with both
3852 3856 __getitem__ and __call__.
3853 3857
3854 3858 2003-08-19 *** Released version 0.5.0-rc1
3855 3859
3856 3860 2003-08-19 Fernando Perez <fperez@colorado.edu>
3857 3861
3858 3862 * IPython/deep_reload.py (load_tail): single tiny change here
3859 3863 seems to fix the long-standing bug of dreload() failing to work
3860 3864 for dotted names. But this module is pretty tricky, so I may have
3861 3865 missed some subtlety. Needs more testing!.
3862 3866
3863 3867 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3864 3868 exceptions which have badly implemented __str__ methods.
3865 3869 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3866 3870 which I've been getting reports about from Python 2.3 users. I
3867 3871 wish I had a simple test case to reproduce the problem, so I could
3868 3872 either write a cleaner workaround or file a bug report if
3869 3873 necessary.
3870 3874
3871 3875 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3872 3876 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3873 3877 a bug report by Tjabo Kloppenburg.
3874 3878
3875 3879 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3876 3880 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3877 3881 seems rather unstable. Thanks to a bug report by Tjabo
3878 3882 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3879 3883
3880 3884 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3881 3885 this out soon because of the critical fixes in the inner loop for
3882 3886 generators.
3883 3887
3884 3888 * IPython/Magic.py (Magic.getargspec): removed. This (and
3885 3889 _get_def) have been obsoleted by OInspect for a long time, I
3886 3890 hadn't noticed that they were dead code.
3887 3891 (Magic._ofind): restored _ofind functionality for a few literals
3888 3892 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3889 3893 for things like "hello".capitalize?, since that would require a
3890 3894 potentially dangerous eval() again.
3891 3895
3892 3896 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3893 3897 logic a bit more to clean up the escapes handling and minimize the
3894 3898 use of _ofind to only necessary cases. The interactive 'feel' of
3895 3899 IPython should have improved quite a bit with the changes in
3896 3900 _prefilter and _ofind (besides being far safer than before).
3897 3901
3898 3902 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3899 3903 obscure, never reported). Edit would fail to find the object to
3900 3904 edit under some circumstances.
3901 3905 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3902 3906 which were causing double-calling of generators. Those eval calls
3903 3907 were _very_ dangerous, since code with side effects could be
3904 3908 triggered. As they say, 'eval is evil'... These were the
3905 3909 nastiest evals in IPython. Besides, _ofind is now far simpler,
3906 3910 and it should also be quite a bit faster. Its use of inspect is
3907 3911 also safer, so perhaps some of the inspect-related crashes I've
3908 3912 seen lately with Python 2.3 might be taken care of. That will
3909 3913 need more testing.
3910 3914
3911 3915 2003-08-17 Fernando Perez <fperez@colorado.edu>
3912 3916
3913 3917 * IPython/iplib.py (InteractiveShell._prefilter): significant
3914 3918 simplifications to the logic for handling user escapes. Faster
3915 3919 and simpler code.
3916 3920
3917 3921 2003-08-14 Fernando Perez <fperez@colorado.edu>
3918 3922
3919 3923 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3920 3924 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3921 3925 but it should be quite a bit faster. And the recursive version
3922 3926 generated O(log N) intermediate storage for all rank>1 arrays,
3923 3927 even if they were contiguous.
3924 3928 (l1norm): Added this function.
3925 3929 (norm): Added this function for arbitrary norms (including
3926 3930 l-infinity). l1 and l2 are still special cases for convenience
3927 3931 and speed.
3928 3932
3929 3933 2003-08-03 Fernando Perez <fperez@colorado.edu>
3930 3934
3931 3935 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3932 3936 exceptions, which now raise PendingDeprecationWarnings in Python
3933 3937 2.3. There were some in Magic and some in Gnuplot2.
3934 3938
3935 3939 2003-06-30 Fernando Perez <fperez@colorado.edu>
3936 3940
3937 3941 * IPython/genutils.py (page): modified to call curses only for
3938 3942 terminals where TERM=='xterm'. After problems under many other
3939 3943 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3940 3944
3941 3945 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3942 3946 would be triggered when readline was absent. This was just an old
3943 3947 debugging statement I'd forgotten to take out.
3944 3948
3945 3949 2003-06-20 Fernando Perez <fperez@colorado.edu>
3946 3950
3947 3951 * IPython/genutils.py (clock): modified to return only user time
3948 3952 (not counting system time), after a discussion on scipy. While
3949 3953 system time may be a useful quantity occasionally, it may much
3950 3954 more easily be skewed by occasional swapping or other similar
3951 3955 activity.
3952 3956
3953 3957 2003-06-05 Fernando Perez <fperez@colorado.edu>
3954 3958
3955 3959 * IPython/numutils.py (identity): new function, for building
3956 3960 arbitrary rank Kronecker deltas (mostly backwards compatible with
3957 3961 Numeric.identity)
3958 3962
3959 3963 2003-06-03 Fernando Perez <fperez@colorado.edu>
3960 3964
3961 3965 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3962 3966 arguments passed to magics with spaces, to allow trailing '\' to
3963 3967 work normally (mainly for Windows users).
3964 3968
3965 3969 2003-05-29 Fernando Perez <fperez@colorado.edu>
3966 3970
3967 3971 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3968 3972 instead of pydoc.help. This fixes a bizarre behavior where
3969 3973 printing '%s' % locals() would trigger the help system. Now
3970 3974 ipython behaves like normal python does.
3971 3975
3972 3976 Note that if one does 'from pydoc import help', the bizarre
3973 3977 behavior returns, but this will also happen in normal python, so
3974 3978 it's not an ipython bug anymore (it has to do with how pydoc.help
3975 3979 is implemented).
3976 3980
3977 3981 2003-05-22 Fernando Perez <fperez@colorado.edu>
3978 3982
3979 3983 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3980 3984 return [] instead of None when nothing matches, also match to end
3981 3985 of line. Patch by Gary Bishop.
3982 3986
3983 3987 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3984 3988 protection as before, for files passed on the command line. This
3985 3989 prevents the CrashHandler from kicking in if user files call into
3986 3990 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3987 3991 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3988 3992
3989 3993 2003-05-20 *** Released version 0.4.0
3990 3994
3991 3995 2003-05-20 Fernando Perez <fperez@colorado.edu>
3992 3996
3993 3997 * setup.py: added support for manpages. It's a bit hackish b/c of
3994 3998 a bug in the way the bdist_rpm distutils target handles gzipped
3995 3999 manpages, but it works. After a patch by Jack.
3996 4000
3997 4001 2003-05-19 Fernando Perez <fperez@colorado.edu>
3998 4002
3999 4003 * IPython/numutils.py: added a mockup of the kinds module, since
4000 4004 it was recently removed from Numeric. This way, numutils will
4001 4005 work for all users even if they are missing kinds.
4002 4006
4003 4007 * IPython/Magic.py (Magic._ofind): Harden against an inspect
4004 4008 failure, which can occur with SWIG-wrapped extensions. After a
4005 4009 crash report from Prabhu.
4006 4010
4007 4011 2003-05-16 Fernando Perez <fperez@colorado.edu>
4008 4012
4009 4013 * IPython/iplib.py (InteractiveShell.excepthook): New method to
4010 4014 protect ipython from user code which may call directly
4011 4015 sys.excepthook (this looks like an ipython crash to the user, even
4012 4016 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4013 4017 This is especially important to help users of WxWindows, but may
4014 4018 also be useful in other cases.
4015 4019
4016 4020 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
4017 4021 an optional tb_offset to be specified, and to preserve exception
4018 4022 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4019 4023
4020 4024 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
4021 4025
4022 4026 2003-05-15 Fernando Perez <fperez@colorado.edu>
4023 4027
4024 4028 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
4025 4029 installing for a new user under Windows.
4026 4030
4027 4031 2003-05-12 Fernando Perez <fperez@colorado.edu>
4028 4032
4029 4033 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
4030 4034 handler for Emacs comint-based lines. Currently it doesn't do
4031 4035 much (but importantly, it doesn't update the history cache). In
4032 4036 the future it may be expanded if Alex needs more functionality
4033 4037 there.
4034 4038
4035 4039 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
4036 4040 info to crash reports.
4037 4041
4038 4042 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
4039 4043 just like Python's -c. Also fixed crash with invalid -color
4040 4044 option value at startup. Thanks to Will French
4041 4045 <wfrench-AT-bestweb.net> for the bug report.
4042 4046
4043 4047 2003-05-09 Fernando Perez <fperez@colorado.edu>
4044 4048
4045 4049 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
4046 4050 to EvalDict (it's a mapping, after all) and simplified its code
4047 4051 quite a bit, after a nice discussion on c.l.py where Gustavo
4048 4052 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
4049 4053
4050 4054 2003-04-30 Fernando Perez <fperez@colorado.edu>
4051 4055
4052 4056 * IPython/genutils.py (timings_out): modified it to reduce its
4053 4057 overhead in the common reps==1 case.
4054 4058
4055 4059 2003-04-29 Fernando Perez <fperez@colorado.edu>
4056 4060
4057 4061 * IPython/genutils.py (timings_out): Modified to use the resource
4058 4062 module, which avoids the wraparound problems of time.clock().
4059 4063
4060 4064 2003-04-17 *** Released version 0.2.15pre4
4061 4065
4062 4066 2003-04-17 Fernando Perez <fperez@colorado.edu>
4063 4067
4064 4068 * setup.py (scriptfiles): Split windows-specific stuff over to a
4065 4069 separate file, in an attempt to have a Windows GUI installer.
4066 4070 That didn't work, but part of the groundwork is done.
4067 4071
4068 4072 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
4069 4073 indent/unindent with 4 spaces. Particularly useful in combination
4070 4074 with the new auto-indent option.
4071 4075
4072 4076 2003-04-16 Fernando Perez <fperez@colorado.edu>
4073 4077
4074 4078 * IPython/Magic.py: various replacements of self.rc for
4075 4079 self.shell.rc. A lot more remains to be done to fully disentangle
4076 4080 this class from the main Shell class.
4077 4081
4078 4082 * IPython/GnuplotRuntime.py: added checks for mouse support so
4079 4083 that we don't try to enable it if the current gnuplot doesn't
4080 4084 really support it. Also added checks so that we don't try to
4081 4085 enable persist under Windows (where Gnuplot doesn't recognize the
4082 4086 option).
4083 4087
4084 4088 * IPython/iplib.py (InteractiveShell.interact): Added optional
4085 4089 auto-indenting code, after a patch by King C. Shu
4086 4090 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
4087 4091 get along well with pasting indented code. If I ever figure out
4088 4092 how to make that part go well, it will become on by default.
4089 4093
4090 4094 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
4091 4095 crash ipython if there was an unmatched '%' in the user's prompt
4092 4096 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4093 4097
4094 4098 * IPython/iplib.py (InteractiveShell.interact): removed the
4095 4099 ability to ask the user whether he wants to crash or not at the
4096 4100 'last line' exception handler. Calling functions at that point
4097 4101 changes the stack, and the error reports would have incorrect
4098 4102 tracebacks.
4099 4103
4100 4104 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
4101 4105 pass through a peger a pretty-printed form of any object. After a
4102 4106 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
4103 4107
4104 4108 2003-04-14 Fernando Perez <fperez@colorado.edu>
4105 4109
4106 4110 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
4107 4111 all files in ~ would be modified at first install (instead of
4108 4112 ~/.ipython). This could be potentially disastrous, as the
4109 4113 modification (make line-endings native) could damage binary files.
4110 4114
4111 4115 2003-04-10 Fernando Perez <fperez@colorado.edu>
4112 4116
4113 4117 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
4114 4118 handle only lines which are invalid python. This now means that
4115 4119 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
4116 4120 for the bug report.
4117 4121
4118 4122 2003-04-01 Fernando Perez <fperez@colorado.edu>
4119 4123
4120 4124 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
4121 4125 where failing to set sys.last_traceback would crash pdb.pm().
4122 4126 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
4123 4127 report.
4124 4128
4125 4129 2003-03-25 Fernando Perez <fperez@colorado.edu>
4126 4130
4127 4131 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
4128 4132 before printing it (it had a lot of spurious blank lines at the
4129 4133 end).
4130 4134
4131 4135 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
4132 4136 output would be sent 21 times! Obviously people don't use this
4133 4137 too often, or I would have heard about it.
4134 4138
4135 4139 2003-03-24 Fernando Perez <fperez@colorado.edu>
4136 4140
4137 4141 * setup.py (scriptfiles): renamed the data_files parameter from
4138 4142 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
4139 4143 for the patch.
4140 4144
4141 4145 2003-03-20 Fernando Perez <fperez@colorado.edu>
4142 4146
4143 4147 * IPython/genutils.py (error): added error() and fatal()
4144 4148 functions.
4145 4149
4146 4150 2003-03-18 *** Released version 0.2.15pre3
4147 4151
4148 4152 2003-03-18 Fernando Perez <fperez@colorado.edu>
4149 4153
4150 4154 * setupext/install_data_ext.py
4151 4155 (install_data_ext.initialize_options): Class contributed by Jack
4152 4156 Moffit for fixing the old distutils hack. He is sending this to
4153 4157 the distutils folks so in the future we may not need it as a
4154 4158 private fix.
4155 4159
4156 4160 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
4157 4161 changes for Debian packaging. See his patch for full details.
4158 4162 The old distutils hack of making the ipythonrc* files carry a
4159 4163 bogus .py extension is gone, at last. Examples were moved to a
4160 4164 separate subdir under doc/, and the separate executable scripts
4161 4165 now live in their own directory. Overall a great cleanup. The
4162 4166 manual was updated to use the new files, and setup.py has been
4163 4167 fixed for this setup.
4164 4168
4165 4169 * IPython/PyColorize.py (Parser.usage): made non-executable and
4166 4170 created a pycolor wrapper around it to be included as a script.
4167 4171
4168 4172 2003-03-12 *** Released version 0.2.15pre2
4169 4173
4170 4174 2003-03-12 Fernando Perez <fperez@colorado.edu>
4171 4175
4172 4176 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4173 4177 long-standing problem with garbage characters in some terminals.
4174 4178 The issue was really that the \001 and \002 escapes must _only_ be
4175 4179 passed to input prompts (which call readline), but _never_ to
4176 4180 normal text to be printed on screen. I changed ColorANSI to have
4177 4181 two classes: TermColors and InputTermColors, each with the
4178 4182 appropriate escapes for input prompts or normal text. The code in
4179 4183 Prompts.py got slightly more complicated, but this very old and
4180 4184 annoying bug is finally fixed.
4181 4185
4182 4186 All the credit for nailing down the real origin of this problem
4183 4187 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4184 4188 *Many* thanks to him for spending quite a bit of effort on this.
4185 4189
4186 4190 2003-03-05 *** Released version 0.2.15pre1
4187 4191
4188 4192 2003-03-03 Fernando Perez <fperez@colorado.edu>
4189 4193
4190 4194 * IPython/FakeModule.py: Moved the former _FakeModule to a
4191 4195 separate file, because it's also needed by Magic (to fix a similar
4192 4196 pickle-related issue in @run).
4193 4197
4194 4198 2003-03-02 Fernando Perez <fperez@colorado.edu>
4195 4199
4196 4200 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4197 4201 the autocall option at runtime.
4198 4202 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4199 4203 across Magic.py to start separating Magic from InteractiveShell.
4200 4204 (Magic._ofind): Fixed to return proper namespace for dotted
4201 4205 names. Before, a dotted name would always return 'not currently
4202 4206 defined', because it would find the 'parent'. s.x would be found,
4203 4207 but since 'x' isn't defined by itself, it would get confused.
4204 4208 (Magic.magic_run): Fixed pickling problems reported by Ralf
4205 4209 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4206 4210 that I'd used when Mike Heeter reported similar issues at the
4207 4211 top-level, but now for @run. It boils down to injecting the
4208 4212 namespace where code is being executed with something that looks
4209 4213 enough like a module to fool pickle.dump(). Since a pickle stores
4210 4214 a named reference to the importing module, we need this for
4211 4215 pickles to save something sensible.
4212 4216
4213 4217 * IPython/ipmaker.py (make_IPython): added an autocall option.
4214 4218
4215 4219 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4216 4220 the auto-eval code. Now autocalling is an option, and the code is
4217 4221 also vastly safer. There is no more eval() involved at all.
4218 4222
4219 4223 2003-03-01 Fernando Perez <fperez@colorado.edu>
4220 4224
4221 4225 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4222 4226 dict with named keys instead of a tuple.
4223 4227
4224 4228 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4225 4229
4226 4230 * setup.py (make_shortcut): Fixed message about directories
4227 4231 created during Windows installation (the directories were ok, just
4228 4232 the printed message was misleading). Thanks to Chris Liechti
4229 4233 <cliechti-AT-gmx.net> for the heads up.
4230 4234
4231 4235 2003-02-21 Fernando Perez <fperez@colorado.edu>
4232 4236
4233 4237 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
4234 4238 of ValueError exception when checking for auto-execution. This
4235 4239 one is raised by things like Numeric arrays arr.flat when the
4236 4240 array is non-contiguous.
4237 4241
4238 4242 2003-01-31 Fernando Perez <fperez@colorado.edu>
4239 4243
4240 4244 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
4241 4245 not return any value at all (even though the command would get
4242 4246 executed).
4243 4247 (xsys): Flush stdout right after printing the command to ensure
4244 4248 proper ordering of commands and command output in the total
4245 4249 output.
4246 4250 (SystemExec/xsys/bq): Switched the names of xsys/bq and
4247 4251 system/getoutput as defaults. The old ones are kept for
4248 4252 compatibility reasons, so no code which uses this library needs
4249 4253 changing.
4250 4254
4251 4255 2003-01-27 *** Released version 0.2.14
4252 4256
4253 4257 2003-01-25 Fernando Perez <fperez@colorado.edu>
4254 4258
4255 4259 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
4256 4260 functions defined in previous edit sessions could not be re-edited
4257 4261 (because the temp files were immediately removed). Now temp files
4258 4262 are removed only at IPython's exit.
4259 4263 (Magic.magic_run): Improved @run to perform shell-like expansions
4260 4264 on its arguments (~users and $VARS). With this, @run becomes more
4261 4265 like a normal command-line.
4262 4266
4263 4267 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
4264 4268 bugs related to embedding and cleaned up that code. A fairly
4265 4269 important one was the impossibility to access the global namespace
4266 4270 through the embedded IPython (only local variables were visible).
4267 4271
4268 4272 2003-01-14 Fernando Perez <fperez@colorado.edu>
4269 4273
4270 4274 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
4271 4275 auto-calling to be a bit more conservative. Now it doesn't get
4272 4276 triggered if any of '!=()<>' are in the rest of the input line, to
4273 4277 allow comparing callables. Thanks to Alex for the heads up.
4274 4278
4275 4279 2003-01-07 Fernando Perez <fperez@colorado.edu>
4276 4280
4277 4281 * IPython/genutils.py (page): fixed estimation of the number of
4278 4282 lines in a string to be paged to simply count newlines. This
4279 4283 prevents over-guessing due to embedded escape sequences. A better
4280 4284 long-term solution would involve stripping out the control chars
4281 4285 for the count, but it's potentially so expensive I just don't
4282 4286 think it's worth doing.
4283 4287
4284 4288 2002-12-19 *** Released version 0.2.14pre50
4285 4289
4286 4290 2002-12-19 Fernando Perez <fperez@colorado.edu>
4287 4291
4288 4292 * tools/release (version): Changed release scripts to inform
4289 4293 Andrea and build a NEWS file with a list of recent changes.
4290 4294
4291 4295 * IPython/ColorANSI.py (__all__): changed terminal detection
4292 4296 code. Seems to work better for xterms without breaking
4293 4297 konsole. Will need more testing to determine if WinXP and Mac OSX
4294 4298 also work ok.
4295 4299
4296 4300 2002-12-18 *** Released version 0.2.14pre49
4297 4301
4298 4302 2002-12-18 Fernando Perez <fperez@colorado.edu>
4299 4303
4300 4304 * Docs: added new info about Mac OSX, from Andrea.
4301 4305
4302 4306 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
4303 4307 allow direct plotting of python strings whose format is the same
4304 4308 of gnuplot data files.
4305 4309
4306 4310 2002-12-16 Fernando Perez <fperez@colorado.edu>
4307 4311
4308 4312 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
4309 4313 value of exit question to be acknowledged.
4310 4314
4311 4315 2002-12-03 Fernando Perez <fperez@colorado.edu>
4312 4316
4313 4317 * IPython/ipmaker.py: removed generators, which had been added
4314 4318 by mistake in an earlier debugging run. This was causing trouble
4315 4319 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
4316 4320 for pointing this out.
4317 4321
4318 4322 2002-11-17 Fernando Perez <fperez@colorado.edu>
4319 4323
4320 4324 * Manual: updated the Gnuplot section.
4321 4325
4322 4326 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4323 4327 a much better split of what goes in Runtime and what goes in
4324 4328 Interactive.
4325 4329
4326 4330 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4327 4331 being imported from iplib.
4328 4332
4329 4333 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4330 4334 for command-passing. Now the global Gnuplot instance is called
4331 4335 'gp' instead of 'g', which was really a far too fragile and
4332 4336 common name.
4333 4337
4334 4338 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4335 4339 bounding boxes generated by Gnuplot for square plots.
4336 4340
4337 4341 * IPython/genutils.py (popkey): new function added. I should
4338 4342 suggest this on c.l.py as a dict method, it seems useful.
4339 4343
4340 4344 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4341 4345 to transparently handle PostScript generation. MUCH better than
4342 4346 the previous plot_eps/replot_eps (which I removed now). The code
4343 4347 is also fairly clean and well documented now (including
4344 4348 docstrings).
4345 4349
4346 4350 2002-11-13 Fernando Perez <fperez@colorado.edu>
4347 4351
4348 4352 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4349 4353 (inconsistent with options).
4350 4354
4351 4355 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4352 4356 manually disabled, I don't know why. Fixed it.
4353 4357 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4354 4358 eps output.
4355 4359
4356 4360 2002-11-12 Fernando Perez <fperez@colorado.edu>
4357 4361
4358 4362 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4359 4363 don't propagate up to caller. Fixes crash reported by François
4360 4364 Pinard.
4361 4365
4362 4366 2002-11-09 Fernando Perez <fperez@colorado.edu>
4363 4367
4364 4368 * IPython/ipmaker.py (make_IPython): fixed problem with writing
4365 4369 history file for new users.
4366 4370 (make_IPython): fixed bug where initial install would leave the
4367 4371 user running in the .ipython dir.
4368 4372 (make_IPython): fixed bug where config dir .ipython would be
4369 4373 created regardless of the given -ipythondir option. Thanks to Cory
4370 4374 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
4371 4375
4372 4376 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
4373 4377 type confirmations. Will need to use it in all of IPython's code
4374 4378 consistently.
4375 4379
4376 4380 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
4377 4381 context to print 31 lines instead of the default 5. This will make
4378 4382 the crash reports extremely detailed in case the problem is in
4379 4383 libraries I don't have access to.
4380 4384
4381 4385 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
4382 4386 line of defense' code to still crash, but giving users fair
4383 4387 warning. I don't want internal errors to go unreported: if there's
4384 4388 an internal problem, IPython should crash and generate a full
4385 4389 report.
4386 4390
4387 4391 2002-11-08 Fernando Perez <fperez@colorado.edu>
4388 4392
4389 4393 * IPython/iplib.py (InteractiveShell.interact): added code to trap
4390 4394 otherwise uncaught exceptions which can appear if people set
4391 4395 sys.stdout to something badly broken. Thanks to a crash report
4392 4396 from henni-AT-mail.brainbot.com.
4393 4397
4394 4398 2002-11-04 Fernando Perez <fperez@colorado.edu>
4395 4399
4396 4400 * IPython/iplib.py (InteractiveShell.interact): added
4397 4401 __IPYTHON__active to the builtins. It's a flag which goes on when
4398 4402 the interaction starts and goes off again when it stops. This
4399 4403 allows embedding code to detect being inside IPython. Before this
4400 4404 was done via __IPYTHON__, but that only shows that an IPython
4401 4405 instance has been created.
4402 4406
4403 4407 * IPython/Magic.py (Magic.magic_env): I realized that in a
4404 4408 UserDict, instance.data holds the data as a normal dict. So I
4405 4409 modified @env to return os.environ.data instead of rebuilding a
4406 4410 dict by hand.
4407 4411
4408 4412 2002-11-02 Fernando Perez <fperez@colorado.edu>
4409 4413
4410 4414 * IPython/genutils.py (warn): changed so that level 1 prints no
4411 4415 header. Level 2 is now the default (with 'WARNING' header, as
4412 4416 before). I think I tracked all places where changes were needed in
4413 4417 IPython, but outside code using the old level numbering may have
4414 4418 broken.
4415 4419
4416 4420 * IPython/iplib.py (InteractiveShell.runcode): added this to
4417 4421 handle the tracebacks in SystemExit traps correctly. The previous
4418 4422 code (through interact) was printing more of the stack than
4419 4423 necessary, showing IPython internal code to the user.
4420 4424
4421 4425 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
4422 4426 default. Now that the default at the confirmation prompt is yes,
4423 4427 it's not so intrusive. François' argument that ipython sessions
4424 4428 tend to be complex enough not to lose them from an accidental C-d,
4425 4429 is a valid one.
4426 4430
4427 4431 * IPython/iplib.py (InteractiveShell.interact): added a
4428 4432 showtraceback() call to the SystemExit trap, and modified the exit
4429 4433 confirmation to have yes as the default.
4430 4434
4431 4435 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
4432 4436 this file. It's been gone from the code for a long time, this was
4433 4437 simply leftover junk.
4434 4438
4435 4439 2002-11-01 Fernando Perez <fperez@colorado.edu>
4436 4440
4437 4441 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
4438 4442 added. If set, IPython now traps EOF and asks for
4439 4443 confirmation. After a request by François Pinard.
4440 4444
4441 4445 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
4442 4446 of @abort, and with a new (better) mechanism for handling the
4443 4447 exceptions.
4444 4448
4445 4449 2002-10-27 Fernando Perez <fperez@colorado.edu>
4446 4450
4447 4451 * IPython/usage.py (__doc__): updated the --help information and
4448 4452 the ipythonrc file to indicate that -log generates
4449 4453 ./ipython.log. Also fixed the corresponding info in @logstart.
4450 4454 This and several other fixes in the manuals thanks to reports by
4451 4455 François Pinard <pinard-AT-iro.umontreal.ca>.
4452 4456
4453 4457 * IPython/Logger.py (Logger.switch_log): Fixed error message to
4454 4458 refer to @logstart (instead of @log, which doesn't exist).
4455 4459
4456 4460 * IPython/iplib.py (InteractiveShell._prefilter): fixed
4457 4461 AttributeError crash. Thanks to Christopher Armstrong
4458 4462 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
4459 4463 introduced recently (in 0.2.14pre37) with the fix to the eval
4460 4464 problem mentioned below.
4461 4465
4462 4466 2002-10-17 Fernando Perez <fperez@colorado.edu>
4463 4467
4464 4468 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
4465 4469 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
4466 4470
4467 4471 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
4468 4472 this function to fix a problem reported by Alex Schmolck. He saw
4469 4473 it with list comprehensions and generators, which were getting
4470 4474 called twice. The real problem was an 'eval' call in testing for
4471 4475 automagic which was evaluating the input line silently.
4472 4476
4473 4477 This is a potentially very nasty bug, if the input has side
4474 4478 effects which must not be repeated. The code is much cleaner now,
4475 4479 without any blanket 'except' left and with a regexp test for
4476 4480 actual function names.
4477 4481
4478 4482 But an eval remains, which I'm not fully comfortable with. I just
4479 4483 don't know how to find out if an expression could be a callable in
4480 4484 the user's namespace without doing an eval on the string. However
4481 4485 that string is now much more strictly checked so that no code
4482 4486 slips by, so the eval should only happen for things that can
4483 4487 really be only function/method names.
4484 4488
4485 4489 2002-10-15 Fernando Perez <fperez@colorado.edu>
4486 4490
4487 4491 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4488 4492 OSX information to main manual, removed README_Mac_OSX file from
4489 4493 distribution. Also updated credits for recent additions.
4490 4494
4491 4495 2002-10-10 Fernando Perez <fperez@colorado.edu>
4492 4496
4493 4497 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4494 4498 terminal-related issues. Many thanks to Andrea Riciputi
4495 4499 <andrea.riciputi-AT-libero.it> for writing it.
4496 4500
4497 4501 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4498 4502 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4499 4503
4500 4504 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4501 4505 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4502 4506 <syver-en-AT-online.no> who both submitted patches for this problem.
4503 4507
4504 4508 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4505 4509 global embedding to make sure that things don't overwrite user
4506 4510 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4507 4511
4508 4512 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4509 4513 compatibility. Thanks to Hayden Callow
4510 4514 <h.callow-AT-elec.canterbury.ac.nz>
4511 4515
4512 4516 2002-10-04 Fernando Perez <fperez@colorado.edu>
4513 4517
4514 4518 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4515 4519 Gnuplot.File objects.
4516 4520
4517 4521 2002-07-23 Fernando Perez <fperez@colorado.edu>
4518 4522
4519 4523 * IPython/genutils.py (timing): Added timings() and timing() for
4520 4524 quick access to the most commonly needed data, the execution
4521 4525 times. Old timing() renamed to timings_out().
4522 4526
4523 4527 2002-07-18 Fernando Perez <fperez@colorado.edu>
4524 4528
4525 4529 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4526 4530 bug with nested instances disrupting the parent's tab completion.
4527 4531
4528 4532 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4529 4533 all_completions code to begin the emacs integration.
4530 4534
4531 4535 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4532 4536 argument to allow titling individual arrays when plotting.
4533 4537
4534 4538 2002-07-15 Fernando Perez <fperez@colorado.edu>
4535 4539
4536 4540 * setup.py (make_shortcut): changed to retrieve the value of
4537 4541 'Program Files' directory from the registry (this value changes in
4538 4542 non-english versions of Windows). Thanks to Thomas Fanslau
4539 4543 <tfanslau-AT-gmx.de> for the report.
4540 4544
4541 4545 2002-07-10 Fernando Perez <fperez@colorado.edu>
4542 4546
4543 4547 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4544 4548 a bug in pdb, which crashes if a line with only whitespace is
4545 4549 entered. Bug report submitted to sourceforge.
4546 4550
4547 4551 2002-07-09 Fernando Perez <fperez@colorado.edu>
4548 4552
4549 4553 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4550 4554 reporting exceptions (it's a bug in inspect.py, I just set a
4551 4555 workaround).
4552 4556
4553 4557 2002-07-08 Fernando Perez <fperez@colorado.edu>
4554 4558
4555 4559 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4556 4560 __IPYTHON__ in __builtins__ to show up in user_ns.
4557 4561
4558 4562 2002-07-03 Fernando Perez <fperez@colorado.edu>
4559 4563
4560 4564 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4561 4565 name from @gp_set_instance to @gp_set_default.
4562 4566
4563 4567 * IPython/ipmaker.py (make_IPython): default editor value set to
4564 4568 '0' (a string), to match the rc file. Otherwise will crash when
4565 4569 .strip() is called on it.
4566 4570
4567 4571
4568 4572 2002-06-28 Fernando Perez <fperez@colorado.edu>
4569 4573
4570 4574 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4571 4575 of files in current directory when a file is executed via
4572 4576 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4573 4577
4574 4578 * setup.py (manfiles): fix for rpm builds, submitted by RA
4575 4579 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4576 4580
4577 4581 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4578 4582 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4579 4583 string!). A. Schmolck caught this one.
4580 4584
4581 4585 2002-06-27 Fernando Perez <fperez@colorado.edu>
4582 4586
4583 4587 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4584 4588 defined files at the cmd line. __name__ wasn't being set to
4585 4589 __main__.
4586 4590
4587 4591 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4588 4592 regular lists and tuples besides Numeric arrays.
4589 4593
4590 4594 * IPython/Prompts.py (CachedOutput.__call__): Added output
4591 4595 supression for input ending with ';'. Similar to Mathematica and
4592 4596 Matlab. The _* vars and Out[] list are still updated, just like
4593 4597 Mathematica behaves.
4594 4598
4595 4599 2002-06-25 Fernando Perez <fperez@colorado.edu>
4596 4600
4597 4601 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4598 4602 .ini extensions for profiels under Windows.
4599 4603
4600 4604 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4601 4605 string form. Fix contributed by Alexander Schmolck
4602 4606 <a.schmolck-AT-gmx.net>
4603 4607
4604 4608 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4605 4609 pre-configured Gnuplot instance.
4606 4610
4607 4611 2002-06-21 Fernando Perez <fperez@colorado.edu>
4608 4612
4609 4613 * IPython/numutils.py (exp_safe): new function, works around the
4610 4614 underflow problems in Numeric.
4611 4615 (log2): New fn. Safe log in base 2: returns exact integer answer
4612 4616 for exact integer powers of 2.
4613 4617
4614 4618 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4615 4619 properly.
4616 4620
4617 4621 2002-06-20 Fernando Perez <fperez@colorado.edu>
4618 4622
4619 4623 * IPython/genutils.py (timing): new function like
4620 4624 Mathematica's. Similar to time_test, but returns more info.
4621 4625
4622 4626 2002-06-18 Fernando Perez <fperez@colorado.edu>
4623 4627
4624 4628 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4625 4629 according to Mike Heeter's suggestions.
4626 4630
4627 4631 2002-06-16 Fernando Perez <fperez@colorado.edu>
4628 4632
4629 4633 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4630 4634 system. GnuplotMagic is gone as a user-directory option. New files
4631 4635 make it easier to use all the gnuplot stuff both from external
4632 4636 programs as well as from IPython. Had to rewrite part of
4633 4637 hardcopy() b/c of a strange bug: often the ps files simply don't
4634 4638 get created, and require a repeat of the command (often several
4635 4639 times).
4636 4640
4637 4641 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4638 4642 resolve output channel at call time, so that if sys.stderr has
4639 4643 been redirected by user this gets honored.
4640 4644
4641 4645 2002-06-13 Fernando Perez <fperez@colorado.edu>
4642 4646
4643 4647 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4644 4648 IPShell. Kept a copy with the old names to avoid breaking people's
4645 4649 embedded code.
4646 4650
4647 4651 * IPython/ipython: simplified it to the bare minimum after
4648 4652 Holger's suggestions. Added info about how to use it in
4649 4653 PYTHONSTARTUP.
4650 4654
4651 4655 * IPython/Shell.py (IPythonShell): changed the options passing
4652 4656 from a string with funky %s replacements to a straight list. Maybe
4653 4657 a bit more typing, but it follows sys.argv conventions, so there's
4654 4658 less special-casing to remember.
4655 4659
4656 4660 2002-06-12 Fernando Perez <fperez@colorado.edu>
4657 4661
4658 4662 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4659 4663 command. Thanks to a suggestion by Mike Heeter.
4660 4664 (Magic.magic_pfile): added behavior to look at filenames if given
4661 4665 arg is not a defined object.
4662 4666 (Magic.magic_save): New @save function to save code snippets. Also
4663 4667 a Mike Heeter idea.
4664 4668
4665 4669 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4666 4670 plot() and replot(). Much more convenient now, especially for
4667 4671 interactive use.
4668 4672
4669 4673 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4670 4674 filenames.
4671 4675
4672 4676 2002-06-02 Fernando Perez <fperez@colorado.edu>
4673 4677
4674 4678 * IPython/Struct.py (Struct.__init__): modified to admit
4675 4679 initialization via another struct.
4676 4680
4677 4681 * IPython/genutils.py (SystemExec.__init__): New stateful
4678 4682 interface to xsys and bq. Useful for writing system scripts.
4679 4683
4680 4684 2002-05-30 Fernando Perez <fperez@colorado.edu>
4681 4685
4682 4686 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4683 4687 documents. This will make the user download smaller (it's getting
4684 4688 too big).
4685 4689
4686 4690 2002-05-29 Fernando Perez <fperez@colorado.edu>
4687 4691
4688 4692 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4689 4693 fix problems with shelve and pickle. Seems to work, but I don't
4690 4694 know if corner cases break it. Thanks to Mike Heeter
4691 4695 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4692 4696
4693 4697 2002-05-24 Fernando Perez <fperez@colorado.edu>
4694 4698
4695 4699 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4696 4700 macros having broken.
4697 4701
4698 4702 2002-05-21 Fernando Perez <fperez@colorado.edu>
4699 4703
4700 4704 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4701 4705 introduced logging bug: all history before logging started was
4702 4706 being written one character per line! This came from the redesign
4703 4707 of the input history as a special list which slices to strings,
4704 4708 not to lists.
4705 4709
4706 4710 2002-05-20 Fernando Perez <fperez@colorado.edu>
4707 4711
4708 4712 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4709 4713 be an attribute of all classes in this module. The design of these
4710 4714 classes needs some serious overhauling.
4711 4715
4712 4716 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4713 4717 which was ignoring '_' in option names.
4714 4718
4715 4719 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4716 4720 'Verbose_novars' to 'Context' and made it the new default. It's a
4717 4721 bit more readable and also safer than verbose.
4718 4722
4719 4723 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4720 4724 triple-quoted strings.
4721 4725
4722 4726 * IPython/OInspect.py (__all__): new module exposing the object
4723 4727 introspection facilities. Now the corresponding magics are dummy
4724 4728 wrappers around this. Having this module will make it much easier
4725 4729 to put these functions into our modified pdb.
4726 4730 This new object inspector system uses the new colorizing module,
4727 4731 so source code and other things are nicely syntax highlighted.
4728 4732
4729 4733 2002-05-18 Fernando Perez <fperez@colorado.edu>
4730 4734
4731 4735 * IPython/ColorANSI.py: Split the coloring tools into a separate
4732 4736 module so I can use them in other code easier (they were part of
4733 4737 ultraTB).
4734 4738
4735 4739 2002-05-17 Fernando Perez <fperez@colorado.edu>
4736 4740
4737 4741 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4738 4742 fixed it to set the global 'g' also to the called instance, as
4739 4743 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4740 4744 user's 'g' variables).
4741 4745
4742 4746 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4743 4747 global variables (aliases to _ih,_oh) so that users which expect
4744 4748 In[5] or Out[7] to work aren't unpleasantly surprised.
4745 4749 (InputList.__getslice__): new class to allow executing slices of
4746 4750 input history directly. Very simple class, complements the use of
4747 4751 macros.
4748 4752
4749 4753 2002-05-16 Fernando Perez <fperez@colorado.edu>
4750 4754
4751 4755 * setup.py (docdirbase): make doc directory be just doc/IPython
4752 4756 without version numbers, it will reduce clutter for users.
4753 4757
4754 4758 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4755 4759 execfile call to prevent possible memory leak. See for details:
4756 4760 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4757 4761
4758 4762 2002-05-15 Fernando Perez <fperez@colorado.edu>
4759 4763
4760 4764 * IPython/Magic.py (Magic.magic_psource): made the object
4761 4765 introspection names be more standard: pdoc, pdef, pfile and
4762 4766 psource. They all print/page their output, and it makes
4763 4767 remembering them easier. Kept old names for compatibility as
4764 4768 aliases.
4765 4769
4766 4770 2002-05-14 Fernando Perez <fperez@colorado.edu>
4767 4771
4768 4772 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4769 4773 what the mouse problem was. The trick is to use gnuplot with temp
4770 4774 files and NOT with pipes (for data communication), because having
4771 4775 both pipes and the mouse on is bad news.
4772 4776
4773 4777 2002-05-13 Fernando Perez <fperez@colorado.edu>
4774 4778
4775 4779 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4776 4780 bug. Information would be reported about builtins even when
4777 4781 user-defined functions overrode them.
4778 4782
4779 4783 2002-05-11 Fernando Perez <fperez@colorado.edu>
4780 4784
4781 4785 * IPython/__init__.py (__all__): removed FlexCompleter from
4782 4786 __all__ so that things don't fail in platforms without readline.
4783 4787
4784 4788 2002-05-10 Fernando Perez <fperez@colorado.edu>
4785 4789
4786 4790 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4787 4791 it requires Numeric, effectively making Numeric a dependency for
4788 4792 IPython.
4789 4793
4790 4794 * Released 0.2.13
4791 4795
4792 4796 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4793 4797 profiler interface. Now all the major options from the profiler
4794 4798 module are directly supported in IPython, both for single
4795 4799 expressions (@prun) and for full programs (@run -p).
4796 4800
4797 4801 2002-05-09 Fernando Perez <fperez@colorado.edu>
4798 4802
4799 4803 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4800 4804 magic properly formatted for screen.
4801 4805
4802 4806 * setup.py (make_shortcut): Changed things to put pdf version in
4803 4807 doc/ instead of doc/manual (had to change lyxport a bit).
4804 4808
4805 4809 * IPython/Magic.py (Profile.string_stats): made profile runs go
4806 4810 through pager (they are long and a pager allows searching, saving,
4807 4811 etc.)
4808 4812
4809 4813 2002-05-08 Fernando Perez <fperez@colorado.edu>
4810 4814
4811 4815 * Released 0.2.12
4812 4816
4813 4817 2002-05-06 Fernando Perez <fperez@colorado.edu>
4814 4818
4815 4819 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4816 4820 introduced); 'hist n1 n2' was broken.
4817 4821 (Magic.magic_pdb): added optional on/off arguments to @pdb
4818 4822 (Magic.magic_run): added option -i to @run, which executes code in
4819 4823 the IPython namespace instead of a clean one. Also added @irun as
4820 4824 an alias to @run -i.
4821 4825
4822 4826 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4823 4827 fixed (it didn't really do anything, the namespaces were wrong).
4824 4828
4825 4829 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4826 4830
4827 4831 * IPython/__init__.py (__all__): Fixed package namespace, now
4828 4832 'import IPython' does give access to IPython.<all> as
4829 4833 expected. Also renamed __release__ to Release.
4830 4834
4831 4835 * IPython/Debugger.py (__license__): created new Pdb class which
4832 4836 functions like a drop-in for the normal pdb.Pdb but does NOT
4833 4837 import readline by default. This way it doesn't muck up IPython's
4834 4838 readline handling, and now tab-completion finally works in the
4835 4839 debugger -- sort of. It completes things globally visible, but the
4836 4840 completer doesn't track the stack as pdb walks it. That's a bit
4837 4841 tricky, and I'll have to implement it later.
4838 4842
4839 4843 2002-05-05 Fernando Perez <fperez@colorado.edu>
4840 4844
4841 4845 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4842 4846 magic docstrings when printed via ? (explicit \'s were being
4843 4847 printed).
4844 4848
4845 4849 * IPython/ipmaker.py (make_IPython): fixed namespace
4846 4850 identification bug. Now variables loaded via logs or command-line
4847 4851 files are recognized in the interactive namespace by @who.
4848 4852
4849 4853 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4850 4854 log replay system stemming from the string form of Structs.
4851 4855
4852 4856 * IPython/Magic.py (Macro.__init__): improved macros to properly
4853 4857 handle magic commands in them.
4854 4858 (Magic.magic_logstart): usernames are now expanded so 'logstart
4855 4859 ~/mylog' now works.
4856 4860
4857 4861 * IPython/iplib.py (complete): fixed bug where paths starting with
4858 4862 '/' would be completed as magic names.
4859 4863
4860 4864 2002-05-04 Fernando Perez <fperez@colorado.edu>
4861 4865
4862 4866 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4863 4867 allow running full programs under the profiler's control.
4864 4868
4865 4869 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4866 4870 mode to report exceptions verbosely but without formatting
4867 4871 variables. This addresses the issue of ipython 'freezing' (it's
4868 4872 not frozen, but caught in an expensive formatting loop) when huge
4869 4873 variables are in the context of an exception.
4870 4874 (VerboseTB.text): Added '--->' markers at line where exception was
4871 4875 triggered. Much clearer to read, especially in NoColor modes.
4872 4876
4873 4877 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4874 4878 implemented in reverse when changing to the new parse_options().
4875 4879
4876 4880 2002-05-03 Fernando Perez <fperez@colorado.edu>
4877 4881
4878 4882 * IPython/Magic.py (Magic.parse_options): new function so that
4879 4883 magics can parse options easier.
4880 4884 (Magic.magic_prun): new function similar to profile.run(),
4881 4885 suggested by Chris Hart.
4882 4886 (Magic.magic_cd): fixed behavior so that it only changes if
4883 4887 directory actually is in history.
4884 4888
4885 4889 * IPython/usage.py (__doc__): added information about potential
4886 4890 slowness of Verbose exception mode when there are huge data
4887 4891 structures to be formatted (thanks to Archie Paulson).
4888 4892
4889 4893 * IPython/ipmaker.py (make_IPython): Changed default logging
4890 4894 (when simply called with -log) to use curr_dir/ipython.log in
4891 4895 rotate mode. Fixed crash which was occuring with -log before
4892 4896 (thanks to Jim Boyle).
4893 4897
4894 4898 2002-05-01 Fernando Perez <fperez@colorado.edu>
4895 4899
4896 4900 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4897 4901 was nasty -- though somewhat of a corner case).
4898 4902
4899 4903 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4900 4904 text (was a bug).
4901 4905
4902 4906 2002-04-30 Fernando Perez <fperez@colorado.edu>
4903 4907
4904 4908 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4905 4909 a print after ^D or ^C from the user so that the In[] prompt
4906 4910 doesn't over-run the gnuplot one.
4907 4911
4908 4912 2002-04-29 Fernando Perez <fperez@colorado.edu>
4909 4913
4910 4914 * Released 0.2.10
4911 4915
4912 4916 * IPython/__release__.py (version): get date dynamically.
4913 4917
4914 4918 * Misc. documentation updates thanks to Arnd's comments. Also ran
4915 4919 a full spellcheck on the manual (hadn't been done in a while).
4916 4920
4917 4921 2002-04-27 Fernando Perez <fperez@colorado.edu>
4918 4922
4919 4923 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4920 4924 starting a log in mid-session would reset the input history list.
4921 4925
4922 4926 2002-04-26 Fernando Perez <fperez@colorado.edu>
4923 4927
4924 4928 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4925 4929 all files were being included in an update. Now anything in
4926 4930 UserConfig that matches [A-Za-z]*.py will go (this excludes
4927 4931 __init__.py)
4928 4932
4929 4933 2002-04-25 Fernando Perez <fperez@colorado.edu>
4930 4934
4931 4935 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4932 4936 to __builtins__ so that any form of embedded or imported code can
4933 4937 test for being inside IPython.
4934 4938
4935 4939 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4936 4940 changed to GnuplotMagic because it's now an importable module,
4937 4941 this makes the name follow that of the standard Gnuplot module.
4938 4942 GnuplotMagic can now be loaded at any time in mid-session.
4939 4943
4940 4944 2002-04-24 Fernando Perez <fperez@colorado.edu>
4941 4945
4942 4946 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4943 4947 the globals (IPython has its own namespace) and the
4944 4948 PhysicalQuantity stuff is much better anyway.
4945 4949
4946 4950 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4947 4951 embedding example to standard user directory for
4948 4952 distribution. Also put it in the manual.
4949 4953
4950 4954 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4951 4955 instance as first argument (so it doesn't rely on some obscure
4952 4956 hidden global).
4953 4957
4954 4958 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4955 4959 delimiters. While it prevents ().TAB from working, it allows
4956 4960 completions in open (... expressions. This is by far a more common
4957 4961 case.
4958 4962
4959 4963 2002-04-23 Fernando Perez <fperez@colorado.edu>
4960 4964
4961 4965 * IPython/Extensions/InterpreterPasteInput.py: new
4962 4966 syntax-processing module for pasting lines with >>> or ... at the
4963 4967 start.
4964 4968
4965 4969 * IPython/Extensions/PhysicalQ_Interactive.py
4966 4970 (PhysicalQuantityInteractive.__int__): fixed to work with either
4967 4971 Numeric or math.
4968 4972
4969 4973 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4970 4974 provided profiles. Now we have:
4971 4975 -math -> math module as * and cmath with its own namespace.
4972 4976 -numeric -> Numeric as *, plus gnuplot & grace
4973 4977 -physics -> same as before
4974 4978
4975 4979 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4976 4980 user-defined magics wouldn't be found by @magic if they were
4977 4981 defined as class methods. Also cleaned up the namespace search
4978 4982 logic and the string building (to use %s instead of many repeated
4979 4983 string adds).
4980 4984
4981 4985 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4982 4986 of user-defined magics to operate with class methods (cleaner, in
4983 4987 line with the gnuplot code).
4984 4988
4985 4989 2002-04-22 Fernando Perez <fperez@colorado.edu>
4986 4990
4987 4991 * setup.py: updated dependency list so that manual is updated when
4988 4992 all included files change.
4989 4993
4990 4994 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4991 4995 the delimiter removal option (the fix is ugly right now).
4992 4996
4993 4997 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4994 4998 all of the math profile (quicker loading, no conflict between
4995 4999 g-9.8 and g-gnuplot).
4996 5000
4997 5001 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4998 5002 name of post-mortem files to IPython_crash_report.txt.
4999 5003
5000 5004 * Cleanup/update of the docs. Added all the new readline info and
5001 5005 formatted all lists as 'real lists'.
5002 5006
5003 5007 * IPython/ipmaker.py (make_IPython): removed now-obsolete
5004 5008 tab-completion options, since the full readline parse_and_bind is
5005 5009 now accessible.
5006 5010
5007 5011 * IPython/iplib.py (InteractiveShell.init_readline): Changed
5008 5012 handling of readline options. Now users can specify any string to
5009 5013 be passed to parse_and_bind(), as well as the delimiters to be
5010 5014 removed.
5011 5015 (InteractiveShell.__init__): Added __name__ to the global
5012 5016 namespace so that things like Itpl which rely on its existence
5013 5017 don't crash.
5014 5018 (InteractiveShell._prefilter): Defined the default with a _ so
5015 5019 that prefilter() is easier to override, while the default one
5016 5020 remains available.
5017 5021
5018 5022 2002-04-18 Fernando Perez <fperez@colorado.edu>
5019 5023
5020 5024 * Added information about pdb in the docs.
5021 5025
5022 5026 2002-04-17 Fernando Perez <fperez@colorado.edu>
5023 5027
5024 5028 * IPython/ipmaker.py (make_IPython): added rc_override option to
5025 5029 allow passing config options at creation time which may override
5026 5030 anything set in the config files or command line. This is
5027 5031 particularly useful for configuring embedded instances.
5028 5032
5029 5033 2002-04-15 Fernando Perez <fperez@colorado.edu>
5030 5034
5031 5035 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
5032 5036 crash embedded instances because of the input cache falling out of
5033 5037 sync with the output counter.
5034 5038
5035 5039 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
5036 5040 mode which calls pdb after an uncaught exception in IPython itself.
5037 5041
5038 5042 2002-04-14 Fernando Perez <fperez@colorado.edu>
5039 5043
5040 5044 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
5041 5045 readline, fix it back after each call.
5042 5046
5043 5047 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
5044 5048 method to force all access via __call__(), which guarantees that
5045 5049 traceback references are properly deleted.
5046 5050
5047 5051 * IPython/Prompts.py (CachedOutput._display): minor fixes to
5048 5052 improve printing when pprint is in use.
5049 5053
5050 5054 2002-04-13 Fernando Perez <fperez@colorado.edu>
5051 5055
5052 5056 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
5053 5057 exceptions aren't caught anymore. If the user triggers one, he
5054 5058 should know why he's doing it and it should go all the way up,
5055 5059 just like any other exception. So now @abort will fully kill the
5056 5060 embedded interpreter and the embedding code (unless that happens
5057 5061 to catch SystemExit).
5058 5062
5059 5063 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
5060 5064 and a debugger() method to invoke the interactive pdb debugger
5061 5065 after printing exception information. Also added the corresponding
5062 5066 -pdb option and @pdb magic to control this feature, and updated
5063 5067 the docs. After a suggestion from Christopher Hart
5064 5068 (hart-AT-caltech.edu).
5065 5069
5066 5070 2002-04-12 Fernando Perez <fperez@colorado.edu>
5067 5071
5068 5072 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
5069 5073 the exception handlers defined by the user (not the CrashHandler)
5070 5074 so that user exceptions don't trigger an ipython bug report.
5071 5075
5072 5076 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
5073 5077 configurable (it should have always been so).
5074 5078
5075 5079 2002-03-26 Fernando Perez <fperez@colorado.edu>
5076 5080
5077 5081 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
5078 5082 and there to fix embedding namespace issues. This should all be
5079 5083 done in a more elegant way.
5080 5084
5081 5085 2002-03-25 Fernando Perez <fperez@colorado.edu>
5082 5086
5083 5087 * IPython/genutils.py (get_home_dir): Try to make it work under
5084 5088 win9x also.
5085 5089
5086 5090 2002-03-20 Fernando Perez <fperez@colorado.edu>
5087 5091
5088 5092 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
5089 5093 sys.displayhook untouched upon __init__.
5090 5094
5091 5095 2002-03-19 Fernando Perez <fperez@colorado.edu>
5092 5096
5093 5097 * Released 0.2.9 (for embedding bug, basically).
5094 5098
5095 5099 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
5096 5100 exceptions so that enclosing shell's state can be restored.
5097 5101
5098 5102 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
5099 5103 naming conventions in the .ipython/ dir.
5100 5104
5101 5105 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
5102 5106 from delimiters list so filenames with - in them get expanded.
5103 5107
5104 5108 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
5105 5109 sys.displayhook not being properly restored after an embedded call.
5106 5110
5107 5111 2002-03-18 Fernando Perez <fperez@colorado.edu>
5108 5112
5109 5113 * Released 0.2.8
5110 5114
5111 5115 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
5112 5116 some files weren't being included in a -upgrade.
5113 5117 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
5114 5118 on' so that the first tab completes.
5115 5119 (InteractiveShell.handle_magic): fixed bug with spaces around
5116 5120 quotes breaking many magic commands.
5117 5121
5118 5122 * setup.py: added note about ignoring the syntax error messages at
5119 5123 installation.
5120 5124
5121 5125 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
5122 5126 streamlining the gnuplot interface, now there's only one magic @gp.
5123 5127
5124 5128 2002-03-17 Fernando Perez <fperez@colorado.edu>
5125 5129
5126 5130 * IPython/UserConfig/magic_gnuplot.py: new name for the
5127 5131 example-magic_pm.py file. Much enhanced system, now with a shell
5128 5132 for communicating directly with gnuplot, one command at a time.
5129 5133
5130 5134 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
5131 5135 setting __name__=='__main__'.
5132 5136
5133 5137 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
5134 5138 mini-shell for accessing gnuplot from inside ipython. Should
5135 5139 extend it later for grace access too. Inspired by Arnd's
5136 5140 suggestion.
5137 5141
5138 5142 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
5139 5143 calling magic functions with () in their arguments. Thanks to Arnd
5140 5144 Baecker for pointing this to me.
5141 5145
5142 5146 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
5143 5147 infinitely for integer or complex arrays (only worked with floats).
5144 5148
5145 5149 2002-03-16 Fernando Perez <fperez@colorado.edu>
5146 5150
5147 5151 * setup.py: Merged setup and setup_windows into a single script
5148 5152 which properly handles things for windows users.
5149 5153
5150 5154 2002-03-15 Fernando Perez <fperez@colorado.edu>
5151 5155
5152 5156 * Big change to the manual: now the magics are all automatically
5153 5157 documented. This information is generated from their docstrings
5154 5158 and put in a latex file included by the manual lyx file. This way
5155 5159 we get always up to date information for the magics. The manual
5156 5160 now also has proper version information, also auto-synced.
5157 5161
5158 5162 For this to work, an undocumented --magic_docstrings option was added.
5159 5163
5160 5164 2002-03-13 Fernando Perez <fperez@colorado.edu>
5161 5165
5162 5166 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
5163 5167 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
5164 5168
5165 5169 2002-03-12 Fernando Perez <fperez@colorado.edu>
5166 5170
5167 5171 * IPython/ultraTB.py (TermColors): changed color escapes again to
5168 5172 fix the (old, reintroduced) line-wrapping bug. Basically, if
5169 5173 \001..\002 aren't given in the color escapes, lines get wrapped
5170 5174 weirdly. But giving those screws up old xterms and emacs terms. So
5171 5175 I added some logic for emacs terms to be ok, but I can't identify old
5172 5176 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5173 5177
5174 5178 2002-03-10 Fernando Perez <fperez@colorado.edu>
5175 5179
5176 5180 * IPython/usage.py (__doc__): Various documentation cleanups and
5177 5181 updates, both in usage docstrings and in the manual.
5178 5182
5179 5183 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
5180 5184 handling of caching. Set minimum acceptabe value for having a
5181 5185 cache at 20 values.
5182 5186
5183 5187 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5184 5188 install_first_time function to a method, renamed it and added an
5185 5189 'upgrade' mode. Now people can update their config directory with
5186 5190 a simple command line switch (-upgrade, also new).
5187 5191
5188 5192 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5189 5193 @file (convenient for automagic users under Python >= 2.2).
5190 5194 Removed @files (it seemed more like a plural than an abbrev. of
5191 5195 'file show').
5192 5196
5193 5197 * IPython/iplib.py (install_first_time): Fixed crash if there were
5194 5198 backup files ('~') in .ipython/ install directory.
5195 5199
5196 5200 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5197 5201 system. Things look fine, but these changes are fairly
5198 5202 intrusive. Test them for a few days.
5199 5203
5200 5204 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5201 5205 the prompts system. Now all in/out prompt strings are user
5202 5206 controllable. This is particularly useful for embedding, as one
5203 5207 can tag embedded instances with particular prompts.
5204 5208
5205 5209 Also removed global use of sys.ps1/2, which now allows nested
5206 5210 embeddings without any problems. Added command-line options for
5207 5211 the prompt strings.
5208 5212
5209 5213 2002-03-08 Fernando Perez <fperez@colorado.edu>
5210 5214
5211 5215 * IPython/UserConfig/example-embed-short.py (ipshell): added
5212 5216 example file with the bare minimum code for embedding.
5213 5217
5214 5218 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5215 5219 functionality for the embeddable shell to be activated/deactivated
5216 5220 either globally or at each call.
5217 5221
5218 5222 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5219 5223 rewriting the prompt with '--->' for auto-inputs with proper
5220 5224 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5221 5225 this is handled by the prompts class itself, as it should.
5222 5226
5223 5227 2002-03-05 Fernando Perez <fperez@colorado.edu>
5224 5228
5225 5229 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5226 5230 @logstart to avoid name clashes with the math log function.
5227 5231
5228 5232 * Big updates to X/Emacs section of the manual.
5229 5233
5230 5234 * Removed ipython_emacs. Milan explained to me how to pass
5231 5235 arguments to ipython through Emacs. Some day I'm going to end up
5232 5236 learning some lisp...
5233 5237
5234 5238 2002-03-04 Fernando Perez <fperez@colorado.edu>
5235 5239
5236 5240 * IPython/ipython_emacs: Created script to be used as the
5237 5241 py-python-command Emacs variable so we can pass IPython
5238 5242 parameters. I can't figure out how to tell Emacs directly to pass
5239 5243 parameters to IPython, so a dummy shell script will do it.
5240 5244
5241 5245 Other enhancements made for things to work better under Emacs'
5242 5246 various types of terminals. Many thanks to Milan Zamazal
5243 5247 <pdm-AT-zamazal.org> for all the suggestions and pointers.
5244 5248
5245 5249 2002-03-01 Fernando Perez <fperez@colorado.edu>
5246 5250
5247 5251 * IPython/ipmaker.py (make_IPython): added a --readline! option so
5248 5252 that loading of readline is now optional. This gives better
5249 5253 control to emacs users.
5250 5254
5251 5255 * IPython/ultraTB.py (__date__): Modified color escape sequences
5252 5256 and now things work fine under xterm and in Emacs' term buffers
5253 5257 (though not shell ones). Well, in emacs you get colors, but all
5254 5258 seem to be 'light' colors (no difference between dark and light
5255 5259 ones). But the garbage chars are gone, and also in xterms. It
5256 5260 seems that now I'm using 'cleaner' ansi sequences.
5257 5261
5258 5262 2002-02-21 Fernando Perez <fperez@colorado.edu>
5259 5263
5260 5264 * Released 0.2.7 (mainly to publish the scoping fix).
5261 5265
5262 5266 * IPython/Logger.py (Logger.logstate): added. A corresponding
5263 5267 @logstate magic was created.
5264 5268
5265 5269 * IPython/Magic.py: fixed nested scoping problem under Python
5266 5270 2.1.x (automagic wasn't working).
5267 5271
5268 5272 2002-02-20 Fernando Perez <fperez@colorado.edu>
5269 5273
5270 5274 * Released 0.2.6.
5271 5275
5272 5276 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
5273 5277 option so that logs can come out without any headers at all.
5274 5278
5275 5279 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
5276 5280 SciPy.
5277 5281
5278 5282 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
5279 5283 that embedded IPython calls don't require vars() to be explicitly
5280 5284 passed. Now they are extracted from the caller's frame (code
5281 5285 snatched from Eric Jones' weave). Added better documentation to
5282 5286 the section on embedding and the example file.
5283 5287
5284 5288 * IPython/genutils.py (page): Changed so that under emacs, it just
5285 5289 prints the string. You can then page up and down in the emacs
5286 5290 buffer itself. This is how the builtin help() works.
5287 5291
5288 5292 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
5289 5293 macro scoping: macros need to be executed in the user's namespace
5290 5294 to work as if they had been typed by the user.
5291 5295
5292 5296 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
5293 5297 execute automatically (no need to type 'exec...'). They then
5294 5298 behave like 'true macros'. The printing system was also modified
5295 5299 for this to work.
5296 5300
5297 5301 2002-02-19 Fernando Perez <fperez@colorado.edu>
5298 5302
5299 5303 * IPython/genutils.py (page_file): new function for paging files
5300 5304 in an OS-independent way. Also necessary for file viewing to work
5301 5305 well inside Emacs buffers.
5302 5306 (page): Added checks for being in an emacs buffer.
5303 5307 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
5304 5308 same bug in iplib.
5305 5309
5306 5310 2002-02-18 Fernando Perez <fperez@colorado.edu>
5307 5311
5308 5312 * IPython/iplib.py (InteractiveShell.init_readline): modified use
5309 5313 of readline so that IPython can work inside an Emacs buffer.
5310 5314
5311 5315 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
5312 5316 method signatures (they weren't really bugs, but it looks cleaner
5313 5317 and keeps PyChecker happy).
5314 5318
5315 5319 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
5316 5320 for implementing various user-defined hooks. Currently only
5317 5321 display is done.
5318 5322
5319 5323 * IPython/Prompts.py (CachedOutput._display): changed display
5320 5324 functions so that they can be dynamically changed by users easily.
5321 5325
5322 5326 * IPython/Extensions/numeric_formats.py (num_display): added an
5323 5327 extension for printing NumPy arrays in flexible manners. It
5324 5328 doesn't do anything yet, but all the structure is in
5325 5329 place. Ultimately the plan is to implement output format control
5326 5330 like in Octave.
5327 5331
5328 5332 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5329 5333 methods are found at run-time by all the automatic machinery.
5330 5334
5331 5335 2002-02-17 Fernando Perez <fperez@colorado.edu>
5332 5336
5333 5337 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5334 5338 whole file a little.
5335 5339
5336 5340 * ToDo: closed this document. Now there's a new_design.lyx
5337 5341 document for all new ideas. Added making a pdf of it for the
5338 5342 end-user distro.
5339 5343
5340 5344 * IPython/Logger.py (Logger.switch_log): Created this to replace
5341 5345 logon() and logoff(). It also fixes a nasty crash reported by
5342 5346 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5343 5347
5344 5348 * IPython/iplib.py (complete): got auto-completion to work with
5345 5349 automagic (I had wanted this for a long time).
5346 5350
5347 5351 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5348 5352 to @file, since file() is now a builtin and clashes with automagic
5349 5353 for @file.
5350 5354
5351 5355 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5352 5356 of this was previously in iplib, which had grown to more than 2000
5353 5357 lines, way too long. No new functionality, but it makes managing
5354 5358 the code a bit easier.
5355 5359
5356 5360 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5357 5361 information to crash reports.
5358 5362
5359 5363 2002-02-12 Fernando Perez <fperez@colorado.edu>
5360 5364
5361 5365 * Released 0.2.5.
5362 5366
5363 5367 2002-02-11 Fernando Perez <fperez@colorado.edu>
5364 5368
5365 5369 * Wrote a relatively complete Windows installer. It puts
5366 5370 everything in place, creates Start Menu entries and fixes the
5367 5371 color issues. Nothing fancy, but it works.
5368 5372
5369 5373 2002-02-10 Fernando Perez <fperez@colorado.edu>
5370 5374
5371 5375 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
5372 5376 os.path.expanduser() call so that we can type @run ~/myfile.py and
5373 5377 have thigs work as expected.
5374 5378
5375 5379 * IPython/genutils.py (page): fixed exception handling so things
5376 5380 work both in Unix and Windows correctly. Quitting a pager triggers
5377 5381 an IOError/broken pipe in Unix, and in windows not finding a pager
5378 5382 is also an IOError, so I had to actually look at the return value
5379 5383 of the exception, not just the exception itself. Should be ok now.
5380 5384
5381 5385 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
5382 5386 modified to allow case-insensitive color scheme changes.
5383 5387
5384 5388 2002-02-09 Fernando Perez <fperez@colorado.edu>
5385 5389
5386 5390 * IPython/genutils.py (native_line_ends): new function to leave
5387 5391 user config files with os-native line-endings.
5388 5392
5389 5393 * README and manual updates.
5390 5394
5391 5395 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
5392 5396 instead of StringType to catch Unicode strings.
5393 5397
5394 5398 * IPython/genutils.py (filefind): fixed bug for paths with
5395 5399 embedded spaces (very common in Windows).
5396 5400
5397 5401 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
5398 5402 files under Windows, so that they get automatically associated
5399 5403 with a text editor. Windows makes it a pain to handle
5400 5404 extension-less files.
5401 5405
5402 5406 * IPython/iplib.py (InteractiveShell.init_readline): Made the
5403 5407 warning about readline only occur for Posix. In Windows there's no
5404 5408 way to get readline, so why bother with the warning.
5405 5409
5406 5410 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
5407 5411 for __str__ instead of dir(self), since dir() changed in 2.2.
5408 5412
5409 5413 * Ported to Windows! Tested on XP, I suspect it should work fine
5410 5414 on NT/2000, but I don't think it will work on 98 et al. That
5411 5415 series of Windows is such a piece of junk anyway that I won't try
5412 5416 porting it there. The XP port was straightforward, showed a few
5413 5417 bugs here and there (fixed all), in particular some string
5414 5418 handling stuff which required considering Unicode strings (which
5415 5419 Windows uses). This is good, but hasn't been too tested :) No
5416 5420 fancy installer yet, I'll put a note in the manual so people at
5417 5421 least make manually a shortcut.
5418 5422
5419 5423 * IPython/iplib.py (Magic.magic_colors): Unified the color options
5420 5424 into a single one, "colors". This now controls both prompt and
5421 5425 exception color schemes, and can be changed both at startup
5422 5426 (either via command-line switches or via ipythonrc files) and at
5423 5427 runtime, with @colors.
5424 5428 (Magic.magic_run): renamed @prun to @run and removed the old
5425 5429 @run. The two were too similar to warrant keeping both.
5426 5430
5427 5431 2002-02-03 Fernando Perez <fperez@colorado.edu>
5428 5432
5429 5433 * IPython/iplib.py (install_first_time): Added comment on how to
5430 5434 configure the color options for first-time users. Put a <return>
5431 5435 request at the end so that small-terminal users get a chance to
5432 5436 read the startup info.
5433 5437
5434 5438 2002-01-23 Fernando Perez <fperez@colorado.edu>
5435 5439
5436 5440 * IPython/iplib.py (CachedOutput.update): Changed output memory
5437 5441 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
5438 5442 input history we still use _i. Did this b/c these variable are
5439 5443 very commonly used in interactive work, so the less we need to
5440 5444 type the better off we are.
5441 5445 (Magic.magic_prun): updated @prun to better handle the namespaces
5442 5446 the file will run in, including a fix for __name__ not being set
5443 5447 before.
5444 5448
5445 5449 2002-01-20 Fernando Perez <fperez@colorado.edu>
5446 5450
5447 5451 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
5448 5452 extra garbage for Python 2.2. Need to look more carefully into
5449 5453 this later.
5450 5454
5451 5455 2002-01-19 Fernando Perez <fperez@colorado.edu>
5452 5456
5453 5457 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
5454 5458 display SyntaxError exceptions properly formatted when they occur
5455 5459 (they can be triggered by imported code).
5456 5460
5457 5461 2002-01-18 Fernando Perez <fperez@colorado.edu>
5458 5462
5459 5463 * IPython/iplib.py (InteractiveShell.safe_execfile): now
5460 5464 SyntaxError exceptions are reported nicely formatted, instead of
5461 5465 spitting out only offset information as before.
5462 5466 (Magic.magic_prun): Added the @prun function for executing
5463 5467 programs with command line args inside IPython.
5464 5468
5465 5469 2002-01-16 Fernando Perez <fperez@colorado.edu>
5466 5470
5467 5471 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
5468 5472 to *not* include the last item given in a range. This brings their
5469 5473 behavior in line with Python's slicing:
5470 5474 a[n1:n2] -> a[n1]...a[n2-1]
5471 5475 It may be a bit less convenient, but I prefer to stick to Python's
5472 5476 conventions *everywhere*, so users never have to wonder.
5473 5477 (Magic.magic_macro): Added @macro function to ease the creation of
5474 5478 macros.
5475 5479
5476 5480 2002-01-05 Fernando Perez <fperez@colorado.edu>
5477 5481
5478 5482 * Released 0.2.4.
5479 5483
5480 5484 * IPython/iplib.py (Magic.magic_pdef):
5481 5485 (InteractiveShell.safe_execfile): report magic lines and error
5482 5486 lines without line numbers so one can easily copy/paste them for
5483 5487 re-execution.
5484 5488
5485 5489 * Updated manual with recent changes.
5486 5490
5487 5491 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5488 5492 docstring printing when class? is called. Very handy for knowing
5489 5493 how to create class instances (as long as __init__ is well
5490 5494 documented, of course :)
5491 5495 (Magic.magic_doc): print both class and constructor docstrings.
5492 5496 (Magic.magic_pdef): give constructor info if passed a class and
5493 5497 __call__ info for callable object instances.
5494 5498
5495 5499 2002-01-04 Fernando Perez <fperez@colorado.edu>
5496 5500
5497 5501 * Made deep_reload() off by default. It doesn't always work
5498 5502 exactly as intended, so it's probably safer to have it off. It's
5499 5503 still available as dreload() anyway, so nothing is lost.
5500 5504
5501 5505 2002-01-02 Fernando Perez <fperez@colorado.edu>
5502 5506
5503 5507 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5504 5508 so I wanted an updated release).
5505 5509
5506 5510 2001-12-27 Fernando Perez <fperez@colorado.edu>
5507 5511
5508 5512 * IPython/iplib.py (InteractiveShell.interact): Added the original
5509 5513 code from 'code.py' for this module in order to change the
5510 5514 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5511 5515 the history cache would break when the user hit Ctrl-C, and
5512 5516 interact() offers no way to add any hooks to it.
5513 5517
5514 5518 2001-12-23 Fernando Perez <fperez@colorado.edu>
5515 5519
5516 5520 * setup.py: added check for 'MANIFEST' before trying to remove
5517 5521 it. Thanks to Sean Reifschneider.
5518 5522
5519 5523 2001-12-22 Fernando Perez <fperez@colorado.edu>
5520 5524
5521 5525 * Released 0.2.2.
5522 5526
5523 5527 * Finished (reasonably) writing the manual. Later will add the
5524 5528 python-standard navigation stylesheets, but for the time being
5525 5529 it's fairly complete. Distribution will include html and pdf
5526 5530 versions.
5527 5531
5528 5532 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5529 5533 (MayaVi author).
5530 5534
5531 5535 2001-12-21 Fernando Perez <fperez@colorado.edu>
5532 5536
5533 5537 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5534 5538 good public release, I think (with the manual and the distutils
5535 5539 installer). The manual can use some work, but that can go
5536 5540 slowly. Otherwise I think it's quite nice for end users. Next
5537 5541 summer, rewrite the guts of it...
5538 5542
5539 5543 * Changed format of ipythonrc files to use whitespace as the
5540 5544 separator instead of an explicit '='. Cleaner.
5541 5545
5542 5546 2001-12-20 Fernando Perez <fperez@colorado.edu>
5543 5547
5544 5548 * Started a manual in LyX. For now it's just a quick merge of the
5545 5549 various internal docstrings and READMEs. Later it may grow into a
5546 5550 nice, full-blown manual.
5547 5551
5548 5552 * Set up a distutils based installer. Installation should now be
5549 5553 trivially simple for end-users.
5550 5554
5551 5555 2001-12-11 Fernando Perez <fperez@colorado.edu>
5552 5556
5553 5557 * Released 0.2.0. First public release, announced it at
5554 5558 comp.lang.python. From now on, just bugfixes...
5555 5559
5556 5560 * Went through all the files, set copyright/license notices and
5557 5561 cleaned up things. Ready for release.
5558 5562
5559 5563 2001-12-10 Fernando Perez <fperez@colorado.edu>
5560 5564
5561 5565 * Changed the first-time installer not to use tarfiles. It's more
5562 5566 robust now and less unix-dependent. Also makes it easier for
5563 5567 people to later upgrade versions.
5564 5568
5565 5569 * Changed @exit to @abort to reflect the fact that it's pretty
5566 5570 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5567 5571 becomes significant only when IPyhton is embedded: in that case,
5568 5572 C-D closes IPython only, but @abort kills the enclosing program
5569 5573 too (unless it had called IPython inside a try catching
5570 5574 SystemExit).
5571 5575
5572 5576 * Created Shell module which exposes the actuall IPython Shell
5573 5577 classes, currently the normal and the embeddable one. This at
5574 5578 least offers a stable interface we won't need to change when
5575 5579 (later) the internals are rewritten. That rewrite will be confined
5576 5580 to iplib and ipmaker, but the Shell interface should remain as is.
5577 5581
5578 5582 * Added embed module which offers an embeddable IPShell object,
5579 5583 useful to fire up IPython *inside* a running program. Great for
5580 5584 debugging or dynamical data analysis.
5581 5585
5582 5586 2001-12-08 Fernando Perez <fperez@colorado.edu>
5583 5587
5584 5588 * Fixed small bug preventing seeing info from methods of defined
5585 5589 objects (incorrect namespace in _ofind()).
5586 5590
5587 5591 * Documentation cleanup. Moved the main usage docstrings to a
5588 5592 separate file, usage.py (cleaner to maintain, and hopefully in the
5589 5593 future some perlpod-like way of producing interactive, man and
5590 5594 html docs out of it will be found).
5591 5595
5592 5596 * Added @profile to see your profile at any time.
5593 5597
5594 5598 * Added @p as an alias for 'print'. It's especially convenient if
5595 5599 using automagic ('p x' prints x).
5596 5600
5597 5601 * Small cleanups and fixes after a pychecker run.
5598 5602
5599 5603 * Changed the @cd command to handle @cd - and @cd -<n> for
5600 5604 visiting any directory in _dh.
5601 5605
5602 5606 * Introduced _dh, a history of visited directories. @dhist prints
5603 5607 it out with numbers.
5604 5608
5605 5609 2001-12-07 Fernando Perez <fperez@colorado.edu>
5606 5610
5607 5611 * Released 0.1.22
5608 5612
5609 5613 * Made initialization a bit more robust against invalid color
5610 5614 options in user input (exit, not traceback-crash).
5611 5615
5612 5616 * Changed the bug crash reporter to write the report only in the
5613 5617 user's .ipython directory. That way IPython won't litter people's
5614 5618 hard disks with crash files all over the place. Also print on
5615 5619 screen the necessary mail command.
5616 5620
5617 5621 * With the new ultraTB, implemented LightBG color scheme for light
5618 5622 background terminals. A lot of people like white backgrounds, so I
5619 5623 guess we should at least give them something readable.
5620 5624
5621 5625 2001-12-06 Fernando Perez <fperez@colorado.edu>
5622 5626
5623 5627 * Modified the structure of ultraTB. Now there's a proper class
5624 5628 for tables of color schemes which allow adding schemes easily and
5625 5629 switching the active scheme without creating a new instance every
5626 5630 time (which was ridiculous). The syntax for creating new schemes
5627 5631 is also cleaner. I think ultraTB is finally done, with a clean
5628 5632 class structure. Names are also much cleaner (now there's proper
5629 5633 color tables, no need for every variable to also have 'color' in
5630 5634 its name).
5631 5635
5632 5636 * Broke down genutils into separate files. Now genutils only
5633 5637 contains utility functions, and classes have been moved to their
5634 5638 own files (they had enough independent functionality to warrant
5635 5639 it): ConfigLoader, OutputTrap, Struct.
5636 5640
5637 5641 2001-12-05 Fernando Perez <fperez@colorado.edu>
5638 5642
5639 5643 * IPython turns 21! Released version 0.1.21, as a candidate for
5640 5644 public consumption. If all goes well, release in a few days.
5641 5645
5642 5646 * Fixed path bug (files in Extensions/ directory wouldn't be found
5643 5647 unless IPython/ was explicitly in sys.path).
5644 5648
5645 5649 * Extended the FlexCompleter class as MagicCompleter to allow
5646 5650 completion of @-starting lines.
5647 5651
5648 5652 * Created __release__.py file as a central repository for release
5649 5653 info that other files can read from.
5650 5654
5651 5655 * Fixed small bug in logging: when logging was turned on in
5652 5656 mid-session, old lines with special meanings (!@?) were being
5653 5657 logged without the prepended comment, which is necessary since
5654 5658 they are not truly valid python syntax. This should make session
5655 5659 restores produce less errors.
5656 5660
5657 5661 * The namespace cleanup forced me to make a FlexCompleter class
5658 5662 which is nothing but a ripoff of rlcompleter, but with selectable
5659 5663 namespace (rlcompleter only works in __main__.__dict__). I'll try
5660 5664 to submit a note to the authors to see if this change can be
5661 5665 incorporated in future rlcompleter releases (Dec.6: done)
5662 5666
5663 5667 * More fixes to namespace handling. It was a mess! Now all
5664 5668 explicit references to __main__.__dict__ are gone (except when
5665 5669 really needed) and everything is handled through the namespace
5666 5670 dicts in the IPython instance. We seem to be getting somewhere
5667 5671 with this, finally...
5668 5672
5669 5673 * Small documentation updates.
5670 5674
5671 5675 * Created the Extensions directory under IPython (with an
5672 5676 __init__.py). Put the PhysicalQ stuff there. This directory should
5673 5677 be used for all special-purpose extensions.
5674 5678
5675 5679 * File renaming:
5676 5680 ipythonlib --> ipmaker
5677 5681 ipplib --> iplib
5678 5682 This makes a bit more sense in terms of what these files actually do.
5679 5683
5680 5684 * Moved all the classes and functions in ipythonlib to ipplib, so
5681 5685 now ipythonlib only has make_IPython(). This will ease up its
5682 5686 splitting in smaller functional chunks later.
5683 5687
5684 5688 * Cleaned up (done, I think) output of @whos. Better column
5685 5689 formatting, and now shows str(var) for as much as it can, which is
5686 5690 typically what one gets with a 'print var'.
5687 5691
5688 5692 2001-12-04 Fernando Perez <fperez@colorado.edu>
5689 5693
5690 5694 * Fixed namespace problems. Now builtin/IPyhton/user names get
5691 5695 properly reported in their namespace. Internal namespace handling
5692 5696 is finally getting decent (not perfect yet, but much better than
5693 5697 the ad-hoc mess we had).
5694 5698
5695 5699 * Removed -exit option. If people just want to run a python
5696 5700 script, that's what the normal interpreter is for. Less
5697 5701 unnecessary options, less chances for bugs.
5698 5702
5699 5703 * Added a crash handler which generates a complete post-mortem if
5700 5704 IPython crashes. This will help a lot in tracking bugs down the
5701 5705 road.
5702 5706
5703 5707 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5704 5708 which were boud to functions being reassigned would bypass the
5705 5709 logger, breaking the sync of _il with the prompt counter. This
5706 5710 would then crash IPython later when a new line was logged.
5707 5711
5708 5712 2001-12-02 Fernando Perez <fperez@colorado.edu>
5709 5713
5710 5714 * Made IPython a package. This means people don't have to clutter
5711 5715 their sys.path with yet another directory. Changed the INSTALL
5712 5716 file accordingly.
5713 5717
5714 5718 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5715 5719 sorts its output (so @who shows it sorted) and @whos formats the
5716 5720 table according to the width of the first column. Nicer, easier to
5717 5721 read. Todo: write a generic table_format() which takes a list of
5718 5722 lists and prints it nicely formatted, with optional row/column
5719 5723 separators and proper padding and justification.
5720 5724
5721 5725 * Released 0.1.20
5722 5726
5723 5727 * Fixed bug in @log which would reverse the inputcache list (a
5724 5728 copy operation was missing).
5725 5729
5726 5730 * Code cleanup. @config was changed to use page(). Better, since
5727 5731 its output is always quite long.
5728 5732
5729 5733 * Itpl is back as a dependency. I was having too many problems
5730 5734 getting the parametric aliases to work reliably, and it's just
5731 5735 easier to code weird string operations with it than playing %()s
5732 5736 games. It's only ~6k, so I don't think it's too big a deal.
5733 5737
5734 5738 * Found (and fixed) a very nasty bug with history. !lines weren't
5735 5739 getting cached, and the out of sync caches would crash
5736 5740 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5737 5741 division of labor a bit better. Bug fixed, cleaner structure.
5738 5742
5739 5743 2001-12-01 Fernando Perez <fperez@colorado.edu>
5740 5744
5741 5745 * Released 0.1.19
5742 5746
5743 5747 * Added option -n to @hist to prevent line number printing. Much
5744 5748 easier to copy/paste code this way.
5745 5749
5746 5750 * Created global _il to hold the input list. Allows easy
5747 5751 re-execution of blocks of code by slicing it (inspired by Janko's
5748 5752 comment on 'macros').
5749 5753
5750 5754 * Small fixes and doc updates.
5751 5755
5752 5756 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5753 5757 much too fragile with automagic. Handles properly multi-line
5754 5758 statements and takes parameters.
5755 5759
5756 5760 2001-11-30 Fernando Perez <fperez@colorado.edu>
5757 5761
5758 5762 * Version 0.1.18 released.
5759 5763
5760 5764 * Fixed nasty namespace bug in initial module imports.
5761 5765
5762 5766 * Added copyright/license notes to all code files (except
5763 5767 DPyGetOpt). For the time being, LGPL. That could change.
5764 5768
5765 5769 * Rewrote a much nicer README, updated INSTALL, cleaned up
5766 5770 ipythonrc-* samples.
5767 5771
5768 5772 * Overall code/documentation cleanup. Basically ready for
5769 5773 release. Only remaining thing: licence decision (LGPL?).
5770 5774
5771 5775 * Converted load_config to a class, ConfigLoader. Now recursion
5772 5776 control is better organized. Doesn't include the same file twice.
5773 5777
5774 5778 2001-11-29 Fernando Perez <fperez@colorado.edu>
5775 5779
5776 5780 * Got input history working. Changed output history variables from
5777 5781 _p to _o so that _i is for input and _o for output. Just cleaner
5778 5782 convention.
5779 5783
5780 5784 * Implemented parametric aliases. This pretty much allows the
5781 5785 alias system to offer full-blown shell convenience, I think.
5782 5786
5783 5787 * Version 0.1.17 released, 0.1.18 opened.
5784 5788
5785 5789 * dot_ipython/ipythonrc (alias): added documentation.
5786 5790 (xcolor): Fixed small bug (xcolors -> xcolor)
5787 5791
5788 5792 * Changed the alias system. Now alias is a magic command to define
5789 5793 aliases just like the shell. Rationale: the builtin magics should
5790 5794 be there for things deeply connected to IPython's
5791 5795 architecture. And this is a much lighter system for what I think
5792 5796 is the really important feature: allowing users to define quickly
5793 5797 magics that will do shell things for them, so they can customize
5794 5798 IPython easily to match their work habits. If someone is really
5795 5799 desperate to have another name for a builtin alias, they can
5796 5800 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5797 5801 works.
5798 5802
5799 5803 2001-11-28 Fernando Perez <fperez@colorado.edu>
5800 5804
5801 5805 * Changed @file so that it opens the source file at the proper
5802 5806 line. Since it uses less, if your EDITOR environment is
5803 5807 configured, typing v will immediately open your editor of choice
5804 5808 right at the line where the object is defined. Not as quick as
5805 5809 having a direct @edit command, but for all intents and purposes it
5806 5810 works. And I don't have to worry about writing @edit to deal with
5807 5811 all the editors, less does that.
5808 5812
5809 5813 * Version 0.1.16 released, 0.1.17 opened.
5810 5814
5811 5815 * Fixed some nasty bugs in the page/page_dumb combo that could
5812 5816 crash IPython.
5813 5817
5814 5818 2001-11-27 Fernando Perez <fperez@colorado.edu>
5815 5819
5816 5820 * Version 0.1.15 released, 0.1.16 opened.
5817 5821
5818 5822 * Finally got ? and ?? to work for undefined things: now it's
5819 5823 possible to type {}.get? and get information about the get method
5820 5824 of dicts, or os.path? even if only os is defined (so technically
5821 5825 os.path isn't). Works at any level. For example, after import os,
5822 5826 os?, os.path?, os.path.abspath? all work. This is great, took some
5823 5827 work in _ofind.
5824 5828
5825 5829 * Fixed more bugs with logging. The sanest way to do it was to add
5826 5830 to @log a 'mode' parameter. Killed two in one shot (this mode
5827 5831 option was a request of Janko's). I think it's finally clean
5828 5832 (famous last words).
5829 5833
5830 5834 * Added a page_dumb() pager which does a decent job of paging on
5831 5835 screen, if better things (like less) aren't available. One less
5832 5836 unix dependency (someday maybe somebody will port this to
5833 5837 windows).
5834 5838
5835 5839 * Fixed problem in magic_log: would lock of logging out if log
5836 5840 creation failed (because it would still think it had succeeded).
5837 5841
5838 5842 * Improved the page() function using curses to auto-detect screen
5839 5843 size. Now it can make a much better decision on whether to print
5840 5844 or page a string. Option screen_length was modified: a value 0
5841 5845 means auto-detect, and that's the default now.
5842 5846
5843 5847 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5844 5848 go out. I'll test it for a few days, then talk to Janko about
5845 5849 licences and announce it.
5846 5850
5847 5851 * Fixed the length of the auto-generated ---> prompt which appears
5848 5852 for auto-parens and auto-quotes. Getting this right isn't trivial,
5849 5853 with all the color escapes, different prompt types and optional
5850 5854 separators. But it seems to be working in all the combinations.
5851 5855
5852 5856 2001-11-26 Fernando Perez <fperez@colorado.edu>
5853 5857
5854 5858 * Wrote a regexp filter to get option types from the option names
5855 5859 string. This eliminates the need to manually keep two duplicate
5856 5860 lists.
5857 5861
5858 5862 * Removed the unneeded check_option_names. Now options are handled
5859 5863 in a much saner manner and it's easy to visually check that things
5860 5864 are ok.
5861 5865
5862 5866 * Updated version numbers on all files I modified to carry a
5863 5867 notice so Janko and Nathan have clear version markers.
5864 5868
5865 5869 * Updated docstring for ultraTB with my changes. I should send
5866 5870 this to Nathan.
5867 5871
5868 5872 * Lots of small fixes. Ran everything through pychecker again.
5869 5873
5870 5874 * Made loading of deep_reload an cmd line option. If it's not too
5871 5875 kosher, now people can just disable it. With -nodeep_reload it's
5872 5876 still available as dreload(), it just won't overwrite reload().
5873 5877
5874 5878 * Moved many options to the no| form (-opt and -noopt
5875 5879 accepted). Cleaner.
5876 5880
5877 5881 * Changed magic_log so that if called with no parameters, it uses
5878 5882 'rotate' mode. That way auto-generated logs aren't automatically
5879 5883 over-written. For normal logs, now a backup is made if it exists
5880 5884 (only 1 level of backups). A new 'backup' mode was added to the
5881 5885 Logger class to support this. This was a request by Janko.
5882 5886
5883 5887 * Added @logoff/@logon to stop/restart an active log.
5884 5888
5885 5889 * Fixed a lot of bugs in log saving/replay. It was pretty
5886 5890 broken. Now special lines (!@,/) appear properly in the command
5887 5891 history after a log replay.
5888 5892
5889 5893 * Tried and failed to implement full session saving via pickle. My
5890 5894 idea was to pickle __main__.__dict__, but modules can't be
5891 5895 pickled. This would be a better alternative to replaying logs, but
5892 5896 seems quite tricky to get to work. Changed -session to be called
5893 5897 -logplay, which more accurately reflects what it does. And if we
5894 5898 ever get real session saving working, -session is now available.
5895 5899
5896 5900 * Implemented color schemes for prompts also. As for tracebacks,
5897 5901 currently only NoColor and Linux are supported. But now the
5898 5902 infrastructure is in place, based on a generic ColorScheme
5899 5903 class. So writing and activating new schemes both for the prompts
5900 5904 and the tracebacks should be straightforward.
5901 5905
5902 5906 * Version 0.1.13 released, 0.1.14 opened.
5903 5907
5904 5908 * Changed handling of options for output cache. Now counter is
5905 5909 hardwired starting at 1 and one specifies the maximum number of
5906 5910 entries *in the outcache* (not the max prompt counter). This is
5907 5911 much better, since many statements won't increase the cache
5908 5912 count. It also eliminated some confusing options, now there's only
5909 5913 one: cache_size.
5910 5914
5911 5915 * Added 'alias' magic function and magic_alias option in the
5912 5916 ipythonrc file. Now the user can easily define whatever names he
5913 5917 wants for the magic functions without having to play weird
5914 5918 namespace games. This gives IPython a real shell-like feel.
5915 5919
5916 5920 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5917 5921 @ or not).
5918 5922
5919 5923 This was one of the last remaining 'visible' bugs (that I know
5920 5924 of). I think if I can clean up the session loading so it works
5921 5925 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5922 5926 about licensing).
5923 5927
5924 5928 2001-11-25 Fernando Perez <fperez@colorado.edu>
5925 5929
5926 5930 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5927 5931 there's a cleaner distinction between what ? and ?? show.
5928 5932
5929 5933 * Added screen_length option. Now the user can define his own
5930 5934 screen size for page() operations.
5931 5935
5932 5936 * Implemented magic shell-like functions with automatic code
5933 5937 generation. Now adding another function is just a matter of adding
5934 5938 an entry to a dict, and the function is dynamically generated at
5935 5939 run-time. Python has some really cool features!
5936 5940
5937 5941 * Renamed many options to cleanup conventions a little. Now all
5938 5942 are lowercase, and only underscores where needed. Also in the code
5939 5943 option name tables are clearer.
5940 5944
5941 5945 * Changed prompts a little. Now input is 'In [n]:' instead of
5942 5946 'In[n]:='. This allows it the numbers to be aligned with the
5943 5947 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5944 5948 Python (it was a Mathematica thing). The '...' continuation prompt
5945 5949 was also changed a little to align better.
5946 5950
5947 5951 * Fixed bug when flushing output cache. Not all _p<n> variables
5948 5952 exist, so their deletion needs to be wrapped in a try:
5949 5953
5950 5954 * Figured out how to properly use inspect.formatargspec() (it
5951 5955 requires the args preceded by *). So I removed all the code from
5952 5956 _get_pdef in Magic, which was just replicating that.
5953 5957
5954 5958 * Added test to prefilter to allow redefining magic function names
5955 5959 as variables. This is ok, since the @ form is always available,
5956 5960 but whe should allow the user to define a variable called 'ls' if
5957 5961 he needs it.
5958 5962
5959 5963 * Moved the ToDo information from README into a separate ToDo.
5960 5964
5961 5965 * General code cleanup and small bugfixes. I think it's close to a
5962 5966 state where it can be released, obviously with a big 'beta'
5963 5967 warning on it.
5964 5968
5965 5969 * Got the magic function split to work. Now all magics are defined
5966 5970 in a separate class. It just organizes things a bit, and now
5967 5971 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5968 5972 was too long).
5969 5973
5970 5974 * Changed @clear to @reset to avoid potential confusions with
5971 5975 the shell command clear. Also renamed @cl to @clear, which does
5972 5976 exactly what people expect it to from their shell experience.
5973 5977
5974 5978 Added a check to the @reset command (since it's so
5975 5979 destructive, it's probably a good idea to ask for confirmation).
5976 5980 But now reset only works for full namespace resetting. Since the
5977 5981 del keyword is already there for deleting a few specific
5978 5982 variables, I don't see the point of having a redundant magic
5979 5983 function for the same task.
5980 5984
5981 5985 2001-11-24 Fernando Perez <fperez@colorado.edu>
5982 5986
5983 5987 * Updated the builtin docs (esp. the ? ones).
5984 5988
5985 5989 * Ran all the code through pychecker. Not terribly impressed with
5986 5990 it: lots of spurious warnings and didn't really find anything of
5987 5991 substance (just a few modules being imported and not used).
5988 5992
5989 5993 * Implemented the new ultraTB functionality into IPython. New
5990 5994 option: xcolors. This chooses color scheme. xmode now only selects
5991 5995 between Plain and Verbose. Better orthogonality.
5992 5996
5993 5997 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5994 5998 mode and color scheme for the exception handlers. Now it's
5995 5999 possible to have the verbose traceback with no coloring.
5996 6000
5997 6001 2001-11-23 Fernando Perez <fperez@colorado.edu>
5998 6002
5999 6003 * Version 0.1.12 released, 0.1.13 opened.
6000 6004
6001 6005 * Removed option to set auto-quote and auto-paren escapes by
6002 6006 user. The chances of breaking valid syntax are just too high. If
6003 6007 someone *really* wants, they can always dig into the code.
6004 6008
6005 6009 * Made prompt separators configurable.
6006 6010
6007 6011 2001-11-22 Fernando Perez <fperez@colorado.edu>
6008 6012
6009 6013 * Small bugfixes in many places.
6010 6014
6011 6015 * Removed the MyCompleter class from ipplib. It seemed redundant
6012 6016 with the C-p,C-n history search functionality. Less code to
6013 6017 maintain.
6014 6018
6015 6019 * Moved all the original ipython.py code into ipythonlib.py. Right
6016 6020 now it's just one big dump into a function called make_IPython, so
6017 6021 no real modularity has been gained. But at least it makes the
6018 6022 wrapper script tiny, and since ipythonlib is a module, it gets
6019 6023 compiled and startup is much faster.
6020 6024
6021 6025 This is a reasobably 'deep' change, so we should test it for a
6022 6026 while without messing too much more with the code.
6023 6027
6024 6028 2001-11-21 Fernando Perez <fperez@colorado.edu>
6025 6029
6026 6030 * Version 0.1.11 released, 0.1.12 opened for further work.
6027 6031
6028 6032 * Removed dependency on Itpl. It was only needed in one place. It
6029 6033 would be nice if this became part of python, though. It makes life
6030 6034 *a lot* easier in some cases.
6031 6035
6032 6036 * Simplified the prefilter code a bit. Now all handlers are
6033 6037 expected to explicitly return a value (at least a blank string).
6034 6038
6035 6039 * Heavy edits in ipplib. Removed the help system altogether. Now
6036 6040 obj?/?? is used for inspecting objects, a magic @doc prints
6037 6041 docstrings, and full-blown Python help is accessed via the 'help'
6038 6042 keyword. This cleans up a lot of code (less to maintain) and does
6039 6043 the job. Since 'help' is now a standard Python component, might as
6040 6044 well use it and remove duplicate functionality.
6041 6045
6042 6046 Also removed the option to use ipplib as a standalone program. By
6043 6047 now it's too dependent on other parts of IPython to function alone.
6044 6048
6045 6049 * Fixed bug in genutils.pager. It would crash if the pager was
6046 6050 exited immediately after opening (broken pipe).
6047 6051
6048 6052 * Trimmed down the VerboseTB reporting a little. The header is
6049 6053 much shorter now and the repeated exception arguments at the end
6050 6054 have been removed. For interactive use the old header seemed a bit
6051 6055 excessive.
6052 6056
6053 6057 * Fixed small bug in output of @whos for variables with multi-word
6054 6058 types (only first word was displayed).
6055 6059
6056 6060 2001-11-17 Fernando Perez <fperez@colorado.edu>
6057 6061
6058 6062 * Version 0.1.10 released, 0.1.11 opened for further work.
6059 6063
6060 6064 * Modified dirs and friends. dirs now *returns* the stack (not
6061 6065 prints), so one can manipulate it as a variable. Convenient to
6062 6066 travel along many directories.
6063 6067
6064 6068 * Fixed bug in magic_pdef: would only work with functions with
6065 6069 arguments with default values.
6066 6070
6067 6071 2001-11-14 Fernando Perez <fperez@colorado.edu>
6068 6072
6069 6073 * Added the PhysicsInput stuff to dot_ipython so it ships as an
6070 6074 example with IPython. Various other minor fixes and cleanups.
6071 6075
6072 6076 * Version 0.1.9 released, 0.1.10 opened for further work.
6073 6077
6074 6078 * Added sys.path to the list of directories searched in the
6075 6079 execfile= option. It used to be the current directory and the
6076 6080 user's IPYTHONDIR only.
6077 6081
6078 6082 2001-11-13 Fernando Perez <fperez@colorado.edu>
6079 6083
6080 6084 * Reinstated the raw_input/prefilter separation that Janko had
6081 6085 initially. This gives a more convenient setup for extending the
6082 6086 pre-processor from the outside: raw_input always gets a string,
6083 6087 and prefilter has to process it. We can then redefine prefilter
6084 6088 from the outside and implement extensions for special
6085 6089 purposes.
6086 6090
6087 6091 Today I got one for inputting PhysicalQuantity objects
6088 6092 (from Scientific) without needing any function calls at
6089 6093 all. Extremely convenient, and it's all done as a user-level
6090 6094 extension (no IPython code was touched). Now instead of:
6091 6095 a = PhysicalQuantity(4.2,'m/s**2')
6092 6096 one can simply say
6093 6097 a = 4.2 m/s**2
6094 6098 or even
6095 6099 a = 4.2 m/s^2
6096 6100
6097 6101 I use this, but it's also a proof of concept: IPython really is
6098 6102 fully user-extensible, even at the level of the parsing of the
6099 6103 command line. It's not trivial, but it's perfectly doable.
6100 6104
6101 6105 * Added 'add_flip' method to inclusion conflict resolver. Fixes
6102 6106 the problem of modules being loaded in the inverse order in which
6103 6107 they were defined in
6104 6108
6105 6109 * Version 0.1.8 released, 0.1.9 opened for further work.
6106 6110
6107 6111 * Added magics pdef, source and file. They respectively show the
6108 6112 definition line ('prototype' in C), source code and full python
6109 6113 file for any callable object. The object inspector oinfo uses
6110 6114 these to show the same information.
6111 6115
6112 6116 * Version 0.1.7 released, 0.1.8 opened for further work.
6113 6117
6114 6118 * Separated all the magic functions into a class called Magic. The
6115 6119 InteractiveShell class was becoming too big for Xemacs to handle
6116 6120 (de-indenting a line would lock it up for 10 seconds while it
6117 6121 backtracked on the whole class!)
6118 6122
6119 6123 FIXME: didn't work. It can be done, but right now namespaces are
6120 6124 all messed up. Do it later (reverted it for now, so at least
6121 6125 everything works as before).
6122 6126
6123 6127 * Got the object introspection system (magic_oinfo) working! I
6124 6128 think this is pretty much ready for release to Janko, so he can
6125 6129 test it for a while and then announce it. Pretty much 100% of what
6126 6130 I wanted for the 'phase 1' release is ready. Happy, tired.
6127 6131
6128 6132 2001-11-12 Fernando Perez <fperez@colorado.edu>
6129 6133
6130 6134 * Version 0.1.6 released, 0.1.7 opened for further work.
6131 6135
6132 6136 * Fixed bug in printing: it used to test for truth before
6133 6137 printing, so 0 wouldn't print. Now checks for None.
6134 6138
6135 6139 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
6136 6140 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
6137 6141 reaches by hand into the outputcache. Think of a better way to do
6138 6142 this later.
6139 6143
6140 6144 * Various small fixes thanks to Nathan's comments.
6141 6145
6142 6146 * Changed magic_pprint to magic_Pprint. This way it doesn't
6143 6147 collide with pprint() and the name is consistent with the command
6144 6148 line option.
6145 6149
6146 6150 * Changed prompt counter behavior to be fully like
6147 6151 Mathematica's. That is, even input that doesn't return a result
6148 6152 raises the prompt counter. The old behavior was kind of confusing
6149 6153 (getting the same prompt number several times if the operation
6150 6154 didn't return a result).
6151 6155
6152 6156 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
6153 6157
6154 6158 * Fixed -Classic mode (wasn't working anymore).
6155 6159
6156 6160 * Added colored prompts using Nathan's new code. Colors are
6157 6161 currently hardwired, they can be user-configurable. For
6158 6162 developers, they can be chosen in file ipythonlib.py, at the
6159 6163 beginning of the CachedOutput class def.
6160 6164
6161 6165 2001-11-11 Fernando Perez <fperez@colorado.edu>
6162 6166
6163 6167 * Version 0.1.5 released, 0.1.6 opened for further work.
6164 6168
6165 6169 * Changed magic_env to *return* the environment as a dict (not to
6166 6170 print it). This way it prints, but it can also be processed.
6167 6171
6168 6172 * Added Verbose exception reporting to interactive
6169 6173 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6170 6174 traceback. Had to make some changes to the ultraTB file. This is
6171 6175 probably the last 'big' thing in my mental todo list. This ties
6172 6176 in with the next entry:
6173 6177
6174 6178 * Changed -Xi and -Xf to a single -xmode option. Now all the user
6175 6179 has to specify is Plain, Color or Verbose for all exception
6176 6180 handling.
6177 6181
6178 6182 * Removed ShellServices option. All this can really be done via
6179 6183 the magic system. It's easier to extend, cleaner and has automatic
6180 6184 namespace protection and documentation.
6181 6185
6182 6186 2001-11-09 Fernando Perez <fperez@colorado.edu>
6183 6187
6184 6188 * Fixed bug in output cache flushing (missing parameter to
6185 6189 __init__). Other small bugs fixed (found using pychecker).
6186 6190
6187 6191 * Version 0.1.4 opened for bugfixing.
6188 6192
6189 6193 2001-11-07 Fernando Perez <fperez@colorado.edu>
6190 6194
6191 6195 * Version 0.1.3 released, mainly because of the raw_input bug.
6192 6196
6193 6197 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6194 6198 and when testing for whether things were callable, a call could
6195 6199 actually be made to certain functions. They would get called again
6196 6200 once 'really' executed, with a resulting double call. A disaster
6197 6201 in many cases (list.reverse() would never work!).
6198 6202
6199 6203 * Removed prefilter() function, moved its code to raw_input (which
6200 6204 after all was just a near-empty caller for prefilter). This saves
6201 6205 a function call on every prompt, and simplifies the class a tiny bit.
6202 6206
6203 6207 * Fix _ip to __ip name in magic example file.
6204 6208
6205 6209 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6206 6210 work with non-gnu versions of tar.
6207 6211
6208 6212 2001-11-06 Fernando Perez <fperez@colorado.edu>
6209 6213
6210 6214 * Version 0.1.2. Just to keep track of the recent changes.
6211 6215
6212 6216 * Fixed nasty bug in output prompt routine. It used to check 'if
6213 6217 arg != None...'. Problem is, this fails if arg implements a
6214 6218 special comparison (__cmp__) which disallows comparing to
6215 6219 None. Found it when trying to use the PhysicalQuantity module from
6216 6220 ScientificPython.
6217 6221
6218 6222 2001-11-05 Fernando Perez <fperez@colorado.edu>
6219 6223
6220 6224 * Also added dirs. Now the pushd/popd/dirs family functions
6221 6225 basically like the shell, with the added convenience of going home
6222 6226 when called with no args.
6223 6227
6224 6228 * pushd/popd slightly modified to mimic shell behavior more
6225 6229 closely.
6226 6230
6227 6231 * Added env,pushd,popd from ShellServices as magic functions. I
6228 6232 think the cleanest will be to port all desired functions from
6229 6233 ShellServices as magics and remove ShellServices altogether. This
6230 6234 will provide a single, clean way of adding functionality
6231 6235 (shell-type or otherwise) to IP.
6232 6236
6233 6237 2001-11-04 Fernando Perez <fperez@colorado.edu>
6234 6238
6235 6239 * Added .ipython/ directory to sys.path. This way users can keep
6236 6240 customizations there and access them via import.
6237 6241
6238 6242 2001-11-03 Fernando Perez <fperez@colorado.edu>
6239 6243
6240 6244 * Opened version 0.1.1 for new changes.
6241 6245
6242 6246 * Changed version number to 0.1.0: first 'public' release, sent to
6243 6247 Nathan and Janko.
6244 6248
6245 6249 * Lots of small fixes and tweaks.
6246 6250
6247 6251 * Minor changes to whos format. Now strings are shown, snipped if
6248 6252 too long.
6249 6253
6250 6254 * Changed ShellServices to work on __main__ so they show up in @who
6251 6255
6252 6256 * Help also works with ? at the end of a line:
6253 6257 ?sin and sin?
6254 6258 both produce the same effect. This is nice, as often I use the
6255 6259 tab-complete to find the name of a method, but I used to then have
6256 6260 to go to the beginning of the line to put a ? if I wanted more
6257 6261 info. Now I can just add the ? and hit return. Convenient.
6258 6262
6259 6263 2001-11-02 Fernando Perez <fperez@colorado.edu>
6260 6264
6261 6265 * Python version check (>=2.1) added.
6262 6266
6263 6267 * Added LazyPython documentation. At this point the docs are quite
6264 6268 a mess. A cleanup is in order.
6265 6269
6266 6270 * Auto-installer created. For some bizarre reason, the zipfiles
6267 6271 module isn't working on my system. So I made a tar version
6268 6272 (hopefully the command line options in various systems won't kill
6269 6273 me).
6270 6274
6271 6275 * Fixes to Struct in genutils. Now all dictionary-like methods are
6272 6276 protected (reasonably).
6273 6277
6274 6278 * Added pager function to genutils and changed ? to print usage
6275 6279 note through it (it was too long).
6276 6280
6277 6281 * Added the LazyPython functionality. Works great! I changed the
6278 6282 auto-quote escape to ';', it's on home row and next to '. But
6279 6283 both auto-quote and auto-paren (still /) escapes are command-line
6280 6284 parameters.
6281 6285
6282 6286
6283 6287 2001-11-01 Fernando Perez <fperez@colorado.edu>
6284 6288
6285 6289 * Version changed to 0.0.7. Fairly large change: configuration now
6286 6290 is all stored in a directory, by default .ipython. There, all
6287 6291 config files have normal looking names (not .names)
6288 6292
6289 6293 * Version 0.0.6 Released first to Lucas and Archie as a test
6290 6294 run. Since it's the first 'semi-public' release, change version to
6291 6295 > 0.0.6 for any changes now.
6292 6296
6293 6297 * Stuff I had put in the ipplib.py changelog:
6294 6298
6295 6299 Changes to InteractiveShell:
6296 6300
6297 6301 - Made the usage message a parameter.
6298 6302
6299 6303 - Require the name of the shell variable to be given. It's a bit
6300 6304 of a hack, but allows the name 'shell' not to be hardwired in the
6301 6305 magic (@) handler, which is problematic b/c it requires
6302 6306 polluting the global namespace with 'shell'. This in turn is
6303 6307 fragile: if a user redefines a variable called shell, things
6304 6308 break.
6305 6309
6306 6310 - magic @: all functions available through @ need to be defined
6307 6311 as magic_<name>, even though they can be called simply as
6308 6312 @<name>. This allows the special command @magic to gather
6309 6313 information automatically about all existing magic functions,
6310 6314 even if they are run-time user extensions, by parsing the shell
6311 6315 instance __dict__ looking for special magic_ names.
6312 6316
6313 6317 - mainloop: added *two* local namespace parameters. This allows
6314 6318 the class to differentiate between parameters which were there
6315 6319 before and after command line initialization was processed. This
6316 6320 way, later @who can show things loaded at startup by the
6317 6321 user. This trick was necessary to make session saving/reloading
6318 6322 really work: ideally after saving/exiting/reloading a session,
6319 6323 *everything* should look the same, including the output of @who. I
6320 6324 was only able to make this work with this double namespace
6321 6325 trick.
6322 6326
6323 6327 - added a header to the logfile which allows (almost) full
6324 6328 session restoring.
6325 6329
6326 6330 - prepend lines beginning with @ or !, with a and log
6327 6331 them. Why? !lines: may be useful to know what you did @lines:
6328 6332 they may affect session state. So when restoring a session, at
6329 6333 least inform the user of their presence. I couldn't quite get
6330 6334 them to properly re-execute, but at least the user is warned.
6331 6335
6332 6336 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now