##// END OF EJS Templates
Fix Python2.4-only bug with automatic skipping of SystemExit
fperez -
Show More
@@ -1,2503 +1,2512 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 IPython -- An enhanced Interactive Python
4 4
5 5 Requires Python 2.3 or newer.
6 6
7 7 This file contains all the classes and helper functions specific to IPython.
8 8
9 $Id: iplib.py 2614 2007-08-13 18:32:38Z vivainio $
9 $Id: iplib.py 2631 2007-08-15 07:07:36Z fperez $
10 10 """
11 11
12 12 #*****************************************************************************
13 13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
14 14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
15 15 #
16 16 # Distributed under the terms of the BSD License. The full license is in
17 17 # the file COPYING, distributed as part of this software.
18 18 #
19 19 # Note: this code originally subclassed code.InteractiveConsole from the
20 20 # Python standard library. Over time, all of that class has been copied
21 21 # verbatim here for modifications which could not be accomplished by
22 22 # subclassing. At this point, there are no dependencies at all on the code
23 23 # module anymore (it is not even imported). The Python License (sec. 2)
24 24 # allows for this, but it's always nice to acknowledge credit where credit is
25 25 # due.
26 26 #*****************************************************************************
27 27
28 28 #****************************************************************************
29 29 # Modules and globals
30 30
31 31 from IPython import Release
32 32 __author__ = '%s <%s>\n%s <%s>' % \
33 33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
34 34 __license__ = Release.license
35 35 __version__ = Release.version
36 36
37 37 # Python standard modules
38 38 import __main__
39 39 import __builtin__
40 40 import StringIO
41 41 import bdb
42 42 import cPickle as pickle
43 43 import codeop
44 44 import doctest
45 45 import exceptions
46 46 import glob
47 47 import inspect
48 48 import keyword
49 49 import new
50 50 import os
51 51 import pydoc
52 52 import re
53 53 import shutil
54 54 import string
55 55 import sys
56 56 import tempfile
57 57 import traceback
58 58 import types
59 59 import pickleshare
60 60 from sets import Set
61 61 from pprint import pprint, pformat
62 62
63 63 # IPython's own modules
64 64 #import IPython
65 65 from IPython import Debugger,OInspect,PyColorize,ultraTB
66 66 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
67 67 from IPython.FakeModule import FakeModule
68 68 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
69 69 from IPython.Logger import Logger
70 70 from IPython.Magic import Magic
71 71 from IPython.Prompts import CachedOutput
72 72 from IPython.ipstruct import Struct
73 73 from IPython.background_jobs import BackgroundJobManager
74 74 from IPython.usage import cmd_line_usage,interactive_usage
75 75 from IPython.genutils import *
76 76 from IPython.strdispatch import StrDispatch
77 77 import IPython.ipapi
78 78 import IPython.history
79 79 import IPython.prefilter as prefilter
80 80 import IPython.shadowns
81 81 # Globals
82 82
83 83 # store the builtin raw_input globally, and use this always, in case user code
84 84 # overwrites it (like wx.py.PyShell does)
85 85 raw_input_original = raw_input
86 86
87 87 # compiled regexps for autoindent management
88 88 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
89 89
90 90
91 91 #****************************************************************************
92 92 # Some utility function definitions
93 93
94 94 ini_spaces_re = re.compile(r'^(\s+)')
95 95
96 96 def num_ini_spaces(strng):
97 97 """Return the number of initial spaces in a string"""
98 98
99 99 ini_spaces = ini_spaces_re.match(strng)
100 100 if ini_spaces:
101 101 return ini_spaces.end()
102 102 else:
103 103 return 0
104 104
105 105 def softspace(file, newvalue):
106 106 """Copied from code.py, to remove the dependency"""
107 107
108 108 oldvalue = 0
109 109 try:
110 110 oldvalue = file.softspace
111 111 except AttributeError:
112 112 pass
113 113 try:
114 114 file.softspace = newvalue
115 115 except (AttributeError, TypeError):
116 116 # "attribute-less object" or "read-only attributes"
117 117 pass
118 118 return oldvalue
119 119
120 120
121 121 #****************************************************************************
122 122 # Local use exceptions
123 123 class SpaceInInput(exceptions.Exception): pass
124 124
125 125
126 126 #****************************************************************************
127 127 # Local use classes
128 128 class Bunch: pass
129 129
130 130 class Undefined: pass
131 131
132 132 class Quitter(object):
133 133 """Simple class to handle exit, similar to Python 2.5's.
134 134
135 135 It handles exiting in an ipython-safe manner, which the one in Python 2.5
136 136 doesn't do (obviously, since it doesn't know about ipython)."""
137 137
138 138 def __init__(self,shell,name):
139 139 self.shell = shell
140 140 self.name = name
141 141
142 142 def __repr__(self):
143 143 return 'Type %s() to exit.' % self.name
144 144 __str__ = __repr__
145 145
146 146 def __call__(self):
147 147 self.shell.exit()
148 148
149 149 class InputList(list):
150 150 """Class to store user input.
151 151
152 152 It's basically a list, but slices return a string instead of a list, thus
153 153 allowing things like (assuming 'In' is an instance):
154 154
155 155 exec In[4:7]
156 156
157 157 or
158 158
159 159 exec In[5:9] + In[14] + In[21:25]"""
160 160
161 161 def __getslice__(self,i,j):
162 162 return ''.join(list.__getslice__(self,i,j))
163 163
164 164 class SyntaxTB(ultraTB.ListTB):
165 165 """Extension which holds some state: the last exception value"""
166 166
167 167 def __init__(self,color_scheme = 'NoColor'):
168 168 ultraTB.ListTB.__init__(self,color_scheme)
169 169 self.last_syntax_error = None
170 170
171 171 def __call__(self, etype, value, elist):
172 172 self.last_syntax_error = value
173 173 ultraTB.ListTB.__call__(self,etype,value,elist)
174 174
175 175 def clear_err_state(self):
176 176 """Return the current error state and clear it"""
177 177 e = self.last_syntax_error
178 178 self.last_syntax_error = None
179 179 return e
180 180
181 181 #****************************************************************************
182 182 # Main IPython class
183 183
184 184 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
185 185 # until a full rewrite is made. I've cleaned all cross-class uses of
186 186 # attributes and methods, but too much user code out there relies on the
187 187 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
188 188 #
189 189 # But at least now, all the pieces have been separated and we could, in
190 190 # principle, stop using the mixin. This will ease the transition to the
191 191 # chainsaw branch.
192 192
193 193 # For reference, the following is the list of 'self.foo' uses in the Magic
194 194 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
195 195 # class, to prevent clashes.
196 196
197 197 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
198 198 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
199 199 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
200 200 # 'self.value']
201 201
202 202 class InteractiveShell(object,Magic):
203 203 """An enhanced console for Python."""
204 204
205 205 # class attribute to indicate whether the class supports threads or not.
206 206 # Subclasses with thread support should override this as needed.
207 207 isthreaded = False
208 208
209 209 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
210 210 user_ns = None,user_global_ns=None,banner2='',
211 211 custom_exceptions=((),None),embedded=False):
212 212
213 213 # log system
214 214 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
215 215
216 216 # some minimal strict typechecks. For some core data structures, I
217 217 # want actual basic python types, not just anything that looks like
218 218 # one. This is especially true for namespaces.
219 219 for ns in (user_ns,user_global_ns):
220 220 if ns is not None and type(ns) != types.DictType:
221 221 raise TypeError,'namespace must be a dictionary'
222 222
223 223 # Job manager (for jobs run as background threads)
224 224 self.jobs = BackgroundJobManager()
225 225
226 226 # Store the actual shell's name
227 227 self.name = name
228 228
229 229 # We need to know whether the instance is meant for embedding, since
230 230 # global/local namespaces need to be handled differently in that case
231 231 self.embedded = embedded
232 232 if embedded:
233 233 # Control variable so users can, from within the embedded instance,
234 234 # permanently deactivate it.
235 235 self.embedded_active = True
236 236
237 237 # command compiler
238 238 self.compile = codeop.CommandCompiler()
239 239
240 240 # User input buffer
241 241 self.buffer = []
242 242
243 243 # Default name given in compilation of code
244 244 self.filename = '<ipython console>'
245 245
246 246 # Install our own quitter instead of the builtins. For python2.3-2.4,
247 247 # this brings in behavior like 2.5, and for 2.5 it's identical.
248 248 __builtin__.exit = Quitter(self,'exit')
249 249 __builtin__.quit = Quitter(self,'quit')
250 250
251 251 # Make an empty namespace, which extension writers can rely on both
252 252 # existing and NEVER being used by ipython itself. This gives them a
253 253 # convenient location for storing additional information and state
254 254 # their extensions may require, without fear of collisions with other
255 255 # ipython names that may develop later.
256 256 self.meta = Struct()
257 257
258 258 # Create the namespace where the user will operate. user_ns is
259 259 # normally the only one used, and it is passed to the exec calls as
260 260 # the locals argument. But we do carry a user_global_ns namespace
261 261 # given as the exec 'globals' argument, This is useful in embedding
262 262 # situations where the ipython shell opens in a context where the
263 263 # distinction between locals and globals is meaningful.
264 264
265 265 # FIXME. For some strange reason, __builtins__ is showing up at user
266 266 # level as a dict instead of a module. This is a manual fix, but I
267 267 # should really track down where the problem is coming from. Alex
268 268 # Schmolck reported this problem first.
269 269
270 270 # A useful post by Alex Martelli on this topic:
271 271 # Re: inconsistent value from __builtins__
272 272 # Von: Alex Martelli <aleaxit@yahoo.com>
273 273 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
274 274 # Gruppen: comp.lang.python
275 275
276 276 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
277 277 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
278 278 # > <type 'dict'>
279 279 # > >>> print type(__builtins__)
280 280 # > <type 'module'>
281 281 # > Is this difference in return value intentional?
282 282
283 283 # Well, it's documented that '__builtins__' can be either a dictionary
284 284 # or a module, and it's been that way for a long time. Whether it's
285 285 # intentional (or sensible), I don't know. In any case, the idea is
286 286 # that if you need to access the built-in namespace directly, you
287 287 # should start with "import __builtin__" (note, no 's') which will
288 288 # definitely give you a module. Yeah, it's somewhat confusing:-(.
289 289
290 290 # These routines return properly built dicts as needed by the rest of
291 291 # the code, and can also be used by extension writers to generate
292 292 # properly initialized namespaces.
293 293 user_ns = IPython.ipapi.make_user_ns(user_ns)
294 294 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
295 295
296 296 # Assign namespaces
297 297 # This is the namespace where all normal user variables live
298 298 self.user_ns = user_ns
299 299 # Embedded instances require a separate namespace for globals.
300 300 # Normally this one is unused by non-embedded instances.
301 301 self.user_global_ns = user_global_ns
302 302 # A namespace to keep track of internal data structures to prevent
303 303 # them from cluttering user-visible stuff. Will be updated later
304 304 self.internal_ns = {}
305 305
306 306 # Namespace of system aliases. Each entry in the alias
307 307 # table must be a 2-tuple of the form (N,name), where N is the number
308 308 # of positional arguments of the alias.
309 309 self.alias_table = {}
310 310
311 311 # A table holding all the namespaces IPython deals with, so that
312 312 # introspection facilities can search easily.
313 313 self.ns_table = {'user':user_ns,
314 314 'user_global':user_global_ns,
315 315 'alias':self.alias_table,
316 316 'internal':self.internal_ns,
317 317 'builtin':__builtin__.__dict__
318 318 }
319 319
320 320 # The user namespace MUST have a pointer to the shell itself.
321 321 self.user_ns[name] = self
322 322
323 323 # We need to insert into sys.modules something that looks like a
324 324 # module but which accesses the IPython namespace, for shelve and
325 325 # pickle to work interactively. Normally they rely on getting
326 326 # everything out of __main__, but for embedding purposes each IPython
327 327 # instance has its own private namespace, so we can't go shoving
328 328 # everything into __main__.
329 329
330 330 # note, however, that we should only do this for non-embedded
331 331 # ipythons, which really mimic the __main__.__dict__ with their own
332 332 # namespace. Embedded instances, on the other hand, should not do
333 333 # this because they need to manage the user local/global namespaces
334 334 # only, but they live within a 'normal' __main__ (meaning, they
335 335 # shouldn't overtake the execution environment of the script they're
336 336 # embedded in).
337 337
338 338 if not embedded:
339 339 try:
340 340 main_name = self.user_ns['__name__']
341 341 except KeyError:
342 342 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
343 343 else:
344 344 #print "pickle hack in place" # dbg
345 345 #print 'main_name:',main_name # dbg
346 346 sys.modules[main_name] = FakeModule(self.user_ns)
347 347
348 348 # List of input with multi-line handling.
349 349 # Fill its zero entry, user counter starts at 1
350 350 self.input_hist = InputList(['\n'])
351 351 # This one will hold the 'raw' input history, without any
352 352 # pre-processing. This will allow users to retrieve the input just as
353 353 # it was exactly typed in by the user, with %hist -r.
354 354 self.input_hist_raw = InputList(['\n'])
355 355
356 356 # list of visited directories
357 357 try:
358 358 self.dir_hist = [os.getcwd()]
359 359 except OSError:
360 360 self.dir_hist = []
361 361
362 362 # dict of output history
363 363 self.output_hist = {}
364 364
365 365 # Get system encoding at startup time. Certain terminals (like Emacs
366 366 # under Win32 have it set to None, and we need to have a known valid
367 367 # encoding to use in the raw_input() method
368 368 self.stdin_encoding = sys.stdin.encoding or 'ascii'
369 369
370 370 # dict of things NOT to alias (keywords, builtins and some magics)
371 371 no_alias = {}
372 372 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
373 373 for key in keyword.kwlist + no_alias_magics:
374 374 no_alias[key] = 1
375 375 no_alias.update(__builtin__.__dict__)
376 376 self.no_alias = no_alias
377 377
378 378 # make global variables for user access to these
379 379 self.user_ns['_ih'] = self.input_hist
380 380 self.user_ns['_oh'] = self.output_hist
381 381 self.user_ns['_dh'] = self.dir_hist
382 382
383 383 # user aliases to input and output histories
384 384 self.user_ns['In'] = self.input_hist
385 385 self.user_ns['Out'] = self.output_hist
386 386
387 387 self.user_ns['_sh'] = IPython.shadowns
388 388 # Object variable to store code object waiting execution. This is
389 389 # used mainly by the multithreaded shells, but it can come in handy in
390 390 # other situations. No need to use a Queue here, since it's a single
391 391 # item which gets cleared once run.
392 392 self.code_to_run = None
393 393
394 394 # escapes for automatic behavior on the command line
395 395 self.ESC_SHELL = '!'
396 396 self.ESC_SH_CAP = '!!'
397 397 self.ESC_HELP = '?'
398 398 self.ESC_MAGIC = '%'
399 399 self.ESC_QUOTE = ','
400 400 self.ESC_QUOTE2 = ';'
401 401 self.ESC_PAREN = '/'
402 402
403 403 # And their associated handlers
404 404 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
405 405 self.ESC_QUOTE : self.handle_auto,
406 406 self.ESC_QUOTE2 : self.handle_auto,
407 407 self.ESC_MAGIC : self.handle_magic,
408 408 self.ESC_HELP : self.handle_help,
409 409 self.ESC_SHELL : self.handle_shell_escape,
410 410 self.ESC_SH_CAP : self.handle_shell_escape,
411 411 }
412 412
413 413 # class initializations
414 414 Magic.__init__(self,self)
415 415
416 416 # Python source parser/formatter for syntax highlighting
417 417 pyformat = PyColorize.Parser().format
418 418 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
419 419
420 420 # hooks holds pointers used for user-side customizations
421 421 self.hooks = Struct()
422 422
423 423 self.strdispatchers = {}
424 424
425 425 # Set all default hooks, defined in the IPython.hooks module.
426 426 hooks = IPython.hooks
427 427 for hook_name in hooks.__all__:
428 428 # default hooks have priority 100, i.e. low; user hooks should have
429 429 # 0-100 priority
430 430 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
431 431 #print "bound hook",hook_name
432 432
433 433 # Flag to mark unconditional exit
434 434 self.exit_now = False
435 435
436 436 self.usage_min = """\
437 437 An enhanced console for Python.
438 438 Some of its features are:
439 439 - Readline support if the readline library is present.
440 440 - Tab completion in the local namespace.
441 441 - Logging of input, see command-line options.
442 442 - System shell escape via ! , eg !ls.
443 443 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
444 444 - Keeps track of locally defined variables via %who, %whos.
445 445 - Show object information with a ? eg ?x or x? (use ?? for more info).
446 446 """
447 447 if usage: self.usage = usage
448 448 else: self.usage = self.usage_min
449 449
450 450 # Storage
451 451 self.rc = rc # This will hold all configuration information
452 452 self.pager = 'less'
453 453 # temporary files used for various purposes. Deleted at exit.
454 454 self.tempfiles = []
455 455
456 456 # Keep track of readline usage (later set by init_readline)
457 457 self.has_readline = False
458 458
459 459 # template for logfile headers. It gets resolved at runtime by the
460 460 # logstart method.
461 461 self.loghead_tpl = \
462 462 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
463 463 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
464 464 #log# opts = %s
465 465 #log# args = %s
466 466 #log# It is safe to make manual edits below here.
467 467 #log#-----------------------------------------------------------------------
468 468 """
469 469 # for pushd/popd management
470 470 try:
471 471 self.home_dir = get_home_dir()
472 472 except HomeDirError,msg:
473 473 fatal(msg)
474 474
475 475 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
476 476
477 477 # Functions to call the underlying shell.
478 478
479 479 # The first is similar to os.system, but it doesn't return a value,
480 480 # and it allows interpolation of variables in the user's namespace.
481 481 self.system = lambda cmd: \
482 482 shell(self.var_expand(cmd,depth=2),
483 483 header=self.rc.system_header,
484 484 verbose=self.rc.system_verbose)
485 485
486 486 # These are for getoutput and getoutputerror:
487 487 self.getoutput = lambda cmd: \
488 488 getoutput(self.var_expand(cmd,depth=2),
489 489 header=self.rc.system_header,
490 490 verbose=self.rc.system_verbose)
491 491
492 492 self.getoutputerror = lambda cmd: \
493 493 getoutputerror(self.var_expand(cmd,depth=2),
494 494 header=self.rc.system_header,
495 495 verbose=self.rc.system_verbose)
496 496
497 497
498 498 # keep track of where we started running (mainly for crash post-mortem)
499 499 self.starting_dir = os.getcwd()
500 500
501 501 # Various switches which can be set
502 502 self.CACHELENGTH = 5000 # this is cheap, it's just text
503 503 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
504 504 self.banner2 = banner2
505 505
506 506 # TraceBack handlers:
507 507
508 508 # Syntax error handler.
509 509 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
510 510
511 511 # The interactive one is initialized with an offset, meaning we always
512 512 # want to remove the topmost item in the traceback, which is our own
513 513 # internal code. Valid modes: ['Plain','Context','Verbose']
514 514 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
515 515 color_scheme='NoColor',
516 516 tb_offset = 1)
517 517
518 518 # IPython itself shouldn't crash. This will produce a detailed
519 519 # post-mortem if it does. But we only install the crash handler for
520 520 # non-threaded shells, the threaded ones use a normal verbose reporter
521 521 # and lose the crash handler. This is because exceptions in the main
522 522 # thread (such as in GUI code) propagate directly to sys.excepthook,
523 523 # and there's no point in printing crash dumps for every user exception.
524 524 if self.isthreaded:
525 525 ipCrashHandler = ultraTB.FormattedTB()
526 526 else:
527 527 from IPython import CrashHandler
528 528 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
529 529 self.set_crash_handler(ipCrashHandler)
530 530
531 531 # and add any custom exception handlers the user may have specified
532 532 self.set_custom_exc(*custom_exceptions)
533 533
534 534 # indentation management
535 535 self.autoindent = False
536 536 self.indent_current_nsp = 0
537 537
538 538 # Make some aliases automatically
539 539 # Prepare list of shell aliases to auto-define
540 540 if os.name == 'posix':
541 541 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
542 542 'mv mv -i','rm rm -i','cp cp -i',
543 543 'cat cat','less less','clear clear',
544 544 # a better ls
545 545 'ls ls -F',
546 546 # long ls
547 547 'll ls -lF')
548 548 # Extra ls aliases with color, which need special treatment on BSD
549 549 # variants
550 550 ls_extra = ( # color ls
551 551 'lc ls -F -o --color',
552 552 # ls normal files only
553 553 'lf ls -F -o --color %l | grep ^-',
554 554 # ls symbolic links
555 555 'lk ls -F -o --color %l | grep ^l',
556 556 # directories or links to directories,
557 557 'ldir ls -F -o --color %l | grep /$',
558 558 # things which are executable
559 559 'lx ls -F -o --color %l | grep ^-..x',
560 560 )
561 561 # The BSDs don't ship GNU ls, so they don't understand the
562 562 # --color switch out of the box
563 563 if 'bsd' in sys.platform:
564 564 ls_extra = ( # ls normal files only
565 565 'lf ls -lF | grep ^-',
566 566 # ls symbolic links
567 567 'lk ls -lF | grep ^l',
568 568 # directories or links to directories,
569 569 'ldir ls -lF | grep /$',
570 570 # things which are executable
571 571 'lx ls -lF | grep ^-..x',
572 572 )
573 573 auto_alias = auto_alias + ls_extra
574 574 elif os.name in ['nt','dos']:
575 575 auto_alias = ('dir dir /on', 'ls dir /on',
576 576 'ddir dir /ad /on', 'ldir dir /ad /on',
577 577 'mkdir mkdir','rmdir rmdir','echo echo',
578 578 'ren ren','cls cls','copy copy')
579 579 else:
580 580 auto_alias = ()
581 581 self.auto_alias = [s.split(None,1) for s in auto_alias]
582 582 # Call the actual (public) initializer
583 583 self.init_auto_alias()
584 584
585 585 # Produce a public API instance
586 586 self.api = IPython.ipapi.IPApi(self)
587 587
588 588 # track which builtins we add, so we can clean up later
589 589 self.builtins_added = {}
590 590 # This method will add the necessary builtins for operation, but
591 591 # tracking what it did via the builtins_added dict.
592 592 self.add_builtins()
593 593
594 594 # end __init__
595 595
596 596 def var_expand(self,cmd,depth=0):
597 597 """Expand python variables in a string.
598 598
599 599 The depth argument indicates how many frames above the caller should
600 600 be walked to look for the local namespace where to expand variables.
601 601
602 602 The global namespace for expansion is always the user's interactive
603 603 namespace.
604 604 """
605 605
606 606 return str(ItplNS(cmd.replace('#','\#'),
607 607 self.user_ns, # globals
608 608 # Skip our own frame in searching for locals:
609 609 sys._getframe(depth+1).f_locals # locals
610 610 ))
611 611
612 612 def pre_config_initialization(self):
613 613 """Pre-configuration init method
614 614
615 615 This is called before the configuration files are processed to
616 616 prepare the services the config files might need.
617 617
618 618 self.rc already has reasonable default values at this point.
619 619 """
620 620 rc = self.rc
621 621 try:
622 622 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
623 623 except exceptions.UnicodeDecodeError:
624 624 print "Your ipythondir can't be decoded to unicode!"
625 625 print "Please set HOME environment variable to something that"
626 626 print r"only has ASCII characters, e.g. c:\home"
627 627 print "Now it is",rc.ipythondir
628 628 sys.exit()
629 629 self.shadowhist = IPython.history.ShadowHist(self.db)
630 630
631 631
632 632 def post_config_initialization(self):
633 633 """Post configuration init method
634 634
635 635 This is called after the configuration files have been processed to
636 636 'finalize' the initialization."""
637 637
638 638 rc = self.rc
639 639
640 640 # Object inspector
641 641 self.inspector = OInspect.Inspector(OInspect.InspectColors,
642 642 PyColorize.ANSICodeColors,
643 643 'NoColor',
644 644 rc.object_info_string_level)
645 645
646 646 self.rl_next_input = None
647 647 self.rl_do_indent = False
648 648 # Load readline proper
649 649 if rc.readline:
650 650 self.init_readline()
651 651
652 652
653 653 # local shortcut, this is used a LOT
654 654 self.log = self.logger.log
655 655
656 656 # Initialize cache, set in/out prompts and printing system
657 657 self.outputcache = CachedOutput(self,
658 658 rc.cache_size,
659 659 rc.pprint,
660 660 input_sep = rc.separate_in,
661 661 output_sep = rc.separate_out,
662 662 output_sep2 = rc.separate_out2,
663 663 ps1 = rc.prompt_in1,
664 664 ps2 = rc.prompt_in2,
665 665 ps_out = rc.prompt_out,
666 666 pad_left = rc.prompts_pad_left)
667 667
668 668 # user may have over-ridden the default print hook:
669 669 try:
670 670 self.outputcache.__class__.display = self.hooks.display
671 671 except AttributeError:
672 672 pass
673 673
674 674 # I don't like assigning globally to sys, because it means when
675 675 # embedding instances, each embedded instance overrides the previous
676 676 # choice. But sys.displayhook seems to be called internally by exec,
677 677 # so I don't see a way around it. We first save the original and then
678 678 # overwrite it.
679 679 self.sys_displayhook = sys.displayhook
680 680 sys.displayhook = self.outputcache
681 681
682 682 # Monkeypatch doctest so that its core test runner method is protected
683 683 # from IPython's modified displayhook. Doctest expects the default
684 684 # displayhook behavior deep down, so our modification breaks it
685 685 # completely. For this reason, a hard monkeypatch seems like a
686 686 # reasonable solution rather than asking users to manually use a
687 687 # different doctest runner when under IPython.
688 688 doctest.DocTestRunner.run = dhook_wrap(doctest.DocTestRunner.run)
689 689
690 690 # Set user colors (don't do it in the constructor above so that it
691 691 # doesn't crash if colors option is invalid)
692 692 self.magic_colors(rc.colors)
693 693
694 694 # Set calling of pdb on exceptions
695 695 self.call_pdb = rc.pdb
696 696
697 697 # Load user aliases
698 698 for alias in rc.alias:
699 699 self.magic_alias(alias)
700 700 self.hooks.late_startup_hook()
701 701
702 702 batchrun = False
703 703 for batchfile in [path(arg) for arg in self.rc.args
704 704 if arg.lower().endswith('.ipy')]:
705 705 if not batchfile.isfile():
706 706 print "No such batch file:", batchfile
707 707 continue
708 708 self.api.runlines(batchfile.text())
709 709 batchrun = True
710 710 if batchrun:
711 711 self.exit_now = True
712 712
713 713 def add_builtins(self):
714 714 """Store ipython references into the builtin namespace.
715 715
716 716 Some parts of ipython operate via builtins injected here, which hold a
717 717 reference to IPython itself."""
718 718
719 719 # TODO: deprecate all except _ip; 'jobs' should be installed
720 720 # by an extension and the rest are under _ip, ipalias is redundant
721 721 builtins_new = dict(__IPYTHON__ = self,
722 722 ip_set_hook = self.set_hook,
723 723 jobs = self.jobs,
724 724 ipmagic = wrap_deprecated(self.ipmagic,'_ip.magic()'),
725 725 ipalias = wrap_deprecated(self.ipalias),
726 726 ipsystem = wrap_deprecated(self.ipsystem,'_ip.system()'),
727 727 _ip = self.api
728 728 )
729 729 for biname,bival in builtins_new.items():
730 730 try:
731 731 # store the orignal value so we can restore it
732 732 self.builtins_added[biname] = __builtin__.__dict__[biname]
733 733 except KeyError:
734 734 # or mark that it wasn't defined, and we'll just delete it at
735 735 # cleanup
736 736 self.builtins_added[biname] = Undefined
737 737 __builtin__.__dict__[biname] = bival
738 738
739 739 # Keep in the builtins a flag for when IPython is active. We set it
740 740 # with setdefault so that multiple nested IPythons don't clobber one
741 741 # another. Each will increase its value by one upon being activated,
742 742 # which also gives us a way to determine the nesting level.
743 743 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
744 744
745 745 def clean_builtins(self):
746 746 """Remove any builtins which might have been added by add_builtins, or
747 747 restore overwritten ones to their previous values."""
748 748 for biname,bival in self.builtins_added.items():
749 749 if bival is Undefined:
750 750 del __builtin__.__dict__[biname]
751 751 else:
752 752 __builtin__.__dict__[biname] = bival
753 753 self.builtins_added.clear()
754 754
755 755 def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
756 756 """set_hook(name,hook) -> sets an internal IPython hook.
757 757
758 758 IPython exposes some of its internal API as user-modifiable hooks. By
759 759 adding your function to one of these hooks, you can modify IPython's
760 760 behavior to call at runtime your own routines."""
761 761
762 762 # At some point in the future, this should validate the hook before it
763 763 # accepts it. Probably at least check that the hook takes the number
764 764 # of args it's supposed to.
765 765
766 766 f = new.instancemethod(hook,self,self.__class__)
767 767
768 768 # check if the hook is for strdispatcher first
769 769 if str_key is not None:
770 770 sdp = self.strdispatchers.get(name, StrDispatch())
771 771 sdp.add_s(str_key, f, priority )
772 772 self.strdispatchers[name] = sdp
773 773 return
774 774 if re_key is not None:
775 775 sdp = self.strdispatchers.get(name, StrDispatch())
776 776 sdp.add_re(re.compile(re_key), f, priority )
777 777 self.strdispatchers[name] = sdp
778 778 return
779 779
780 780 dp = getattr(self.hooks, name, None)
781 781 if name not in IPython.hooks.__all__:
782 782 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
783 783 if not dp:
784 784 dp = IPython.hooks.CommandChainDispatcher()
785 785
786 786 try:
787 787 dp.add(f,priority)
788 788 except AttributeError:
789 789 # it was not commandchain, plain old func - replace
790 790 dp = f
791 791
792 792 setattr(self.hooks,name, dp)
793 793
794 794
795 795 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
796 796
797 797 def set_crash_handler(self,crashHandler):
798 798 """Set the IPython crash handler.
799 799
800 800 This must be a callable with a signature suitable for use as
801 801 sys.excepthook."""
802 802
803 803 # Install the given crash handler as the Python exception hook
804 804 sys.excepthook = crashHandler
805 805
806 806 # The instance will store a pointer to this, so that runtime code
807 807 # (such as magics) can access it. This is because during the
808 808 # read-eval loop, it gets temporarily overwritten (to deal with GUI
809 809 # frameworks).
810 810 self.sys_excepthook = sys.excepthook
811 811
812 812
813 813 def set_custom_exc(self,exc_tuple,handler):
814 814 """set_custom_exc(exc_tuple,handler)
815 815
816 816 Set a custom exception handler, which will be called if any of the
817 817 exceptions in exc_tuple occur in the mainloop (specifically, in the
818 818 runcode() method.
819 819
820 820 Inputs:
821 821
822 822 - exc_tuple: a *tuple* of valid exceptions to call the defined
823 823 handler for. It is very important that you use a tuple, and NOT A
824 824 LIST here, because of the way Python's except statement works. If
825 825 you only want to trap a single exception, use a singleton tuple:
826 826
827 827 exc_tuple == (MyCustomException,)
828 828
829 829 - handler: this must be defined as a function with the following
830 830 basic interface: def my_handler(self,etype,value,tb).
831 831
832 832 This will be made into an instance method (via new.instancemethod)
833 833 of IPython itself, and it will be called if any of the exceptions
834 834 listed in the exc_tuple are caught. If the handler is None, an
835 835 internal basic one is used, which just prints basic info.
836 836
837 837 WARNING: by putting in your own exception handler into IPython's main
838 838 execution loop, you run a very good chance of nasty crashes. This
839 839 facility should only be used if you really know what you are doing."""
840 840
841 841 assert type(exc_tuple)==type(()) , \
842 842 "The custom exceptions must be given AS A TUPLE."
843 843
844 844 def dummy_handler(self,etype,value,tb):
845 845 print '*** Simple custom exception handler ***'
846 846 print 'Exception type :',etype
847 847 print 'Exception value:',value
848 848 print 'Traceback :',tb
849 849 print 'Source code :','\n'.join(self.buffer)
850 850
851 851 if handler is None: handler = dummy_handler
852 852
853 853 self.CustomTB = new.instancemethod(handler,self,self.__class__)
854 854 self.custom_exceptions = exc_tuple
855 855
856 856 def set_custom_completer(self,completer,pos=0):
857 857 """set_custom_completer(completer,pos=0)
858 858
859 859 Adds a new custom completer function.
860 860
861 861 The position argument (defaults to 0) is the index in the completers
862 862 list where you want the completer to be inserted."""
863 863
864 864 newcomp = new.instancemethod(completer,self.Completer,
865 865 self.Completer.__class__)
866 866 self.Completer.matchers.insert(pos,newcomp)
867 867
868 868 def set_completer(self):
869 869 """reset readline's completer to be our own."""
870 870 self.readline.set_completer(self.Completer.complete)
871 871
872 872 def _get_call_pdb(self):
873 873 return self._call_pdb
874 874
875 875 def _set_call_pdb(self,val):
876 876
877 877 if val not in (0,1,False,True):
878 878 raise ValueError,'new call_pdb value must be boolean'
879 879
880 880 # store value in instance
881 881 self._call_pdb = val
882 882
883 883 # notify the actual exception handlers
884 884 self.InteractiveTB.call_pdb = val
885 885 if self.isthreaded:
886 886 try:
887 887 self.sys_excepthook.call_pdb = val
888 888 except:
889 889 warn('Failed to activate pdb for threaded exception handler')
890 890
891 891 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
892 892 'Control auto-activation of pdb at exceptions')
893 893
894 894
895 895 # These special functions get installed in the builtin namespace, to
896 896 # provide programmatic (pure python) access to magics, aliases and system
897 897 # calls. This is important for logging, user scripting, and more.
898 898
899 899 # We are basically exposing, via normal python functions, the three
900 900 # mechanisms in which ipython offers special call modes (magics for
901 901 # internal control, aliases for direct system access via pre-selected
902 902 # names, and !cmd for calling arbitrary system commands).
903 903
904 904 def ipmagic(self,arg_s):
905 905 """Call a magic function by name.
906 906
907 907 Input: a string containing the name of the magic function to call and any
908 908 additional arguments to be passed to the magic.
909 909
910 910 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
911 911 prompt:
912 912
913 913 In[1]: %name -opt foo bar
914 914
915 915 To call a magic without arguments, simply use ipmagic('name').
916 916
917 917 This provides a proper Python function to call IPython's magics in any
918 918 valid Python code you can type at the interpreter, including loops and
919 919 compound statements. It is added by IPython to the Python builtin
920 920 namespace upon initialization."""
921 921
922 922 args = arg_s.split(' ',1)
923 923 magic_name = args[0]
924 924 magic_name = magic_name.lstrip(self.ESC_MAGIC)
925 925
926 926 try:
927 927 magic_args = args[1]
928 928 except IndexError:
929 929 magic_args = ''
930 930 fn = getattr(self,'magic_'+magic_name,None)
931 931 if fn is None:
932 932 error("Magic function `%s` not found." % magic_name)
933 933 else:
934 934 magic_args = self.var_expand(magic_args,1)
935 935 return fn(magic_args)
936 936
937 937 def ipalias(self,arg_s):
938 938 """Call an alias by name.
939 939
940 940 Input: a string containing the name of the alias to call and any
941 941 additional arguments to be passed to the magic.
942 942
943 943 ipalias('name -opt foo bar') is equivalent to typing at the ipython
944 944 prompt:
945 945
946 946 In[1]: name -opt foo bar
947 947
948 948 To call an alias without arguments, simply use ipalias('name').
949 949
950 950 This provides a proper Python function to call IPython's aliases in any
951 951 valid Python code you can type at the interpreter, including loops and
952 952 compound statements. It is added by IPython to the Python builtin
953 953 namespace upon initialization."""
954 954
955 955 args = arg_s.split(' ',1)
956 956 alias_name = args[0]
957 957 try:
958 958 alias_args = args[1]
959 959 except IndexError:
960 960 alias_args = ''
961 961 if alias_name in self.alias_table:
962 962 self.call_alias(alias_name,alias_args)
963 963 else:
964 964 error("Alias `%s` not found." % alias_name)
965 965
966 966 def ipsystem(self,arg_s):
967 967 """Make a system call, using IPython."""
968 968
969 969 self.system(arg_s)
970 970
971 971 def complete(self,text):
972 972 """Return a sorted list of all possible completions on text.
973 973
974 974 Inputs:
975 975
976 976 - text: a string of text to be completed on.
977 977
978 978 This is a wrapper around the completion mechanism, similar to what
979 979 readline does at the command line when the TAB key is hit. By
980 980 exposing it as a method, it can be used by other non-readline
981 981 environments (such as GUIs) for text completion.
982 982
983 983 Simple usage example:
984 984
985 985 In [1]: x = 'hello'
986 986
987 987 In [2]: __IP.complete('x.l')
988 988 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
989 989
990 990 complete = self.Completer.complete
991 991 state = 0
992 992 # use a dict so we get unique keys, since ipyhton's multiple
993 993 # completers can return duplicates. When we make 2.4 a requirement,
994 994 # start using sets instead, which are faster.
995 995 comps = {}
996 996 while True:
997 997 newcomp = complete(text,state,line_buffer=text)
998 998 if newcomp is None:
999 999 break
1000 1000 comps[newcomp] = 1
1001 1001 state += 1
1002 1002 outcomps = comps.keys()
1003 1003 outcomps.sort()
1004 1004 return outcomps
1005 1005
1006 1006 def set_completer_frame(self, frame=None):
1007 1007 if frame:
1008 1008 self.Completer.namespace = frame.f_locals
1009 1009 self.Completer.global_namespace = frame.f_globals
1010 1010 else:
1011 1011 self.Completer.namespace = self.user_ns
1012 1012 self.Completer.global_namespace = self.user_global_ns
1013 1013
1014 1014 def init_auto_alias(self):
1015 1015 """Define some aliases automatically.
1016 1016
1017 1017 These are ALL parameter-less aliases"""
1018 1018
1019 1019 for alias,cmd in self.auto_alias:
1020 1020 self.alias_table[alias] = (0,cmd)
1021 1021
1022 1022 def alias_table_validate(self,verbose=0):
1023 1023 """Update information about the alias table.
1024 1024
1025 1025 In particular, make sure no Python keywords/builtins are in it."""
1026 1026
1027 1027 no_alias = self.no_alias
1028 1028 for k in self.alias_table.keys():
1029 1029 if k in no_alias:
1030 1030 del self.alias_table[k]
1031 1031 if verbose:
1032 1032 print ("Deleting alias <%s>, it's a Python "
1033 1033 "keyword or builtin." % k)
1034 1034
1035 1035 def set_autoindent(self,value=None):
1036 1036 """Set the autoindent flag, checking for readline support.
1037 1037
1038 1038 If called with no arguments, it acts as a toggle."""
1039 1039
1040 1040 if not self.has_readline:
1041 1041 if os.name == 'posix':
1042 1042 warn("The auto-indent feature requires the readline library")
1043 1043 self.autoindent = 0
1044 1044 return
1045 1045 if value is None:
1046 1046 self.autoindent = not self.autoindent
1047 1047 else:
1048 1048 self.autoindent = value
1049 1049
1050 1050 def rc_set_toggle(self,rc_field,value=None):
1051 1051 """Set or toggle a field in IPython's rc config. structure.
1052 1052
1053 1053 If called with no arguments, it acts as a toggle.
1054 1054
1055 1055 If called with a non-existent field, the resulting AttributeError
1056 1056 exception will propagate out."""
1057 1057
1058 1058 rc_val = getattr(self.rc,rc_field)
1059 1059 if value is None:
1060 1060 value = not rc_val
1061 1061 setattr(self.rc,rc_field,value)
1062 1062
1063 1063 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1064 1064 """Install the user configuration directory.
1065 1065
1066 1066 Can be called when running for the first time or to upgrade the user's
1067 1067 .ipython/ directory with the mode parameter. Valid modes are 'install'
1068 1068 and 'upgrade'."""
1069 1069
1070 1070 def wait():
1071 1071 try:
1072 1072 raw_input("Please press <RETURN> to start IPython.")
1073 1073 except EOFError:
1074 1074 print >> Term.cout
1075 1075 print '*'*70
1076 1076
1077 1077 cwd = os.getcwd() # remember where we started
1078 1078 glb = glob.glob
1079 1079 print '*'*70
1080 1080 if mode == 'install':
1081 1081 print \
1082 1082 """Welcome to IPython. I will try to create a personal configuration directory
1083 1083 where you can customize many aspects of IPython's functionality in:\n"""
1084 1084 else:
1085 1085 print 'I am going to upgrade your configuration in:'
1086 1086
1087 1087 print ipythondir
1088 1088
1089 1089 rcdirend = os.path.join('IPython','UserConfig')
1090 1090 cfg = lambda d: os.path.join(d,rcdirend)
1091 1091 try:
1092 1092 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1093 1093 except IOError:
1094 1094 warning = """
1095 1095 Installation error. IPython's directory was not found.
1096 1096
1097 1097 Check the following:
1098 1098
1099 1099 The ipython/IPython directory should be in a directory belonging to your
1100 1100 PYTHONPATH environment variable (that is, it should be in a directory
1101 1101 belonging to sys.path). You can copy it explicitly there or just link to it.
1102 1102
1103 1103 IPython will proceed with builtin defaults.
1104 1104 """
1105 1105 warn(warning)
1106 1106 wait()
1107 1107 return
1108 1108
1109 1109 if mode == 'install':
1110 1110 try:
1111 1111 shutil.copytree(rcdir,ipythondir)
1112 1112 os.chdir(ipythondir)
1113 1113 rc_files = glb("ipythonrc*")
1114 1114 for rc_file in rc_files:
1115 1115 os.rename(rc_file,rc_file+rc_suffix)
1116 1116 except:
1117 1117 warning = """
1118 1118
1119 1119 There was a problem with the installation:
1120 1120 %s
1121 1121 Try to correct it or contact the developers if you think it's a bug.
1122 1122 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1123 1123 warn(warning)
1124 1124 wait()
1125 1125 return
1126 1126
1127 1127 elif mode == 'upgrade':
1128 1128 try:
1129 1129 os.chdir(ipythondir)
1130 1130 except:
1131 1131 print """
1132 1132 Can not upgrade: changing to directory %s failed. Details:
1133 1133 %s
1134 1134 """ % (ipythondir,sys.exc_info()[1])
1135 1135 wait()
1136 1136 return
1137 1137 else:
1138 1138 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1139 1139 for new_full_path in sources:
1140 1140 new_filename = os.path.basename(new_full_path)
1141 1141 if new_filename.startswith('ipythonrc'):
1142 1142 new_filename = new_filename + rc_suffix
1143 1143 # The config directory should only contain files, skip any
1144 1144 # directories which may be there (like CVS)
1145 1145 if os.path.isdir(new_full_path):
1146 1146 continue
1147 1147 if os.path.exists(new_filename):
1148 1148 old_file = new_filename+'.old'
1149 1149 if os.path.exists(old_file):
1150 1150 os.remove(old_file)
1151 1151 os.rename(new_filename,old_file)
1152 1152 shutil.copy(new_full_path,new_filename)
1153 1153 else:
1154 1154 raise ValueError,'unrecognized mode for install:',`mode`
1155 1155
1156 1156 # Fix line-endings to those native to each platform in the config
1157 1157 # directory.
1158 1158 try:
1159 1159 os.chdir(ipythondir)
1160 1160 except:
1161 1161 print """
1162 1162 Problem: changing to directory %s failed.
1163 1163 Details:
1164 1164 %s
1165 1165
1166 1166 Some configuration files may have incorrect line endings. This should not
1167 1167 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1168 1168 wait()
1169 1169 else:
1170 1170 for fname in glb('ipythonrc*'):
1171 1171 try:
1172 1172 native_line_ends(fname,backup=0)
1173 1173 except IOError:
1174 1174 pass
1175 1175
1176 1176 if mode == 'install':
1177 1177 print """
1178 1178 Successful installation!
1179 1179
1180 1180 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1181 1181 IPython manual (there are both HTML and PDF versions supplied with the
1182 1182 distribution) to make sure that your system environment is properly configured
1183 1183 to take advantage of IPython's features.
1184 1184
1185 1185 Important note: the configuration system has changed! The old system is
1186 1186 still in place, but its setting may be partly overridden by the settings in
1187 1187 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1188 1188 if some of the new settings bother you.
1189 1189
1190 1190 """
1191 1191 else:
1192 1192 print """
1193 1193 Successful upgrade!
1194 1194
1195 1195 All files in your directory:
1196 1196 %(ipythondir)s
1197 1197 which would have been overwritten by the upgrade were backed up with a .old
1198 1198 extension. If you had made particular customizations in those files you may
1199 1199 want to merge them back into the new files.""" % locals()
1200 1200 wait()
1201 1201 os.chdir(cwd)
1202 1202 # end user_setup()
1203 1203
1204 1204 def atexit_operations(self):
1205 1205 """This will be executed at the time of exit.
1206 1206
1207 1207 Saving of persistent data should be performed here. """
1208 1208
1209 1209 #print '*** IPython exit cleanup ***' # dbg
1210 1210 # input history
1211 1211 self.savehist()
1212 1212
1213 1213 # Cleanup all tempfiles left around
1214 1214 for tfile in self.tempfiles:
1215 1215 try:
1216 1216 os.unlink(tfile)
1217 1217 except OSError:
1218 1218 pass
1219 1219
1220 1220 self.hooks.shutdown_hook()
1221 1221
1222 1222 def savehist(self):
1223 1223 """Save input history to a file (via readline library)."""
1224 1224 try:
1225 1225 self.readline.write_history_file(self.histfile)
1226 1226 except:
1227 1227 print 'Unable to save IPython command history to file: ' + \
1228 1228 `self.histfile`
1229 1229
1230 1230 def reloadhist(self):
1231 1231 """Reload the input history from disk file."""
1232 1232
1233 1233 if self.has_readline:
1234 1234 self.readline.clear_history()
1235 1235 self.readline.read_history_file(self.shell.histfile)
1236 1236
1237 1237 def history_saving_wrapper(self, func):
1238 1238 """ Wrap func for readline history saving
1239 1239
1240 1240 Convert func into callable that saves & restores
1241 1241 history around the call """
1242 1242
1243 1243 if not self.has_readline:
1244 1244 return func
1245 1245
1246 1246 def wrapper():
1247 1247 self.savehist()
1248 1248 try:
1249 1249 func()
1250 1250 finally:
1251 1251 readline.read_history_file(self.histfile)
1252 1252 return wrapper
1253 1253
1254 1254
1255 1255 def pre_readline(self):
1256 1256 """readline hook to be used at the start of each line.
1257 1257
1258 1258 Currently it handles auto-indent only."""
1259 1259
1260 1260 #debugx('self.indent_current_nsp','pre_readline:')
1261 1261
1262 1262 if self.rl_do_indent:
1263 1263 self.readline.insert_text(self.indent_current_str())
1264 1264 if self.rl_next_input is not None:
1265 1265 self.readline.insert_text(self.rl_next_input)
1266 1266 self.rl_next_input = None
1267 1267
1268 1268 def init_readline(self):
1269 1269 """Command history completion/saving/reloading."""
1270 1270
1271 1271 import IPython.rlineimpl as readline
1272 1272 if not readline.have_readline:
1273 1273 self.has_readline = 0
1274 1274 self.readline = None
1275 1275 # no point in bugging windows users with this every time:
1276 1276 warn('Readline services not available on this platform.')
1277 1277 else:
1278 1278 sys.modules['readline'] = readline
1279 1279 import atexit
1280 1280 from IPython.completer import IPCompleter
1281 1281 self.Completer = IPCompleter(self,
1282 1282 self.user_ns,
1283 1283 self.user_global_ns,
1284 1284 self.rc.readline_omit__names,
1285 1285 self.alias_table)
1286 1286 sdisp = self.strdispatchers.get('complete_command', StrDispatch())
1287 1287 self.strdispatchers['complete_command'] = sdisp
1288 1288 self.Completer.custom_completers = sdisp
1289 1289 # Platform-specific configuration
1290 1290 if os.name == 'nt':
1291 1291 self.readline_startup_hook = readline.set_pre_input_hook
1292 1292 else:
1293 1293 self.readline_startup_hook = readline.set_startup_hook
1294 1294
1295 1295 # Load user's initrc file (readline config)
1296 1296 inputrc_name = os.environ.get('INPUTRC')
1297 1297 if inputrc_name is None:
1298 1298 home_dir = get_home_dir()
1299 1299 if home_dir is not None:
1300 1300 inputrc_name = os.path.join(home_dir,'.inputrc')
1301 1301 if os.path.isfile(inputrc_name):
1302 1302 try:
1303 1303 readline.read_init_file(inputrc_name)
1304 1304 except:
1305 1305 warn('Problems reading readline initialization file <%s>'
1306 1306 % inputrc_name)
1307 1307
1308 1308 self.has_readline = 1
1309 1309 self.readline = readline
1310 1310 # save this in sys so embedded copies can restore it properly
1311 1311 sys.ipcompleter = self.Completer.complete
1312 1312 self.set_completer()
1313 1313
1314 1314 # Configure readline according to user's prefs
1315 1315 for rlcommand in self.rc.readline_parse_and_bind:
1316 1316 readline.parse_and_bind(rlcommand)
1317 1317
1318 1318 # remove some chars from the delimiters list
1319 1319 delims = readline.get_completer_delims()
1320 1320 delims = delims.translate(string._idmap,
1321 1321 self.rc.readline_remove_delims)
1322 1322 readline.set_completer_delims(delims)
1323 1323 # otherwise we end up with a monster history after a while:
1324 1324 readline.set_history_length(1000)
1325 1325 try:
1326 1326 #print '*** Reading readline history' # dbg
1327 1327 readline.read_history_file(self.histfile)
1328 1328 except IOError:
1329 1329 pass # It doesn't exist yet.
1330 1330
1331 1331 atexit.register(self.atexit_operations)
1332 1332 del atexit
1333 1333
1334 1334 # Configure auto-indent for all platforms
1335 1335 self.set_autoindent(self.rc.autoindent)
1336 1336
1337 1337 def ask_yes_no(self,prompt,default=True):
1338 1338 if self.rc.quiet:
1339 1339 return True
1340 1340 return ask_yes_no(prompt,default)
1341 1341
1342 1342 def _should_recompile(self,e):
1343 1343 """Utility routine for edit_syntax_error"""
1344 1344
1345 1345 if e.filename in ('<ipython console>','<input>','<string>',
1346 1346 '<console>','<BackgroundJob compilation>',
1347 1347 None):
1348 1348
1349 1349 return False
1350 1350 try:
1351 1351 if (self.rc.autoedit_syntax and
1352 1352 not self.ask_yes_no('Return to editor to correct syntax error? '
1353 1353 '[Y/n] ','y')):
1354 1354 return False
1355 1355 except EOFError:
1356 1356 return False
1357 1357
1358 1358 def int0(x):
1359 1359 try:
1360 1360 return int(x)
1361 1361 except TypeError:
1362 1362 return 0
1363 1363 # always pass integer line and offset values to editor hook
1364 1364 self.hooks.fix_error_editor(e.filename,
1365 1365 int0(e.lineno),int0(e.offset),e.msg)
1366 1366 return True
1367 1367
1368 1368 def edit_syntax_error(self):
1369 1369 """The bottom half of the syntax error handler called in the main loop.
1370 1370
1371 1371 Loop until syntax error is fixed or user cancels.
1372 1372 """
1373 1373
1374 1374 while self.SyntaxTB.last_syntax_error:
1375 1375 # copy and clear last_syntax_error
1376 1376 err = self.SyntaxTB.clear_err_state()
1377 1377 if not self._should_recompile(err):
1378 1378 return
1379 1379 try:
1380 1380 # may set last_syntax_error again if a SyntaxError is raised
1381 1381 self.safe_execfile(err.filename,self.user_ns)
1382 1382 except:
1383 1383 self.showtraceback()
1384 1384 else:
1385 1385 try:
1386 1386 f = file(err.filename)
1387 1387 try:
1388 1388 sys.displayhook(f.read())
1389 1389 finally:
1390 1390 f.close()
1391 1391 except:
1392 1392 self.showtraceback()
1393 1393
1394 1394 def showsyntaxerror(self, filename=None):
1395 1395 """Display the syntax error that just occurred.
1396 1396
1397 1397 This doesn't display a stack trace because there isn't one.
1398 1398
1399 1399 If a filename is given, it is stuffed in the exception instead
1400 1400 of what was there before (because Python's parser always uses
1401 1401 "<string>" when reading from a string).
1402 1402 """
1403 1403 etype, value, last_traceback = sys.exc_info()
1404 1404
1405 1405 # See note about these variables in showtraceback() below
1406 1406 sys.last_type = etype
1407 1407 sys.last_value = value
1408 1408 sys.last_traceback = last_traceback
1409 1409
1410 1410 if filename and etype is SyntaxError:
1411 1411 # Work hard to stuff the correct filename in the exception
1412 1412 try:
1413 1413 msg, (dummy_filename, lineno, offset, line) = value
1414 1414 except:
1415 1415 # Not the format we expect; leave it alone
1416 1416 pass
1417 1417 else:
1418 1418 # Stuff in the right filename
1419 1419 try:
1420 1420 # Assume SyntaxError is a class exception
1421 1421 value = SyntaxError(msg, (filename, lineno, offset, line))
1422 1422 except:
1423 1423 # If that failed, assume SyntaxError is a string
1424 1424 value = msg, (filename, lineno, offset, line)
1425 1425 self.SyntaxTB(etype,value,[])
1426 1426
1427 1427 def debugger(self,force=False):
1428 1428 """Call the pydb/pdb debugger.
1429 1429
1430 1430 Keywords:
1431 1431
1432 1432 - force(False): by default, this routine checks the instance call_pdb
1433 1433 flag and does not actually invoke the debugger if the flag is false.
1434 1434 The 'force' option forces the debugger to activate even if the flag
1435 1435 is false.
1436 1436 """
1437 1437
1438 1438 if not (force or self.call_pdb):
1439 1439 return
1440 1440
1441 1441 if not hasattr(sys,'last_traceback'):
1442 1442 error('No traceback has been produced, nothing to debug.')
1443 1443 return
1444 1444
1445 1445 # use pydb if available
1446 1446 if Debugger.has_pydb:
1447 1447 from pydb import pm
1448 1448 else:
1449 1449 # fallback to our internal debugger
1450 1450 pm = lambda : self.InteractiveTB.debugger(force=True)
1451 1451 self.history_saving_wrapper(pm)()
1452 1452
1453 1453 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1454 1454 """Display the exception that just occurred.
1455 1455
1456 1456 If nothing is known about the exception, this is the method which
1457 1457 should be used throughout the code for presenting user tracebacks,
1458 1458 rather than directly invoking the InteractiveTB object.
1459 1459
1460 1460 A specific showsyntaxerror() also exists, but this method can take
1461 1461 care of calling it if needed, so unless you are explicitly catching a
1462 1462 SyntaxError exception, don't try to analyze the stack manually and
1463 1463 simply call this method."""
1464 1464
1465 1465
1466 1466 # Though this won't be called by syntax errors in the input line,
1467 1467 # there may be SyntaxError cases whith imported code.
1468 1468
1469 1469
1470 1470 if exc_tuple is None:
1471 1471 etype, value, tb = sys.exc_info()
1472 1472 else:
1473 1473 etype, value, tb = exc_tuple
1474 1474
1475 1475 if etype is SyntaxError:
1476 1476 self.showsyntaxerror(filename)
1477 1477 else:
1478 1478 # WARNING: these variables are somewhat deprecated and not
1479 1479 # necessarily safe to use in a threaded environment, but tools
1480 1480 # like pdb depend on their existence, so let's set them. If we
1481 1481 # find problems in the field, we'll need to revisit their use.
1482 1482 sys.last_type = etype
1483 1483 sys.last_value = value
1484 1484 sys.last_traceback = tb
1485 1485
1486 1486 if etype in self.custom_exceptions:
1487 1487 self.CustomTB(etype,value,tb)
1488 1488 else:
1489 1489 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1490 1490 if self.InteractiveTB.call_pdb and self.has_readline:
1491 1491 # pdb mucks up readline, fix it back
1492 1492 self.set_completer()
1493 1493
1494 1494
1495 1495 def mainloop(self,banner=None):
1496 1496 """Creates the local namespace and starts the mainloop.
1497 1497
1498 1498 If an optional banner argument is given, it will override the
1499 1499 internally created default banner."""
1500 1500
1501 1501 if self.rc.c: # Emulate Python's -c option
1502 1502 self.exec_init_cmd()
1503 1503 if banner is None:
1504 1504 if not self.rc.banner:
1505 1505 banner = ''
1506 1506 # banner is string? Use it directly!
1507 1507 elif isinstance(self.rc.banner,basestring):
1508 1508 banner = self.rc.banner
1509 1509 else:
1510 1510 banner = self.BANNER+self.banner2
1511 1511
1512 1512 self.interact(banner)
1513 1513
1514 1514 def exec_init_cmd(self):
1515 1515 """Execute a command given at the command line.
1516 1516
1517 1517 This emulates Python's -c option."""
1518 1518
1519 1519 #sys.argv = ['-c']
1520 1520 self.push(self.prefilter(self.rc.c, False))
1521 1521 self.exit_now = True
1522 1522
1523 1523 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1524 1524 """Embeds IPython into a running python program.
1525 1525
1526 1526 Input:
1527 1527
1528 1528 - header: An optional header message can be specified.
1529 1529
1530 1530 - local_ns, global_ns: working namespaces. If given as None, the
1531 1531 IPython-initialized one is updated with __main__.__dict__, so that
1532 1532 program variables become visible but user-specific configuration
1533 1533 remains possible.
1534 1534
1535 1535 - stack_depth: specifies how many levels in the stack to go to
1536 1536 looking for namespaces (when local_ns and global_ns are None). This
1537 1537 allows an intermediate caller to make sure that this function gets
1538 1538 the namespace from the intended level in the stack. By default (0)
1539 1539 it will get its locals and globals from the immediate caller.
1540 1540
1541 1541 Warning: it's possible to use this in a program which is being run by
1542 1542 IPython itself (via %run), but some funny things will happen (a few
1543 1543 globals get overwritten). In the future this will be cleaned up, as
1544 1544 there is no fundamental reason why it can't work perfectly."""
1545 1545
1546 1546 # Get locals and globals from caller
1547 1547 if local_ns is None or global_ns is None:
1548 1548 call_frame = sys._getframe(stack_depth).f_back
1549 1549
1550 1550 if local_ns is None:
1551 1551 local_ns = call_frame.f_locals
1552 1552 if global_ns is None:
1553 1553 global_ns = call_frame.f_globals
1554 1554
1555 1555 # Update namespaces and fire up interpreter
1556 1556
1557 1557 # The global one is easy, we can just throw it in
1558 1558 self.user_global_ns = global_ns
1559 1559
1560 1560 # but the user/local one is tricky: ipython needs it to store internal
1561 1561 # data, but we also need the locals. We'll copy locals in the user
1562 1562 # one, but will track what got copied so we can delete them at exit.
1563 1563 # This is so that a later embedded call doesn't see locals from a
1564 1564 # previous call (which most likely existed in a separate scope).
1565 1565 local_varnames = local_ns.keys()
1566 1566 self.user_ns.update(local_ns)
1567 1567
1568 1568 # Patch for global embedding to make sure that things don't overwrite
1569 1569 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1570 1570 # FIXME. Test this a bit more carefully (the if.. is new)
1571 1571 if local_ns is None and global_ns is None:
1572 1572 self.user_global_ns.update(__main__.__dict__)
1573 1573
1574 1574 # make sure the tab-completer has the correct frame information, so it
1575 1575 # actually completes using the frame's locals/globals
1576 1576 self.set_completer_frame()
1577 1577
1578 1578 # before activating the interactive mode, we need to make sure that
1579 1579 # all names in the builtin namespace needed by ipython point to
1580 1580 # ourselves, and not to other instances.
1581 1581 self.add_builtins()
1582 1582
1583 1583 self.interact(header)
1584 1584
1585 1585 # now, purge out the user namespace from anything we might have added
1586 1586 # from the caller's local namespace
1587 1587 delvar = self.user_ns.pop
1588 1588 for var in local_varnames:
1589 1589 delvar(var,None)
1590 1590 # and clean builtins we may have overridden
1591 1591 self.clean_builtins()
1592 1592
1593 1593 def interact(self, banner=None):
1594 1594 """Closely emulate the interactive Python console.
1595 1595
1596 1596 The optional banner argument specify the banner to print
1597 1597 before the first interaction; by default it prints a banner
1598 1598 similar to the one printed by the real Python interpreter,
1599 1599 followed by the current class name in parentheses (so as not
1600 1600 to confuse this with the real interpreter -- since it's so
1601 1601 close!).
1602 1602
1603 1603 """
1604 1604
1605 1605 if self.exit_now:
1606 1606 # batch run -> do not interact
1607 1607 return
1608 1608 cprt = 'Type "copyright", "credits" or "license" for more information.'
1609 1609 if banner is None:
1610 1610 self.write("Python %s on %s\n%s\n(%s)\n" %
1611 1611 (sys.version, sys.platform, cprt,
1612 1612 self.__class__.__name__))
1613 1613 else:
1614 1614 self.write(banner)
1615 1615
1616 1616 more = 0
1617 1617
1618 1618 # Mark activity in the builtins
1619 1619 __builtin__.__dict__['__IPYTHON__active'] += 1
1620 1620
1621 1621 if readline.have_readline:
1622 1622 self.readline_startup_hook(self.pre_readline)
1623 1623 # exit_now is set by a call to %Exit or %Quit
1624 1624
1625 1625 while not self.exit_now:
1626 1626 if more:
1627 1627 prompt = self.hooks.generate_prompt(True)
1628 1628 if self.autoindent:
1629 1629 self.rl_do_indent = True
1630 1630
1631 1631 else:
1632 1632 prompt = self.hooks.generate_prompt(False)
1633 1633 try:
1634 1634 line = self.raw_input(prompt,more)
1635 1635 if self.exit_now:
1636 1636 # quick exit on sys.std[in|out] close
1637 1637 break
1638 1638 if self.autoindent:
1639 1639 self.rl_do_indent = False
1640 1640
1641 1641 except KeyboardInterrupt:
1642 1642 self.write('\nKeyboardInterrupt\n')
1643 1643 self.resetbuffer()
1644 1644 # keep cache in sync with the prompt counter:
1645 1645 self.outputcache.prompt_count -= 1
1646 1646
1647 1647 if self.autoindent:
1648 1648 self.indent_current_nsp = 0
1649 1649 more = 0
1650 1650 except EOFError:
1651 1651 if self.autoindent:
1652 1652 self.rl_do_indent = False
1653 1653 self.readline_startup_hook(None)
1654 1654 self.write('\n')
1655 1655 self.exit()
1656 1656 except bdb.BdbQuit:
1657 1657 warn('The Python debugger has exited with a BdbQuit exception.\n'
1658 1658 'Because of how pdb handles the stack, it is impossible\n'
1659 1659 'for IPython to properly format this particular exception.\n'
1660 1660 'IPython will resume normal operation.')
1661 1661 except:
1662 1662 # exceptions here are VERY RARE, but they can be triggered
1663 1663 # asynchronously by signal handlers, for example.
1664 1664 self.showtraceback()
1665 1665 else:
1666 1666 more = self.push(line)
1667 1667 if (self.SyntaxTB.last_syntax_error and
1668 1668 self.rc.autoedit_syntax):
1669 1669 self.edit_syntax_error()
1670 1670
1671 1671 # We are off again...
1672 1672 __builtin__.__dict__['__IPYTHON__active'] -= 1
1673 1673
1674 1674 def excepthook(self, etype, value, tb):
1675 1675 """One more defense for GUI apps that call sys.excepthook.
1676 1676
1677 1677 GUI frameworks like wxPython trap exceptions and call
1678 1678 sys.excepthook themselves. I guess this is a feature that
1679 1679 enables them to keep running after exceptions that would
1680 1680 otherwise kill their mainloop. This is a bother for IPython
1681 1681 which excepts to catch all of the program exceptions with a try:
1682 1682 except: statement.
1683 1683
1684 1684 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1685 1685 any app directly invokes sys.excepthook, it will look to the user like
1686 1686 IPython crashed. In order to work around this, we can disable the
1687 1687 CrashHandler and replace it with this excepthook instead, which prints a
1688 1688 regular traceback using our InteractiveTB. In this fashion, apps which
1689 1689 call sys.excepthook will generate a regular-looking exception from
1690 1690 IPython, and the CrashHandler will only be triggered by real IPython
1691 1691 crashes.
1692 1692
1693 1693 This hook should be used sparingly, only in places which are not likely
1694 1694 to be true IPython errors.
1695 1695 """
1696 1696 self.showtraceback((etype,value,tb),tb_offset=0)
1697 1697
1698 1698 def expand_aliases(self,fn,rest):
1699 1699 """ Expand multiple levels of aliases:
1700 1700
1701 1701 if:
1702 1702
1703 1703 alias foo bar /tmp
1704 1704 alias baz foo
1705 1705
1706 1706 then:
1707 1707
1708 1708 baz huhhahhei -> bar /tmp huhhahhei
1709 1709
1710 1710 """
1711 1711 line = fn + " " + rest
1712 1712
1713 1713 done = Set()
1714 1714 while 1:
1715 1715 pre,fn,rest = prefilter.splitUserInput(line,
1716 1716 prefilter.shell_line_split)
1717 1717 if fn in self.alias_table:
1718 1718 if fn in done:
1719 1719 warn("Cyclic alias definition, repeated '%s'" % fn)
1720 1720 return ""
1721 1721 done.add(fn)
1722 1722
1723 1723 l2 = self.transform_alias(fn,rest)
1724 1724 # dir -> dir
1725 1725 # print "alias",line, "->",l2 #dbg
1726 1726 if l2 == line:
1727 1727 break
1728 1728 # ls -> ls -F should not recurse forever
1729 1729 if l2.split(None,1)[0] == line.split(None,1)[0]:
1730 1730 line = l2
1731 1731 break
1732 1732
1733 1733 line=l2
1734 1734
1735 1735
1736 1736 # print "al expand to",line #dbg
1737 1737 else:
1738 1738 break
1739 1739
1740 1740 return line
1741 1741
1742 1742 def transform_alias(self, alias,rest=''):
1743 1743 """ Transform alias to system command string.
1744 1744 """
1745 1745 nargs,cmd = self.alias_table[alias]
1746 1746 if ' ' in cmd and os.path.isfile(cmd):
1747 1747 cmd = '"%s"' % cmd
1748 1748
1749 1749 # Expand the %l special to be the user's input line
1750 1750 if cmd.find('%l') >= 0:
1751 1751 cmd = cmd.replace('%l',rest)
1752 1752 rest = ''
1753 1753 if nargs==0:
1754 1754 # Simple, argument-less aliases
1755 1755 cmd = '%s %s' % (cmd,rest)
1756 1756 else:
1757 1757 # Handle aliases with positional arguments
1758 1758 args = rest.split(None,nargs)
1759 1759 if len(args)< nargs:
1760 1760 error('Alias <%s> requires %s arguments, %s given.' %
1761 1761 (alias,nargs,len(args)))
1762 1762 return None
1763 1763 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1764 1764 # Now call the macro, evaluating in the user's namespace
1765 1765 #print 'new command: <%r>' % cmd # dbg
1766 1766 return cmd
1767 1767
1768 1768 def call_alias(self,alias,rest=''):
1769 1769 """Call an alias given its name and the rest of the line.
1770 1770
1771 1771 This is only used to provide backwards compatibility for users of
1772 1772 ipalias(), use of which is not recommended for anymore."""
1773 1773
1774 1774 # Now call the macro, evaluating in the user's namespace
1775 1775 cmd = self.transform_alias(alias, rest)
1776 1776 try:
1777 1777 self.system(cmd)
1778 1778 except:
1779 1779 self.showtraceback()
1780 1780
1781 1781 def indent_current_str(self):
1782 1782 """return the current level of indentation as a string"""
1783 1783 return self.indent_current_nsp * ' '
1784 1784
1785 1785 def autoindent_update(self,line):
1786 1786 """Keep track of the indent level."""
1787 1787
1788 1788 #debugx('line')
1789 1789 #debugx('self.indent_current_nsp')
1790 1790 if self.autoindent:
1791 1791 if line:
1792 1792 inisp = num_ini_spaces(line)
1793 1793 if inisp < self.indent_current_nsp:
1794 1794 self.indent_current_nsp = inisp
1795 1795
1796 1796 if line[-1] == ':':
1797 1797 self.indent_current_nsp += 4
1798 1798 elif dedent_re.match(line):
1799 1799 self.indent_current_nsp -= 4
1800 1800 else:
1801 1801 self.indent_current_nsp = 0
1802 1802 def runlines(self,lines):
1803 1803 """Run a string of one or more lines of source.
1804 1804
1805 1805 This method is capable of running a string containing multiple source
1806 1806 lines, as if they had been entered at the IPython prompt. Since it
1807 1807 exposes IPython's processing machinery, the given strings can contain
1808 1808 magic calls (%magic), special shell access (!cmd), etc."""
1809 1809
1810 1810 # We must start with a clean buffer, in case this is run from an
1811 1811 # interactive IPython session (via a magic, for example).
1812 1812 self.resetbuffer()
1813 1813 lines = lines.split('\n')
1814 1814 more = 0
1815 1815
1816 1816 for line in lines:
1817 1817 # skip blank lines so we don't mess up the prompt counter, but do
1818 1818 # NOT skip even a blank line if we are in a code block (more is
1819 1819 # true)
1820 1820
1821 1821
1822 1822 if line or more:
1823 1823 # push to raw history, so hist line numbers stay in sync
1824 1824 self.input_hist_raw.append("# " + line + "\n")
1825 1825 more = self.push(self.prefilter(line,more))
1826 1826 # IPython's runsource returns None if there was an error
1827 1827 # compiling the code. This allows us to stop processing right
1828 1828 # away, so the user gets the error message at the right place.
1829 1829 if more is None:
1830 1830 break
1831 1831 else:
1832 1832 self.input_hist_raw.append("\n")
1833 1833 # final newline in case the input didn't have it, so that the code
1834 1834 # actually does get executed
1835 1835 if more:
1836 1836 self.push('\n')
1837 1837
1838 1838 def runsource(self, source, filename='<input>', symbol='single'):
1839 1839 """Compile and run some source in the interpreter.
1840 1840
1841 1841 Arguments are as for compile_command().
1842 1842
1843 1843 One several things can happen:
1844 1844
1845 1845 1) The input is incorrect; compile_command() raised an
1846 1846 exception (SyntaxError or OverflowError). A syntax traceback
1847 1847 will be printed by calling the showsyntaxerror() method.
1848 1848
1849 1849 2) The input is incomplete, and more input is required;
1850 1850 compile_command() returned None. Nothing happens.
1851 1851
1852 1852 3) The input is complete; compile_command() returned a code
1853 1853 object. The code is executed by calling self.runcode() (which
1854 1854 also handles run-time exceptions, except for SystemExit).
1855 1855
1856 1856 The return value is:
1857 1857
1858 1858 - True in case 2
1859 1859
1860 1860 - False in the other cases, unless an exception is raised, where
1861 1861 None is returned instead. This can be used by external callers to
1862 1862 know whether to continue feeding input or not.
1863 1863
1864 1864 The return value can be used to decide whether to use sys.ps1 or
1865 1865 sys.ps2 to prompt the next line."""
1866 1866
1867 1867 # if the source code has leading blanks, add 'if 1:\n' to it
1868 1868 # this allows execution of indented pasted code. It is tempting
1869 1869 # to add '\n' at the end of source to run commands like ' a=1'
1870 1870 # directly, but this fails for more complicated scenarios
1871 1871 if source[:1] in [' ', '\t']:
1872 1872 source = 'if 1:\n%s' % source
1873 1873
1874 1874 try:
1875 1875 code = self.compile(source,filename,symbol)
1876 1876 except (OverflowError, SyntaxError, ValueError):
1877 1877 # Case 1
1878 1878 self.showsyntaxerror(filename)
1879 1879 return None
1880 1880
1881 1881 if code is None:
1882 1882 # Case 2
1883 1883 return True
1884 1884
1885 1885 # Case 3
1886 1886 # We store the code object so that threaded shells and
1887 1887 # custom exception handlers can access all this info if needed.
1888 1888 # The source corresponding to this can be obtained from the
1889 1889 # buffer attribute as '\n'.join(self.buffer).
1890 1890 self.code_to_run = code
1891 1891 # now actually execute the code object
1892 1892 if self.runcode(code) == 0:
1893 1893 return False
1894 1894 else:
1895 1895 return None
1896 1896
1897 1897 def runcode(self,code_obj):
1898 1898 """Execute a code object.
1899 1899
1900 1900 When an exception occurs, self.showtraceback() is called to display a
1901 1901 traceback.
1902 1902
1903 1903 Return value: a flag indicating whether the code to be run completed
1904 1904 successfully:
1905 1905
1906 1906 - 0: successful execution.
1907 1907 - 1: an error occurred.
1908 1908 """
1909 1909
1910 1910 # Set our own excepthook in case the user code tries to call it
1911 1911 # directly, so that the IPython crash handler doesn't get triggered
1912 1912 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1913 1913
1914 1914 # we save the original sys.excepthook in the instance, in case config
1915 1915 # code (such as magics) needs access to it.
1916 1916 self.sys_excepthook = old_excepthook
1917 1917 outflag = 1 # happens in more places, so it's easier as default
1918 1918 try:
1919 1919 try:
1920 1920 # Embedded instances require separate global/local namespaces
1921 1921 # so they can see both the surrounding (local) namespace and
1922 1922 # the module-level globals when called inside another function.
1923 1923 if self.embedded:
1924 1924 exec code_obj in self.user_global_ns, self.user_ns
1925 1925 # Normal (non-embedded) instances should only have a single
1926 1926 # namespace for user code execution, otherwise functions won't
1927 1927 # see interactive top-level globals.
1928 1928 else:
1929 1929 exec code_obj in self.user_ns
1930 1930 finally:
1931 1931 # Reset our crash handler in place
1932 1932 sys.excepthook = old_excepthook
1933 1933 except SystemExit:
1934 1934 self.resetbuffer()
1935 1935 self.showtraceback()
1936 1936 warn("Type %exit or %quit to exit IPython "
1937 1937 "(%Exit or %Quit do so unconditionally).",level=1)
1938 1938 except self.custom_exceptions:
1939 1939 etype,value,tb = sys.exc_info()
1940 1940 self.CustomTB(etype,value,tb)
1941 1941 except:
1942 1942 self.showtraceback()
1943 1943 else:
1944 1944 outflag = 0
1945 1945 if softspace(sys.stdout, 0):
1946 1946 print
1947 1947 # Flush out code object which has been run (and source)
1948 1948 self.code_to_run = None
1949 1949 return outflag
1950 1950
1951 1951 def push(self, line):
1952 1952 """Push a line to the interpreter.
1953 1953
1954 1954 The line should not have a trailing newline; it may have
1955 1955 internal newlines. The line is appended to a buffer and the
1956 1956 interpreter's runsource() method is called with the
1957 1957 concatenated contents of the buffer as source. If this
1958 1958 indicates that the command was executed or invalid, the buffer
1959 1959 is reset; otherwise, the command is incomplete, and the buffer
1960 1960 is left as it was after the line was appended. The return
1961 1961 value is 1 if more input is required, 0 if the line was dealt
1962 1962 with in some way (this is the same as runsource()).
1963 1963 """
1964 1964
1965 1965 # autoindent management should be done here, and not in the
1966 1966 # interactive loop, since that one is only seen by keyboard input. We
1967 1967 # need this done correctly even for code run via runlines (which uses
1968 1968 # push).
1969 1969
1970 1970 #print 'push line: <%s>' % line # dbg
1971 1971 for subline in line.splitlines():
1972 1972 self.autoindent_update(subline)
1973 1973 self.buffer.append(line)
1974 1974 more = self.runsource('\n'.join(self.buffer), self.filename)
1975 1975 if not more:
1976 1976 self.resetbuffer()
1977 1977 return more
1978 1978
1979 1979 def split_user_input(self, line):
1980 1980 # This is really a hold-over to support ipapi and some extensions
1981 1981 return prefilter.splitUserInput(line)
1982 1982
1983 1983 def resetbuffer(self):
1984 1984 """Reset the input buffer."""
1985 1985 self.buffer[:] = []
1986 1986
1987 1987 def raw_input(self,prompt='',continue_prompt=False):
1988 1988 """Write a prompt and read a line.
1989 1989
1990 1990 The returned line does not include the trailing newline.
1991 1991 When the user enters the EOF key sequence, EOFError is raised.
1992 1992
1993 1993 Optional inputs:
1994 1994
1995 1995 - prompt(''): a string to be printed to prompt the user.
1996 1996
1997 1997 - continue_prompt(False): whether this line is the first one or a
1998 1998 continuation in a sequence of inputs.
1999 1999 """
2000 2000
2001 2001 # Code run by the user may have modified the readline completer state.
2002 2002 # We must ensure that our completer is back in place.
2003 2003 if self.has_readline:
2004 2004 self.set_completer()
2005 2005
2006 2006 try:
2007 2007 line = raw_input_original(prompt).decode(self.stdin_encoding)
2008 2008 except ValueError:
2009 2009 warn("\n********\nYou or a %run:ed script called sys.stdin.close()"
2010 2010 " or sys.stdout.close()!\nExiting IPython!")
2011 2011 self.exit_now = True
2012 2012 return ""
2013 2013
2014 2014 # Try to be reasonably smart about not re-indenting pasted input more
2015 2015 # than necessary. We do this by trimming out the auto-indent initial
2016 2016 # spaces, if the user's actual input started itself with whitespace.
2017 2017 #debugx('self.buffer[-1]')
2018 2018
2019 2019 if self.autoindent:
2020 2020 if num_ini_spaces(line) > self.indent_current_nsp:
2021 2021 line = line[self.indent_current_nsp:]
2022 2022 self.indent_current_nsp = 0
2023 2023
2024 2024 # store the unfiltered input before the user has any chance to modify
2025 2025 # it.
2026 2026 if line.strip():
2027 2027 if continue_prompt:
2028 2028 self.input_hist_raw[-1] += '%s\n' % line
2029 2029 if self.has_readline: # and some config option is set?
2030 2030 try:
2031 2031 histlen = self.readline.get_current_history_length()
2032 2032 newhist = self.input_hist_raw[-1].rstrip()
2033 2033 self.readline.remove_history_item(histlen-1)
2034 2034 self.readline.replace_history_item(histlen-2,newhist)
2035 2035 except AttributeError:
2036 2036 pass # re{move,place}_history_item are new in 2.4.
2037 2037 else:
2038 2038 self.input_hist_raw.append('%s\n' % line)
2039 2039 # only entries starting at first column go to shadow history
2040 2040 if line.lstrip() == line:
2041 2041 self.shadowhist.add(line.strip())
2042 2042 else:
2043 2043 self.input_hist_raw.append('\n')
2044 2044 try:
2045 2045 lineout = self.prefilter(line,continue_prompt)
2046 2046 except:
2047 2047 # blanket except, in case a user-defined prefilter crashes, so it
2048 2048 # can't take all of ipython with it.
2049 2049 self.showtraceback()
2050 2050 return ''
2051 2051 else:
2052 2052 return lineout
2053 2053
2054 2054 def _prefilter(self, line, continue_prompt):
2055 2055 """Calls different preprocessors, depending on the form of line."""
2056 2056
2057 2057 # All handlers *must* return a value, even if it's blank ('').
2058 2058
2059 2059 # Lines are NOT logged here. Handlers should process the line as
2060 2060 # needed, update the cache AND log it (so that the input cache array
2061 2061 # stays synced).
2062 2062
2063 2063 #.....................................................................
2064 2064 # Code begins
2065 2065
2066 2066 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
2067 2067
2068 2068 # save the line away in case we crash, so the post-mortem handler can
2069 2069 # record it
2070 2070 self._last_input_line = line
2071 2071
2072 2072 #print '***line: <%s>' % line # dbg
2073 2073
2074 2074 if not line:
2075 2075 # Return immediately on purely empty lines, so that if the user
2076 2076 # previously typed some whitespace that started a continuation
2077 2077 # prompt, he can break out of that loop with just an empty line.
2078 2078 # This is how the default python prompt works.
2079 2079
2080 2080 # Only return if the accumulated input buffer was just whitespace!
2081 2081 if ''.join(self.buffer).isspace():
2082 2082 self.buffer[:] = []
2083 2083 return ''
2084 2084
2085 2085 line_info = prefilter.LineInfo(line, continue_prompt)
2086 2086
2087 2087 # the input history needs to track even empty lines
2088 2088 stripped = line.strip()
2089 2089
2090 2090 if not stripped:
2091 2091 if not continue_prompt:
2092 2092 self.outputcache.prompt_count -= 1
2093 2093 return self.handle_normal(line_info)
2094 2094
2095 2095 # print '***cont',continue_prompt # dbg
2096 2096 # special handlers are only allowed for single line statements
2097 2097 if continue_prompt and not self.rc.multi_line_specials:
2098 2098 return self.handle_normal(line_info)
2099 2099
2100 2100
2101 2101 # See whether any pre-existing handler can take care of it
2102 2102 rewritten = self.hooks.input_prefilter(stripped)
2103 2103 if rewritten != stripped: # ok, some prefilter did something
2104 2104 rewritten = line_info.pre + rewritten # add indentation
2105 2105 return self.handle_normal(prefilter.LineInfo(rewritten,
2106 2106 continue_prompt))
2107 2107
2108 2108 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2109 2109
2110 2110 return prefilter.prefilter(line_info, self)
2111 2111
2112 2112
2113 2113 def _prefilter_dumb(self, line, continue_prompt):
2114 2114 """simple prefilter function, for debugging"""
2115 2115 return self.handle_normal(line,continue_prompt)
2116 2116
2117 2117
2118 2118 def multiline_prefilter(self, line, continue_prompt):
2119 2119 """ Run _prefilter for each line of input
2120 2120
2121 2121 Covers cases where there are multiple lines in the user entry,
2122 2122 which is the case when the user goes back to a multiline history
2123 2123 entry and presses enter.
2124 2124
2125 2125 """
2126 2126 out = []
2127 2127 for l in line.rstrip('\n').split('\n'):
2128 2128 out.append(self._prefilter(l, continue_prompt))
2129 2129 return '\n'.join(out)
2130 2130
2131 2131 # Set the default prefilter() function (this can be user-overridden)
2132 2132 prefilter = multiline_prefilter
2133 2133
2134 2134 def handle_normal(self,line_info):
2135 2135 """Handle normal input lines. Use as a template for handlers."""
2136 2136
2137 2137 # With autoindent on, we need some way to exit the input loop, and I
2138 2138 # don't want to force the user to have to backspace all the way to
2139 2139 # clear the line. The rule will be in this case, that either two
2140 2140 # lines of pure whitespace in a row, or a line of pure whitespace but
2141 2141 # of a size different to the indent level, will exit the input loop.
2142 2142 line = line_info.line
2143 2143 continue_prompt = line_info.continue_prompt
2144 2144
2145 2145 if (continue_prompt and self.autoindent and line.isspace() and
2146 2146 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2147 2147 (self.buffer[-1]).isspace() )):
2148 2148 line = ''
2149 2149
2150 2150 self.log(line,line,continue_prompt)
2151 2151 return line
2152 2152
2153 2153 def handle_alias(self,line_info):
2154 2154 """Handle alias input lines. """
2155 2155 tgt = self.alias_table[line_info.iFun]
2156 2156 # print "=>",tgt #dbg
2157 2157 if callable(tgt):
2158 2158 line_out = "_sh." + line_info.iFun + '(r"""' + line_info.line + '""")'
2159 2159 else:
2160 2160 transformed = self.expand_aliases(line_info.iFun,line_info.theRest)
2161 2161
2162 2162 # pre is needed, because it carries the leading whitespace. Otherwise
2163 2163 # aliases won't work in indented sections.
2164 2164 line_out = '%s_ip.system(%s)' % (line_info.preWhitespace,
2165 2165 make_quoted_expr( transformed ))
2166 2166
2167 2167 self.log(line_info.line,line_out,line_info.continue_prompt)
2168 2168 #print 'line out:',line_out # dbg
2169 2169 return line_out
2170 2170
2171 2171 def handle_shell_escape(self, line_info):
2172 2172 """Execute the line in a shell, empty return value"""
2173 2173 #print 'line in :', `line` # dbg
2174 2174 line = line_info.line
2175 2175 if line.lstrip().startswith('!!'):
2176 2176 # rewrite LineInfo's line, iFun and theRest to properly hold the
2177 2177 # call to %sx and the actual command to be executed, so
2178 2178 # handle_magic can work correctly. Note that this works even if
2179 2179 # the line is indented, so it handles multi_line_specials
2180 2180 # properly.
2181 2181 new_rest = line.lstrip()[2:]
2182 2182 line_info.line = '%ssx %s' % (self.ESC_MAGIC,new_rest)
2183 2183 line_info.iFun = 'sx'
2184 2184 line_info.theRest = new_rest
2185 2185 return self.handle_magic(line_info)
2186 2186 else:
2187 2187 cmd = line.lstrip().lstrip('!')
2188 2188 line_out = '%s_ip.system(%s)' % (line_info.preWhitespace,
2189 2189 make_quoted_expr(cmd))
2190 2190 # update cache/log and return
2191 2191 self.log(line,line_out,line_info.continue_prompt)
2192 2192 return line_out
2193 2193
2194 2194 def handle_magic(self, line_info):
2195 2195 """Execute magic functions."""
2196 2196 iFun = line_info.iFun
2197 2197 theRest = line_info.theRest
2198 2198 cmd = '%s_ip.magic(%s)' % (line_info.preWhitespace,
2199 2199 make_quoted_expr(iFun + " " + theRest))
2200 2200 self.log(line_info.line,cmd,line_info.continue_prompt)
2201 2201 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2202 2202 return cmd
2203 2203
2204 2204 def handle_auto(self, line_info):
2205 2205 """Hande lines which can be auto-executed, quoting if requested."""
2206 2206
2207 2207 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2208 2208 line = line_info.line
2209 2209 iFun = line_info.iFun
2210 2210 theRest = line_info.theRest
2211 2211 pre = line_info.pre
2212 2212 continue_prompt = line_info.continue_prompt
2213 2213 obj = line_info.ofind(self)['obj']
2214 2214
2215 2215 # This should only be active for single-line input!
2216 2216 if continue_prompt:
2217 2217 self.log(line,line,continue_prompt)
2218 2218 return line
2219 2219
2220 2220 force_auto = isinstance(obj, IPython.ipapi.IPyAutocall)
2221 2221 auto_rewrite = True
2222 2222
2223 2223 if pre == self.ESC_QUOTE:
2224 2224 # Auto-quote splitting on whitespace
2225 2225 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2226 2226 elif pre == self.ESC_QUOTE2:
2227 2227 # Auto-quote whole string
2228 2228 newcmd = '%s("%s")' % (iFun,theRest)
2229 2229 elif pre == self.ESC_PAREN:
2230 2230 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2231 2231 else:
2232 2232 # Auto-paren.
2233 2233 # We only apply it to argument-less calls if the autocall
2234 2234 # parameter is set to 2. We only need to check that autocall is <
2235 2235 # 2, since this function isn't called unless it's at least 1.
2236 2236 if not theRest and (self.rc.autocall < 2) and not force_auto:
2237 2237 newcmd = '%s %s' % (iFun,theRest)
2238 2238 auto_rewrite = False
2239 2239 else:
2240 2240 if not force_auto and theRest.startswith('['):
2241 2241 if hasattr(obj,'__getitem__'):
2242 2242 # Don't autocall in this case: item access for an object
2243 2243 # which is BOTH callable and implements __getitem__.
2244 2244 newcmd = '%s %s' % (iFun,theRest)
2245 2245 auto_rewrite = False
2246 2246 else:
2247 2247 # if the object doesn't support [] access, go ahead and
2248 2248 # autocall
2249 2249 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2250 2250 elif theRest.endswith(';'):
2251 2251 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2252 2252 else:
2253 2253 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2254 2254
2255 2255 if auto_rewrite:
2256 2256 rw = self.outputcache.prompt1.auto_rewrite() + newcmd
2257 2257
2258 2258 try:
2259 2259 # plain ascii works better w/ pyreadline, on some machines, so
2260 2260 # we use it and only print uncolored rewrite if we have unicode
2261 2261 rw = str(rw)
2262 2262 print >>Term.cout, rw
2263 2263 except UnicodeEncodeError:
2264 2264 print "-------------->" + newcmd
2265 2265
2266 2266 # log what is now valid Python, not the actual user input (without the
2267 2267 # final newline)
2268 2268 self.log(line,newcmd,continue_prompt)
2269 2269 return newcmd
2270 2270
2271 2271 def handle_help(self, line_info):
2272 2272 """Try to get some help for the object.
2273 2273
2274 2274 obj? or ?obj -> basic information.
2275 2275 obj?? or ??obj -> more details.
2276 2276 """
2277 2277
2278 2278 line = line_info.line
2279 2279 # We need to make sure that we don't process lines which would be
2280 2280 # otherwise valid python, such as "x=1 # what?"
2281 2281 try:
2282 2282 codeop.compile_command(line)
2283 2283 except SyntaxError:
2284 2284 # We should only handle as help stuff which is NOT valid syntax
2285 2285 if line[0]==self.ESC_HELP:
2286 2286 line = line[1:]
2287 2287 elif line[-1]==self.ESC_HELP:
2288 2288 line = line[:-1]
2289 2289 self.log(line,'#?'+line,line_info.continue_prompt)
2290 2290 if line:
2291 2291 #print 'line:<%r>' % line # dbg
2292 2292 self.magic_pinfo(line)
2293 2293 else:
2294 2294 page(self.usage,screen_lines=self.rc.screen_length)
2295 2295 return '' # Empty string is needed here!
2296 2296 except:
2297 2297 # Pass any other exceptions through to the normal handler
2298 2298 return self.handle_normal(line_info)
2299 2299 else:
2300 2300 # If the code compiles ok, we should handle it normally
2301 2301 return self.handle_normal(line_info)
2302 2302
2303 2303 def getapi(self):
2304 2304 """ Get an IPApi object for this shell instance
2305 2305
2306 2306 Getting an IPApi object is always preferable to accessing the shell
2307 2307 directly, but this holds true especially for extensions.
2308 2308
2309 2309 It should always be possible to implement an extension with IPApi
2310 2310 alone. If not, contact maintainer to request an addition.
2311 2311
2312 2312 """
2313 2313 return self.api
2314 2314
2315 2315 def handle_emacs(self, line_info):
2316 2316 """Handle input lines marked by python-mode."""
2317 2317
2318 2318 # Currently, nothing is done. Later more functionality can be added
2319 2319 # here if needed.
2320 2320
2321 2321 # The input cache shouldn't be updated
2322 2322 return line_info.line
2323 2323
2324 2324
2325 2325 def mktempfile(self,data=None):
2326 2326 """Make a new tempfile and return its filename.
2327 2327
2328 2328 This makes a call to tempfile.mktemp, but it registers the created
2329 2329 filename internally so ipython cleans it up at exit time.
2330 2330
2331 2331 Optional inputs:
2332 2332
2333 2333 - data(None): if data is given, it gets written out to the temp file
2334 2334 immediately, and the file is closed again."""
2335 2335
2336 2336 filename = tempfile.mktemp('.py','ipython_edit_')
2337 2337 self.tempfiles.append(filename)
2338 2338
2339 2339 if data:
2340 2340 tmp_file = open(filename,'w')
2341 2341 tmp_file.write(data)
2342 2342 tmp_file.close()
2343 2343 return filename
2344 2344
2345 2345 def write(self,data):
2346 2346 """Write a string to the default output"""
2347 2347 Term.cout.write(data)
2348 2348
2349 2349 def write_err(self,data):
2350 2350 """Write a string to the default error output"""
2351 2351 Term.cerr.write(data)
2352 2352
2353 2353 def exit(self):
2354 2354 """Handle interactive exit.
2355 2355
2356 2356 This method sets the exit_now attribute."""
2357 2357
2358 2358 if self.rc.confirm_exit:
2359 2359 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2360 2360 self.exit_now = True
2361 2361 else:
2362 2362 self.exit_now = True
2363 2363
2364 2364 def safe_execfile(self,fname,*where,**kw):
2365 2365 """A safe version of the builtin execfile().
2366 2366
2367 2367 This version will never throw an exception, and knows how to handle
2368 2368 ipython logs as well."""
2369 2369
2370 2370 def syspath_cleanup():
2371 2371 """Internal cleanup routine for sys.path."""
2372 2372 if add_dname:
2373 2373 try:
2374 2374 sys.path.remove(dname)
2375 2375 except ValueError:
2376 2376 # For some reason the user has already removed it, ignore.
2377 2377 pass
2378 2378
2379 2379 fname = os.path.expanduser(fname)
2380 2380
2381 2381 # Find things also in current directory. This is needed to mimic the
2382 2382 # behavior of running a script from the system command line, where
2383 2383 # Python inserts the script's directory into sys.path
2384 2384 dname = os.path.dirname(os.path.abspath(fname))
2385 2385 add_dname = False
2386 2386 if dname not in sys.path:
2387 2387 sys.path.insert(0,dname)
2388 2388 add_dname = True
2389 2389
2390 2390 try:
2391 2391 xfile = open(fname)
2392 2392 except:
2393 2393 print >> Term.cerr, \
2394 2394 'Could not open file <%s> for safe execution.' % fname
2395 2395 syspath_cleanup()
2396 2396 return None
2397 2397
2398 2398 kw.setdefault('islog',0)
2399 2399 kw.setdefault('quiet',1)
2400 2400 kw.setdefault('exit_ignore',0)
2401 2401 first = xfile.readline()
2402 2402 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2403 2403 xfile.close()
2404 2404 # line by line execution
2405 2405 if first.startswith(loghead) or kw['islog']:
2406 2406 print 'Loading log file <%s> one line at a time...' % fname
2407 2407 if kw['quiet']:
2408 2408 stdout_save = sys.stdout
2409 2409 sys.stdout = StringIO.StringIO()
2410 2410 try:
2411 2411 globs,locs = where[0:2]
2412 2412 except:
2413 2413 try:
2414 2414 globs = locs = where[0]
2415 2415 except:
2416 2416 globs = locs = globals()
2417 2417 badblocks = []
2418 2418
2419 2419 # we also need to identify indented blocks of code when replaying
2420 2420 # logs and put them together before passing them to an exec
2421 2421 # statement. This takes a bit of regexp and look-ahead work in the
2422 2422 # file. It's easiest if we swallow the whole thing in memory
2423 2423 # first, and manually walk through the lines list moving the
2424 2424 # counter ourselves.
2425 2425 indent_re = re.compile('\s+\S')
2426 2426 xfile = open(fname)
2427 2427 filelines = xfile.readlines()
2428 2428 xfile.close()
2429 2429 nlines = len(filelines)
2430 2430 lnum = 0
2431 2431 while lnum < nlines:
2432 2432 line = filelines[lnum]
2433 2433 lnum += 1
2434 2434 # don't re-insert logger status info into cache
2435 2435 if line.startswith('#log#'):
2436 2436 continue
2437 2437 else:
2438 2438 # build a block of code (maybe a single line) for execution
2439 2439 block = line
2440 2440 try:
2441 2441 next = filelines[lnum] # lnum has already incremented
2442 2442 except:
2443 2443 next = None
2444 2444 while next and indent_re.match(next):
2445 2445 block += next
2446 2446 lnum += 1
2447 2447 try:
2448 2448 next = filelines[lnum]
2449 2449 except:
2450 2450 next = None
2451 2451 # now execute the block of one or more lines
2452 2452 try:
2453 2453 exec block in globs,locs
2454 2454 except SystemExit:
2455 2455 pass
2456 2456 except:
2457 2457 badblocks.append(block.rstrip())
2458 2458 if kw['quiet']: # restore stdout
2459 2459 sys.stdout.close()
2460 2460 sys.stdout = stdout_save
2461 2461 print 'Finished replaying log file <%s>' % fname
2462 2462 if badblocks:
2463 2463 print >> sys.stderr, ('\nThe following lines/blocks in file '
2464 2464 '<%s> reported errors:' % fname)
2465 2465
2466 2466 for badline in badblocks:
2467 2467 print >> sys.stderr, badline
2468 2468 else: # regular file execution
2469 2469 try:
2470 2470 if sys.platform == 'win32' and sys.version_info < (2,5,1):
2471 2471 # Work around a bug in Python for Windows. The bug was
2472 2472 # fixed in in Python 2.5 r54159 and 54158, but that's still
2473 2473 # SVN Python as of March/07. For details, see:
2474 2474 # http://projects.scipy.org/ipython/ipython/ticket/123
2475 2475 try:
2476 2476 globs,locs = where[0:2]
2477 2477 except:
2478 2478 try:
2479 2479 globs = locs = where[0]
2480 2480 except:
2481 2481 globs = locs = globals()
2482 2482 exec file(fname) in globs,locs
2483 2483 else:
2484 2484 execfile(fname,*where)
2485 2485 except SyntaxError:
2486 2486 self.showsyntaxerror()
2487 2487 warn('Failure executing file: <%s>' % fname)
2488 2488 except SystemExit,status:
2489 #print 'STATUS:',status # dbg
2490 if status.message!=0 and not kw['exit_ignore']:
2491 # Code that correctly sets the exit status flag to success
2492 # (0) shouldn't be bothered with a traceback. Note that a
2493 # plain sys.exit() does NOT set the message to 0 (it's
2494 # empty) so that will still get a traceback.
2489 # Code that correctly sets the exit status flag to success (0)
2490 # shouldn't be bothered with a traceback. Note that a plain
2491 # sys.exit() does NOT set the message to 0 (it's empty) so that
2492 # will still get a traceback. Note that the structure of the
2493 # SystemExit exception changed between Python 2.4 and 2.5, so
2494 # the checks must be done in a version-dependent way.
2495 show = False
2496
2497 if sys.version_info[:2] > (2,5):
2498 if status.message!=0 and not kw['exit_ignore']:
2499 show = True
2500 else:
2501 if status.code and not kw['exit_ignore']:
2502 show = True
2503 if show:
2495 2504 self.showtraceback()
2496 2505 warn('Failure executing file: <%s>' % fname)
2497 2506 except:
2498 2507 self.showtraceback()
2499 2508 warn('Failure executing file: <%s>' % fname)
2500 2509
2501 2510 syspath_cleanup()
2502 2511
2503 2512 #************************* end of file <iplib.py> *****************************
@@ -1,7001 +1,7008 b''
1 2007-08-15 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/iplib.py (safe_execfile): fix the SystemExit
4 auto-suppression code to work in Python2.4 (the internal structure
5 of that exception changed and I'd only tested the code with 2.5).
6 Bug reported by a SciPy attendee.
7
1 8 2007-08-13 Ville Vainio <vivainio@gmail.com>
2 9
3 10 * prefilter.py: reverted !c:/bin/foo fix, made % in
4 11 multiline specials work again
5 12
6 13 2007-08-13 Ville Vainio <vivainio@gmail.com>
7 14
8 15 * prefilter.py: Take more care to special-case !, so that
9 16 !c:/bin/foo.exe works.
10 17
11 18 * setup.py: if we are building eggs, strip all docs and
12 19 examples (it doesn't make sense to bytecompile examples,
13 20 and docs would be in an awkward place anyway).
14 21
15 22 * Ryan Krauss' patch fixes start menu shortcuts when IPython
16 23 is installed into a directory that has spaces in the name.
17 24
18 25 2007-08-13 Fernando Perez <Fernando.Perez@colorado.edu>
19 26
20 27 * IPython/Magic.py (magic_doctest_mode): fix prompt separators in
21 28 doctest profile and %doctest_mode, so they actually generate the
22 29 blank lines needed by doctest to separate individual tests.
23 30
24 31 * IPython/iplib.py (safe_execfile): modify so that running code
25 32 which calls sys.exit(0) (or equivalently, raise SystemExit(0))
26 33 doesn't get a printed traceback. Any other value in sys.exit(),
27 34 including the empty call, still generates a traceback. This
28 35 enables use of %run without having to pass '-e' for codes that
29 36 correctly set the exit status flag.
30 37
31 38 2007-08-12 Fernando Perez <Fernando.Perez@colorado.edu>
32 39
33 40 * IPython/iplib.py (InteractiveShell.post_config_initialization):
34 41 fix problems with doctests failing when run inside IPython due to
35 42 IPython's modifications of sys.displayhook.
36 43
37 44 2007-8-9 Fernando Perez <fperez@planck.colorado.edu>
38 45
39 46 * IPython/ipapi.py (to_user_ns): update to accept a dict as well as
40 47 a string with names.
41 48
42 49 2007-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
43 50
44 51 * IPython/Magic.py (magic_doctest_mode): added new %doctest_mode
45 52 magic to toggle on/off the doctest pasting support without having
46 53 to leave a session to switch to a separate profile.
47 54
48 55 2007-08-08 Fernando Perez <Fernando.Perez@colorado.edu>
49 56
50 57 * IPython/Extensions/ipy_profile_doctest.py (main): fix prompt to
51 58 introduce a blank line between inputs, to conform to doctest
52 59 requirements.
53 60
54 61 * IPython/OInspect.py (Inspector.pinfo): fix another part where
55 62 auto-generated docstrings for new-style classes were showing up.
56 63
57 64 2007-08-07 Fernando Perez <Fernando.Perez@colorado.edu>
58 65
59 66 * api_changes: Add new file to track backward-incompatible
60 67 user-visible changes.
61 68
62 69 2007-08-06 Ville Vainio <vivainio@gmail.com>
63 70
64 71 * ipmaker.py: fix bug where user_config_ns didn't exist at all
65 72 before all the config files were handled.
66 73
67 74 2007-08-04 Fernando Perez <Fernando.Perez@colorado.edu>
68 75
69 76 * IPython/irunner.py (RunnerFactory): Add new factory class for
70 77 creating reusable runners based on filenames.
71 78
72 79 * IPython/Extensions/ipy_profile_doctest.py: New profile for
73 80 doctest support. It sets prompts/exceptions as similar to
74 81 standard Python as possible, so that ipython sessions in this
75 82 profile can be easily pasted as doctests with minimal
76 83 modifications. It also enables pasting of doctests from external
77 84 sources (even if they have leading whitespace), so that you can
78 85 rerun doctests from existing sources.
79 86
80 87 * IPython/iplib.py (_prefilter): fix a buglet where after entering
81 88 some whitespace, the prompt would become a continuation prompt
82 89 with no way of exiting it other than Ctrl-C. This fix brings us
83 90 into conformity with how the default python prompt works.
84 91
85 92 * IPython/Extensions/InterpreterPasteInput.py (prefilter_paste):
86 93 Add support for pasting not only lines that start with '>>>', but
87 94 also with ' >>>'. That is, arbitrary whitespace can now precede
88 95 the prompts. This makes the system useful for pasting doctests
89 96 from docstrings back into a normal session.
90 97
91 98 2007-08-02 Fernando Perez <Fernando.Perez@colorado.edu>
92 99
93 100 * IPython/Shell.py (IPShellEmbed.__call__): fix bug introduced in
94 101 r1357, which had killed multiple invocations of an embedded
95 102 ipython (this means that example-embed has been broken for over 1
96 103 year!!!). Rather than possibly breaking the batch stuff for which
97 104 the code in iplib.py/interact was introduced, I worked around the
98 105 problem in the embedding class in Shell.py. We really need a
99 106 bloody test suite for this code, I'm sick of finding stuff that
100 107 used to work breaking left and right every time I use an old
101 108 feature I hadn't touched in a few months.
102 109 (kill_embedded): Add a new magic that only shows up in embedded
103 110 mode, to allow users to permanently deactivate an embedded instance.
104 111
105 112 2007-08-01 Ville Vainio <vivainio@gmail.com>
106 113
107 114 * iplib.py, ipy_profile_sh.py (runlines): Fix the bug where raw
108 115 history gets out of sync on runlines (e.g. when running macros).
109 116
110 117 2007-07-31 Fernando Perez <Fernando.Perez@colorado.edu>
111 118
112 119 * IPython/Magic.py (magic_colors): fix win32-related error message
113 120 that could appear under *nix when readline was missing. Patch by
114 121 Scott Jackson, closes #175.
115 122
116 123 2007-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
117 124
118 125 * IPython/Extensions/ipy_traits_completer.py: Add a new custom
119 126 completer that it traits-aware, so that traits objects don't show
120 127 all of their internal attributes all the time.
121 128
122 129 * IPython/genutils.py (dir2): moved this code from inside
123 130 completer.py to expose it publicly, so I could use it in the
124 131 wildcards bugfix.
125 132
126 133 * IPython/wildcard.py (NameSpace.__init__): fix a bug reported by
127 134 Stefan with Traits.
128 135
129 136 * IPython/completer.py (Completer.attr_matches): change internal
130 137 var name from 'object' to 'obj', since 'object' is now a builtin
131 138 and this can lead to weird bugs if reusing this code elsewhere.
132 139
133 140 2007-07-25 Fernando Perez <Fernando.Perez@colorado.edu>
134 141
135 142 * IPython/OInspect.py (Inspector.pinfo): fix small glitches in
136 143 'foo?' and update the code to prevent printing of default
137 144 docstrings that started appearing after I added support for
138 145 new-style classes. The approach I'm using isn't ideal (I just
139 146 special-case those strings) but I'm not sure how to more robustly
140 147 differentiate between truly user-written strings and Python's
141 148 automatic ones.
142 149
143 150 2007-07-09 Ville Vainio <vivainio@gmail.com>
144 151
145 152 * completer.py: Applied Matthew Neeley's patch:
146 153 Dynamic attributes from trait_names and _getAttributeNames are added
147 154 to the list of tab completions, but when this happens, the attribute
148 155 list is turned into a set, so the attributes are unordered when
149 156 printed, which makes it hard to find the right completion. This patch
150 157 turns this set back into a list and sort it.
151 158
152 159 2007-07-06 Fernando Perez <Fernando.Perez@colorado.edu>
153 160
154 161 * IPython/OInspect.py (Inspector.pinfo): Add support for new-style
155 162 classes in various inspector functions.
156 163
157 164 2007-06-28 Ville Vainio <vivainio@gmail.com>
158 165
159 166 * shadowns.py, iplib.py, ipapi.py, OInspect.py:
160 167 Implement "shadow" namespace, and callable aliases that reside there.
161 168 Use them by:
162 169
163 170 _ip.defalias('foo',myfunc) # creates _sh.foo that points to myfunc
164 171
165 172 foo hello world
166 173 (gets translated to:)
167 174 _sh.foo(r"""hello world""")
168 175
169 176 In practice, this kind of alias can take the role of a magic function
170 177
171 178 * New generic inspect_object, called on obj? and obj??
172 179
173 180 2007-06-15 Fernando Perez <Fernando.Perez@colorado.edu>
174 181
175 182 * IPython/ultraTB.py (findsource): fix a problem with
176 183 inspect.getfile that can cause crashes during traceback construction.
177 184
178 185 2007-06-14 Ville Vainio <vivainio@gmail.com>
179 186
180 187 * iplib.py (handle_auto): Try to use ascii for printing "--->"
181 188 autocall rewrite indication, becausesometimes unicode fails to print
182 189 properly (and you get ' - - - '). Use plain uncoloured ---> for
183 190 unicode.
184 191
185 192 * shadow history. Usable through "%hist -g <pat>" and "%rep 0123".
186 193
187 194 . pickleshare 'hash' commands (hget, hset, hcompress,
188 195 hdict) for efficient shadow history storage.
189 196
190 197 2007-06-13 Ville Vainio <vivainio@gmail.com>
191 198
192 199 * ipapi.py: _ip.to_user_ns(vars, interactive = True).
193 200 Added kw arg 'interactive', tell whether vars should be visible
194 201 with %whos.
195 202
196 203 2007-06-11 Ville Vainio <vivainio@gmail.com>
197 204
198 205 * pspersistence.py, Magic.py, iplib.py: directory history now saved
199 206 to db
200 207
201 208 * iplib.py: "ipython -c <cmd>" now passes the command through prefilter.
202 209 Also, it exits IPython immediately after evaluating the command (just like
203 210 std python)
204 211
205 212 2007-06-05 Walter Doerwald <walter@livinglogic.de>
206 213
207 214 * IPython/Extensions/ipipe.py: Added a new table icap, which executes a
208 215 Python string and captures the output. (Idea and original patch by
209 216 StοΏ½fan van der Walt)
210 217
211 218 2007-06-01 Fernando Perez <Fernando.Perez@colorado.edu>
212 219
213 220 * IPython/ultraTB.py (VerboseTB.text): update printing of
214 221 exception types for Python 2.5 (now all exceptions in the stdlib
215 222 are new-style classes).
216 223
217 224 2007-05-31 Walter Doerwald <walter@livinglogic.de>
218 225
219 226 * IPython/Extensions/igrid.py: Add new commands refresh and
220 227 refresh_timer (mapped to "R"/"F5" and to the menu) which restarts
221 228 the iterator once (refresh) or after every x seconds (refresh_timer).
222 229 Add a working implementation of "searchexpression", where the text
223 230 entered is not the text to search for, but an expression that must
224 231 be true. Added display of shortcuts to the menu. Added commands "pickinput"
225 232 and "pickinputattr" that put the object or attribute under the cursor
226 233 in the input line. Split the statusbar to be able to display the currently
227 234 active refresh interval. (Patch by Nik Tautenhahn)
228 235
229 236 2007-05-29 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
230 237
231 238 * fixing set_term_title to use ctypes as default
232 239
233 240 * fixing set_term_title fallback to work when curent dir
234 241 is on a windows network share
235 242
236 243 2007-05-28 Ville Vainio <vivainio@gmail.com>
237 244
238 245 * %cpaste: strip + with > from left (diffs).
239 246
240 247 * iplib.py: Fix crash when readline not installed
241 248
242 249 2007-05-26 Ville Vainio <vivainio@gmail.com>
243 250
244 251 * generics.py: intruduce easy to extend result_display generic
245 252 function (using simplegeneric.py).
246 253
247 254 * Fixed the append functionality of %set.
248 255
249 256 2007-05-25 Ville Vainio <vivainio@gmail.com>
250 257
251 258 * New magic: %rep (fetch / run old commands from history)
252 259
253 260 * New extension: mglob (%mglob magic), for powerful glob / find /filter
254 261 like functionality
255 262
256 263 % maghistory.py: %hist -g PATTERM greps the history for pattern
257 264
258 265 2007-05-24 Walter Doerwald <walter@livinglogic.de>
259 266
260 267 * IPython/Extensions/ipipe.py: Added a Table ihist that can be used to
261 268 browse the IPython input history
262 269
263 270 * IPython/Extensions/ibrowse.py: Added two command to ibrowse: pickinput
264 271 (mapped to "i") can be used to put the object under the curser in the input
265 272 line. pickinputattr (mapped to "I") does the same for the attribute under
266 273 the cursor.
267 274
268 275 2007-05-24 Ville Vainio <vivainio@gmail.com>
269 276
270 277 * Grand magic cleansing (changeset [2380]):
271 278
272 279 * Introduce ipy_legacy.py where the following magics were
273 280 moved:
274 281
275 282 pdef pdoc psource pfile rehash dhist Quit p r automagic autocall
276 283
277 284 If you need them, either use default profile or "import ipy_legacy"
278 285 in your ipy_user_conf.py
279 286
280 287 * Move sh and scipy profile to Extensions from UserConfig. this implies
281 288 you should not edit them, but you don't need to run %upgrade when
282 289 upgrading IPython anymore.
283 290
284 291 * %hist/%history now operates in "raw" mode by default. To get the old
285 292 behaviour, run '%hist -n' (native mode).
286 293
287 294 * split ipy_stock_completers.py to ipy_stock_completers.py and
288 295 ipy_app_completers.py. Stock completers (%cd, import, %run) are now
289 296 installed as default.
290 297
291 298 * sh profile now installs ipy_signals.py, for (hopefully) better ctrl+c
292 299 handling.
293 300
294 301 * iplib.py, ipapi.py: _ip.set_next_input(s) sets the next ("default")
295 302 input if readline is available.
296 303
297 304 2007-05-23 Ville Vainio <vivainio@gmail.com>
298 305
299 306 * macro.py: %store uses __getstate__ properly
300 307
301 308 * exesetup.py: added new setup script for creating
302 309 standalone IPython executables with py2exe (i.e.
303 310 no python installation required).
304 311
305 312 * Removed ipythonrc-scipy, ipy_profile_scipy.py takes
306 313 its place.
307 314
308 315 * rlineimpl.py, genutils.py (get_home_dir): py2exe support
309 316
310 317 2007-05-21 Ville Vainio <vivainio@gmail.com>
311 318
312 319 * platutil_win32.py (set_term_title): handle
313 320 failure of 'title' system call properly.
314 321
315 322 2007-05-17 Walter Doerwald <walter@livinglogic.de>
316 323
317 324 * IPython/Extensions/ipipe.py: Fix xrepr for ifiles.
318 325 (Bug detected by Paul Mueller).
319 326
320 327 2007-05-16 Ville Vainio <vivainio@gmail.com>
321 328
322 329 * ipy_profile_sci.py, ipython_win_post_install.py: Create
323 330 new "sci" profile, effectively a modern version of the old
324 331 "scipy" profile (which is now slated for deprecation).
325 332
326 333 2007-05-15 Ville Vainio <vivainio@gmail.com>
327 334
328 335 * pycolorize.py, pycolor.1: Paul Mueller's patches that
329 336 make pycolorize read input from stdin when run without arguments.
330 337
331 338 * Magic.py: do not require 'PATH' in %rehash/%rehashx. Closes #155
332 339
333 340 * ipy_rehashdir.py: rename ext_rehashdir to ipy_rehashdir, import
334 341 it in sh profile (instead of ipy_system_conf.py).
335 342
336 343 * Magic.py, ipy_rehashdir.py, ipy_profile_sh.py: System command
337 344 aliases are now lower case on windows (MyCommand.exe => mycommand).
338 345
339 346 * macro.py, ipapi.py, iplib.py, Prompts.py: Macro system rehaul.
340 347 Macros are now callable objects that inherit from ipapi.IPyAutocall,
341 348 i.e. get autocalled regardless of system autocall setting.
342 349
343 350 2007-05-10 Fernando Perez <Fernando.Perez@colorado.edu>
344 351
345 352 * IPython/rlineimpl.py: check for clear_history in readline and
346 353 make it a dummy no-op if not available. This function isn't
347 354 guaranteed to be in the API and appeared in Python 2.4, so we need
348 355 to check it ourselves. Also, clean up this file quite a bit.
349 356
350 357 * ipython.1: update man page and full manual with information
351 358 about threads (remove outdated warning). Closes #151.
352 359
353 360 2007-05-09 Fernando Perez <Fernando.Perez@colorado.edu>
354 361
355 362 * IPython/Extensions/ipy_constants.py: Add Gael's constants module
356 363 in trunk (note that this made it into the 0.8.1 release already,
357 364 but the changelogs didn't get coordinated). Many thanks to Gael
358 365 Varoquaux <gael.varoquaux-AT-normalesup.org>
359 366
360 367 2007-05-09 *** Released version 0.8.1
361 368
362 369 2007-05-10 Walter Doerwald <walter@livinglogic.de>
363 370
364 371 * IPython/Extensions/igrid.py: Incorporate html help into
365 372 the module, so we don't have to search for the file.
366 373
367 374 2007-05-02 Fernando Perez <Fernando.Perez@colorado.edu>
368 375
369 376 * test/test_irunner.py (RunnerTestCase._test_runner): Close #147.
370 377
371 378 2007-04-30 Ville Vainio <vivainio@gmail.com>
372 379
373 380 * iplib.py: (pre_config_initialization) Catch UnicodeDecodeError if the
374 381 user has illegal (non-ascii) home directory name
375 382
376 383 2007-04-27 Ville Vainio <vivainio@gmail.com>
377 384
378 385 * platutils_win32.py: implement set_term_title for windows
379 386
380 387 * Update version number
381 388
382 389 * ipy_profile_sh.py: more informative prompt (2 dir levels)
383 390
384 391 2007-04-26 Walter Doerwald <walter@livinglogic.de>
385 392
386 393 * IPython/Extensions/igrid.py: (igrid) Fix bug that surfaced
387 394 when the igrid input raised an exception. (Patch by Nik Tautenhahn,
388 395 bug discovered by Ville).
389 396
390 397 2007-04-26 Ville Vainio <vivainio@gmail.com>
391 398
392 399 * Extensions/ipy_completers.py: Olivier's module completer now
393 400 saves the list of root modules if it takes > 4 secs on the first run.
394 401
395 402 * Magic.py (%rehashx): %rehashx now clears the completer cache
396 403
397 404
398 405 2007-04-26 Fernando Perez <Fernando.Perez@colorado.edu>
399 406
400 407 * ipython.el: fix incorrect color scheme, reported by Stefan.
401 408 Closes #149.
402 409
403 410 * IPython/PyColorize.py (Parser.format2): fix state-handling
404 411 logic. I still don't like how that code handles state, but at
405 412 least now it should be correct, if inelegant. Closes #146.
406 413
407 414 2007-04-25 Ville Vainio <vivainio@gmail.com>
408 415
409 416 * Extensions/ipy_which.py: added extension for %which magic, works
410 417 a lot like unix 'which' but also finds and expands aliases, and
411 418 allows wildcards.
412 419
413 420 * ipapi.py (expand_alias): Now actually *return* the expanded alias,
414 421 as opposed to returning nothing.
415 422
416 423 * UserConfig/ipy_user_conf.py, ipy_profile_sh.py: do not import
417 424 ipy_stock_completers on default profile, do import on sh profile.
418 425
419 426 2007-04-22 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
420 427
421 428 * Fix bug in iplib.py/safe_execfile when launching ipython with a script
422 429 like ipython.py foo.py which raised a IndexError.
423 430
424 431 2007-04-21 Ville Vainio <vivainio@gmail.com>
425 432
426 433 * Extensions/ipy_extutil.py: added extension to manage other ipython
427 434 extensions. Now only supports 'ls' == list extensions.
428 435
429 436 2007-04-20 Fernando Perez <Fernando.Perez@colorado.edu>
430 437
431 438 * IPython/Debugger.py (BdbQuit_excepthook): fix small bug that
432 439 would prevent use of the exception system outside of a running
433 440 IPython instance.
434 441
435 442 2007-04-20 Ville Vainio <vivainio@gmail.com>
436 443
437 444 * Extensions/ipy_render.py: added extension for easy
438 445 interactive text template rendering (to clipboard). Uses Ka-Ping Yee's
439 446 'Iptl' template notation,
440 447
441 448 * Extensions/ipy_completers.py: introduced Olivier Lauzanne's
442 449 safer & faster 'import' completer.
443 450
444 451 * ipapi.py: Introduced new ipapi methods, _ip.defmacro(name, value)
445 452 and _ip.defalias(name, command).
446 453
447 454 * Extensions/ipy_exportdb.py: New extension for exporting all the
448 455 %store'd data in a portable format (normal ipapi calls like
449 456 defmacro() etc.)
450 457
451 458 2007-04-19 Ville Vainio <vivainio@gmail.com>
452 459
453 460 * upgrade_dir.py: skip junk files like *.pyc
454 461
455 462 * Release.py: version number to 0.8.1
456 463
457 464 2007-04-18 Ville Vainio <vivainio@gmail.com>
458 465
459 466 * iplib.py (safe_execfile): make "ipython foo.py" work with 2.5.1c1
460 467 and later on win32.
461 468
462 469 2007-04-16 Ville Vainio <vivainio@gmail.com>
463 470
464 471 * iplib.py (showtraceback): Do not crash when running w/o readline.
465 472
466 473 2007-04-12 Walter Doerwald <walter@livinglogic.de>
467 474
468 475 * IPython/Extensions/ipipe.py: (ils) Directoy listings are now
469 476 sorted (case sensitive with files and dirs mixed).
470 477
471 478 2007-04-10 Fernando Perez <Fernando.Perez@colorado.edu>
472 479
473 480 * IPython/Release.py (version): Open trunk for 0.8.1 development.
474 481
475 482 2007-04-10 *** Released version 0.8.0
476 483
477 484 2007-04-07 Fernando Perez <Fernando.Perez@colorado.edu>
478 485
479 486 * Tag 0.8.0 for release.
480 487
481 488 * IPython/iplib.py (reloadhist): add API function to cleanly
482 489 reload the readline history, which was growing inappropriately on
483 490 every %run call.
484 491
485 492 * win32_manual_post_install.py (run): apply last part of Nicolas
486 493 Pernetty's patch (I'd accidentally applied it in a different
487 494 directory and this particular file didn't get patched).
488 495
489 496 2007-04-05 Fernando Perez <Fernando.Perez@colorado.edu>
490 497
491 498 * IPython/Shell.py (MAIN_THREAD_ID): get rid of my stupid hack to
492 499 find the main thread id and use the proper API call. Thanks to
493 500 Stefan for the fix.
494 501
495 502 * test/test_prefilter.py (esc_handler_tests): udpate one of Dan's
496 503 unit tests to reflect fixed ticket #52, and add more tests sent by
497 504 him.
498 505
499 506 * IPython/iplib.py (raw_input): restore the readline completer
500 507 state on every input, in case third-party code messed it up.
501 508 (_prefilter): revert recent addition of early-escape checks which
502 509 prevent many valid alias calls from working.
503 510
504 511 * IPython/Shell.py (MTInteractiveShell.runcode): add a tracking
505 512 flag for sigint handler so we don't run a full signal() call on
506 513 each runcode access.
507 514
508 515 * IPython/Magic.py (magic_whos): small improvement to diagnostic
509 516 message.
510 517
511 518 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
512 519
513 520 * IPython/Shell.py (sigint_handler): I *THINK* I finally got
514 521 asynchronous exceptions working, i.e., Ctrl-C can actually
515 522 interrupt long-running code in the multithreaded shells.
516 523
517 524 This is using Tomer Filiba's great ctypes-based trick:
518 525 http://sebulba.wikispaces.com/recipe+thread2. I'd already tried
519 526 this in the past, but hadn't been able to make it work before. So
520 527 far it looks like it's actually running, but this needs more
521 528 testing. If it really works, I'll be *very* happy, and we'll owe
522 529 a huge thank you to Tomer. My current implementation is ugly,
523 530 hackish and uses nasty globals, but I don't want to try and clean
524 531 anything up until we know if it actually works.
525 532
526 533 NOTE: this feature needs ctypes to work. ctypes is included in
527 534 Python2.5, but 2.4 users will need to manually install it. This
528 535 feature makes multi-threaded shells so much more usable that it's
529 536 a minor price to pay (ctypes is very easy to install, already a
530 537 requirement for win32 and available in major linux distros).
531 538
532 539 2007-04-04 Ville Vainio <vivainio@gmail.com>
533 540
534 541 * Extensions/ipy_completers.py, ipy_stock_completers.py:
535 542 Moved implementations of 'bundled' completers to ipy_completers.py,
536 543 they are only enabled in ipy_stock_completers.py.
537 544
538 545 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
539 546
540 547 * IPython/PyColorize.py (Parser.format2): Fix identation of
541 548 colorzied output and return early if color scheme is NoColor, to
542 549 avoid unnecessary and expensive tokenization. Closes #131.
543 550
544 551 2007-04-03 Fernando Perez <Fernando.Perez@colorado.edu>
545 552
546 553 * IPython/Debugger.py: disable the use of pydb version 1.17. It
547 554 has a critical bug (a missing import that makes post-mortem not
548 555 work at all). Unfortunately as of this time, this is the version
549 556 shipped with Ubuntu Edgy, so quite a few people have this one. I
550 557 hope Edgy will update to a more recent package.
551 558
552 559 2007-04-02 Fernando Perez <Fernando.Perez@colorado.edu>
553 560
554 561 * IPython/iplib.py (_prefilter): close #52, second part of a patch
555 562 set by Stefan (only the first part had been applied before).
556 563
557 564 * IPython/Extensions/ipy_stock_completers.py (module_completer):
558 565 remove usage of the dangerous pkgutil.walk_packages(). See
559 566 details in comments left in the code.
560 567
561 568 * IPython/Magic.py (magic_whos): add support for numpy arrays
562 569 similar to what we had for Numeric.
563 570
564 571 * IPython/completer.py (IPCompleter.complete): extend the
565 572 complete() call API to support completions by other mechanisms
566 573 than readline. Closes #109.
567 574
568 575 * IPython/iplib.py (safe_execfile): add a safeguard under Win32 to
569 576 protect against a bug in Python's execfile(). Closes #123.
570 577
571 578 2007-04-01 Fernando Perez <Fernando.Perez@colorado.edu>
572 579
573 580 * IPython/iplib.py (split_user_input): ensure that when splitting
574 581 user input, the part that can be treated as a python name is pure
575 582 ascii (Python identifiers MUST be pure ascii). Part of the
576 583 ongoing Unicode support work.
577 584
578 585 * IPython/Prompts.py (prompt_specials_color): Add \N for the
579 586 actual prompt number, without any coloring. This allows users to
580 587 produce numbered prompts with their own colors. Added after a
581 588 report/request by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
582 589
583 590 2007-03-31 Walter Doerwald <walter@livinglogic.de>
584 591
585 592 * IPython/Extensions/igrid.py: Map the return key
586 593 to enter() and shift-return to enterattr().
587 594
588 595 2007-03-30 Fernando Perez <Fernando.Perez@colorado.edu>
589 596
590 597 * IPython/Magic.py (magic_psearch): add unicode support by
591 598 encoding to ascii the input, since this routine also only deals
592 599 with valid Python names. Fixes a bug reported by Stefan.
593 600
594 601 2007-03-29 Fernando Perez <Fernando.Perez@colorado.edu>
595 602
596 603 * IPython/Magic.py (_inspect): convert unicode input into ascii
597 604 before trying to evaluate it as a Python identifier. This fixes a
598 605 problem that the new unicode support had introduced when analyzing
599 606 long definition lines for functions.
600 607
601 608 2007-03-24 Walter Doerwald <walter@livinglogic.de>
602 609
603 610 * IPython/Extensions/igrid.py: Fix picking. Using
604 611 igrid with wxPython 2.6 and -wthread should work now.
605 612 igrid.display() simply tries to create a frame without
606 613 an application. Only if this fails an application is created.
607 614
608 615 2007-03-23 Walter Doerwald <walter@livinglogic.de>
609 616
610 617 * IPython/Extensions/path.py: Updated to version 2.2.
611 618
612 619 2007-03-23 Ville Vainio <vivainio@gmail.com>
613 620
614 621 * iplib.py: recursive alias expansion now works better, so that
615 622 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
616 623 doesn't trip up the process, if 'd' has been aliased to 'ls'.
617 624
618 625 * Extensions/ipy_gnuglobal.py added, provides %global magic
619 626 for users of http://www.gnu.org/software/global
620 627
621 628 * iplib.py: '!command /?' now doesn't invoke IPython's help system.
622 629 Closes #52. Patch by Stefan van der Walt.
623 630
624 631 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
625 632
626 633 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
627 634 respect the __file__ attribute when using %run. Thanks to a bug
628 635 report by Sebastian Rooks <sebastian.rooks-AT-free.fr>.
629 636
630 637 2007-03-22 Fernando Perez <Fernando.Perez@colorado.edu>
631 638
632 639 * IPython/iplib.py (raw_input): Fix mishandling of unicode at
633 640 input. Patch sent by Stefan.
634 641
635 642 2007-03-20 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
636 643 * IPython/Extensions/ipy_stock_completer.py
637 644 shlex_split, fix bug in shlex_split. len function
638 645 call was missing an if statement. Caused shlex_split to
639 646 sometimes return "" as last element.
640 647
641 648 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
642 649
643 650 * IPython/completer.py
644 651 (IPCompleter.file_matches.single_dir_expand): fix a problem
645 652 reported by Stefan, where directories containign a single subdir
646 653 would be completed too early.
647 654
648 655 * IPython/Shell.py (_load_pylab): Make the execution of 'from
649 656 pylab import *' when -pylab is given be optional. A new flag,
650 657 pylab_import_all controls this behavior, the default is True for
651 658 backwards compatibility.
652 659
653 660 * IPython/ultraTB.py (_formatTracebackLines): Added (slightly
654 661 modified) R. Bernstein's patch for fully syntax highlighted
655 662 tracebacks. The functionality is also available under ultraTB for
656 663 non-ipython users (someone using ultraTB but outside an ipython
657 664 session). They can select the color scheme by setting the
658 665 module-level global DEFAULT_SCHEME. The highlight functionality
659 666 also works when debugging.
660 667
661 668 * IPython/genutils.py (IOStream.close): small patch by
662 669 R. Bernstein for improved pydb support.
663 670
664 671 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
665 672 DaveS <davls@telus.net> to improve support of debugging under
666 673 NTEmacs, including improved pydb behavior.
667 674
668 675 * IPython/Magic.py (magic_prun): Fix saving of profile info for
669 676 Python 2.5, where the stats object API changed a little. Thanks
670 677 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
671 678
672 679 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
673 680 Pernetty's patch to improve support for (X)Emacs under Win32.
674 681
675 682 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
676 683
677 684 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
678 685 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
679 686 a report by Nik Tautenhahn.
680 687
681 688 2007-03-16 Walter Doerwald <walter@livinglogic.de>
682 689
683 690 * setup.py: Add the igrid help files to the list of data files
684 691 to be installed alongside igrid.
685 692 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
686 693 Show the input object of the igrid browser as the window tile.
687 694 Show the object the cursor is on in the statusbar.
688 695
689 696 2007-03-15 Ville Vainio <vivainio@gmail.com>
690 697
691 698 * Extensions/ipy_stock_completers.py: Fixed exception
692 699 on mismatching quotes in %run completer. Patch by
693 700 JοΏ½rgen Stenarson. Closes #127.
694 701
695 702 2007-03-14 Ville Vainio <vivainio@gmail.com>
696 703
697 704 * Extensions/ext_rehashdir.py: Do not do auto_alias
698 705 in %rehashdir, it clobbers %store'd aliases.
699 706
700 707 * UserConfig/ipy_profile_sh.py: envpersist.py extension
701 708 (beefed up %env) imported for sh profile.
702 709
703 710 2007-03-10 Walter Doerwald <walter@livinglogic.de>
704 711
705 712 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
706 713 as the default browser.
707 714 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
708 715 As igrid displays all attributes it ever encounters, fetch() (which has
709 716 been renamed to _fetch()) doesn't have to recalculate the display attributes
710 717 every time a new item is fetched. This should speed up scrolling.
711 718
712 719 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
713 720
714 721 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
715 722 Schmolck's recently reported tab-completion bug (my previous one
716 723 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
717 724
718 725 2007-03-09 Walter Doerwald <walter@livinglogic.de>
719 726
720 727 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
721 728 Close help window if exiting igrid.
722 729
723 730 2007-03-02 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
724 731
725 732 * IPython/Extensions/ipy_defaults.py: Check if readline is available
726 733 before calling functions from readline.
727 734
728 735 2007-03-02 Walter Doerwald <walter@livinglogic.de>
729 736
730 737 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
731 738 igrid is a wxPython-based display object for ipipe. If your system has
732 739 wx installed igrid will be the default display. Without wx ipipe falls
733 740 back to ibrowse (which needs curses). If no curses is installed ipipe
734 741 falls back to idump.
735 742
736 743 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
737 744
738 745 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
739 746 my changes from yesterday, they introduced bugs. Will reactivate
740 747 once I get a correct solution, which will be much easier thanks to
741 748 Dan Milstein's new prefilter test suite.
742 749
743 750 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
744 751
745 752 * IPython/iplib.py (split_user_input): fix input splitting so we
746 753 don't attempt attribute accesses on things that can't possibly be
747 754 valid Python attributes. After a bug report by Alex Schmolck.
748 755 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
749 756 %magic with explicit % prefix.
750 757
751 758 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
752 759
753 760 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
754 761 avoid a DeprecationWarning from GTK.
755 762
756 763 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
757 764
758 765 * IPython/genutils.py (clock): I modified clock() to return total
759 766 time, user+system. This is a more commonly needed metric. I also
760 767 introduced the new clocku/clocks to get only user/system time if
761 768 one wants those instead.
762 769
763 770 ***WARNING: API CHANGE*** clock() used to return only user time,
764 771 so if you want exactly the same results as before, use clocku
765 772 instead.
766 773
767 774 2007-02-22 Ville Vainio <vivainio@gmail.com>
768 775
769 776 * IPython/Extensions/ipy_p4.py: Extension for improved
770 777 p4 (perforce version control system) experience.
771 778 Adds %p4 magic with p4 command completion and
772 779 automatic -G argument (marshall output as python dict)
773 780
774 781 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
775 782
776 783 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
777 784 stop marks.
778 785 (ClearingMixin): a simple mixin to easily make a Demo class clear
779 786 the screen in between blocks and have empty marquees. The
780 787 ClearDemo and ClearIPDemo classes that use it are included.
781 788
782 789 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
783 790
784 791 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
785 792 protect against exceptions at Python shutdown time. Patch
786 793 sumbmitted to upstream.
787 794
788 795 2007-02-14 Walter Doerwald <walter@livinglogic.de>
789 796
790 797 * IPython/Extensions/ibrowse.py: If entering the first object level
791 798 (i.e. the object for which the browser has been started) fails,
792 799 now the error is raised directly (aborting the browser) instead of
793 800 running into an empty levels list later.
794 801
795 802 2007-02-03 Walter Doerwald <walter@livinglogic.de>
796 803
797 804 * IPython/Extensions/ipipe.py: Add an xrepr implementation
798 805 for the noitem object.
799 806
800 807 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
801 808
802 809 * IPython/completer.py (Completer.attr_matches): Fix small
803 810 tab-completion bug with Enthought Traits objects with units.
804 811 Thanks to a bug report by Tom Denniston
805 812 <tom.denniston-AT-alum.dartmouth.org>.
806 813
807 814 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
808 815
809 816 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
810 817 bug where only .ipy or .py would be completed. Once the first
811 818 argument to %run has been given, all completions are valid because
812 819 they are the arguments to the script, which may well be non-python
813 820 filenames.
814 821
815 822 * IPython/irunner.py (InteractiveRunner.run_source): major updates
816 823 to irunner to allow it to correctly support real doctesting of
817 824 out-of-process ipython code.
818 825
819 826 * IPython/Magic.py (magic_cd): Make the setting of the terminal
820 827 title an option (-noterm_title) because it completely breaks
821 828 doctesting.
822 829
823 830 * IPython/demo.py: fix IPythonDemo class that was not actually working.
824 831
825 832 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
826 833
827 834 * IPython/irunner.py (main): fix small bug where extensions were
828 835 not being correctly recognized.
829 836
830 837 2007-01-23 Walter Doerwald <walter@livinglogic.de>
831 838
832 839 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
833 840 a string containing a single line yields the string itself as the
834 841 only item.
835 842
836 843 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
837 844 object if it's the same as the one on the last level (This avoids
838 845 infinite recursion for one line strings).
839 846
840 847 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
841 848
842 849 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
843 850 all output streams before printing tracebacks. This ensures that
844 851 user output doesn't end up interleaved with traceback output.
845 852
846 853 2007-01-10 Ville Vainio <vivainio@gmail.com>
847 854
848 855 * Extensions/envpersist.py: Turbocharged %env that remembers
849 856 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
850 857 "%env VISUAL=jed".
851 858
852 859 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
853 860
854 861 * IPython/iplib.py (showtraceback): ensure that we correctly call
855 862 custom handlers in all cases (some with pdb were slipping through,
856 863 but I'm not exactly sure why).
857 864
858 865 * IPython/Debugger.py (Tracer.__init__): added new class to
859 866 support set_trace-like usage of IPython's enhanced debugger.
860 867
861 868 2006-12-24 Ville Vainio <vivainio@gmail.com>
862 869
863 870 * ipmaker.py: more informative message when ipy_user_conf
864 871 import fails (suggest running %upgrade).
865 872
866 873 * tools/run_ipy_in_profiler.py: Utility to see where
867 874 the time during IPython startup is spent.
868 875
869 876 2006-12-20 Ville Vainio <vivainio@gmail.com>
870 877
871 878 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
872 879
873 880 * ipapi.py: Add new ipapi method, expand_alias.
874 881
875 882 * Release.py: Bump up version to 0.7.4.svn
876 883
877 884 2006-12-17 Ville Vainio <vivainio@gmail.com>
878 885
879 886 * Extensions/jobctrl.py: Fixed &cmd arg arg...
880 887 to work properly on posix too
881 888
882 889 * Release.py: Update revnum (version is still just 0.7.3).
883 890
884 891 2006-12-15 Ville Vainio <vivainio@gmail.com>
885 892
886 893 * scripts/ipython_win_post_install: create ipython.py in
887 894 prefix + "/scripts".
888 895
889 896 * Release.py: Update version to 0.7.3.
890 897
891 898 2006-12-14 Ville Vainio <vivainio@gmail.com>
892 899
893 900 * scripts/ipython_win_post_install: Overwrite old shortcuts
894 901 if they already exist
895 902
896 903 * Release.py: release 0.7.3rc2
897 904
898 905 2006-12-13 Ville Vainio <vivainio@gmail.com>
899 906
900 907 * Branch and update Release.py for 0.7.3rc1
901 908
902 909 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
903 910
904 911 * IPython/Shell.py (IPShellWX): update for current WX naming
905 912 conventions, to avoid a deprecation warning with current WX
906 913 versions. Thanks to a report by Danny Shevitz.
907 914
908 915 2006-12-12 Ville Vainio <vivainio@gmail.com>
909 916
910 917 * ipmaker.py: apply david cournapeau's patch to make
911 918 import_some work properly even when ipythonrc does
912 919 import_some on empty list (it was an old bug!).
913 920
914 921 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
915 922 Add deprecation note to ipythonrc and a url to wiki
916 923 in ipy_user_conf.py
917 924
918 925
919 926 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
920 927 as if it was typed on IPython command prompt, i.e.
921 928 as IPython script.
922 929
923 930 * example-magic.py, magic_grepl.py: remove outdated examples
924 931
925 932 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
926 933
927 934 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
928 935 is called before any exception has occurred.
929 936
930 937 2006-12-08 Ville Vainio <vivainio@gmail.com>
931 938
932 939 * Extensions/ipy_stock_completers.py: fix cd completer
933 940 to translate /'s to \'s again.
934 941
935 942 * completer.py: prevent traceback on file completions w/
936 943 backslash.
937 944
938 945 * Release.py: Update release number to 0.7.3b3 for release
939 946
940 947 2006-12-07 Ville Vainio <vivainio@gmail.com>
941 948
942 949 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
943 950 while executing external code. Provides more shell-like behaviour
944 951 and overall better response to ctrl + C / ctrl + break.
945 952
946 953 * tools/make_tarball.py: new script to create tarball straight from svn
947 954 (setup.py sdist doesn't work on win32).
948 955
949 956 * Extensions/ipy_stock_completers.py: fix cd completer to give up
950 957 on dirnames with spaces and use the default completer instead.
951 958
952 959 * Revision.py: Change version to 0.7.3b2 for release.
953 960
954 961 2006-12-05 Ville Vainio <vivainio@gmail.com>
955 962
956 963 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
957 964 pydb patch 4 (rm debug printing, py 2.5 checking)
958 965
959 966 2006-11-30 Walter Doerwald <walter@livinglogic.de>
960 967 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
961 968 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
962 969 "refreshfind" (mapped to "R") does the same but tries to go back to the same
963 970 object the cursor was on before the refresh. The command "markrange" is
964 971 mapped to "%" now.
965 972 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
966 973
967 974 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
968 975
969 976 * IPython/Magic.py (magic_debug): new %debug magic to activate the
970 977 interactive debugger on the last traceback, without having to call
971 978 %pdb and rerun your code. Made minor changes in various modules,
972 979 should automatically recognize pydb if available.
973 980
974 981 2006-11-28 Ville Vainio <vivainio@gmail.com>
975 982
976 983 * completer.py: If the text start with !, show file completions
977 984 properly. This helps when trying to complete command name
978 985 for shell escapes.
979 986
980 987 2006-11-27 Ville Vainio <vivainio@gmail.com>
981 988
982 989 * ipy_stock_completers.py: bzr completer submitted by Stefan van
983 990 der Walt. Clean up svn and hg completers by using a common
984 991 vcs_completer.
985 992
986 993 2006-11-26 Ville Vainio <vivainio@gmail.com>
987 994
988 995 * Remove ipconfig and %config; you should use _ip.options structure
989 996 directly instead!
990 997
991 998 * genutils.py: add wrap_deprecated function for deprecating callables
992 999
993 1000 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
994 1001 _ip.system instead. ipalias is redundant.
995 1002
996 1003 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
997 1004 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
998 1005 explicit.
999 1006
1000 1007 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
1001 1008 completer. Try it by entering 'hg ' and pressing tab.
1002 1009
1003 1010 * macro.py: Give Macro a useful __repr__ method
1004 1011
1005 1012 * Magic.py: %whos abbreviates the typename of Macro for brevity.
1006 1013
1007 1014 2006-11-24 Walter Doerwald <walter@livinglogic.de>
1008 1015 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
1009 1016 we don't get a duplicate ipipe module, where registration of the xrepr
1010 1017 implementation for Text is useless.
1011 1018
1012 1019 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
1013 1020
1014 1021 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
1015 1022
1016 1023 2006-11-24 Ville Vainio <vivainio@gmail.com>
1017 1024
1018 1025 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
1019 1026 try to use "cProfile" instead of the slower pure python
1020 1027 "profile"
1021 1028
1022 1029 2006-11-23 Ville Vainio <vivainio@gmail.com>
1023 1030
1024 1031 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
1025 1032 Qt+IPython+Designer link in documentation.
1026 1033
1027 1034 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
1028 1035 correct Pdb object to %pydb.
1029 1036
1030 1037
1031 1038 2006-11-22 Walter Doerwald <walter@livinglogic.de>
1032 1039 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
1033 1040 generic xrepr(), otherwise the list implementation would kick in.
1034 1041
1035 1042 2006-11-21 Ville Vainio <vivainio@gmail.com>
1036 1043
1037 1044 * upgrade_dir.py: Now actually overwrites a nonmodified user file
1038 1045 with one from UserConfig.
1039 1046
1040 1047 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
1041 1048 it was missing which broke the sh profile.
1042 1049
1043 1050 * completer.py: file completer now uses explicit '/' instead
1044 1051 of os.path.join, expansion of 'foo' was broken on win32
1045 1052 if there was one directory with name 'foobar'.
1046 1053
1047 1054 * A bunch of patches from Kirill Smelkov:
1048 1055
1049 1056 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
1050 1057
1051 1058 * [patch 7/9] Implement %page -r (page in raw mode) -
1052 1059
1053 1060 * [patch 5/9] ScientificPython webpage has moved
1054 1061
1055 1062 * [patch 4/9] The manual mentions %ds, should be %dhist
1056 1063
1057 1064 * [patch 3/9] Kill old bits from %prun doc.
1058 1065
1059 1066 * [patch 1/9] Fix typos here and there.
1060 1067
1061 1068 2006-11-08 Ville Vainio <vivainio@gmail.com>
1062 1069
1063 1070 * completer.py (attr_matches): catch all exceptions raised
1064 1071 by eval of expr with dots.
1065 1072
1066 1073 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
1067 1074
1068 1075 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
1069 1076 input if it starts with whitespace. This allows you to paste
1070 1077 indented input from any editor without manually having to type in
1071 1078 the 'if 1:', which is convenient when working interactively.
1072 1079 Slightly modifed version of a patch by Bo Peng
1073 1080 <bpeng-AT-rice.edu>.
1074 1081
1075 1082 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1076 1083
1077 1084 * IPython/irunner.py (main): modified irunner so it automatically
1078 1085 recognizes the right runner to use based on the extension (.py for
1079 1086 python, .ipy for ipython and .sage for sage).
1080 1087
1081 1088 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
1082 1089 visible in ipapi as ip.config(), to programatically control the
1083 1090 internal rc object. There's an accompanying %config magic for
1084 1091 interactive use, which has been enhanced to match the
1085 1092 funtionality in ipconfig.
1086 1093
1087 1094 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
1088 1095 so it's not just a toggle, it now takes an argument. Add support
1089 1096 for a customizable header when making system calls, as the new
1090 1097 system_header variable in the ipythonrc file.
1091 1098
1092 1099 2006-11-03 Walter Doerwald <walter@livinglogic.de>
1093 1100
1094 1101 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
1095 1102 generic functions (using Philip J. Eby's simplegeneric package).
1096 1103 This makes it possible to customize the display of third-party classes
1097 1104 without having to monkeypatch them. xiter() no longer supports a mode
1098 1105 argument and the XMode class has been removed. The same functionality can
1099 1106 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
1100 1107 One consequence of the switch to generic functions is that xrepr() and
1101 1108 xattrs() implementation must define the default value for the mode
1102 1109 argument themselves and xattrs() implementations must return real
1103 1110 descriptors.
1104 1111
1105 1112 * IPython/external: This new subpackage will contain all third-party
1106 1113 packages that are bundled with IPython. (The first one is simplegeneric).
1107 1114
1108 1115 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
1109 1116 directory which as been dropped in r1703.
1110 1117
1111 1118 * IPython/Extensions/ipipe.py (iless): Fixed.
1112 1119
1113 1120 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
1114 1121
1115 1122 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1116 1123
1117 1124 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
1118 1125 handling in variable expansion so that shells and magics recognize
1119 1126 function local scopes correctly. Bug reported by Brian.
1120 1127
1121 1128 * scripts/ipython: remove the very first entry in sys.path which
1122 1129 Python auto-inserts for scripts, so that sys.path under IPython is
1123 1130 as similar as possible to that under plain Python.
1124 1131
1125 1132 * IPython/completer.py (IPCompleter.file_matches): Fix
1126 1133 tab-completion so that quotes are not closed unless the completion
1127 1134 is unambiguous. After a request by Stefan. Minor cleanups in
1128 1135 ipy_stock_completers.
1129 1136
1130 1137 2006-11-02 Ville Vainio <vivainio@gmail.com>
1131 1138
1132 1139 * ipy_stock_completers.py: Add %run and %cd completers.
1133 1140
1134 1141 * completer.py: Try running custom completer for both
1135 1142 "foo" and "%foo" if the command is just "foo". Ignore case
1136 1143 when filtering possible completions.
1137 1144
1138 1145 * UserConfig/ipy_user_conf.py: install stock completers as default
1139 1146
1140 1147 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
1141 1148 simplified readline history save / restore through a wrapper
1142 1149 function
1143 1150
1144 1151
1145 1152 2006-10-31 Ville Vainio <vivainio@gmail.com>
1146 1153
1147 1154 * strdispatch.py, completer.py, ipy_stock_completers.py:
1148 1155 Allow str_key ("command") in completer hooks. Implement
1149 1156 trivial completer for 'import' (stdlib modules only). Rename
1150 1157 ipy_linux_package_managers.py to ipy_stock_completers.py.
1151 1158 SVN completer.
1152 1159
1153 1160 * Extensions/ledit.py: %magic line editor for easily and
1154 1161 incrementally manipulating lists of strings. The magic command
1155 1162 name is %led.
1156 1163
1157 1164 2006-10-30 Ville Vainio <vivainio@gmail.com>
1158 1165
1159 1166 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
1160 1167 Bernsteins's patches for pydb integration.
1161 1168 http://bashdb.sourceforge.net/pydb/
1162 1169
1163 1170 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
1164 1171 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
1165 1172 custom completer hook to allow the users to implement their own
1166 1173 completers. See ipy_linux_package_managers.py for example. The
1167 1174 hook name is 'complete_command'.
1168 1175
1169 1176 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
1170 1177
1171 1178 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
1172 1179 Numeric leftovers.
1173 1180
1174 1181 * ipython.el (py-execute-region): apply Stefan's patch to fix
1175 1182 garbled results if the python shell hasn't been previously started.
1176 1183
1177 1184 * IPython/genutils.py (arg_split): moved to genutils, since it's a
1178 1185 pretty generic function and useful for other things.
1179 1186
1180 1187 * IPython/OInspect.py (getsource): Add customizable source
1181 1188 extractor. After a request/patch form W. Stein (SAGE).
1182 1189
1183 1190 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
1184 1191 window size to a more reasonable value from what pexpect does,
1185 1192 since their choice causes wrapping bugs with long input lines.
1186 1193
1187 1194 2006-10-28 Ville Vainio <vivainio@gmail.com>
1188 1195
1189 1196 * Magic.py (%run): Save and restore the readline history from
1190 1197 file around %run commands to prevent side effects from
1191 1198 %runned programs that might use readline (e.g. pydb).
1192 1199
1193 1200 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
1194 1201 invoking the pydb enhanced debugger.
1195 1202
1196 1203 2006-10-23 Walter Doerwald <walter@livinglogic.de>
1197 1204
1198 1205 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
1199 1206 call the base class method and propagate the return value to
1200 1207 ifile. This is now done by path itself.
1201 1208
1202 1209 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1203 1210
1204 1211 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
1205 1212 api: set_crash_handler(), to expose the ability to change the
1206 1213 internal crash handler.
1207 1214
1208 1215 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
1209 1216 the various parameters of the crash handler so that apps using
1210 1217 IPython as their engine can customize crash handling. Ipmlemented
1211 1218 at the request of SAGE.
1212 1219
1213 1220 2006-10-14 Ville Vainio <vivainio@gmail.com>
1214 1221
1215 1222 * Magic.py, ipython.el: applied first "safe" part of Rocky
1216 1223 Bernstein's patch set for pydb integration.
1217 1224
1218 1225 * Magic.py (%unalias, %alias): %store'd aliases can now be
1219 1226 removed with '%unalias'. %alias w/o args now shows most
1220 1227 interesting (stored / manually defined) aliases last
1221 1228 where they catch the eye w/o scrolling.
1222 1229
1223 1230 * Magic.py (%rehashx), ext_rehashdir.py: files with
1224 1231 'py' extension are always considered executable, even
1225 1232 when not in PATHEXT environment variable.
1226 1233
1227 1234 2006-10-12 Ville Vainio <vivainio@gmail.com>
1228 1235
1229 1236 * jobctrl.py: Add new "jobctrl" extension for spawning background
1230 1237 processes with "&find /". 'import jobctrl' to try it out. Requires
1231 1238 'subprocess' module, standard in python 2.4+.
1232 1239
1233 1240 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
1234 1241 so if foo -> bar and bar -> baz, then foo -> baz.
1235 1242
1236 1243 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
1237 1244
1238 1245 * IPython/Magic.py (Magic.parse_options): add a new posix option
1239 1246 to allow parsing of input args in magics that doesn't strip quotes
1240 1247 (if posix=False). This also closes %timeit bug reported by
1241 1248 Stefan.
1242 1249
1243 1250 2006-10-03 Ville Vainio <vivainio@gmail.com>
1244 1251
1245 1252 * iplib.py (raw_input, interact): Return ValueError catching for
1246 1253 raw_input. Fixes infinite loop for sys.stdin.close() or
1247 1254 sys.stdout.close().
1248 1255
1249 1256 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1250 1257
1251 1258 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
1252 1259 to help in handling doctests. irunner is now pretty useful for
1253 1260 running standalone scripts and simulate a full interactive session
1254 1261 in a format that can be then pasted as a doctest.
1255 1262
1256 1263 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
1257 1264 on top of the default (useless) ones. This also fixes the nasty
1258 1265 way in which 2.5's Quitter() exits (reverted [1785]).
1259 1266
1260 1267 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
1261 1268 2.5.
1262 1269
1263 1270 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
1264 1271 color scheme is updated as well when color scheme is changed
1265 1272 interactively.
1266 1273
1267 1274 2006-09-27 Ville Vainio <vivainio@gmail.com>
1268 1275
1269 1276 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
1270 1277 infinite loop and just exit. It's a hack, but will do for a while.
1271 1278
1272 1279 2006-08-25 Walter Doerwald <walter@livinglogic.de>
1273 1280
1274 1281 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
1275 1282 the constructor, this makes it possible to get a list of only directories
1276 1283 or only files.
1277 1284
1278 1285 2006-08-12 Ville Vainio <vivainio@gmail.com>
1279 1286
1280 1287 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
1281 1288 they broke unittest
1282 1289
1283 1290 2006-08-11 Ville Vainio <vivainio@gmail.com>
1284 1291
1285 1292 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
1286 1293 by resolving issue properly, i.e. by inheriting FakeModule
1287 1294 from types.ModuleType. Pickling ipython interactive data
1288 1295 should still work as usual (testing appreciated).
1289 1296
1290 1297 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
1291 1298
1292 1299 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
1293 1300 running under python 2.3 with code from 2.4 to fix a bug with
1294 1301 help(). Reported by the Debian maintainers, Norbert Tretkowski
1295 1302 <norbert-AT-tretkowski.de> and Alexandre Fayolle
1296 1303 <afayolle-AT-debian.org>.
1297 1304
1298 1305 2006-08-04 Walter Doerwald <walter@livinglogic.de>
1299 1306
1300 1307 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
1301 1308 (which was displaying "quit" twice).
1302 1309
1303 1310 2006-07-28 Walter Doerwald <walter@livinglogic.de>
1304 1311
1305 1312 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
1306 1313 the mode argument).
1307 1314
1308 1315 2006-07-27 Walter Doerwald <walter@livinglogic.de>
1309 1316
1310 1317 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
1311 1318 not running under IPython.
1312 1319
1313 1320 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
1314 1321 and make it iterable (iterating over the attribute itself). Add two new
1315 1322 magic strings for __xattrs__(): If the string starts with "-", the attribute
1316 1323 will not be displayed in ibrowse's detail view (but it can still be
1317 1324 iterated over). This makes it possible to add attributes that are large
1318 1325 lists or generator methods to the detail view. Replace magic attribute names
1319 1326 and _attrname() and _getattr() with "descriptors": For each type of magic
1320 1327 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
1321 1328 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
1322 1329 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
1323 1330 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
1324 1331 are still supported.
1325 1332
1326 1333 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
1327 1334 fails in ibrowse.fetch(), the exception object is added as the last item
1328 1335 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
1329 1336 a generator throws an exception midway through execution.
1330 1337
1331 1338 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
1332 1339 encoding into methods.
1333 1340
1334 1341 2006-07-26 Ville Vainio <vivainio@gmail.com>
1335 1342
1336 1343 * iplib.py: history now stores multiline input as single
1337 1344 history entries. Patch by Jorgen Cederlof.
1338 1345
1339 1346 2006-07-18 Walter Doerwald <walter@livinglogic.de>
1340 1347
1341 1348 * IPython/Extensions/ibrowse.py: Make cursor visible over
1342 1349 non existing attributes.
1343 1350
1344 1351 2006-07-14 Walter Doerwald <walter@livinglogic.de>
1345 1352
1346 1353 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
1347 1354 error output of the running command doesn't mess up the screen.
1348 1355
1349 1356 2006-07-13 Walter Doerwald <walter@livinglogic.de>
1350 1357
1351 1358 * IPython/Extensions/ipipe.py (isort): Make isort usable without
1352 1359 argument. This sorts the items themselves.
1353 1360
1354 1361 2006-07-12 Walter Doerwald <walter@livinglogic.de>
1355 1362
1356 1363 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
1357 1364 Compile expression strings into code objects. This should speed
1358 1365 up ifilter and friends somewhat.
1359 1366
1360 1367 2006-07-08 Ville Vainio <vivainio@gmail.com>
1361 1368
1362 1369 * Magic.py: %cpaste now strips > from the beginning of lines
1363 1370 to ease pasting quoted code from emails. Contributed by
1364 1371 Stefan van der Walt.
1365 1372
1366 1373 2006-06-29 Ville Vainio <vivainio@gmail.com>
1367 1374
1368 1375 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
1369 1376 mode, patch contributed by Darren Dale. NEEDS TESTING!
1370 1377
1371 1378 2006-06-28 Walter Doerwald <walter@livinglogic.de>
1372 1379
1373 1380 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
1374 1381 a blue background. Fix fetching new display rows when the browser
1375 1382 scrolls more than a screenful (e.g. by using the goto command).
1376 1383
1377 1384 2006-06-27 Ville Vainio <vivainio@gmail.com>
1378 1385
1379 1386 * Magic.py (_inspect, _ofind) Apply David Huard's
1380 1387 patch for displaying the correct docstring for 'property'
1381 1388 attributes.
1382 1389
1383 1390 2006-06-23 Walter Doerwald <walter@livinglogic.de>
1384 1391
1385 1392 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
1386 1393 commands into the methods implementing them.
1387 1394
1388 1395 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
1389 1396
1390 1397 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
1391 1398 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
1392 1399 autoindent support was authored by Jin Liu.
1393 1400
1394 1401 2006-06-22 Walter Doerwald <walter@livinglogic.de>
1395 1402
1396 1403 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
1397 1404 for keymaps with a custom class that simplifies handling.
1398 1405
1399 1406 2006-06-19 Walter Doerwald <walter@livinglogic.de>
1400 1407
1401 1408 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
1402 1409 resizing. This requires Python 2.5 to work.
1403 1410
1404 1411 2006-06-16 Walter Doerwald <walter@livinglogic.de>
1405 1412
1406 1413 * IPython/Extensions/ibrowse.py: Add two new commands to
1407 1414 ibrowse: "hideattr" (mapped to "h") hides the attribute under
1408 1415 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
1409 1416 attributes again. Remapped the help command to "?". Display
1410 1417 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
1411 1418 as keys for the "home" and "end" commands. Add three new commands
1412 1419 to the input mode for "find" and friends: "delend" (CTRL-K)
1413 1420 deletes to the end of line. "incsearchup" searches upwards in the
1414 1421 command history for an input that starts with the text before the cursor.
1415 1422 "incsearchdown" does the same downwards. Removed a bogus mapping of
1416 1423 the x key to "delete".
1417 1424
1418 1425 2006-06-15 Ville Vainio <vivainio@gmail.com>
1419 1426
1420 1427 * iplib.py, hooks.py: Added new generate_prompt hook that can be
1421 1428 used to create prompts dynamically, instead of the "old" way of
1422 1429 assigning "magic" strings to prompt_in1 and prompt_in2. The old
1423 1430 way still works (it's invoked by the default hook), of course.
1424 1431
1425 1432 * Prompts.py: added generate_output_prompt hook for altering output
1426 1433 prompt
1427 1434
1428 1435 * Release.py: Changed version string to 0.7.3.svn.
1429 1436
1430 1437 2006-06-15 Walter Doerwald <walter@livinglogic.de>
1431 1438
1432 1439 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
1433 1440 the call to fetch() always tries to fetch enough data for at least one
1434 1441 full screen. This makes it possible to simply call moveto(0,0,True) in
1435 1442 the constructor. Fix typos and removed the obsolete goto attribute.
1436 1443
1437 1444 2006-06-12 Ville Vainio <vivainio@gmail.com>
1438 1445
1439 1446 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
1440 1447 allowing $variable interpolation within multiline statements,
1441 1448 though so far only with "sh" profile for a testing period.
1442 1449 The patch also enables splitting long commands with \ but it
1443 1450 doesn't work properly yet.
1444 1451
1445 1452 2006-06-12 Walter Doerwald <walter@livinglogic.de>
1446 1453
1447 1454 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
1448 1455 input history and the position of the cursor in the input history for
1449 1456 the find, findbackwards and goto command.
1450 1457
1451 1458 2006-06-10 Walter Doerwald <walter@livinglogic.de>
1452 1459
1453 1460 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
1454 1461 implements the basic functionality of browser commands that require
1455 1462 input. Reimplement the goto, find and findbackwards commands as
1456 1463 subclasses of _CommandInput. Add an input history and keymaps to those
1457 1464 commands. Add "\r" as a keyboard shortcut for the enterdefault and
1458 1465 execute commands.
1459 1466
1460 1467 2006-06-07 Ville Vainio <vivainio@gmail.com>
1461 1468
1462 1469 * iplib.py: ipython mybatch.ipy exits ipython immediately after
1463 1470 running the batch files instead of leaving the session open.
1464 1471
1465 1472 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
1466 1473
1467 1474 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
1468 1475 the original fix was incomplete. Patch submitted by W. Maier.
1469 1476
1470 1477 2006-06-07 Ville Vainio <vivainio@gmail.com>
1471 1478
1472 1479 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
1473 1480 Confirmation prompts can be supressed by 'quiet' option.
1474 1481 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
1475 1482
1476 1483 2006-06-06 *** Released version 0.7.2
1477 1484
1478 1485 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
1479 1486
1480 1487 * IPython/Release.py (version): Made 0.7.2 final for release.
1481 1488 Repo tagged and release cut.
1482 1489
1483 1490 2006-06-05 Ville Vainio <vivainio@gmail.com>
1484 1491
1485 1492 * Magic.py (magic_rehashx): Honor no_alias list earlier in
1486 1493 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
1487 1494
1488 1495 * upgrade_dir.py: try import 'path' module a bit harder
1489 1496 (for %upgrade)
1490 1497
1491 1498 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
1492 1499
1493 1500 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
1494 1501 instead of looping 20 times.
1495 1502
1496 1503 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
1497 1504 correctly at initialization time. Bug reported by Krishna Mohan
1498 1505 Gundu <gkmohan-AT-gmail.com> on the user list.
1499 1506
1500 1507 * IPython/Release.py (version): Mark 0.7.2 version to start
1501 1508 testing for release on 06/06.
1502 1509
1503 1510 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
1504 1511
1505 1512 * scripts/irunner: thin script interface so users don't have to
1506 1513 find the module and call it as an executable, since modules rarely
1507 1514 live in people's PATH.
1508 1515
1509 1516 * IPython/irunner.py (InteractiveRunner.__init__): added
1510 1517 delaybeforesend attribute to control delays with newer versions of
1511 1518 pexpect. Thanks to detailed help from pexpect's author, Noah
1512 1519 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
1513 1520 correctly (it works in NoColor mode).
1514 1521
1515 1522 * IPython/iplib.py (handle_normal): fix nasty crash reported on
1516 1523 SAGE list, from improper log() calls.
1517 1524
1518 1525 2006-05-31 Ville Vainio <vivainio@gmail.com>
1519 1526
1520 1527 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
1521 1528 with args in parens to work correctly with dirs that have spaces.
1522 1529
1523 1530 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
1524 1531
1525 1532 * IPython/Logger.py (Logger.logstart): add option to log raw input
1526 1533 instead of the processed one. A -r flag was added to the
1527 1534 %logstart magic used for controlling logging.
1528 1535
1529 1536 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
1530 1537
1531 1538 * IPython/iplib.py (InteractiveShell.__init__): add check for the
1532 1539 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
1533 1540 recognize the option. After a bug report by Will Maier. This
1534 1541 closes #64 (will do it after confirmation from W. Maier).
1535 1542
1536 1543 * IPython/irunner.py: New module to run scripts as if manually
1537 1544 typed into an interactive environment, based on pexpect. After a
1538 1545 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
1539 1546 ipython-user list. Simple unittests in the tests/ directory.
1540 1547
1541 1548 * tools/release: add Will Maier, OpenBSD port maintainer, to
1542 1549 recepients list. We are now officially part of the OpenBSD ports:
1543 1550 http://www.openbsd.org/ports.html ! Many thanks to Will for the
1544 1551 work.
1545 1552
1546 1553 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
1547 1554
1548 1555 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
1549 1556 so that it doesn't break tkinter apps.
1550 1557
1551 1558 * IPython/iplib.py (_prefilter): fix bug where aliases would
1552 1559 shadow variables when autocall was fully off. Reported by SAGE
1553 1560 author William Stein.
1554 1561
1555 1562 * IPython/OInspect.py (Inspector.__init__): add a flag to control
1556 1563 at what detail level strings are computed when foo? is requested.
1557 1564 This allows users to ask for example that the string form of an
1558 1565 object is only computed when foo?? is called, or even never, by
1559 1566 setting the object_info_string_level >= 2 in the configuration
1560 1567 file. This new option has been added and documented. After a
1561 1568 request by SAGE to be able to control the printing of very large
1562 1569 objects more easily.
1563 1570
1564 1571 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
1565 1572
1566 1573 * IPython/ipmaker.py (make_IPython): remove the ipython call path
1567 1574 from sys.argv, to be 100% consistent with how Python itself works
1568 1575 (as seen for example with python -i file.py). After a bug report
1569 1576 by Jeffrey Collins.
1570 1577
1571 1578 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
1572 1579 nasty bug which was preventing custom namespaces with -pylab,
1573 1580 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
1574 1581 compatibility (long gone from mpl).
1575 1582
1576 1583 * IPython/ipapi.py (make_session): name change: create->make. We
1577 1584 use make in other places (ipmaker,...), it's shorter and easier to
1578 1585 type and say, etc. I'm trying to clean things before 0.7.2 so
1579 1586 that I can keep things stable wrt to ipapi in the chainsaw branch.
1580 1587
1581 1588 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
1582 1589 python-mode recognizes our debugger mode. Add support for
1583 1590 autoindent inside (X)emacs. After a patch sent in by Jin Liu
1584 1591 <m.liu.jin-AT-gmail.com> originally written by
1585 1592 doxgen-AT-newsmth.net (with minor modifications for xemacs
1586 1593 compatibility)
1587 1594
1588 1595 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
1589 1596 tracebacks when walking the stack so that the stack tracking system
1590 1597 in emacs' python-mode can identify the frames correctly.
1591 1598
1592 1599 * IPython/ipmaker.py (make_IPython): make the internal (and
1593 1600 default config) autoedit_syntax value false by default. Too many
1594 1601 users have complained to me (both on and off-list) about problems
1595 1602 with this option being on by default, so I'm making it default to
1596 1603 off. It can still be enabled by anyone via the usual mechanisms.
1597 1604
1598 1605 * IPython/completer.py (Completer.attr_matches): add support for
1599 1606 PyCrust-style _getAttributeNames magic method. Patch contributed
1600 1607 by <mscott-AT-goldenspud.com>. Closes #50.
1601 1608
1602 1609 * IPython/iplib.py (InteractiveShell.__init__): remove the
1603 1610 deletion of exit/quit from __builtin__, which can break
1604 1611 third-party tools like the Zope debugging console. The
1605 1612 %exit/%quit magics remain. In general, it's probably a good idea
1606 1613 not to delete anything from __builtin__, since we never know what
1607 1614 that will break. In any case, python now (for 2.5) will support
1608 1615 'real' exit/quit, so this issue is moot. Closes #55.
1609 1616
1610 1617 * IPython/genutils.py (with_obj): rename the 'with' function to
1611 1618 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
1612 1619 becomes a language keyword. Closes #53.
1613 1620
1614 1621 * IPython/FakeModule.py (FakeModule.__init__): add a proper
1615 1622 __file__ attribute to this so it fools more things into thinking
1616 1623 it is a real module. Closes #59.
1617 1624
1618 1625 * IPython/Magic.py (magic_edit): add -n option to open the editor
1619 1626 at a specific line number. After a patch by Stefan van der Walt.
1620 1627
1621 1628 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
1622 1629
1623 1630 * IPython/iplib.py (edit_syntax_error): fix crash when for some
1624 1631 reason the file could not be opened. After automatic crash
1625 1632 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
1626 1633 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
1627 1634 (_should_recompile): Don't fire editor if using %bg, since there
1628 1635 is no file in the first place. From the same report as above.
1629 1636 (raw_input): protect against faulty third-party prefilters. After
1630 1637 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
1631 1638 while running under SAGE.
1632 1639
1633 1640 2006-05-23 Ville Vainio <vivainio@gmail.com>
1634 1641
1635 1642 * ipapi.py: Stripped down ip.to_user_ns() to work only as
1636 1643 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
1637 1644 now returns None (again), unless dummy is specifically allowed by
1638 1645 ipapi.get(allow_dummy=True).
1639 1646
1640 1647 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
1641 1648
1642 1649 * IPython: remove all 2.2-compatibility objects and hacks from
1643 1650 everywhere, since we only support 2.3 at this point. Docs
1644 1651 updated.
1645 1652
1646 1653 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
1647 1654 Anything requiring extra validation can be turned into a Python
1648 1655 property in the future. I used a property for the db one b/c
1649 1656 there was a nasty circularity problem with the initialization
1650 1657 order, which right now I don't have time to clean up.
1651 1658
1652 1659 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
1653 1660 another locking bug reported by Jorgen. I'm not 100% sure though,
1654 1661 so more testing is needed...
1655 1662
1656 1663 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
1657 1664
1658 1665 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
1659 1666 local variables from any routine in user code (typically executed
1660 1667 with %run) directly into the interactive namespace. Very useful
1661 1668 when doing complex debugging.
1662 1669 (IPythonNotRunning): Changed the default None object to a dummy
1663 1670 whose attributes can be queried as well as called without
1664 1671 exploding, to ease writing code which works transparently both in
1665 1672 and out of ipython and uses some of this API.
1666 1673
1667 1674 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
1668 1675
1669 1676 * IPython/hooks.py (result_display): Fix the fact that our display
1670 1677 hook was using str() instead of repr(), as the default python
1671 1678 console does. This had gone unnoticed b/c it only happened if
1672 1679 %Pprint was off, but the inconsistency was there.
1673 1680
1674 1681 2006-05-15 Ville Vainio <vivainio@gmail.com>
1675 1682
1676 1683 * Oinspect.py: Only show docstring for nonexisting/binary files
1677 1684 when doing object??, closing ticket #62
1678 1685
1679 1686 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
1680 1687
1681 1688 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
1682 1689 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
1683 1690 was being released in a routine which hadn't checked if it had
1684 1691 been the one to acquire it.
1685 1692
1686 1693 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
1687 1694
1688 1695 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
1689 1696
1690 1697 2006-04-11 Ville Vainio <vivainio@gmail.com>
1691 1698
1692 1699 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
1693 1700 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
1694 1701 prefilters, allowing stuff like magics and aliases in the file.
1695 1702
1696 1703 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
1697 1704 added. Supported now are "%clear in" and "%clear out" (clear input and
1698 1705 output history, respectively). Also fixed CachedOutput.flush to
1699 1706 properly flush the output cache.
1700 1707
1701 1708 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
1702 1709 half-success (and fail explicitly).
1703 1710
1704 1711 2006-03-28 Ville Vainio <vivainio@gmail.com>
1705 1712
1706 1713 * iplib.py: Fix quoting of aliases so that only argless ones
1707 1714 are quoted
1708 1715
1709 1716 2006-03-28 Ville Vainio <vivainio@gmail.com>
1710 1717
1711 1718 * iplib.py: Quote aliases with spaces in the name.
1712 1719 "c:\program files\blah\bin" is now legal alias target.
1713 1720
1714 1721 * ext_rehashdir.py: Space no longer allowed as arg
1715 1722 separator, since space is legal in path names.
1716 1723
1717 1724 2006-03-16 Ville Vainio <vivainio@gmail.com>
1718 1725
1719 1726 * upgrade_dir.py: Take path.py from Extensions, correcting
1720 1727 %upgrade magic
1721 1728
1722 1729 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
1723 1730
1724 1731 * hooks.py: Only enclose editor binary in quotes if legal and
1725 1732 necessary (space in the name, and is an existing file). Fixes a bug
1726 1733 reported by Zachary Pincus.
1727 1734
1728 1735 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
1729 1736
1730 1737 * Manual: thanks to a tip on proper color handling for Emacs, by
1731 1738 Eric J Haywiser <ejh1-AT-MIT.EDU>.
1732 1739
1733 1740 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
1734 1741 by applying the provided patch. Thanks to Liu Jin
1735 1742 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
1736 1743 XEmacs/Linux, I'm trusting the submitter that it actually helps
1737 1744 under win32/GNU Emacs. Will revisit if any problems are reported.
1738 1745
1739 1746 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1740 1747
1741 1748 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
1742 1749 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
1743 1750
1744 1751 2006-03-12 Ville Vainio <vivainio@gmail.com>
1745 1752
1746 1753 * Magic.py (magic_timeit): Added %timeit magic, contributed by
1747 1754 Torsten Marek.
1748 1755
1749 1756 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1750 1757
1751 1758 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
1752 1759 line ranges works again.
1753 1760
1754 1761 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
1755 1762
1756 1763 * IPython/iplib.py (showtraceback): add back sys.last_traceback
1757 1764 and friends, after a discussion with Zach Pincus on ipython-user.
1758 1765 I'm not 100% sure, but after thinking about it quite a bit, it may
1759 1766 be OK. Testing with the multithreaded shells didn't reveal any
1760 1767 problems, but let's keep an eye out.
1761 1768
1762 1769 In the process, I fixed a few things which were calling
1763 1770 self.InteractiveTB() directly (like safe_execfile), which is a
1764 1771 mistake: ALL exception reporting should be done by calling
1765 1772 self.showtraceback(), which handles state and tab-completion and
1766 1773 more.
1767 1774
1768 1775 2006-03-01 Ville Vainio <vivainio@gmail.com>
1769 1776
1770 1777 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
1771 1778 To use, do "from ipipe import *".
1772 1779
1773 1780 2006-02-24 Ville Vainio <vivainio@gmail.com>
1774 1781
1775 1782 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
1776 1783 "cleanly" and safely than the older upgrade mechanism.
1777 1784
1778 1785 2006-02-21 Ville Vainio <vivainio@gmail.com>
1779 1786
1780 1787 * Magic.py: %save works again.
1781 1788
1782 1789 2006-02-15 Ville Vainio <vivainio@gmail.com>
1783 1790
1784 1791 * Magic.py: %Pprint works again
1785 1792
1786 1793 * Extensions/ipy_sane_defaults.py: Provide everything provided
1787 1794 in default ipythonrc, to make it possible to have a completely empty
1788 1795 ipythonrc (and thus completely rc-file free configuration)
1789 1796
1790 1797 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
1791 1798
1792 1799 * IPython/hooks.py (editor): quote the call to the editor command,
1793 1800 to allow commands with spaces in them. Problem noted by watching
1794 1801 Ian Oswald's video about textpad under win32 at
1795 1802 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
1796 1803
1797 1804 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
1798 1805 describing magics (we haven't used @ for a loong time).
1799 1806
1800 1807 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
1801 1808 contributed by marienz to close
1802 1809 http://www.scipy.net/roundup/ipython/issue53.
1803 1810
1804 1811 2006-02-10 Ville Vainio <vivainio@gmail.com>
1805 1812
1806 1813 * genutils.py: getoutput now works in win32 too
1807 1814
1808 1815 * completer.py: alias and magic completion only invoked
1809 1816 at the first "item" in the line, to avoid "cd %store"
1810 1817 nonsense.
1811 1818
1812 1819 2006-02-09 Ville Vainio <vivainio@gmail.com>
1813 1820
1814 1821 * test/*: Added a unit testing framework (finally).
1815 1822 '%run runtests.py' to run test_*.
1816 1823
1817 1824 * ipapi.py: Exposed runlines and set_custom_exc
1818 1825
1819 1826 2006-02-07 Ville Vainio <vivainio@gmail.com>
1820 1827
1821 1828 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
1822 1829 instead use "f(1 2)" as before.
1823 1830
1824 1831 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
1825 1832
1826 1833 * IPython/demo.py (IPythonDemo): Add new classes to the demo
1827 1834 facilities, for demos processed by the IPython input filter
1828 1835 (IPythonDemo), and for running a script one-line-at-a-time as a
1829 1836 demo, both for pure Python (LineDemo) and for IPython-processed
1830 1837 input (IPythonLineDemo). After a request by Dave Kohel, from the
1831 1838 SAGE team.
1832 1839 (Demo.edit): added an edit() method to the demo objects, to edit
1833 1840 the in-memory copy of the last executed block.
1834 1841
1835 1842 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
1836 1843 processing to %edit, %macro and %save. These commands can now be
1837 1844 invoked on the unprocessed input as it was typed by the user
1838 1845 (without any prefilters applied). After requests by the SAGE team
1839 1846 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1840 1847
1841 1848 2006-02-01 Ville Vainio <vivainio@gmail.com>
1842 1849
1843 1850 * setup.py, eggsetup.py: easy_install ipython==dev works
1844 1851 correctly now (on Linux)
1845 1852
1846 1853 * ipy_user_conf,ipmaker: user config changes, removed spurious
1847 1854 warnings
1848 1855
1849 1856 * iplib: if rc.banner is string, use it as is.
1850 1857
1851 1858 * Magic: %pycat accepts a string argument and pages it's contents.
1852 1859
1853 1860
1854 1861 2006-01-30 Ville Vainio <vivainio@gmail.com>
1855 1862
1856 1863 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1857 1864 Now %store and bookmarks work through PickleShare, meaning that
1858 1865 concurrent access is possible and all ipython sessions see the
1859 1866 same database situation all the time, instead of snapshot of
1860 1867 the situation when the session was started. Hence, %bookmark
1861 1868 results are immediately accessible from othes sessions. The database
1862 1869 is also available for use by user extensions. See:
1863 1870 http://www.python.org/pypi/pickleshare
1864 1871
1865 1872 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1866 1873
1867 1874 * aliases can now be %store'd
1868 1875
1869 1876 * path.py moved to Extensions so that pickleshare does not need
1870 1877 IPython-specific import. Extensions added to pythonpath right
1871 1878 at __init__.
1872 1879
1873 1880 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1874 1881 called with _ip.system and the pre-transformed command string.
1875 1882
1876 1883 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1877 1884
1878 1885 * IPython/iplib.py (interact): Fix that we were not catching
1879 1886 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1880 1887 logic here had to change, but it's fixed now.
1881 1888
1882 1889 2006-01-29 Ville Vainio <vivainio@gmail.com>
1883 1890
1884 1891 * iplib.py: Try to import pyreadline on Windows.
1885 1892
1886 1893 2006-01-27 Ville Vainio <vivainio@gmail.com>
1887 1894
1888 1895 * iplib.py: Expose ipapi as _ip in builtin namespace.
1889 1896 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1890 1897 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1891 1898 syntax now produce _ip.* variant of the commands.
1892 1899
1893 1900 * "_ip.options().autoedit_syntax = 2" automatically throws
1894 1901 user to editor for syntax error correction without prompting.
1895 1902
1896 1903 2006-01-27 Ville Vainio <vivainio@gmail.com>
1897 1904
1898 1905 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1899 1906 'ipython' at argv[0]) executed through command line.
1900 1907 NOTE: this DEPRECATES calling ipython with multiple scripts
1901 1908 ("ipython a.py b.py c.py")
1902 1909
1903 1910 * iplib.py, hooks.py: Added configurable input prefilter,
1904 1911 named 'input_prefilter'. See ext_rescapture.py for example
1905 1912 usage.
1906 1913
1907 1914 * ext_rescapture.py, Magic.py: Better system command output capture
1908 1915 through 'var = !ls' (deprecates user-visible %sc). Same notation
1909 1916 applies for magics, 'var = %alias' assigns alias list to var.
1910 1917
1911 1918 * ipapi.py: added meta() for accessing extension-usable data store.
1912 1919
1913 1920 * iplib.py: added InteractiveShell.getapi(). New magics should be
1914 1921 written doing self.getapi() instead of using the shell directly.
1915 1922
1916 1923 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
1917 1924 %store foo >> ~/myfoo.txt to store variables to files (in clean
1918 1925 textual form, not a restorable pickle).
1919 1926
1920 1927 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
1921 1928
1922 1929 * usage.py, Magic.py: added %quickref
1923 1930
1924 1931 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
1925 1932
1926 1933 * GetoptErrors when invoking magics etc. with wrong args
1927 1934 are now more helpful:
1928 1935 GetoptError: option -l not recognized (allowed: "qb" )
1929 1936
1930 1937 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
1931 1938
1932 1939 * IPython/demo.py (Demo.show): Flush stdout after each block, so
1933 1940 computationally intensive blocks don't appear to stall the demo.
1934 1941
1935 1942 2006-01-24 Ville Vainio <vivainio@gmail.com>
1936 1943
1937 1944 * iplib.py, hooks.py: 'result_display' hook can return a non-None
1938 1945 value to manipulate resulting history entry.
1939 1946
1940 1947 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
1941 1948 to instance methods of IPApi class, to make extending an embedded
1942 1949 IPython feasible. See ext_rehashdir.py for example usage.
1943 1950
1944 1951 * Merged 1071-1076 from branches/0.7.1
1945 1952
1946 1953
1947 1954 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
1948 1955
1949 1956 * tools/release (daystamp): Fix build tools to use the new
1950 1957 eggsetup.py script to build lightweight eggs.
1951 1958
1952 1959 * Applied changesets 1062 and 1064 before 0.7.1 release.
1953 1960
1954 1961 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
1955 1962 see the raw input history (without conversions like %ls ->
1956 1963 ipmagic("ls")). After a request from W. Stein, SAGE
1957 1964 (http://modular.ucsd.edu/sage) developer. This information is
1958 1965 stored in the input_hist_raw attribute of the IPython instance, so
1959 1966 developers can access it if needed (it's an InputList instance).
1960 1967
1961 1968 * Versionstring = 0.7.2.svn
1962 1969
1963 1970 * eggsetup.py: A separate script for constructing eggs, creates
1964 1971 proper launch scripts even on Windows (an .exe file in
1965 1972 \python24\scripts).
1966 1973
1967 1974 * ipapi.py: launch_new_instance, launch entry point needed for the
1968 1975 egg.
1969 1976
1970 1977 2006-01-23 Ville Vainio <vivainio@gmail.com>
1971 1978
1972 1979 * Added %cpaste magic for pasting python code
1973 1980
1974 1981 2006-01-22 Ville Vainio <vivainio@gmail.com>
1975 1982
1976 1983 * Merge from branches/0.7.1 into trunk, revs 1052-1057
1977 1984
1978 1985 * Versionstring = 0.7.2.svn
1979 1986
1980 1987 * eggsetup.py: A separate script for constructing eggs, creates
1981 1988 proper launch scripts even on Windows (an .exe file in
1982 1989 \python24\scripts).
1983 1990
1984 1991 * ipapi.py: launch_new_instance, launch entry point needed for the
1985 1992 egg.
1986 1993
1987 1994 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1988 1995
1989 1996 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1990 1997 %pfile foo would print the file for foo even if it was a binary.
1991 1998 Now, extensions '.so' and '.dll' are skipped.
1992 1999
1993 2000 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1994 2001 bug, where macros would fail in all threaded modes. I'm not 100%
1995 2002 sure, so I'm going to put out an rc instead of making a release
1996 2003 today, and wait for feedback for at least a few days.
1997 2004
1998 2005 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1999 2006 it...) the handling of pasting external code with autoindent on.
2000 2007 To get out of a multiline input, the rule will appear for most
2001 2008 users unchanged: two blank lines or change the indent level
2002 2009 proposed by IPython. But there is a twist now: you can
2003 2010 add/subtract only *one or two spaces*. If you add/subtract three
2004 2011 or more (unless you completely delete the line), IPython will
2005 2012 accept that line, and you'll need to enter a second one of pure
2006 2013 whitespace. I know it sounds complicated, but I can't find a
2007 2014 different solution that covers all the cases, with the right
2008 2015 heuristics. Hopefully in actual use, nobody will really notice
2009 2016 all these strange rules and things will 'just work'.
2010 2017
2011 2018 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
2012 2019
2013 2020 * IPython/iplib.py (interact): catch exceptions which can be
2014 2021 triggered asynchronously by signal handlers. Thanks to an
2015 2022 automatic crash report, submitted by Colin Kingsley
2016 2023 <tercel-AT-gentoo.org>.
2017 2024
2018 2025 2006-01-20 Ville Vainio <vivainio@gmail.com>
2019 2026
2020 2027 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
2021 2028 (%rehashdir, very useful, try it out) of how to extend ipython
2022 2029 with new magics. Also added Extensions dir to pythonpath to make
2023 2030 importing extensions easy.
2024 2031
2025 2032 * %store now complains when trying to store interactively declared
2026 2033 classes / instances of those classes.
2027 2034
2028 2035 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
2029 2036 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
2030 2037 if they exist, and ipy_user_conf.py with some defaults is created for
2031 2038 the user.
2032 2039
2033 2040 * Startup rehashing done by the config file, not InterpreterExec.
2034 2041 This means system commands are available even without selecting the
2035 2042 pysh profile. It's the sensible default after all.
2036 2043
2037 2044 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
2038 2045
2039 2046 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
2040 2047 multiline code with autoindent on working. But I am really not
2041 2048 sure, so this needs more testing. Will commit a debug-enabled
2042 2049 version for now, while I test it some more, so that Ville and
2043 2050 others may also catch any problems. Also made
2044 2051 self.indent_current_str() a method, to ensure that there's no
2045 2052 chance of the indent space count and the corresponding string
2046 2053 falling out of sync. All code needing the string should just call
2047 2054 the method.
2048 2055
2049 2056 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
2050 2057
2051 2058 * IPython/Magic.py (magic_edit): fix check for when users don't
2052 2059 save their output files, the try/except was in the wrong section.
2053 2060
2054 2061 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
2055 2062
2056 2063 * IPython/Magic.py (magic_run): fix __file__ global missing from
2057 2064 script's namespace when executed via %run. After a report by
2058 2065 Vivian.
2059 2066
2060 2067 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
2061 2068 when using python 2.4. The parent constructor changed in 2.4, and
2062 2069 we need to track it directly (we can't call it, as it messes up
2063 2070 readline and tab-completion inside our pdb would stop working).
2064 2071 After a bug report by R. Bernstein <rocky-AT-panix.com>.
2065 2072
2066 2073 2006-01-16 Ville Vainio <vivainio@gmail.com>
2067 2074
2068 2075 * Ipython/magic.py: Reverted back to old %edit functionality
2069 2076 that returns file contents on exit.
2070 2077
2071 2078 * IPython/path.py: Added Jason Orendorff's "path" module to
2072 2079 IPython tree, http://www.jorendorff.com/articles/python/path/.
2073 2080 You can get path objects conveniently through %sc, and !!, e.g.:
2074 2081 sc files=ls
2075 2082 for p in files.paths: # or files.p
2076 2083 print p,p.mtime
2077 2084
2078 2085 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
2079 2086 now work again without considering the exclusion regexp -
2080 2087 hence, things like ',foo my/path' turn to 'foo("my/path")'
2081 2088 instead of syntax error.
2082 2089
2083 2090
2084 2091 2006-01-14 Ville Vainio <vivainio@gmail.com>
2085 2092
2086 2093 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
2087 2094 ipapi decorators for python 2.4 users, options() provides access to rc
2088 2095 data.
2089 2096
2090 2097 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
2091 2098 as path separators (even on Linux ;-). Space character after
2092 2099 backslash (as yielded by tab completer) is still space;
2093 2100 "%cd long\ name" works as expected.
2094 2101
2095 2102 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
2096 2103 as "chain of command", with priority. API stays the same,
2097 2104 TryNext exception raised by a hook function signals that
2098 2105 current hook failed and next hook should try handling it, as
2099 2106 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
2100 2107 requested configurable display hook, which is now implemented.
2101 2108
2102 2109 2006-01-13 Ville Vainio <vivainio@gmail.com>
2103 2110
2104 2111 * IPython/platutils*.py: platform specific utility functions,
2105 2112 so far only set_term_title is implemented (change terminal
2106 2113 label in windowing systems). %cd now changes the title to
2107 2114 current dir.
2108 2115
2109 2116 * IPython/Release.py: Added myself to "authors" list,
2110 2117 had to create new files.
2111 2118
2112 2119 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
2113 2120 shell escape; not a known bug but had potential to be one in the
2114 2121 future.
2115 2122
2116 2123 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
2117 2124 extension API for IPython! See the module for usage example. Fix
2118 2125 OInspect for docstring-less magic functions.
2119 2126
2120 2127
2121 2128 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
2122 2129
2123 2130 * IPython/iplib.py (raw_input): temporarily deactivate all
2124 2131 attempts at allowing pasting of code with autoindent on. It
2125 2132 introduced bugs (reported by Prabhu) and I can't seem to find a
2126 2133 robust combination which works in all cases. Will have to revisit
2127 2134 later.
2128 2135
2129 2136 * IPython/genutils.py: remove isspace() function. We've dropped
2130 2137 2.2 compatibility, so it's OK to use the string method.
2131 2138
2132 2139 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2133 2140
2134 2141 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
2135 2142 matching what NOT to autocall on, to include all python binary
2136 2143 operators (including things like 'and', 'or', 'is' and 'in').
2137 2144 Prompted by a bug report on 'foo & bar', but I realized we had
2138 2145 many more potential bug cases with other operators. The regexp is
2139 2146 self.re_exclude_auto, it's fairly commented.
2140 2147
2141 2148 2006-01-12 Ville Vainio <vivainio@gmail.com>
2142 2149
2143 2150 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
2144 2151 Prettified and hardened string/backslash quoting with ipsystem(),
2145 2152 ipalias() and ipmagic(). Now even \ characters are passed to
2146 2153 %magics, !shell escapes and aliases exactly as they are in the
2147 2154 ipython command line. Should improve backslash experience,
2148 2155 particularly in Windows (path delimiter for some commands that
2149 2156 won't understand '/'), but Unix benefits as well (regexps). %cd
2150 2157 magic still doesn't support backslash path delimiters, though. Also
2151 2158 deleted all pretense of supporting multiline command strings in
2152 2159 !system or %magic commands. Thanks to Jerry McRae for suggestions.
2153 2160
2154 2161 * doc/build_doc_instructions.txt added. Documentation on how to
2155 2162 use doc/update_manual.py, added yesterday. Both files contributed
2156 2163 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
2157 2164 doc/*.sh for deprecation at a later date.
2158 2165
2159 2166 * /ipython.py Added ipython.py to root directory for
2160 2167 zero-installation (tar xzvf ipython.tgz; cd ipython; python
2161 2168 ipython.py) and development convenience (no need to keep doing
2162 2169 "setup.py install" between changes).
2163 2170
2164 2171 * Made ! and !! shell escapes work (again) in multiline expressions:
2165 2172 if 1:
2166 2173 !ls
2167 2174 !!ls
2168 2175
2169 2176 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2170 2177
2171 2178 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
2172 2179 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
2173 2180 module in case-insensitive installation. Was causing crashes
2174 2181 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
2175 2182
2176 2183 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
2177 2184 <marienz-AT-gentoo.org>, closes
2178 2185 http://www.scipy.net/roundup/ipython/issue51.
2179 2186
2180 2187 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
2181 2188
2182 2189 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
2183 2190 problem of excessive CPU usage under *nix and keyboard lag under
2184 2191 win32.
2185 2192
2186 2193 2006-01-10 *** Released version 0.7.0
2187 2194
2188 2195 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
2189 2196
2190 2197 * IPython/Release.py (revision): tag version number to 0.7.0,
2191 2198 ready for release.
2192 2199
2193 2200 * IPython/Magic.py (magic_edit): Add print statement to %edit so
2194 2201 it informs the user of the name of the temp. file used. This can
2195 2202 help if you decide later to reuse that same file, so you know
2196 2203 where to copy the info from.
2197 2204
2198 2205 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
2199 2206
2200 2207 * setup_bdist_egg.py: little script to build an egg. Added
2201 2208 support in the release tools as well.
2202 2209
2203 2210 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
2204 2211
2205 2212 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
2206 2213 version selection (new -wxversion command line and ipythonrc
2207 2214 parameter). Patch contributed by Arnd Baecker
2208 2215 <arnd.baecker-AT-web.de>.
2209 2216
2210 2217 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2211 2218 embedded instances, for variables defined at the interactive
2212 2219 prompt of the embedded ipython. Reported by Arnd.
2213 2220
2214 2221 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
2215 2222 it can be used as a (stateful) toggle, or with a direct parameter.
2216 2223
2217 2224 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
2218 2225 could be triggered in certain cases and cause the traceback
2219 2226 printer not to work.
2220 2227
2221 2228 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
2222 2229
2223 2230 * IPython/iplib.py (_should_recompile): Small fix, closes
2224 2231 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
2225 2232
2226 2233 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
2227 2234
2228 2235 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
2229 2236 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
2230 2237 Moad for help with tracking it down.
2231 2238
2232 2239 * IPython/iplib.py (handle_auto): fix autocall handling for
2233 2240 objects which support BOTH __getitem__ and __call__ (so that f [x]
2234 2241 is left alone, instead of becoming f([x]) automatically).
2235 2242
2236 2243 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
2237 2244 Ville's patch.
2238 2245
2239 2246 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
2240 2247
2241 2248 * IPython/iplib.py (handle_auto): changed autocall semantics to
2242 2249 include 'smart' mode, where the autocall transformation is NOT
2243 2250 applied if there are no arguments on the line. This allows you to
2244 2251 just type 'foo' if foo is a callable to see its internal form,
2245 2252 instead of having it called with no arguments (typically a
2246 2253 mistake). The old 'full' autocall still exists: for that, you
2247 2254 need to set the 'autocall' parameter to 2 in your ipythonrc file.
2248 2255
2249 2256 * IPython/completer.py (Completer.attr_matches): add
2250 2257 tab-completion support for Enthoughts' traits. After a report by
2251 2258 Arnd and a patch by Prabhu.
2252 2259
2253 2260 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
2254 2261
2255 2262 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
2256 2263 Schmolck's patch to fix inspect.getinnerframes().
2257 2264
2258 2265 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
2259 2266 for embedded instances, regarding handling of namespaces and items
2260 2267 added to the __builtin__ one. Multiple embedded instances and
2261 2268 recursive embeddings should work better now (though I'm not sure
2262 2269 I've got all the corner cases fixed, that code is a bit of a brain
2263 2270 twister).
2264 2271
2265 2272 * IPython/Magic.py (magic_edit): added support to edit in-memory
2266 2273 macros (automatically creates the necessary temp files). %edit
2267 2274 also doesn't return the file contents anymore, it's just noise.
2268 2275
2269 2276 * IPython/completer.py (Completer.attr_matches): revert change to
2270 2277 complete only on attributes listed in __all__. I realized it
2271 2278 cripples the tab-completion system as a tool for exploring the
2272 2279 internals of unknown libraries (it renders any non-__all__
2273 2280 attribute off-limits). I got bit by this when trying to see
2274 2281 something inside the dis module.
2275 2282
2276 2283 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
2277 2284
2278 2285 * IPython/iplib.py (InteractiveShell.__init__): add .meta
2279 2286 namespace for users and extension writers to hold data in. This
2280 2287 follows the discussion in
2281 2288 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
2282 2289
2283 2290 * IPython/completer.py (IPCompleter.complete): small patch to help
2284 2291 tab-completion under Emacs, after a suggestion by John Barnard
2285 2292 <barnarj-AT-ccf.org>.
2286 2293
2287 2294 * IPython/Magic.py (Magic.extract_input_slices): added support for
2288 2295 the slice notation in magics to use N-M to represent numbers N...M
2289 2296 (closed endpoints). This is used by %macro and %save.
2290 2297
2291 2298 * IPython/completer.py (Completer.attr_matches): for modules which
2292 2299 define __all__, complete only on those. After a patch by Jeffrey
2293 2300 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
2294 2301 speed up this routine.
2295 2302
2296 2303 * IPython/Logger.py (Logger.log): fix a history handling bug. I
2297 2304 don't know if this is the end of it, but the behavior now is
2298 2305 certainly much more correct. Note that coupled with macros,
2299 2306 slightly surprising (at first) behavior may occur: a macro will in
2300 2307 general expand to multiple lines of input, so upon exiting, the
2301 2308 in/out counters will both be bumped by the corresponding amount
2302 2309 (as if the macro's contents had been typed interactively). Typing
2303 2310 %hist will reveal the intermediate (silently processed) lines.
2304 2311
2305 2312 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
2306 2313 pickle to fail (%run was overwriting __main__ and not restoring
2307 2314 it, but pickle relies on __main__ to operate).
2308 2315
2309 2316 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
2310 2317 using properties, but forgot to make the main InteractiveShell
2311 2318 class a new-style class. Properties fail silently, and
2312 2319 mysteriously, with old-style class (getters work, but
2313 2320 setters don't do anything).
2314 2321
2315 2322 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
2316 2323
2317 2324 * IPython/Magic.py (magic_history): fix history reporting bug (I
2318 2325 know some nasties are still there, I just can't seem to find a
2319 2326 reproducible test case to track them down; the input history is
2320 2327 falling out of sync...)
2321 2328
2322 2329 * IPython/iplib.py (handle_shell_escape): fix bug where both
2323 2330 aliases and system accesses where broken for indented code (such
2324 2331 as loops).
2325 2332
2326 2333 * IPython/genutils.py (shell): fix small but critical bug for
2327 2334 win32 system access.
2328 2335
2329 2336 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2330 2337
2331 2338 * IPython/iplib.py (showtraceback): remove use of the
2332 2339 sys.last_{type/value/traceback} structures, which are non
2333 2340 thread-safe.
2334 2341 (_prefilter): change control flow to ensure that we NEVER
2335 2342 introspect objects when autocall is off. This will guarantee that
2336 2343 having an input line of the form 'x.y', where access to attribute
2337 2344 'y' has side effects, doesn't trigger the side effect TWICE. It
2338 2345 is important to note that, with autocall on, these side effects
2339 2346 can still happen.
2340 2347 (ipsystem): new builtin, to complete the ip{magic/alias/system}
2341 2348 trio. IPython offers these three kinds of special calls which are
2342 2349 not python code, and it's a good thing to have their call method
2343 2350 be accessible as pure python functions (not just special syntax at
2344 2351 the command line). It gives us a better internal implementation
2345 2352 structure, as well as exposing these for user scripting more
2346 2353 cleanly.
2347 2354
2348 2355 * IPython/macro.py (Macro.__init__): moved macros to a standalone
2349 2356 file. Now that they'll be more likely to be used with the
2350 2357 persistance system (%store), I want to make sure their module path
2351 2358 doesn't change in the future, so that we don't break things for
2352 2359 users' persisted data.
2353 2360
2354 2361 * IPython/iplib.py (autoindent_update): move indentation
2355 2362 management into the _text_ processing loop, not the keyboard
2356 2363 interactive one. This is necessary to correctly process non-typed
2357 2364 multiline input (such as macros).
2358 2365
2359 2366 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
2360 2367 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
2361 2368 which was producing problems in the resulting manual.
2362 2369 (magic_whos): improve reporting of instances (show their class,
2363 2370 instead of simply printing 'instance' which isn't terribly
2364 2371 informative).
2365 2372
2366 2373 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
2367 2374 (minor mods) to support network shares under win32.
2368 2375
2369 2376 * IPython/winconsole.py (get_console_size): add new winconsole
2370 2377 module and fixes to page_dumb() to improve its behavior under
2371 2378 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
2372 2379
2373 2380 * IPython/Magic.py (Macro): simplified Macro class to just
2374 2381 subclass list. We've had only 2.2 compatibility for a very long
2375 2382 time, yet I was still avoiding subclassing the builtin types. No
2376 2383 more (I'm also starting to use properties, though I won't shift to
2377 2384 2.3-specific features quite yet).
2378 2385 (magic_store): added Ville's patch for lightweight variable
2379 2386 persistence, after a request on the user list by Matt Wilkie
2380 2387 <maphew-AT-gmail.com>. The new %store magic's docstring has full
2381 2388 details.
2382 2389
2383 2390 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2384 2391 changed the default logfile name from 'ipython.log' to
2385 2392 'ipython_log.py'. These logs are real python files, and now that
2386 2393 we have much better multiline support, people are more likely to
2387 2394 want to use them as such. Might as well name them correctly.
2388 2395
2389 2396 * IPython/Magic.py: substantial cleanup. While we can't stop
2390 2397 using magics as mixins, due to the existing customizations 'out
2391 2398 there' which rely on the mixin naming conventions, at least I
2392 2399 cleaned out all cross-class name usage. So once we are OK with
2393 2400 breaking compatibility, the two systems can be separated.
2394 2401
2395 2402 * IPython/Logger.py: major cleanup. This one is NOT a mixin
2396 2403 anymore, and the class is a fair bit less hideous as well. New
2397 2404 features were also introduced: timestamping of input, and logging
2398 2405 of output results. These are user-visible with the -t and -o
2399 2406 options to %logstart. Closes
2400 2407 http://www.scipy.net/roundup/ipython/issue11 and a request by
2401 2408 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
2402 2409
2403 2410 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
2404 2411
2405 2412 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
2406 2413 better handle backslashes in paths. See the thread 'More Windows
2407 2414 questions part 2 - \/ characters revisited' on the iypthon user
2408 2415 list:
2409 2416 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
2410 2417
2411 2418 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
2412 2419
2413 2420 (InteractiveShell.__init__): change threaded shells to not use the
2414 2421 ipython crash handler. This was causing more problems than not,
2415 2422 as exceptions in the main thread (GUI code, typically) would
2416 2423 always show up as a 'crash', when they really weren't.
2417 2424
2418 2425 The colors and exception mode commands (%colors/%xmode) have been
2419 2426 synchronized to also take this into account, so users can get
2420 2427 verbose exceptions for their threaded code as well. I also added
2421 2428 support for activating pdb inside this exception handler as well,
2422 2429 so now GUI authors can use IPython's enhanced pdb at runtime.
2423 2430
2424 2431 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
2425 2432 true by default, and add it to the shipped ipythonrc file. Since
2426 2433 this asks the user before proceeding, I think it's OK to make it
2427 2434 true by default.
2428 2435
2429 2436 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
2430 2437 of the previous special-casing of input in the eval loop. I think
2431 2438 this is cleaner, as they really are commands and shouldn't have
2432 2439 a special role in the middle of the core code.
2433 2440
2434 2441 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
2435 2442
2436 2443 * IPython/iplib.py (edit_syntax_error): added support for
2437 2444 automatically reopening the editor if the file had a syntax error
2438 2445 in it. Thanks to scottt who provided the patch at:
2439 2446 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
2440 2447 version committed).
2441 2448
2442 2449 * IPython/iplib.py (handle_normal): add suport for multi-line
2443 2450 input with emtpy lines. This fixes
2444 2451 http://www.scipy.net/roundup/ipython/issue43 and a similar
2445 2452 discussion on the user list.
2446 2453
2447 2454 WARNING: a behavior change is necessarily introduced to support
2448 2455 blank lines: now a single blank line with whitespace does NOT
2449 2456 break the input loop, which means that when autoindent is on, by
2450 2457 default hitting return on the next (indented) line does NOT exit.
2451 2458
2452 2459 Instead, to exit a multiline input you can either have:
2453 2460
2454 2461 - TWO whitespace lines (just hit return again), or
2455 2462 - a single whitespace line of a different length than provided
2456 2463 by the autoindent (add or remove a space).
2457 2464
2458 2465 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
2459 2466 module to better organize all readline-related functionality.
2460 2467 I've deleted FlexCompleter and put all completion clases here.
2461 2468
2462 2469 * IPython/iplib.py (raw_input): improve indentation management.
2463 2470 It is now possible to paste indented code with autoindent on, and
2464 2471 the code is interpreted correctly (though it still looks bad on
2465 2472 screen, due to the line-oriented nature of ipython).
2466 2473 (MagicCompleter.complete): change behavior so that a TAB key on an
2467 2474 otherwise empty line actually inserts a tab, instead of completing
2468 2475 on the entire global namespace. This makes it easier to use the
2469 2476 TAB key for indentation. After a request by Hans Meine
2470 2477 <hans_meine-AT-gmx.net>
2471 2478 (_prefilter): add support so that typing plain 'exit' or 'quit'
2472 2479 does a sensible thing. Originally I tried to deviate as little as
2473 2480 possible from the default python behavior, but even that one may
2474 2481 change in this direction (thread on python-dev to that effect).
2475 2482 Regardless, ipython should do the right thing even if CPython's
2476 2483 '>>>' prompt doesn't.
2477 2484 (InteractiveShell): removed subclassing code.InteractiveConsole
2478 2485 class. By now we'd overridden just about all of its methods: I've
2479 2486 copied the remaining two over, and now ipython is a standalone
2480 2487 class. This will provide a clearer picture for the chainsaw
2481 2488 branch refactoring.
2482 2489
2483 2490 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
2484 2491
2485 2492 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
2486 2493 failures for objects which break when dir() is called on them.
2487 2494
2488 2495 * IPython/FlexCompleter.py (Completer.__init__): Added support for
2489 2496 distinct local and global namespaces in the completer API. This
2490 2497 change allows us to properly handle completion with distinct
2491 2498 scopes, including in embedded instances (this had never really
2492 2499 worked correctly).
2493 2500
2494 2501 Note: this introduces a change in the constructor for
2495 2502 MagicCompleter, as a new global_namespace parameter is now the
2496 2503 second argument (the others were bumped one position).
2497 2504
2498 2505 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
2499 2506
2500 2507 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2501 2508 embedded instances (which can be done now thanks to Vivian's
2502 2509 frame-handling fixes for pdb).
2503 2510 (InteractiveShell.__init__): Fix namespace handling problem in
2504 2511 embedded instances. We were overwriting __main__ unconditionally,
2505 2512 and this should only be done for 'full' (non-embedded) IPython;
2506 2513 embedded instances must respect the caller's __main__. Thanks to
2507 2514 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
2508 2515
2509 2516 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
2510 2517
2511 2518 * setup.py: added download_url to setup(). This registers the
2512 2519 download address at PyPI, which is not only useful to humans
2513 2520 browsing the site, but is also picked up by setuptools (the Eggs
2514 2521 machinery). Thanks to Ville and R. Kern for the info/discussion
2515 2522 on this.
2516 2523
2517 2524 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
2518 2525
2519 2526 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
2520 2527 This brings a lot of nice functionality to the pdb mode, which now
2521 2528 has tab-completion, syntax highlighting, and better stack handling
2522 2529 than before. Many thanks to Vivian De Smedt
2523 2530 <vivian-AT-vdesmedt.com> for the original patches.
2524 2531
2525 2532 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
2526 2533
2527 2534 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
2528 2535 sequence to consistently accept the banner argument. The
2529 2536 inconsistency was tripping SAGE, thanks to Gary Zablackis
2530 2537 <gzabl-AT-yahoo.com> for the report.
2531 2538
2532 2539 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2533 2540
2534 2541 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2535 2542 Fix bug where a naked 'alias' call in the ipythonrc file would
2536 2543 cause a crash. Bug reported by Jorgen Stenarson.
2537 2544
2538 2545 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2539 2546
2540 2547 * IPython/ipmaker.py (make_IPython): cleanups which should improve
2541 2548 startup time.
2542 2549
2543 2550 * IPython/iplib.py (runcode): my globals 'fix' for embedded
2544 2551 instances had introduced a bug with globals in normal code. Now
2545 2552 it's working in all cases.
2546 2553
2547 2554 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
2548 2555 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
2549 2556 has been introduced to set the default case sensitivity of the
2550 2557 searches. Users can still select either mode at runtime on a
2551 2558 per-search basis.
2552 2559
2553 2560 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
2554 2561
2555 2562 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
2556 2563 attributes in wildcard searches for subclasses. Modified version
2557 2564 of a patch by Jorgen.
2558 2565
2559 2566 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
2560 2567
2561 2568 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
2562 2569 embedded instances. I added a user_global_ns attribute to the
2563 2570 InteractiveShell class to handle this.
2564 2571
2565 2572 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
2566 2573
2567 2574 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
2568 2575 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
2569 2576 (reported under win32, but may happen also in other platforms).
2570 2577 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
2571 2578
2572 2579 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
2573 2580
2574 2581 * IPython/Magic.py (magic_psearch): new support for wildcard
2575 2582 patterns. Now, typing ?a*b will list all names which begin with a
2576 2583 and end in b, for example. The %psearch magic has full
2577 2584 docstrings. Many thanks to JΓΆrgen Stenarson
2578 2585 <jorgen.stenarson-AT-bostream.nu>, author of the patches
2579 2586 implementing this functionality.
2580 2587
2581 2588 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2582 2589
2583 2590 * Manual: fixed long-standing annoyance of double-dashes (as in
2584 2591 --prefix=~, for example) being stripped in the HTML version. This
2585 2592 is a latex2html bug, but a workaround was provided. Many thanks
2586 2593 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
2587 2594 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
2588 2595 rolling. This seemingly small issue had tripped a number of users
2589 2596 when first installing, so I'm glad to see it gone.
2590 2597
2591 2598 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2592 2599
2593 2600 * IPython/Extensions/numeric_formats.py: fix missing import,
2594 2601 reported by Stephen Walton.
2595 2602
2596 2603 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
2597 2604
2598 2605 * IPython/demo.py: finish demo module, fully documented now.
2599 2606
2600 2607 * IPython/genutils.py (file_read): simple little utility to read a
2601 2608 file and ensure it's closed afterwards.
2602 2609
2603 2610 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
2604 2611
2605 2612 * IPython/demo.py (Demo.__init__): added support for individually
2606 2613 tagging blocks for automatic execution.
2607 2614
2608 2615 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
2609 2616 syntax-highlighted python sources, requested by John.
2610 2617
2611 2618 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
2612 2619
2613 2620 * IPython/demo.py (Demo.again): fix bug where again() blocks after
2614 2621 finishing.
2615 2622
2616 2623 * IPython/genutils.py (shlex_split): moved from Magic to here,
2617 2624 where all 2.2 compatibility stuff lives. I needed it for demo.py.
2618 2625
2619 2626 * IPython/demo.py (Demo.__init__): added support for silent
2620 2627 blocks, improved marks as regexps, docstrings written.
2621 2628 (Demo.__init__): better docstring, added support for sys.argv.
2622 2629
2623 2630 * IPython/genutils.py (marquee): little utility used by the demo
2624 2631 code, handy in general.
2625 2632
2626 2633 * IPython/demo.py (Demo.__init__): new class for interactive
2627 2634 demos. Not documented yet, I just wrote it in a hurry for
2628 2635 scipy'05. Will docstring later.
2629 2636
2630 2637 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
2631 2638
2632 2639 * IPython/Shell.py (sigint_handler): Drastic simplification which
2633 2640 also seems to make Ctrl-C work correctly across threads! This is
2634 2641 so simple, that I can't beleive I'd missed it before. Needs more
2635 2642 testing, though.
2636 2643 (KBINT): Never mind, revert changes. I'm sure I'd tried something
2637 2644 like this before...
2638 2645
2639 2646 * IPython/genutils.py (get_home_dir): add protection against
2640 2647 non-dirs in win32 registry.
2641 2648
2642 2649 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
2643 2650 bug where dict was mutated while iterating (pysh crash).
2644 2651
2645 2652 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
2646 2653
2647 2654 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
2648 2655 spurious newlines added by this routine. After a report by
2649 2656 F. Mantegazza.
2650 2657
2651 2658 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
2652 2659
2653 2660 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
2654 2661 calls. These were a leftover from the GTK 1.x days, and can cause
2655 2662 problems in certain cases (after a report by John Hunter).
2656 2663
2657 2664 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
2658 2665 os.getcwd() fails at init time. Thanks to patch from David Remahl
2659 2666 <chmod007-AT-mac.com>.
2660 2667 (InteractiveShell.__init__): prevent certain special magics from
2661 2668 being shadowed by aliases. Closes
2662 2669 http://www.scipy.net/roundup/ipython/issue41.
2663 2670
2664 2671 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
2665 2672
2666 2673 * IPython/iplib.py (InteractiveShell.complete): Added new
2667 2674 top-level completion method to expose the completion mechanism
2668 2675 beyond readline-based environments.
2669 2676
2670 2677 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
2671 2678
2672 2679 * tools/ipsvnc (svnversion): fix svnversion capture.
2673 2680
2674 2681 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
2675 2682 attribute to self, which was missing. Before, it was set by a
2676 2683 routine which in certain cases wasn't being called, so the
2677 2684 instance could end up missing the attribute. This caused a crash.
2678 2685 Closes http://www.scipy.net/roundup/ipython/issue40.
2679 2686
2680 2687 2005-08-16 Fernando Perez <fperez@colorado.edu>
2681 2688
2682 2689 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
2683 2690 contains non-string attribute. Closes
2684 2691 http://www.scipy.net/roundup/ipython/issue38.
2685 2692
2686 2693 2005-08-14 Fernando Perez <fperez@colorado.edu>
2687 2694
2688 2695 * tools/ipsvnc: Minor improvements, to add changeset info.
2689 2696
2690 2697 2005-08-12 Fernando Perez <fperez@colorado.edu>
2691 2698
2692 2699 * IPython/iplib.py (runsource): remove self.code_to_run_src
2693 2700 attribute. I realized this is nothing more than
2694 2701 '\n'.join(self.buffer), and having the same data in two different
2695 2702 places is just asking for synchronization bugs. This may impact
2696 2703 people who have custom exception handlers, so I need to warn
2697 2704 ipython-dev about it (F. Mantegazza may use them).
2698 2705
2699 2706 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
2700 2707
2701 2708 * IPython/genutils.py: fix 2.2 compatibility (generators)
2702 2709
2703 2710 2005-07-18 Fernando Perez <fperez@colorado.edu>
2704 2711
2705 2712 * IPython/genutils.py (get_home_dir): fix to help users with
2706 2713 invalid $HOME under win32.
2707 2714
2708 2715 2005-07-17 Fernando Perez <fperez@colorado.edu>
2709 2716
2710 2717 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
2711 2718 some old hacks and clean up a bit other routines; code should be
2712 2719 simpler and a bit faster.
2713 2720
2714 2721 * IPython/iplib.py (interact): removed some last-resort attempts
2715 2722 to survive broken stdout/stderr. That code was only making it
2716 2723 harder to abstract out the i/o (necessary for gui integration),
2717 2724 and the crashes it could prevent were extremely rare in practice
2718 2725 (besides being fully user-induced in a pretty violent manner).
2719 2726
2720 2727 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
2721 2728 Nothing major yet, but the code is simpler to read; this should
2722 2729 make it easier to do more serious modifications in the future.
2723 2730
2724 2731 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
2725 2732 which broke in .15 (thanks to a report by Ville).
2726 2733
2727 2734 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
2728 2735 be quite correct, I know next to nothing about unicode). This
2729 2736 will allow unicode strings to be used in prompts, amongst other
2730 2737 cases. It also will prevent ipython from crashing when unicode
2731 2738 shows up unexpectedly in many places. If ascii encoding fails, we
2732 2739 assume utf_8. Currently the encoding is not a user-visible
2733 2740 setting, though it could be made so if there is demand for it.
2734 2741
2735 2742 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
2736 2743
2737 2744 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
2738 2745
2739 2746 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
2740 2747
2741 2748 * IPython/genutils.py: Add 2.2 compatibility here, so all other
2742 2749 code can work transparently for 2.2/2.3.
2743 2750
2744 2751 2005-07-16 Fernando Perez <fperez@colorado.edu>
2745 2752
2746 2753 * IPython/ultraTB.py (ExceptionColors): Make a global variable
2747 2754 out of the color scheme table used for coloring exception
2748 2755 tracebacks. This allows user code to add new schemes at runtime.
2749 2756 This is a minimally modified version of the patch at
2750 2757 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
2751 2758 for the contribution.
2752 2759
2753 2760 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
2754 2761 slightly modified version of the patch in
2755 2762 http://www.scipy.net/roundup/ipython/issue34, which also allows me
2756 2763 to remove the previous try/except solution (which was costlier).
2757 2764 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
2758 2765
2759 2766 2005-06-08 Fernando Perez <fperez@colorado.edu>
2760 2767
2761 2768 * IPython/iplib.py (write/write_err): Add methods to abstract all
2762 2769 I/O a bit more.
2763 2770
2764 2771 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
2765 2772 warning, reported by Aric Hagberg, fix by JD Hunter.
2766 2773
2767 2774 2005-06-02 *** Released version 0.6.15
2768 2775
2769 2776 2005-06-01 Fernando Perez <fperez@colorado.edu>
2770 2777
2771 2778 * IPython/iplib.py (MagicCompleter.file_matches): Fix
2772 2779 tab-completion of filenames within open-quoted strings. Note that
2773 2780 this requires that in ~/.ipython/ipythonrc, users change the
2774 2781 readline delimiters configuration to read:
2775 2782
2776 2783 readline_remove_delims -/~
2777 2784
2778 2785
2779 2786 2005-05-31 *** Released version 0.6.14
2780 2787
2781 2788 2005-05-29 Fernando Perez <fperez@colorado.edu>
2782 2789
2783 2790 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
2784 2791 with files not on the filesystem. Reported by Eliyahu Sandler
2785 2792 <eli@gondolin.net>
2786 2793
2787 2794 2005-05-22 Fernando Perez <fperez@colorado.edu>
2788 2795
2789 2796 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
2790 2797 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
2791 2798
2792 2799 2005-05-19 Fernando Perez <fperez@colorado.edu>
2793 2800
2794 2801 * IPython/iplib.py (safe_execfile): close a file which could be
2795 2802 left open (causing problems in win32, which locks open files).
2796 2803 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
2797 2804
2798 2805 2005-05-18 Fernando Perez <fperez@colorado.edu>
2799 2806
2800 2807 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
2801 2808 keyword arguments correctly to safe_execfile().
2802 2809
2803 2810 2005-05-13 Fernando Perez <fperez@colorado.edu>
2804 2811
2805 2812 * ipython.1: Added info about Qt to manpage, and threads warning
2806 2813 to usage page (invoked with --help).
2807 2814
2808 2815 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
2809 2816 new matcher (it goes at the end of the priority list) to do
2810 2817 tab-completion on named function arguments. Submitted by George
2811 2818 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
2812 2819 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
2813 2820 for more details.
2814 2821
2815 2822 * IPython/Magic.py (magic_run): Added new -e flag to ignore
2816 2823 SystemExit exceptions in the script being run. Thanks to a report
2817 2824 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
2818 2825 producing very annoying behavior when running unit tests.
2819 2826
2820 2827 2005-05-12 Fernando Perez <fperez@colorado.edu>
2821 2828
2822 2829 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
2823 2830 which I'd broken (again) due to a changed regexp. In the process,
2824 2831 added ';' as an escape to auto-quote the whole line without
2825 2832 splitting its arguments. Thanks to a report by Jerry McRae
2826 2833 <qrs0xyc02-AT-sneakemail.com>.
2827 2834
2828 2835 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
2829 2836 possible crashes caused by a TokenError. Reported by Ed Schofield
2830 2837 <schofield-AT-ftw.at>.
2831 2838
2832 2839 2005-05-06 Fernando Perez <fperez@colorado.edu>
2833 2840
2834 2841 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
2835 2842
2836 2843 2005-04-29 Fernando Perez <fperez@colorado.edu>
2837 2844
2838 2845 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2839 2846 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2840 2847 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2841 2848 which provides support for Qt interactive usage (similar to the
2842 2849 existing one for WX and GTK). This had been often requested.
2843 2850
2844 2851 2005-04-14 *** Released version 0.6.13
2845 2852
2846 2853 2005-04-08 Fernando Perez <fperez@colorado.edu>
2847 2854
2848 2855 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
2849 2856 from _ofind, which gets called on almost every input line. Now,
2850 2857 we only try to get docstrings if they are actually going to be
2851 2858 used (the overhead of fetching unnecessary docstrings can be
2852 2859 noticeable for certain objects, such as Pyro proxies).
2853 2860
2854 2861 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2855 2862 for completers. For some reason I had been passing them the state
2856 2863 variable, which completers never actually need, and was in
2857 2864 conflict with the rlcompleter API. Custom completers ONLY need to
2858 2865 take the text parameter.
2859 2866
2860 2867 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2861 2868 work correctly in pysh. I've also moved all the logic which used
2862 2869 to be in pysh.py here, which will prevent problems with future
2863 2870 upgrades. However, this time I must warn users to update their
2864 2871 pysh profile to include the line
2865 2872
2866 2873 import_all IPython.Extensions.InterpreterExec
2867 2874
2868 2875 because otherwise things won't work for them. They MUST also
2869 2876 delete pysh.py and the line
2870 2877
2871 2878 execfile pysh.py
2872 2879
2873 2880 from their ipythonrc-pysh.
2874 2881
2875 2882 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2876 2883 robust in the face of objects whose dir() returns non-strings
2877 2884 (which it shouldn't, but some broken libs like ITK do). Thanks to
2878 2885 a patch by John Hunter (implemented differently, though). Also
2879 2886 minor improvements by using .extend instead of + on lists.
2880 2887
2881 2888 * pysh.py:
2882 2889
2883 2890 2005-04-06 Fernando Perez <fperez@colorado.edu>
2884 2891
2885 2892 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2886 2893 by default, so that all users benefit from it. Those who don't
2887 2894 want it can still turn it off.
2888 2895
2889 2896 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2890 2897 config file, I'd forgotten about this, so users were getting it
2891 2898 off by default.
2892 2899
2893 2900 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2894 2901 consistency. Now magics can be called in multiline statements,
2895 2902 and python variables can be expanded in magic calls via $var.
2896 2903 This makes the magic system behave just like aliases or !system
2897 2904 calls.
2898 2905
2899 2906 2005-03-28 Fernando Perez <fperez@colorado.edu>
2900 2907
2901 2908 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
2902 2909 expensive string additions for building command. Add support for
2903 2910 trailing ';' when autocall is used.
2904 2911
2905 2912 2005-03-26 Fernando Perez <fperez@colorado.edu>
2906 2913
2907 2914 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
2908 2915 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
2909 2916 ipython.el robust against prompts with any number of spaces
2910 2917 (including 0) after the ':' character.
2911 2918
2912 2919 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
2913 2920 continuation prompt, which misled users to think the line was
2914 2921 already indented. Closes debian Bug#300847, reported to me by
2915 2922 Norbert Tretkowski <tretkowski-AT-inittab.de>.
2916 2923
2917 2924 2005-03-23 Fernando Perez <fperez@colorado.edu>
2918 2925
2919 2926 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
2920 2927 properly aligned if they have embedded newlines.
2921 2928
2922 2929 * IPython/iplib.py (runlines): Add a public method to expose
2923 2930 IPython's code execution machinery, so that users can run strings
2924 2931 as if they had been typed at the prompt interactively.
2925 2932 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
2926 2933 methods which can call the system shell, but with python variable
2927 2934 expansion. The three such methods are: __IPYTHON__.system,
2928 2935 .getoutput and .getoutputerror. These need to be documented in a
2929 2936 'public API' section (to be written) of the manual.
2930 2937
2931 2938 2005-03-20 Fernando Perez <fperez@colorado.edu>
2932 2939
2933 2940 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
2934 2941 for custom exception handling. This is quite powerful, and it
2935 2942 allows for user-installable exception handlers which can trap
2936 2943 custom exceptions at runtime and treat them separately from
2937 2944 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
2938 2945 Mantegazza <mantegazza-AT-ill.fr>.
2939 2946 (InteractiveShell.set_custom_completer): public API function to
2940 2947 add new completers at runtime.
2941 2948
2942 2949 2005-03-19 Fernando Perez <fperez@colorado.edu>
2943 2950
2944 2951 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
2945 2952 allow objects which provide their docstrings via non-standard
2946 2953 mechanisms (like Pyro proxies) to still be inspected by ipython's
2947 2954 ? system.
2948 2955
2949 2956 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
2950 2957 automatic capture system. I tried quite hard to make it work
2951 2958 reliably, and simply failed. I tried many combinations with the
2952 2959 subprocess module, but eventually nothing worked in all needed
2953 2960 cases (not blocking stdin for the child, duplicating stdout
2954 2961 without blocking, etc). The new %sc/%sx still do capture to these
2955 2962 magical list/string objects which make shell use much more
2956 2963 conveninent, so not all is lost.
2957 2964
2958 2965 XXX - FIX MANUAL for the change above!
2959 2966
2960 2967 (runsource): I copied code.py's runsource() into ipython to modify
2961 2968 it a bit. Now the code object and source to be executed are
2962 2969 stored in ipython. This makes this info accessible to third-party
2963 2970 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
2964 2971 Mantegazza <mantegazza-AT-ill.fr>.
2965 2972
2966 2973 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
2967 2974 history-search via readline (like C-p/C-n). I'd wanted this for a
2968 2975 long time, but only recently found out how to do it. For users
2969 2976 who already have their ipythonrc files made and want this, just
2970 2977 add:
2971 2978
2972 2979 readline_parse_and_bind "\e[A": history-search-backward
2973 2980 readline_parse_and_bind "\e[B": history-search-forward
2974 2981
2975 2982 2005-03-18 Fernando Perez <fperez@colorado.edu>
2976 2983
2977 2984 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
2978 2985 LSString and SList classes which allow transparent conversions
2979 2986 between list mode and whitespace-separated string.
2980 2987 (magic_r): Fix recursion problem in %r.
2981 2988
2982 2989 * IPython/genutils.py (LSString): New class to be used for
2983 2990 automatic storage of the results of all alias/system calls in _o
2984 2991 and _e (stdout/err). These provide a .l/.list attribute which
2985 2992 does automatic splitting on newlines. This means that for most
2986 2993 uses, you'll never need to do capturing of output with %sc/%sx
2987 2994 anymore, since ipython keeps this always done for you. Note that
2988 2995 only the LAST results are stored, the _o/e variables are
2989 2996 overwritten on each call. If you need to save their contents
2990 2997 further, simply bind them to any other name.
2991 2998
2992 2999 2005-03-17 Fernando Perez <fperez@colorado.edu>
2993 3000
2994 3001 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2995 3002 prompt namespace handling.
2996 3003
2997 3004 2005-03-16 Fernando Perez <fperez@colorado.edu>
2998 3005
2999 3006 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
3000 3007 classic prompts to be '>>> ' (final space was missing, and it
3001 3008 trips the emacs python mode).
3002 3009 (BasePrompt.__str__): Added safe support for dynamic prompt
3003 3010 strings. Now you can set your prompt string to be '$x', and the
3004 3011 value of x will be printed from your interactive namespace. The
3005 3012 interpolation syntax includes the full Itpl support, so
3006 3013 ${foo()+x+bar()} is a valid prompt string now, and the function
3007 3014 calls will be made at runtime.
3008 3015
3009 3016 2005-03-15 Fernando Perez <fperez@colorado.edu>
3010 3017
3011 3018 * IPython/Magic.py (magic_history): renamed %hist to %history, to
3012 3019 avoid name clashes in pylab. %hist still works, it just forwards
3013 3020 the call to %history.
3014 3021
3015 3022 2005-03-02 *** Released version 0.6.12
3016 3023
3017 3024 2005-03-02 Fernando Perez <fperez@colorado.edu>
3018 3025
3019 3026 * IPython/iplib.py (handle_magic): log magic calls properly as
3020 3027 ipmagic() function calls.
3021 3028
3022 3029 * IPython/Magic.py (magic_time): Improved %time to support
3023 3030 statements and provide wall-clock as well as CPU time.
3024 3031
3025 3032 2005-02-27 Fernando Perez <fperez@colorado.edu>
3026 3033
3027 3034 * IPython/hooks.py: New hooks module, to expose user-modifiable
3028 3035 IPython functionality in a clean manner. For now only the editor
3029 3036 hook is actually written, and other thigns which I intend to turn
3030 3037 into proper hooks aren't yet there. The display and prefilter
3031 3038 stuff, for example, should be hooks. But at least now the
3032 3039 framework is in place, and the rest can be moved here with more
3033 3040 time later. IPython had had a .hooks variable for a long time for
3034 3041 this purpose, but I'd never actually used it for anything.
3035 3042
3036 3043 2005-02-26 Fernando Perez <fperez@colorado.edu>
3037 3044
3038 3045 * IPython/ipmaker.py (make_IPython): make the default ipython
3039 3046 directory be called _ipython under win32, to follow more the
3040 3047 naming peculiarities of that platform (where buggy software like
3041 3048 Visual Sourcesafe breaks with .named directories). Reported by
3042 3049 Ville Vainio.
3043 3050
3044 3051 2005-02-23 Fernando Perez <fperez@colorado.edu>
3045 3052
3046 3053 * IPython/iplib.py (InteractiveShell.__init__): removed a few
3047 3054 auto_aliases for win32 which were causing problems. Users can
3048 3055 define the ones they personally like.
3049 3056
3050 3057 2005-02-21 Fernando Perez <fperez@colorado.edu>
3051 3058
3052 3059 * IPython/Magic.py (magic_time): new magic to time execution of
3053 3060 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
3054 3061
3055 3062 2005-02-19 Fernando Perez <fperez@colorado.edu>
3056 3063
3057 3064 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
3058 3065 into keys (for prompts, for example).
3059 3066
3060 3067 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
3061 3068 prompts in case users want them. This introduces a small behavior
3062 3069 change: ipython does not automatically add a space to all prompts
3063 3070 anymore. To get the old prompts with a space, users should add it
3064 3071 manually to their ipythonrc file, so for example prompt_in1 should
3065 3072 now read 'In [\#]: ' instead of 'In [\#]:'.
3066 3073 (BasePrompt.__init__): New option prompts_pad_left (only in rc
3067 3074 file) to control left-padding of secondary prompts.
3068 3075
3069 3076 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
3070 3077 the profiler can't be imported. Fix for Debian, which removed
3071 3078 profile.py because of License issues. I applied a slightly
3072 3079 modified version of the original Debian patch at
3073 3080 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
3074 3081
3075 3082 2005-02-17 Fernando Perez <fperez@colorado.edu>
3076 3083
3077 3084 * IPython/genutils.py (native_line_ends): Fix bug which would
3078 3085 cause improper line-ends under win32 b/c I was not opening files
3079 3086 in binary mode. Bug report and fix thanks to Ville.
3080 3087
3081 3088 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
3082 3089 trying to catch spurious foo[1] autocalls. My fix actually broke
3083 3090 ',/' autoquote/call with explicit escape (bad regexp).
3084 3091
3085 3092 2005-02-15 *** Released version 0.6.11
3086 3093
3087 3094 2005-02-14 Fernando Perez <fperez@colorado.edu>
3088 3095
3089 3096 * IPython/background_jobs.py: New background job management
3090 3097 subsystem. This is implemented via a new set of classes, and
3091 3098 IPython now provides a builtin 'jobs' object for background job
3092 3099 execution. A convenience %bg magic serves as a lightweight
3093 3100 frontend for starting the more common type of calls. This was
3094 3101 inspired by discussions with B. Granger and the BackgroundCommand
3095 3102 class described in the book Python Scripting for Computational
3096 3103 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
3097 3104 (although ultimately no code from this text was used, as IPython's
3098 3105 system is a separate implementation).
3099 3106
3100 3107 * IPython/iplib.py (MagicCompleter.python_matches): add new option
3101 3108 to control the completion of single/double underscore names
3102 3109 separately. As documented in the example ipytonrc file, the
3103 3110 readline_omit__names variable can now be set to 2, to omit even
3104 3111 single underscore names. Thanks to a patch by Brian Wong
3105 3112 <BrianWong-AT-AirgoNetworks.Com>.
3106 3113 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
3107 3114 be autocalled as foo([1]) if foo were callable. A problem for
3108 3115 things which are both callable and implement __getitem__.
3109 3116 (init_readline): Fix autoindentation for win32. Thanks to a patch
3110 3117 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
3111 3118
3112 3119 2005-02-12 Fernando Perez <fperez@colorado.edu>
3113 3120
3114 3121 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
3115 3122 which I had written long ago to sort out user error messages which
3116 3123 may occur during startup. This seemed like a good idea initially,
3117 3124 but it has proven a disaster in retrospect. I don't want to
3118 3125 change much code for now, so my fix is to set the internal 'debug'
3119 3126 flag to true everywhere, whose only job was precisely to control
3120 3127 this subsystem. This closes issue 28 (as well as avoiding all
3121 3128 sorts of strange hangups which occur from time to time).
3122 3129
3123 3130 2005-02-07 Fernando Perez <fperez@colorado.edu>
3124 3131
3125 3132 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
3126 3133 previous call produced a syntax error.
3127 3134
3128 3135 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3129 3136 classes without constructor.
3130 3137
3131 3138 2005-02-06 Fernando Perez <fperez@colorado.edu>
3132 3139
3133 3140 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
3134 3141 completions with the results of each matcher, so we return results
3135 3142 to the user from all namespaces. This breaks with ipython
3136 3143 tradition, but I think it's a nicer behavior. Now you get all
3137 3144 possible completions listed, from all possible namespaces (python,
3138 3145 filesystem, magics...) After a request by John Hunter
3139 3146 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3140 3147
3141 3148 2005-02-05 Fernando Perez <fperez@colorado.edu>
3142 3149
3143 3150 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
3144 3151 the call had quote characters in it (the quotes were stripped).
3145 3152
3146 3153 2005-01-31 Fernando Perez <fperez@colorado.edu>
3147 3154
3148 3155 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
3149 3156 Itpl.itpl() to make the code more robust against psyco
3150 3157 optimizations.
3151 3158
3152 3159 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
3153 3160 of causing an exception. Quicker, cleaner.
3154 3161
3155 3162 2005-01-28 Fernando Perez <fperez@colorado.edu>
3156 3163
3157 3164 * scripts/ipython_win_post_install.py (install): hardcode
3158 3165 sys.prefix+'python.exe' as the executable path. It turns out that
3159 3166 during the post-installation run, sys.executable resolves to the
3160 3167 name of the binary installer! I should report this as a distutils
3161 3168 bug, I think. I updated the .10 release with this tiny fix, to
3162 3169 avoid annoying the lists further.
3163 3170
3164 3171 2005-01-27 *** Released version 0.6.10
3165 3172
3166 3173 2005-01-27 Fernando Perez <fperez@colorado.edu>
3167 3174
3168 3175 * IPython/numutils.py (norm): Added 'inf' as optional name for
3169 3176 L-infinity norm, included references to mathworld.com for vector
3170 3177 norm definitions.
3171 3178 (amin/amax): added amin/amax for array min/max. Similar to what
3172 3179 pylab ships with after the recent reorganization of names.
3173 3180 (spike/spike_odd): removed deprecated spike/spike_odd functions.
3174 3181
3175 3182 * ipython.el: committed Alex's recent fixes and improvements.
3176 3183 Tested with python-mode from CVS, and it looks excellent. Since
3177 3184 python-mode hasn't released anything in a while, I'm temporarily
3178 3185 putting a copy of today's CVS (v 4.70) of python-mode in:
3179 3186 http://ipython.scipy.org/tmp/python-mode.el
3180 3187
3181 3188 * scripts/ipython_win_post_install.py (install): Win32 fix to use
3182 3189 sys.executable for the executable name, instead of assuming it's
3183 3190 called 'python.exe' (the post-installer would have produced broken
3184 3191 setups on systems with a differently named python binary).
3185 3192
3186 3193 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
3187 3194 references to os.linesep, to make the code more
3188 3195 platform-independent. This is also part of the win32 coloring
3189 3196 fixes.
3190 3197
3191 3198 * IPython/genutils.py (page_dumb): Remove attempts to chop long
3192 3199 lines, which actually cause coloring bugs because the length of
3193 3200 the line is very difficult to correctly compute with embedded
3194 3201 escapes. This was the source of all the coloring problems under
3195 3202 Win32. I think that _finally_, Win32 users have a properly
3196 3203 working ipython in all respects. This would never have happened
3197 3204 if not for Gary Bishop and Viktor Ransmayr's great help and work.
3198 3205
3199 3206 2005-01-26 *** Released version 0.6.9
3200 3207
3201 3208 2005-01-25 Fernando Perez <fperez@colorado.edu>
3202 3209
3203 3210 * setup.py: finally, we have a true Windows installer, thanks to
3204 3211 the excellent work of Viktor Ransmayr
3205 3212 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
3206 3213 Windows users. The setup routine is quite a bit cleaner thanks to
3207 3214 this, and the post-install script uses the proper functions to
3208 3215 allow a clean de-installation using the standard Windows Control
3209 3216 Panel.
3210 3217
3211 3218 * IPython/genutils.py (get_home_dir): changed to use the $HOME
3212 3219 environment variable under all OSes (including win32) if
3213 3220 available. This will give consistency to win32 users who have set
3214 3221 this variable for any reason. If os.environ['HOME'] fails, the
3215 3222 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
3216 3223
3217 3224 2005-01-24 Fernando Perez <fperez@colorado.edu>
3218 3225
3219 3226 * IPython/numutils.py (empty_like): add empty_like(), similar to
3220 3227 zeros_like() but taking advantage of the new empty() Numeric routine.
3221 3228
3222 3229 2005-01-23 *** Released version 0.6.8
3223 3230
3224 3231 2005-01-22 Fernando Perez <fperez@colorado.edu>
3225 3232
3226 3233 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
3227 3234 automatic show() calls. After discussing things with JDH, it
3228 3235 turns out there are too many corner cases where this can go wrong.
3229 3236 It's best not to try to be 'too smart', and simply have ipython
3230 3237 reproduce as much as possible the default behavior of a normal
3231 3238 python shell.
3232 3239
3233 3240 * IPython/iplib.py (InteractiveShell.__init__): Modified the
3234 3241 line-splitting regexp and _prefilter() to avoid calling getattr()
3235 3242 on assignments. This closes
3236 3243 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
3237 3244 readline uses getattr(), so a simple <TAB> keypress is still
3238 3245 enough to trigger getattr() calls on an object.
3239 3246
3240 3247 2005-01-21 Fernando Perez <fperez@colorado.edu>
3241 3248
3242 3249 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
3243 3250 docstring under pylab so it doesn't mask the original.
3244 3251
3245 3252 2005-01-21 *** Released version 0.6.7
3246 3253
3247 3254 2005-01-21 Fernando Perez <fperez@colorado.edu>
3248 3255
3249 3256 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
3250 3257 signal handling for win32 users in multithreaded mode.
3251 3258
3252 3259 2005-01-17 Fernando Perez <fperez@colorado.edu>
3253 3260
3254 3261 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3255 3262 instances with no __init__. After a crash report by Norbert Nemec
3256 3263 <Norbert-AT-nemec-online.de>.
3257 3264
3258 3265 2005-01-14 Fernando Perez <fperez@colorado.edu>
3259 3266
3260 3267 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
3261 3268 names for verbose exceptions, when multiple dotted names and the
3262 3269 'parent' object were present on the same line.
3263 3270
3264 3271 2005-01-11 Fernando Perez <fperez@colorado.edu>
3265 3272
3266 3273 * IPython/genutils.py (flag_calls): new utility to trap and flag
3267 3274 calls in functions. I need it to clean up matplotlib support.
3268 3275 Also removed some deprecated code in genutils.
3269 3276
3270 3277 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
3271 3278 that matplotlib scripts called with %run, which don't call show()
3272 3279 themselves, still have their plotting windows open.
3273 3280
3274 3281 2005-01-05 Fernando Perez <fperez@colorado.edu>
3275 3282
3276 3283 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
3277 3284 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
3278 3285
3279 3286 2004-12-19 Fernando Perez <fperez@colorado.edu>
3280 3287
3281 3288 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
3282 3289 parent_runcode, which was an eyesore. The same result can be
3283 3290 obtained with Python's regular superclass mechanisms.
3284 3291
3285 3292 2004-12-17 Fernando Perez <fperez@colorado.edu>
3286 3293
3287 3294 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
3288 3295 reported by Prabhu.
3289 3296 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
3290 3297 sys.stderr) instead of explicitly calling sys.stderr. This helps
3291 3298 maintain our I/O abstractions clean, for future GUI embeddings.
3292 3299
3293 3300 * IPython/genutils.py (info): added new utility for sys.stderr
3294 3301 unified info message handling (thin wrapper around warn()).
3295 3302
3296 3303 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
3297 3304 composite (dotted) names on verbose exceptions.
3298 3305 (VerboseTB.nullrepr): harden against another kind of errors which
3299 3306 Python's inspect module can trigger, and which were crashing
3300 3307 IPython. Thanks to a report by Marco Lombardi
3301 3308 <mlombard-AT-ma010192.hq.eso.org>.
3302 3309
3303 3310 2004-12-13 *** Released version 0.6.6
3304 3311
3305 3312 2004-12-12 Fernando Perez <fperez@colorado.edu>
3306 3313
3307 3314 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
3308 3315 generated by pygtk upon initialization if it was built without
3309 3316 threads (for matplotlib users). After a crash reported by
3310 3317 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
3311 3318
3312 3319 * IPython/ipmaker.py (make_IPython): fix small bug in the
3313 3320 import_some parameter for multiple imports.
3314 3321
3315 3322 * IPython/iplib.py (ipmagic): simplified the interface of
3316 3323 ipmagic() to take a single string argument, just as it would be
3317 3324 typed at the IPython cmd line.
3318 3325 (ipalias): Added new ipalias() with an interface identical to
3319 3326 ipmagic(). This completes exposing a pure python interface to the
3320 3327 alias and magic system, which can be used in loops or more complex
3321 3328 code where IPython's automatic line mangling is not active.
3322 3329
3323 3330 * IPython/genutils.py (timing): changed interface of timing to
3324 3331 simply run code once, which is the most common case. timings()
3325 3332 remains unchanged, for the cases where you want multiple runs.
3326 3333
3327 3334 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
3328 3335 bug where Python2.2 crashes with exec'ing code which does not end
3329 3336 in a single newline. Python 2.3 is OK, so I hadn't noticed this
3330 3337 before.
3331 3338
3332 3339 2004-12-10 Fernando Perez <fperez@colorado.edu>
3333 3340
3334 3341 * IPython/Magic.py (Magic.magic_prun): changed name of option from
3335 3342 -t to -T, to accomodate the new -t flag in %run (the %run and
3336 3343 %prun options are kind of intermixed, and it's not easy to change
3337 3344 this with the limitations of python's getopt).
3338 3345
3339 3346 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
3340 3347 the execution of scripts. It's not as fine-tuned as timeit.py,
3341 3348 but it works from inside ipython (and under 2.2, which lacks
3342 3349 timeit.py). Optionally a number of runs > 1 can be given for
3343 3350 timing very short-running code.
3344 3351
3345 3352 * IPython/genutils.py (uniq_stable): new routine which returns a
3346 3353 list of unique elements in any iterable, but in stable order of
3347 3354 appearance. I needed this for the ultraTB fixes, and it's a handy
3348 3355 utility.
3349 3356
3350 3357 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
3351 3358 dotted names in Verbose exceptions. This had been broken since
3352 3359 the very start, now x.y will properly be printed in a Verbose
3353 3360 traceback, instead of x being shown and y appearing always as an
3354 3361 'undefined global'. Getting this to work was a bit tricky,
3355 3362 because by default python tokenizers are stateless. Saved by
3356 3363 python's ability to easily add a bit of state to an arbitrary
3357 3364 function (without needing to build a full-blown callable object).
3358 3365
3359 3366 Also big cleanup of this code, which had horrendous runtime
3360 3367 lookups of zillions of attributes for colorization. Moved all
3361 3368 this code into a few templates, which make it cleaner and quicker.
3362 3369
3363 3370 Printout quality was also improved for Verbose exceptions: one
3364 3371 variable per line, and memory addresses are printed (this can be
3365 3372 quite handy in nasty debugging situations, which is what Verbose
3366 3373 is for).
3367 3374
3368 3375 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
3369 3376 the command line as scripts to be loaded by embedded instances.
3370 3377 Doing so has the potential for an infinite recursion if there are
3371 3378 exceptions thrown in the process. This fixes a strange crash
3372 3379 reported by Philippe MULLER <muller-AT-irit.fr>.
3373 3380
3374 3381 2004-12-09 Fernando Perez <fperez@colorado.edu>
3375 3382
3376 3383 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
3377 3384 to reflect new names in matplotlib, which now expose the
3378 3385 matlab-compatible interface via a pylab module instead of the
3379 3386 'matlab' name. The new code is backwards compatible, so users of
3380 3387 all matplotlib versions are OK. Patch by J. Hunter.
3381 3388
3382 3389 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
3383 3390 of __init__ docstrings for instances (class docstrings are already
3384 3391 automatically printed). Instances with customized docstrings
3385 3392 (indep. of the class) are also recognized and all 3 separate
3386 3393 docstrings are printed (instance, class, constructor). After some
3387 3394 comments/suggestions by J. Hunter.
3388 3395
3389 3396 2004-12-05 Fernando Perez <fperez@colorado.edu>
3390 3397
3391 3398 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
3392 3399 warnings when tab-completion fails and triggers an exception.
3393 3400
3394 3401 2004-12-03 Fernando Perez <fperez@colorado.edu>
3395 3402
3396 3403 * IPython/Magic.py (magic_prun): Fix bug where an exception would
3397 3404 be triggered when using 'run -p'. An incorrect option flag was
3398 3405 being set ('d' instead of 'D').
3399 3406 (manpage): fix missing escaped \- sign.
3400 3407
3401 3408 2004-11-30 *** Released version 0.6.5
3402 3409
3403 3410 2004-11-30 Fernando Perez <fperez@colorado.edu>
3404 3411
3405 3412 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
3406 3413 setting with -d option.
3407 3414
3408 3415 * setup.py (docfiles): Fix problem where the doc glob I was using
3409 3416 was COMPLETELY BROKEN. It was giving the right files by pure
3410 3417 accident, but failed once I tried to include ipython.el. Note:
3411 3418 glob() does NOT allow you to do exclusion on multiple endings!
3412 3419
3413 3420 2004-11-29 Fernando Perez <fperez@colorado.edu>
3414 3421
3415 3422 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
3416 3423 the manpage as the source. Better formatting & consistency.
3417 3424
3418 3425 * IPython/Magic.py (magic_run): Added new -d option, to run
3419 3426 scripts under the control of the python pdb debugger. Note that
3420 3427 this required changing the %prun option -d to -D, to avoid a clash
3421 3428 (since %run must pass options to %prun, and getopt is too dumb to
3422 3429 handle options with string values with embedded spaces). Thanks
3423 3430 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
3424 3431 (magic_who_ls): added type matching to %who and %whos, so that one
3425 3432 can filter their output to only include variables of certain
3426 3433 types. Another suggestion by Matthew.
3427 3434 (magic_whos): Added memory summaries in kb and Mb for arrays.
3428 3435 (magic_who): Improve formatting (break lines every 9 vars).
3429 3436
3430 3437 2004-11-28 Fernando Perez <fperez@colorado.edu>
3431 3438
3432 3439 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
3433 3440 cache when empty lines were present.
3434 3441
3435 3442 2004-11-24 Fernando Perez <fperez@colorado.edu>
3436 3443
3437 3444 * IPython/usage.py (__doc__): document the re-activated threading
3438 3445 options for WX and GTK.
3439 3446
3440 3447 2004-11-23 Fernando Perez <fperez@colorado.edu>
3441 3448
3442 3449 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
3443 3450 the -wthread and -gthread options, along with a new -tk one to try
3444 3451 and coordinate Tk threading with wx/gtk. The tk support is very
3445 3452 platform dependent, since it seems to require Tcl and Tk to be
3446 3453 built with threads (Fedora1/2 appears NOT to have it, but in
3447 3454 Prabhu's Debian boxes it works OK). But even with some Tk
3448 3455 limitations, this is a great improvement.
3449 3456
3450 3457 * IPython/Prompts.py (prompt_specials_color): Added \t for time
3451 3458 info in user prompts. Patch by Prabhu.
3452 3459
3453 3460 2004-11-18 Fernando Perez <fperez@colorado.edu>
3454 3461
3455 3462 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
3456 3463 EOFErrors and bail, to avoid infinite loops if a non-terminating
3457 3464 file is fed into ipython. Patch submitted in issue 19 by user,
3458 3465 many thanks.
3459 3466
3460 3467 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
3461 3468 autoquote/parens in continuation prompts, which can cause lots of
3462 3469 problems. Closes roundup issue 20.
3463 3470
3464 3471 2004-11-17 Fernando Perez <fperez@colorado.edu>
3465 3472
3466 3473 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
3467 3474 reported as debian bug #280505. I'm not sure my local changelog
3468 3475 entry has the proper debian format (Jack?).
3469 3476
3470 3477 2004-11-08 *** Released version 0.6.4
3471 3478
3472 3479 2004-11-08 Fernando Perez <fperez@colorado.edu>
3473 3480
3474 3481 * IPython/iplib.py (init_readline): Fix exit message for Windows
3475 3482 when readline is active. Thanks to a report by Eric Jones
3476 3483 <eric-AT-enthought.com>.
3477 3484
3478 3485 2004-11-07 Fernando Perez <fperez@colorado.edu>
3479 3486
3480 3487 * IPython/genutils.py (page): Add a trap for OSError exceptions,
3481 3488 sometimes seen by win2k/cygwin users.
3482 3489
3483 3490 2004-11-06 Fernando Perez <fperez@colorado.edu>
3484 3491
3485 3492 * IPython/iplib.py (interact): Change the handling of %Exit from
3486 3493 trying to propagate a SystemExit to an internal ipython flag.
3487 3494 This is less elegant than using Python's exception mechanism, but
3488 3495 I can't get that to work reliably with threads, so under -pylab
3489 3496 %Exit was hanging IPython. Cross-thread exception handling is
3490 3497 really a bitch. Thaks to a bug report by Stephen Walton
3491 3498 <stephen.walton-AT-csun.edu>.
3492 3499
3493 3500 2004-11-04 Fernando Perez <fperez@colorado.edu>
3494 3501
3495 3502 * IPython/iplib.py (raw_input_original): store a pointer to the
3496 3503 true raw_input to harden against code which can modify it
3497 3504 (wx.py.PyShell does this and would otherwise crash ipython).
3498 3505 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
3499 3506
3500 3507 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
3501 3508 Ctrl-C problem, which does not mess up the input line.
3502 3509
3503 3510 2004-11-03 Fernando Perez <fperez@colorado.edu>
3504 3511
3505 3512 * IPython/Release.py: Changed licensing to BSD, in all files.
3506 3513 (name): lowercase name for tarball/RPM release.
3507 3514
3508 3515 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
3509 3516 use throughout ipython.
3510 3517
3511 3518 * IPython/Magic.py (Magic._ofind): Switch to using the new
3512 3519 OInspect.getdoc() function.
3513 3520
3514 3521 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
3515 3522 of the line currently being canceled via Ctrl-C. It's extremely
3516 3523 ugly, but I don't know how to do it better (the problem is one of
3517 3524 handling cross-thread exceptions).
3518 3525
3519 3526 2004-10-28 Fernando Perez <fperez@colorado.edu>
3520 3527
3521 3528 * IPython/Shell.py (signal_handler): add signal handlers to trap
3522 3529 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
3523 3530 report by Francesc Alted.
3524 3531
3525 3532 2004-10-21 Fernando Perez <fperez@colorado.edu>
3526 3533
3527 3534 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
3528 3535 to % for pysh syntax extensions.
3529 3536
3530 3537 2004-10-09 Fernando Perez <fperez@colorado.edu>
3531 3538
3532 3539 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
3533 3540 arrays to print a more useful summary, without calling str(arr).
3534 3541 This avoids the problem of extremely lengthy computations which
3535 3542 occur if arr is large, and appear to the user as a system lockup
3536 3543 with 100% cpu activity. After a suggestion by Kristian Sandberg
3537 3544 <Kristian.Sandberg@colorado.edu>.
3538 3545 (Magic.__init__): fix bug in global magic escapes not being
3539 3546 correctly set.
3540 3547
3541 3548 2004-10-08 Fernando Perez <fperez@colorado.edu>
3542 3549
3543 3550 * IPython/Magic.py (__license__): change to absolute imports of
3544 3551 ipython's own internal packages, to start adapting to the absolute
3545 3552 import requirement of PEP-328.
3546 3553
3547 3554 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
3548 3555 files, and standardize author/license marks through the Release
3549 3556 module instead of having per/file stuff (except for files with
3550 3557 particular licenses, like the MIT/PSF-licensed codes).
3551 3558
3552 3559 * IPython/Debugger.py: remove dead code for python 2.1
3553 3560
3554 3561 2004-10-04 Fernando Perez <fperez@colorado.edu>
3555 3562
3556 3563 * IPython/iplib.py (ipmagic): New function for accessing magics
3557 3564 via a normal python function call.
3558 3565
3559 3566 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
3560 3567 from '@' to '%', to accomodate the new @decorator syntax of python
3561 3568 2.4.
3562 3569
3563 3570 2004-09-29 Fernando Perez <fperez@colorado.edu>
3564 3571
3565 3572 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
3566 3573 matplotlib.use to prevent running scripts which try to switch
3567 3574 interactive backends from within ipython. This will just crash
3568 3575 the python interpreter, so we can't allow it (but a detailed error
3569 3576 is given to the user).
3570 3577
3571 3578 2004-09-28 Fernando Perez <fperez@colorado.edu>
3572 3579
3573 3580 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
3574 3581 matplotlib-related fixes so that using @run with non-matplotlib
3575 3582 scripts doesn't pop up spurious plot windows. This requires
3576 3583 matplotlib >= 0.63, where I had to make some changes as well.
3577 3584
3578 3585 * IPython/ipmaker.py (make_IPython): update version requirement to
3579 3586 python 2.2.
3580 3587
3581 3588 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
3582 3589 banner arg for embedded customization.
3583 3590
3584 3591 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
3585 3592 explicit uses of __IP as the IPython's instance name. Now things
3586 3593 are properly handled via the shell.name value. The actual code
3587 3594 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
3588 3595 is much better than before. I'll clean things completely when the
3589 3596 magic stuff gets a real overhaul.
3590 3597
3591 3598 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
3592 3599 minor changes to debian dir.
3593 3600
3594 3601 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
3595 3602 pointer to the shell itself in the interactive namespace even when
3596 3603 a user-supplied dict is provided. This is needed for embedding
3597 3604 purposes (found by tests with Michel Sanner).
3598 3605
3599 3606 2004-09-27 Fernando Perez <fperez@colorado.edu>
3600 3607
3601 3608 * IPython/UserConfig/ipythonrc: remove []{} from
3602 3609 readline_remove_delims, so that things like [modname.<TAB> do
3603 3610 proper completion. This disables [].TAB, but that's a less common
3604 3611 case than module names in list comprehensions, for example.
3605 3612 Thanks to a report by Andrea Riciputi.
3606 3613
3607 3614 2004-09-09 Fernando Perez <fperez@colorado.edu>
3608 3615
3609 3616 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
3610 3617 blocking problems in win32 and osx. Fix by John.
3611 3618
3612 3619 2004-09-08 Fernando Perez <fperez@colorado.edu>
3613 3620
3614 3621 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
3615 3622 for Win32 and OSX. Fix by John Hunter.
3616 3623
3617 3624 2004-08-30 *** Released version 0.6.3
3618 3625
3619 3626 2004-08-30 Fernando Perez <fperez@colorado.edu>
3620 3627
3621 3628 * setup.py (isfile): Add manpages to list of dependent files to be
3622 3629 updated.
3623 3630
3624 3631 2004-08-27 Fernando Perez <fperez@colorado.edu>
3625 3632
3626 3633 * IPython/Shell.py (start): I've disabled -wthread and -gthread
3627 3634 for now. They don't really work with standalone WX/GTK code
3628 3635 (though matplotlib IS working fine with both of those backends).
3629 3636 This will neeed much more testing. I disabled most things with
3630 3637 comments, so turning it back on later should be pretty easy.
3631 3638
3632 3639 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
3633 3640 autocalling of expressions like r'foo', by modifying the line
3634 3641 split regexp. Closes
3635 3642 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
3636 3643 Riley <ipythonbugs-AT-sabi.net>.
3637 3644 (InteractiveShell.mainloop): honor --nobanner with banner
3638 3645 extensions.
3639 3646
3640 3647 * IPython/Shell.py: Significant refactoring of all classes, so
3641 3648 that we can really support ALL matplotlib backends and threading
3642 3649 models (John spotted a bug with Tk which required this). Now we
3643 3650 should support single-threaded, WX-threads and GTK-threads, both
3644 3651 for generic code and for matplotlib.
3645 3652
3646 3653 * IPython/ipmaker.py (__call__): Changed -mpthread option to
3647 3654 -pylab, to simplify things for users. Will also remove the pylab
3648 3655 profile, since now all of matplotlib configuration is directly
3649 3656 handled here. This also reduces startup time.
3650 3657
3651 3658 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
3652 3659 shell wasn't being correctly called. Also in IPShellWX.
3653 3660
3654 3661 * IPython/iplib.py (InteractiveShell.__init__): Added option to
3655 3662 fine-tune banner.
3656 3663
3657 3664 * IPython/numutils.py (spike): Deprecate these spike functions,
3658 3665 delete (long deprecated) gnuplot_exec handler.
3659 3666
3660 3667 2004-08-26 Fernando Perez <fperez@colorado.edu>
3661 3668
3662 3669 * ipython.1: Update for threading options, plus some others which
3663 3670 were missing.
3664 3671
3665 3672 * IPython/ipmaker.py (__call__): Added -wthread option for
3666 3673 wxpython thread handling. Make sure threading options are only
3667 3674 valid at the command line.
3668 3675
3669 3676 * scripts/ipython: moved shell selection into a factory function
3670 3677 in Shell.py, to keep the starter script to a minimum.
3671 3678
3672 3679 2004-08-25 Fernando Perez <fperez@colorado.edu>
3673 3680
3674 3681 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
3675 3682 John. Along with some recent changes he made to matplotlib, the
3676 3683 next versions of both systems should work very well together.
3677 3684
3678 3685 2004-08-24 Fernando Perez <fperez@colorado.edu>
3679 3686
3680 3687 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
3681 3688 tried to switch the profiling to using hotshot, but I'm getting
3682 3689 strange errors from prof.runctx() there. I may be misreading the
3683 3690 docs, but it looks weird. For now the profiling code will
3684 3691 continue to use the standard profiler.
3685 3692
3686 3693 2004-08-23 Fernando Perez <fperez@colorado.edu>
3687 3694
3688 3695 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
3689 3696 threaded shell, by John Hunter. It's not quite ready yet, but
3690 3697 close.
3691 3698
3692 3699 2004-08-22 Fernando Perez <fperez@colorado.edu>
3693 3700
3694 3701 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
3695 3702 in Magic and ultraTB.
3696 3703
3697 3704 * ipython.1: document threading options in manpage.
3698 3705
3699 3706 * scripts/ipython: Changed name of -thread option to -gthread,
3700 3707 since this is GTK specific. I want to leave the door open for a
3701 3708 -wthread option for WX, which will most likely be necessary. This
3702 3709 change affects usage and ipmaker as well.
3703 3710
3704 3711 * IPython/Shell.py (matplotlib_shell): Add a factory function to
3705 3712 handle the matplotlib shell issues. Code by John Hunter
3706 3713 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3707 3714 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
3708 3715 broken (and disabled for end users) for now, but it puts the
3709 3716 infrastructure in place.
3710 3717
3711 3718 2004-08-21 Fernando Perez <fperez@colorado.edu>
3712 3719
3713 3720 * ipythonrc-pylab: Add matplotlib support.
3714 3721
3715 3722 * matplotlib_config.py: new files for matplotlib support, part of
3716 3723 the pylab profile.
3717 3724
3718 3725 * IPython/usage.py (__doc__): documented the threading options.
3719 3726
3720 3727 2004-08-20 Fernando Perez <fperez@colorado.edu>
3721 3728
3722 3729 * ipython: Modified the main calling routine to handle the -thread
3723 3730 and -mpthread options. This needs to be done as a top-level hack,
3724 3731 because it determines which class to instantiate for IPython
3725 3732 itself.
3726 3733
3727 3734 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
3728 3735 classes to support multithreaded GTK operation without blocking,
3729 3736 and matplotlib with all backends. This is a lot of still very
3730 3737 experimental code, and threads are tricky. So it may still have a
3731 3738 few rough edges... This code owes a lot to
3732 3739 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
3733 3740 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
3734 3741 to John Hunter for all the matplotlib work.
3735 3742
3736 3743 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
3737 3744 options for gtk thread and matplotlib support.
3738 3745
3739 3746 2004-08-16 Fernando Perez <fperez@colorado.edu>
3740 3747
3741 3748 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
3742 3749 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
3743 3750 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
3744 3751
3745 3752 2004-08-11 Fernando Perez <fperez@colorado.edu>
3746 3753
3747 3754 * setup.py (isfile): Fix build so documentation gets updated for
3748 3755 rpms (it was only done for .tgz builds).
3749 3756
3750 3757 2004-08-10 Fernando Perez <fperez@colorado.edu>
3751 3758
3752 3759 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
3753 3760
3754 3761 * iplib.py : Silence syntax error exceptions in tab-completion.
3755 3762
3756 3763 2004-08-05 Fernando Perez <fperez@colorado.edu>
3757 3764
3758 3765 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
3759 3766 'color off' mark for continuation prompts. This was causing long
3760 3767 continuation lines to mis-wrap.
3761 3768
3762 3769 2004-08-01 Fernando Perez <fperez@colorado.edu>
3763 3770
3764 3771 * IPython/ipmaker.py (make_IPython): Allow the shell class used
3765 3772 for building ipython to be a parameter. All this is necessary
3766 3773 right now to have a multithreaded version, but this insane
3767 3774 non-design will be cleaned up soon. For now, it's a hack that
3768 3775 works.
3769 3776
3770 3777 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
3771 3778 args in various places. No bugs so far, but it's a dangerous
3772 3779 practice.
3773 3780
3774 3781 2004-07-31 Fernando Perez <fperez@colorado.edu>
3775 3782
3776 3783 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
3777 3784 fix completion of files with dots in their names under most
3778 3785 profiles (pysh was OK because the completion order is different).
3779 3786
3780 3787 2004-07-27 Fernando Perez <fperez@colorado.edu>
3781 3788
3782 3789 * IPython/iplib.py (InteractiveShell.__init__): build dict of
3783 3790 keywords manually, b/c the one in keyword.py was removed in python
3784 3791 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
3785 3792 This is NOT a bug under python 2.3 and earlier.
3786 3793
3787 3794 2004-07-26 Fernando Perez <fperez@colorado.edu>
3788 3795
3789 3796 * IPython/ultraTB.py (VerboseTB.text): Add another
3790 3797 linecache.checkcache() call to try to prevent inspect.py from
3791 3798 crashing under python 2.3. I think this fixes
3792 3799 http://www.scipy.net/roundup/ipython/issue17.
3793 3800
3794 3801 2004-07-26 *** Released version 0.6.2
3795 3802
3796 3803 2004-07-26 Fernando Perez <fperez@colorado.edu>
3797 3804
3798 3805 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
3799 3806 fail for any number.
3800 3807 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
3801 3808 empty bookmarks.
3802 3809
3803 3810 2004-07-26 *** Released version 0.6.1
3804 3811
3805 3812 2004-07-26 Fernando Perez <fperez@colorado.edu>
3806 3813
3807 3814 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
3808 3815
3809 3816 * IPython/iplib.py (protect_filename): Applied Ville's patch for
3810 3817 escaping '()[]{}' in filenames.
3811 3818
3812 3819 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
3813 3820 Python 2.2 users who lack a proper shlex.split.
3814 3821
3815 3822 2004-07-19 Fernando Perez <fperez@colorado.edu>
3816 3823
3817 3824 * IPython/iplib.py (InteractiveShell.init_readline): Add support
3818 3825 for reading readline's init file. I follow the normal chain:
3819 3826 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
3820 3827 report by Mike Heeter. This closes
3821 3828 http://www.scipy.net/roundup/ipython/issue16.
3822 3829
3823 3830 2004-07-18 Fernando Perez <fperez@colorado.edu>
3824 3831
3825 3832 * IPython/iplib.py (__init__): Add better handling of '\' under
3826 3833 Win32 for filenames. After a patch by Ville.
3827 3834
3828 3835 2004-07-17 Fernando Perez <fperez@colorado.edu>
3829 3836
3830 3837 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3831 3838 autocalling would be triggered for 'foo is bar' if foo is
3832 3839 callable. I also cleaned up the autocall detection code to use a
3833 3840 regexp, which is faster. Bug reported by Alexander Schmolck.
3834 3841
3835 3842 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
3836 3843 '?' in them would confuse the help system. Reported by Alex
3837 3844 Schmolck.
3838 3845
3839 3846 2004-07-16 Fernando Perez <fperez@colorado.edu>
3840 3847
3841 3848 * IPython/GnuplotInteractive.py (__all__): added plot2.
3842 3849
3843 3850 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
3844 3851 plotting dictionaries, lists or tuples of 1d arrays.
3845 3852
3846 3853 * IPython/Magic.py (Magic.magic_hist): small clenaups and
3847 3854 optimizations.
3848 3855
3849 3856 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
3850 3857 the information which was there from Janko's original IPP code:
3851 3858
3852 3859 03.05.99 20:53 porto.ifm.uni-kiel.de
3853 3860 --Started changelog.
3854 3861 --make clear do what it say it does
3855 3862 --added pretty output of lines from inputcache
3856 3863 --Made Logger a mixin class, simplifies handling of switches
3857 3864 --Added own completer class. .string<TAB> expands to last history
3858 3865 line which starts with string. The new expansion is also present
3859 3866 with Ctrl-r from the readline library. But this shows, who this
3860 3867 can be done for other cases.
3861 3868 --Added convention that all shell functions should accept a
3862 3869 parameter_string This opens the door for different behaviour for
3863 3870 each function. @cd is a good example of this.
3864 3871
3865 3872 04.05.99 12:12 porto.ifm.uni-kiel.de
3866 3873 --added logfile rotation
3867 3874 --added new mainloop method which freezes first the namespace
3868 3875
3869 3876 07.05.99 21:24 porto.ifm.uni-kiel.de
3870 3877 --added the docreader classes. Now there is a help system.
3871 3878 -This is only a first try. Currently it's not easy to put new
3872 3879 stuff in the indices. But this is the way to go. Info would be
3873 3880 better, but HTML is every where and not everybody has an info
3874 3881 system installed and it's not so easy to change html-docs to info.
3875 3882 --added global logfile option
3876 3883 --there is now a hook for object inspection method pinfo needs to
3877 3884 be provided for this. Can be reached by two '??'.
3878 3885
3879 3886 08.05.99 20:51 porto.ifm.uni-kiel.de
3880 3887 --added a README
3881 3888 --bug in rc file. Something has changed so functions in the rc
3882 3889 file need to reference the shell and not self. Not clear if it's a
3883 3890 bug or feature.
3884 3891 --changed rc file for new behavior
3885 3892
3886 3893 2004-07-15 Fernando Perez <fperez@colorado.edu>
3887 3894
3888 3895 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3889 3896 cache was falling out of sync in bizarre manners when multi-line
3890 3897 input was present. Minor optimizations and cleanup.
3891 3898
3892 3899 (Logger): Remove old Changelog info for cleanup. This is the
3893 3900 information which was there from Janko's original code:
3894 3901
3895 3902 Changes to Logger: - made the default log filename a parameter
3896 3903
3897 3904 - put a check for lines beginning with !@? in log(). Needed
3898 3905 (even if the handlers properly log their lines) for mid-session
3899 3906 logging activation to work properly. Without this, lines logged
3900 3907 in mid session, which get read from the cache, would end up
3901 3908 'bare' (with !@? in the open) in the log. Now they are caught
3902 3909 and prepended with a #.
3903 3910
3904 3911 * IPython/iplib.py (InteractiveShell.init_readline): added check
3905 3912 in case MagicCompleter fails to be defined, so we don't crash.
3906 3913
3907 3914 2004-07-13 Fernando Perez <fperez@colorado.edu>
3908 3915
3909 3916 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
3910 3917 of EPS if the requested filename ends in '.eps'.
3911 3918
3912 3919 2004-07-04 Fernando Perez <fperez@colorado.edu>
3913 3920
3914 3921 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
3915 3922 escaping of quotes when calling the shell.
3916 3923
3917 3924 2004-07-02 Fernando Perez <fperez@colorado.edu>
3918 3925
3919 3926 * IPython/Prompts.py (CachedOutput.update): Fix problem with
3920 3927 gettext not working because we were clobbering '_'. Fixes
3921 3928 http://www.scipy.net/roundup/ipython/issue6.
3922 3929
3923 3930 2004-07-01 Fernando Perez <fperez@colorado.edu>
3924 3931
3925 3932 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
3926 3933 into @cd. Patch by Ville.
3927 3934
3928 3935 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3929 3936 new function to store things after ipmaker runs. Patch by Ville.
3930 3937 Eventually this will go away once ipmaker is removed and the class
3931 3938 gets cleaned up, but for now it's ok. Key functionality here is
3932 3939 the addition of the persistent storage mechanism, a dict for
3933 3940 keeping data across sessions (for now just bookmarks, but more can
3934 3941 be implemented later).
3935 3942
3936 3943 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
3937 3944 persistent across sections. Patch by Ville, I modified it
3938 3945 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
3939 3946 added a '-l' option to list all bookmarks.
3940 3947
3941 3948 * IPython/iplib.py (InteractiveShell.atexit_operations): new
3942 3949 center for cleanup. Registered with atexit.register(). I moved
3943 3950 here the old exit_cleanup(). After a patch by Ville.
3944 3951
3945 3952 * IPython/Magic.py (get_py_filename): added '~' to the accepted
3946 3953 characters in the hacked shlex_split for python 2.2.
3947 3954
3948 3955 * IPython/iplib.py (file_matches): more fixes to filenames with
3949 3956 whitespace in them. It's not perfect, but limitations in python's
3950 3957 readline make it impossible to go further.
3951 3958
3952 3959 2004-06-29 Fernando Perez <fperez@colorado.edu>
3953 3960
3954 3961 * IPython/iplib.py (file_matches): escape whitespace correctly in
3955 3962 filename completions. Bug reported by Ville.
3956 3963
3957 3964 2004-06-28 Fernando Perez <fperez@colorado.edu>
3958 3965
3959 3966 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
3960 3967 the history file will be called 'history-PROFNAME' (or just
3961 3968 'history' if no profile is loaded). I was getting annoyed at
3962 3969 getting my Numerical work history clobbered by pysh sessions.
3963 3970
3964 3971 * IPython/iplib.py (InteractiveShell.__init__): Internal
3965 3972 getoutputerror() function so that we can honor the system_verbose
3966 3973 flag for _all_ system calls. I also added escaping of #
3967 3974 characters here to avoid confusing Itpl.
3968 3975
3969 3976 * IPython/Magic.py (shlex_split): removed call to shell in
3970 3977 parse_options and replaced it with shlex.split(). The annoying
3971 3978 part was that in Python 2.2, shlex.split() doesn't exist, so I had
3972 3979 to backport it from 2.3, with several frail hacks (the shlex
3973 3980 module is rather limited in 2.2). Thanks to a suggestion by Ville
3974 3981 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
3975 3982 problem.
3976 3983
3977 3984 (Magic.magic_system_verbose): new toggle to print the actual
3978 3985 system calls made by ipython. Mainly for debugging purposes.
3979 3986
3980 3987 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
3981 3988 doesn't support persistence. Reported (and fix suggested) by
3982 3989 Travis Caldwell <travis_caldwell2000@yahoo.com>.
3983 3990
3984 3991 2004-06-26 Fernando Perez <fperez@colorado.edu>
3985 3992
3986 3993 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3987 3994 continue prompts.
3988 3995
3989 3996 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3990 3997 function (basically a big docstring) and a few more things here to
3991 3998 speedup startup. pysh.py is now very lightweight. We want because
3992 3999 it gets execfile'd, while InterpreterExec gets imported, so
3993 4000 byte-compilation saves time.
3994 4001
3995 4002 2004-06-25 Fernando Perez <fperez@colorado.edu>
3996 4003
3997 4004 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3998 4005 -NUM', which was recently broken.
3999 4006
4000 4007 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
4001 4008 in multi-line input (but not !!, which doesn't make sense there).
4002 4009
4003 4010 * IPython/UserConfig/ipythonrc: made autoindent on by default.
4004 4011 It's just too useful, and people can turn it off in the less
4005 4012 common cases where it's a problem.
4006 4013
4007 4014 2004-06-24 Fernando Perez <fperez@colorado.edu>
4008 4015
4009 4016 * IPython/iplib.py (InteractiveShell._prefilter): big change -
4010 4017 special syntaxes (like alias calling) is now allied in multi-line
4011 4018 input. This is still _very_ experimental, but it's necessary for
4012 4019 efficient shell usage combining python looping syntax with system
4013 4020 calls. For now it's restricted to aliases, I don't think it
4014 4021 really even makes sense to have this for magics.
4015 4022
4016 4023 2004-06-23 Fernando Perez <fperez@colorado.edu>
4017 4024
4018 4025 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
4019 4026 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
4020 4027
4021 4028 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
4022 4029 extensions under Windows (after code sent by Gary Bishop). The
4023 4030 extensions considered 'executable' are stored in IPython's rc
4024 4031 structure as win_exec_ext.
4025 4032
4026 4033 * IPython/genutils.py (shell): new function, like system() but
4027 4034 without return value. Very useful for interactive shell work.
4028 4035
4029 4036 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
4030 4037 delete aliases.
4031 4038
4032 4039 * IPython/iplib.py (InteractiveShell.alias_table_update): make
4033 4040 sure that the alias table doesn't contain python keywords.
4034 4041
4035 4042 2004-06-21 Fernando Perez <fperez@colorado.edu>
4036 4043
4037 4044 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
4038 4045 non-existent items are found in $PATH. Reported by Thorsten.
4039 4046
4040 4047 2004-06-20 Fernando Perez <fperez@colorado.edu>
4041 4048
4042 4049 * IPython/iplib.py (complete): modified the completer so that the
4043 4050 order of priorities can be easily changed at runtime.
4044 4051
4045 4052 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
4046 4053 Modified to auto-execute all lines beginning with '~', '/' or '.'.
4047 4054
4048 4055 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
4049 4056 expand Python variables prepended with $ in all system calls. The
4050 4057 same was done to InteractiveShell.handle_shell_escape. Now all
4051 4058 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
4052 4059 expansion of python variables and expressions according to the
4053 4060 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
4054 4061
4055 4062 Though PEP-215 has been rejected, a similar (but simpler) one
4056 4063 seems like it will go into Python 2.4, PEP-292 -
4057 4064 http://www.python.org/peps/pep-0292.html.
4058 4065
4059 4066 I'll keep the full syntax of PEP-215, since IPython has since the
4060 4067 start used Ka-Ping Yee's reference implementation discussed there
4061 4068 (Itpl), and I actually like the powerful semantics it offers.
4062 4069
4063 4070 In order to access normal shell variables, the $ has to be escaped
4064 4071 via an extra $. For example:
4065 4072
4066 4073 In [7]: PATH='a python variable'
4067 4074
4068 4075 In [8]: !echo $PATH
4069 4076 a python variable
4070 4077
4071 4078 In [9]: !echo $$PATH
4072 4079 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
4073 4080
4074 4081 (Magic.parse_options): escape $ so the shell doesn't evaluate
4075 4082 things prematurely.
4076 4083
4077 4084 * IPython/iplib.py (InteractiveShell.call_alias): added the
4078 4085 ability for aliases to expand python variables via $.
4079 4086
4080 4087 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
4081 4088 system, now there's a @rehash/@rehashx pair of magics. These work
4082 4089 like the csh rehash command, and can be invoked at any time. They
4083 4090 build a table of aliases to everything in the user's $PATH
4084 4091 (@rehash uses everything, @rehashx is slower but only adds
4085 4092 executable files). With this, the pysh.py-based shell profile can
4086 4093 now simply call rehash upon startup, and full access to all
4087 4094 programs in the user's path is obtained.
4088 4095
4089 4096 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
4090 4097 functionality is now fully in place. I removed the old dynamic
4091 4098 code generation based approach, in favor of a much lighter one
4092 4099 based on a simple dict. The advantage is that this allows me to
4093 4100 now have thousands of aliases with negligible cost (unthinkable
4094 4101 with the old system).
4095 4102
4096 4103 2004-06-19 Fernando Perez <fperez@colorado.edu>
4097 4104
4098 4105 * IPython/iplib.py (__init__): extended MagicCompleter class to
4099 4106 also complete (last in priority) on user aliases.
4100 4107
4101 4108 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
4102 4109 call to eval.
4103 4110 (ItplNS.__init__): Added a new class which functions like Itpl,
4104 4111 but allows configuring the namespace for the evaluation to occur
4105 4112 in.
4106 4113
4107 4114 2004-06-18 Fernando Perez <fperez@colorado.edu>
4108 4115
4109 4116 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
4110 4117 better message when 'exit' or 'quit' are typed (a common newbie
4111 4118 confusion).
4112 4119
4113 4120 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
4114 4121 check for Windows users.
4115 4122
4116 4123 * IPython/iplib.py (InteractiveShell.user_setup): removed
4117 4124 disabling of colors for Windows. I'll test at runtime and issue a
4118 4125 warning if Gary's readline isn't found, as to nudge users to
4119 4126 download it.
4120 4127
4121 4128 2004-06-16 Fernando Perez <fperez@colorado.edu>
4122 4129
4123 4130 * IPython/genutils.py (Stream.__init__): changed to print errors
4124 4131 to sys.stderr. I had a circular dependency here. Now it's
4125 4132 possible to run ipython as IDLE's shell (consider this pre-alpha,
4126 4133 since true stdout things end up in the starting terminal instead
4127 4134 of IDLE's out).
4128 4135
4129 4136 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
4130 4137 users who haven't # updated their prompt_in2 definitions. Remove
4131 4138 eventually.
4132 4139 (multiple_replace): added credit to original ASPN recipe.
4133 4140
4134 4141 2004-06-15 Fernando Perez <fperez@colorado.edu>
4135 4142
4136 4143 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
4137 4144 list of auto-defined aliases.
4138 4145
4139 4146 2004-06-13 Fernando Perez <fperez@colorado.edu>
4140 4147
4141 4148 * setup.py (scriptfiles): Don't trigger win_post_install unless an
4142 4149 install was really requested (so setup.py can be used for other
4143 4150 things under Windows).
4144 4151
4145 4152 2004-06-10 Fernando Perez <fperez@colorado.edu>
4146 4153
4147 4154 * IPython/Logger.py (Logger.create_log): Manually remove any old
4148 4155 backup, since os.remove may fail under Windows. Fixes bug
4149 4156 reported by Thorsten.
4150 4157
4151 4158 2004-06-09 Fernando Perez <fperez@colorado.edu>
4152 4159
4153 4160 * examples/example-embed.py: fixed all references to %n (replaced
4154 4161 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
4155 4162 for all examples and the manual as well.
4156 4163
4157 4164 2004-06-08 Fernando Perez <fperez@colorado.edu>
4158 4165
4159 4166 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
4160 4167 alignment and color management. All 3 prompt subsystems now
4161 4168 inherit from BasePrompt.
4162 4169
4163 4170 * tools/release: updates for windows installer build and tag rpms
4164 4171 with python version (since paths are fixed).
4165 4172
4166 4173 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
4167 4174 which will become eventually obsolete. Also fixed the default
4168 4175 prompt_in2 to use \D, so at least new users start with the correct
4169 4176 defaults.
4170 4177 WARNING: Users with existing ipythonrc files will need to apply
4171 4178 this fix manually!
4172 4179
4173 4180 * setup.py: make windows installer (.exe). This is finally the
4174 4181 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
4175 4182 which I hadn't included because it required Python 2.3 (or recent
4176 4183 distutils).
4177 4184
4178 4185 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
4179 4186 usage of new '\D' escape.
4180 4187
4181 4188 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
4182 4189 lacks os.getuid())
4183 4190 (CachedOutput.set_colors): Added the ability to turn coloring
4184 4191 on/off with @colors even for manually defined prompt colors. It
4185 4192 uses a nasty global, but it works safely and via the generic color
4186 4193 handling mechanism.
4187 4194 (Prompt2.__init__): Introduced new escape '\D' for continuation
4188 4195 prompts. It represents the counter ('\#') as dots.
4189 4196 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
4190 4197 need to update their ipythonrc files and replace '%n' with '\D' in
4191 4198 their prompt_in2 settings everywhere. Sorry, but there's
4192 4199 otherwise no clean way to get all prompts to properly align. The
4193 4200 ipythonrc shipped with IPython has been updated.
4194 4201
4195 4202 2004-06-07 Fernando Perez <fperez@colorado.edu>
4196 4203
4197 4204 * setup.py (isfile): Pass local_icons option to latex2html, so the
4198 4205 resulting HTML file is self-contained. Thanks to
4199 4206 dryice-AT-liu.com.cn for the tip.
4200 4207
4201 4208 * pysh.py: I created a new profile 'shell', which implements a
4202 4209 _rudimentary_ IPython-based shell. This is in NO WAY a realy
4203 4210 system shell, nor will it become one anytime soon. It's mainly
4204 4211 meant to illustrate the use of the new flexible bash-like prompts.
4205 4212 I guess it could be used by hardy souls for true shell management,
4206 4213 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
4207 4214 profile. This uses the InterpreterExec extension provided by
4208 4215 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
4209 4216
4210 4217 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
4211 4218 auto-align itself with the length of the previous input prompt
4212 4219 (taking into account the invisible color escapes).
4213 4220 (CachedOutput.__init__): Large restructuring of this class. Now
4214 4221 all three prompts (primary1, primary2, output) are proper objects,
4215 4222 managed by the 'parent' CachedOutput class. The code is still a
4216 4223 bit hackish (all prompts share state via a pointer to the cache),
4217 4224 but it's overall far cleaner than before.
4218 4225
4219 4226 * IPython/genutils.py (getoutputerror): modified to add verbose,
4220 4227 debug and header options. This makes the interface of all getout*
4221 4228 functions uniform.
4222 4229 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
4223 4230
4224 4231 * IPython/Magic.py (Magic.default_option): added a function to
4225 4232 allow registering default options for any magic command. This
4226 4233 makes it easy to have profiles which customize the magics globally
4227 4234 for a certain use. The values set through this function are
4228 4235 picked up by the parse_options() method, which all magics should
4229 4236 use to parse their options.
4230 4237
4231 4238 * IPython/genutils.py (warn): modified the warnings framework to
4232 4239 use the Term I/O class. I'm trying to slowly unify all of
4233 4240 IPython's I/O operations to pass through Term.
4234 4241
4235 4242 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
4236 4243 the secondary prompt to correctly match the length of the primary
4237 4244 one for any prompt. Now multi-line code will properly line up
4238 4245 even for path dependent prompts, such as the new ones available
4239 4246 via the prompt_specials.
4240 4247
4241 4248 2004-06-06 Fernando Perez <fperez@colorado.edu>
4242 4249
4243 4250 * IPython/Prompts.py (prompt_specials): Added the ability to have
4244 4251 bash-like special sequences in the prompts, which get
4245 4252 automatically expanded. Things like hostname, current working
4246 4253 directory and username are implemented already, but it's easy to
4247 4254 add more in the future. Thanks to a patch by W.J. van der Laan
4248 4255 <gnufnork-AT-hetdigitalegat.nl>
4249 4256 (prompt_specials): Added color support for prompt strings, so
4250 4257 users can define arbitrary color setups for their prompts.
4251 4258
4252 4259 2004-06-05 Fernando Perez <fperez@colorado.edu>
4253 4260
4254 4261 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
4255 4262 code to load Gary Bishop's readline and configure it
4256 4263 automatically. Thanks to Gary for help on this.
4257 4264
4258 4265 2004-06-01 Fernando Perez <fperez@colorado.edu>
4259 4266
4260 4267 * IPython/Logger.py (Logger.create_log): fix bug for logging
4261 4268 with no filename (previous fix was incomplete).
4262 4269
4263 4270 2004-05-25 Fernando Perez <fperez@colorado.edu>
4264 4271
4265 4272 * IPython/Magic.py (Magic.parse_options): fix bug where naked
4266 4273 parens would get passed to the shell.
4267 4274
4268 4275 2004-05-20 Fernando Perez <fperez@colorado.edu>
4269 4276
4270 4277 * IPython/Magic.py (Magic.magic_prun): changed default profile
4271 4278 sort order to 'time' (the more common profiling need).
4272 4279
4273 4280 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
4274 4281 so that source code shown is guaranteed in sync with the file on
4275 4282 disk (also changed in psource). Similar fix to the one for
4276 4283 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
4277 4284 <yann.ledu-AT-noos.fr>.
4278 4285
4279 4286 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
4280 4287 with a single option would not be correctly parsed. Closes
4281 4288 http://www.scipy.net/roundup/ipython/issue14. This bug had been
4282 4289 introduced in 0.6.0 (on 2004-05-06).
4283 4290
4284 4291 2004-05-13 *** Released version 0.6.0
4285 4292
4286 4293 2004-05-13 Fernando Perez <fperez@colorado.edu>
4287 4294
4288 4295 * debian/: Added debian/ directory to CVS, so that debian support
4289 4296 is publicly accessible. The debian package is maintained by Jack
4290 4297 Moffit <jack-AT-xiph.org>.
4291 4298
4292 4299 * Documentation: included the notes about an ipython-based system
4293 4300 shell (the hypothetical 'pysh') into the new_design.pdf document,
4294 4301 so that these ideas get distributed to users along with the
4295 4302 official documentation.
4296 4303
4297 4304 2004-05-10 Fernando Perez <fperez@colorado.edu>
4298 4305
4299 4306 * IPython/Logger.py (Logger.create_log): fix recently introduced
4300 4307 bug (misindented line) where logstart would fail when not given an
4301 4308 explicit filename.
4302 4309
4303 4310 2004-05-09 Fernando Perez <fperez@colorado.edu>
4304 4311
4305 4312 * IPython/Magic.py (Magic.parse_options): skip system call when
4306 4313 there are no options to look for. Faster, cleaner for the common
4307 4314 case.
4308 4315
4309 4316 * Documentation: many updates to the manual: describing Windows
4310 4317 support better, Gnuplot updates, credits, misc small stuff. Also
4311 4318 updated the new_design doc a bit.
4312 4319
4313 4320 2004-05-06 *** Released version 0.6.0.rc1
4314 4321
4315 4322 2004-05-06 Fernando Perez <fperez@colorado.edu>
4316 4323
4317 4324 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
4318 4325 operations to use the vastly more efficient list/''.join() method.
4319 4326 (FormattedTB.text): Fix
4320 4327 http://www.scipy.net/roundup/ipython/issue12 - exception source
4321 4328 extract not updated after reload. Thanks to Mike Salib
4322 4329 <msalib-AT-mit.edu> for pinning the source of the problem.
4323 4330 Fortunately, the solution works inside ipython and doesn't require
4324 4331 any changes to python proper.
4325 4332
4326 4333 * IPython/Magic.py (Magic.parse_options): Improved to process the
4327 4334 argument list as a true shell would (by actually using the
4328 4335 underlying system shell). This way, all @magics automatically get
4329 4336 shell expansion for variables. Thanks to a comment by Alex
4330 4337 Schmolck.
4331 4338
4332 4339 2004-04-04 Fernando Perez <fperez@colorado.edu>
4333 4340
4334 4341 * IPython/iplib.py (InteractiveShell.interact): Added a special
4335 4342 trap for a debugger quit exception, which is basically impossible
4336 4343 to handle by normal mechanisms, given what pdb does to the stack.
4337 4344 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
4338 4345
4339 4346 2004-04-03 Fernando Perez <fperez@colorado.edu>
4340 4347
4341 4348 * IPython/genutils.py (Term): Standardized the names of the Term
4342 4349 class streams to cin/cout/cerr, following C++ naming conventions
4343 4350 (I can't use in/out/err because 'in' is not a valid attribute
4344 4351 name).
4345 4352
4346 4353 * IPython/iplib.py (InteractiveShell.interact): don't increment
4347 4354 the prompt if there's no user input. By Daniel 'Dang' Griffith
4348 4355 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
4349 4356 Francois Pinard.
4350 4357
4351 4358 2004-04-02 Fernando Perez <fperez@colorado.edu>
4352 4359
4353 4360 * IPython/genutils.py (Stream.__init__): Modified to survive at
4354 4361 least importing in contexts where stdin/out/err aren't true file
4355 4362 objects, such as PyCrust (they lack fileno() and mode). However,
4356 4363 the recovery facilities which rely on these things existing will
4357 4364 not work.
4358 4365
4359 4366 2004-04-01 Fernando Perez <fperez@colorado.edu>
4360 4367
4361 4368 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
4362 4369 use the new getoutputerror() function, so it properly
4363 4370 distinguishes stdout/err.
4364 4371
4365 4372 * IPython/genutils.py (getoutputerror): added a function to
4366 4373 capture separately the standard output and error of a command.
4367 4374 After a comment from dang on the mailing lists. This code is
4368 4375 basically a modified version of commands.getstatusoutput(), from
4369 4376 the standard library.
4370 4377
4371 4378 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
4372 4379 '!!' as a special syntax (shorthand) to access @sx.
4373 4380
4374 4381 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
4375 4382 command and return its output as a list split on '\n'.
4376 4383
4377 4384 2004-03-31 Fernando Perez <fperez@colorado.edu>
4378 4385
4379 4386 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
4380 4387 method to dictionaries used as FakeModule instances if they lack
4381 4388 it. At least pydoc in python2.3 breaks for runtime-defined
4382 4389 functions without this hack. At some point I need to _really_
4383 4390 understand what FakeModule is doing, because it's a gross hack.
4384 4391 But it solves Arnd's problem for now...
4385 4392
4386 4393 2004-02-27 Fernando Perez <fperez@colorado.edu>
4387 4394
4388 4395 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
4389 4396 mode would behave erratically. Also increased the number of
4390 4397 possible logs in rotate mod to 999. Thanks to Rod Holland
4391 4398 <rhh@StructureLABS.com> for the report and fixes.
4392 4399
4393 4400 2004-02-26 Fernando Perez <fperez@colorado.edu>
4394 4401
4395 4402 * IPython/genutils.py (page): Check that the curses module really
4396 4403 has the initscr attribute before trying to use it. For some
4397 4404 reason, the Solaris curses module is missing this. I think this
4398 4405 should be considered a Solaris python bug, but I'm not sure.
4399 4406
4400 4407 2004-01-17 Fernando Perez <fperez@colorado.edu>
4401 4408
4402 4409 * IPython/genutils.py (Stream.__init__): Changes to try to make
4403 4410 ipython robust against stdin/out/err being closed by the user.
4404 4411 This is 'user error' (and blocks a normal python session, at least
4405 4412 the stdout case). However, Ipython should be able to survive such
4406 4413 instances of abuse as gracefully as possible. To simplify the
4407 4414 coding and maintain compatibility with Gary Bishop's Term
4408 4415 contributions, I've made use of classmethods for this. I think
4409 4416 this introduces a dependency on python 2.2.
4410 4417
4411 4418 2004-01-13 Fernando Perez <fperez@colorado.edu>
4412 4419
4413 4420 * IPython/numutils.py (exp_safe): simplified the code a bit and
4414 4421 removed the need for importing the kinds module altogether.
4415 4422
4416 4423 2004-01-06 Fernando Perez <fperez@colorado.edu>
4417 4424
4418 4425 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
4419 4426 a magic function instead, after some community feedback. No
4420 4427 special syntax will exist for it, but its name is deliberately
4421 4428 very short.
4422 4429
4423 4430 2003-12-20 Fernando Perez <fperez@colorado.edu>
4424 4431
4425 4432 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
4426 4433 new functionality, to automagically assign the result of a shell
4427 4434 command to a variable. I'll solicit some community feedback on
4428 4435 this before making it permanent.
4429 4436
4430 4437 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
4431 4438 requested about callables for which inspect couldn't obtain a
4432 4439 proper argspec. Thanks to a crash report sent by Etienne
4433 4440 Posthumus <etienne-AT-apple01.cs.vu.nl>.
4434 4441
4435 4442 2003-12-09 Fernando Perez <fperez@colorado.edu>
4436 4443
4437 4444 * IPython/genutils.py (page): patch for the pager to work across
4438 4445 various versions of Windows. By Gary Bishop.
4439 4446
4440 4447 2003-12-04 Fernando Perez <fperez@colorado.edu>
4441 4448
4442 4449 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
4443 4450 Gnuplot.py version 1.7, whose internal names changed quite a bit.
4444 4451 While I tested this and it looks ok, there may still be corner
4445 4452 cases I've missed.
4446 4453
4447 4454 2003-12-01 Fernando Perez <fperez@colorado.edu>
4448 4455
4449 4456 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
4450 4457 where a line like 'p,q=1,2' would fail because the automagic
4451 4458 system would be triggered for @p.
4452 4459
4453 4460 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
4454 4461 cleanups, code unmodified.
4455 4462
4456 4463 * IPython/genutils.py (Term): added a class for IPython to handle
4457 4464 output. In most cases it will just be a proxy for stdout/err, but
4458 4465 having this allows modifications to be made for some platforms,
4459 4466 such as handling color escapes under Windows. All of this code
4460 4467 was contributed by Gary Bishop, with minor modifications by me.
4461 4468 The actual changes affect many files.
4462 4469
4463 4470 2003-11-30 Fernando Perez <fperez@colorado.edu>
4464 4471
4465 4472 * IPython/iplib.py (file_matches): new completion code, courtesy
4466 4473 of Jeff Collins. This enables filename completion again under
4467 4474 python 2.3, which disabled it at the C level.
4468 4475
4469 4476 2003-11-11 Fernando Perez <fperez@colorado.edu>
4470 4477
4471 4478 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
4472 4479 for Numeric.array(map(...)), but often convenient.
4473 4480
4474 4481 2003-11-05 Fernando Perez <fperez@colorado.edu>
4475 4482
4476 4483 * IPython/numutils.py (frange): Changed a call from int() to
4477 4484 int(round()) to prevent a problem reported with arange() in the
4478 4485 numpy list.
4479 4486
4480 4487 2003-10-06 Fernando Perez <fperez@colorado.edu>
4481 4488
4482 4489 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
4483 4490 prevent crashes if sys lacks an argv attribute (it happens with
4484 4491 embedded interpreters which build a bare-bones sys module).
4485 4492 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
4486 4493
4487 4494 2003-09-24 Fernando Perez <fperez@colorado.edu>
4488 4495
4489 4496 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
4490 4497 to protect against poorly written user objects where __getattr__
4491 4498 raises exceptions other than AttributeError. Thanks to a bug
4492 4499 report by Oliver Sander <osander-AT-gmx.de>.
4493 4500
4494 4501 * IPython/FakeModule.py (FakeModule.__repr__): this method was
4495 4502 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
4496 4503
4497 4504 2003-09-09 Fernando Perez <fperez@colorado.edu>
4498 4505
4499 4506 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4500 4507 unpacking a list whith a callable as first element would
4501 4508 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
4502 4509 Collins.
4503 4510
4504 4511 2003-08-25 *** Released version 0.5.0
4505 4512
4506 4513 2003-08-22 Fernando Perez <fperez@colorado.edu>
4507 4514
4508 4515 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
4509 4516 improperly defined user exceptions. Thanks to feedback from Mark
4510 4517 Russell <mrussell-AT-verio.net>.
4511 4518
4512 4519 2003-08-20 Fernando Perez <fperez@colorado.edu>
4513 4520
4514 4521 * IPython/OInspect.py (Inspector.pinfo): changed String Form
4515 4522 printing so that it would print multi-line string forms starting
4516 4523 with a new line. This way the formatting is better respected for
4517 4524 objects which work hard to make nice string forms.
4518 4525
4519 4526 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
4520 4527 autocall would overtake data access for objects with both
4521 4528 __getitem__ and __call__.
4522 4529
4523 4530 2003-08-19 *** Released version 0.5.0-rc1
4524 4531
4525 4532 2003-08-19 Fernando Perez <fperez@colorado.edu>
4526 4533
4527 4534 * IPython/deep_reload.py (load_tail): single tiny change here
4528 4535 seems to fix the long-standing bug of dreload() failing to work
4529 4536 for dotted names. But this module is pretty tricky, so I may have
4530 4537 missed some subtlety. Needs more testing!.
4531 4538
4532 4539 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
4533 4540 exceptions which have badly implemented __str__ methods.
4534 4541 (VerboseTB.text): harden against inspect.getinnerframes crashing,
4535 4542 which I've been getting reports about from Python 2.3 users. I
4536 4543 wish I had a simple test case to reproduce the problem, so I could
4537 4544 either write a cleaner workaround or file a bug report if
4538 4545 necessary.
4539 4546
4540 4547 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
4541 4548 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
4542 4549 a bug report by Tjabo Kloppenburg.
4543 4550
4544 4551 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
4545 4552 crashes. Wrapped the pdb call in a blanket try/except, since pdb
4546 4553 seems rather unstable. Thanks to a bug report by Tjabo
4547 4554 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
4548 4555
4549 4556 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
4550 4557 this out soon because of the critical fixes in the inner loop for
4551 4558 generators.
4552 4559
4553 4560 * IPython/Magic.py (Magic.getargspec): removed. This (and
4554 4561 _get_def) have been obsoleted by OInspect for a long time, I
4555 4562 hadn't noticed that they were dead code.
4556 4563 (Magic._ofind): restored _ofind functionality for a few literals
4557 4564 (those in ["''",'""','[]','{}','()']). But it won't work anymore
4558 4565 for things like "hello".capitalize?, since that would require a
4559 4566 potentially dangerous eval() again.
4560 4567
4561 4568 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
4562 4569 logic a bit more to clean up the escapes handling and minimize the
4563 4570 use of _ofind to only necessary cases. The interactive 'feel' of
4564 4571 IPython should have improved quite a bit with the changes in
4565 4572 _prefilter and _ofind (besides being far safer than before).
4566 4573
4567 4574 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
4568 4575 obscure, never reported). Edit would fail to find the object to
4569 4576 edit under some circumstances.
4570 4577 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
4571 4578 which were causing double-calling of generators. Those eval calls
4572 4579 were _very_ dangerous, since code with side effects could be
4573 4580 triggered. As they say, 'eval is evil'... These were the
4574 4581 nastiest evals in IPython. Besides, _ofind is now far simpler,
4575 4582 and it should also be quite a bit faster. Its use of inspect is
4576 4583 also safer, so perhaps some of the inspect-related crashes I've
4577 4584 seen lately with Python 2.3 might be taken care of. That will
4578 4585 need more testing.
4579 4586
4580 4587 2003-08-17 Fernando Perez <fperez@colorado.edu>
4581 4588
4582 4589 * IPython/iplib.py (InteractiveShell._prefilter): significant
4583 4590 simplifications to the logic for handling user escapes. Faster
4584 4591 and simpler code.
4585 4592
4586 4593 2003-08-14 Fernando Perez <fperez@colorado.edu>
4587 4594
4588 4595 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
4589 4596 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
4590 4597 but it should be quite a bit faster. And the recursive version
4591 4598 generated O(log N) intermediate storage for all rank>1 arrays,
4592 4599 even if they were contiguous.
4593 4600 (l1norm): Added this function.
4594 4601 (norm): Added this function for arbitrary norms (including
4595 4602 l-infinity). l1 and l2 are still special cases for convenience
4596 4603 and speed.
4597 4604
4598 4605 2003-08-03 Fernando Perez <fperez@colorado.edu>
4599 4606
4600 4607 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
4601 4608 exceptions, which now raise PendingDeprecationWarnings in Python
4602 4609 2.3. There were some in Magic and some in Gnuplot2.
4603 4610
4604 4611 2003-06-30 Fernando Perez <fperez@colorado.edu>
4605 4612
4606 4613 * IPython/genutils.py (page): modified to call curses only for
4607 4614 terminals where TERM=='xterm'. After problems under many other
4608 4615 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
4609 4616
4610 4617 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
4611 4618 would be triggered when readline was absent. This was just an old
4612 4619 debugging statement I'd forgotten to take out.
4613 4620
4614 4621 2003-06-20 Fernando Perez <fperez@colorado.edu>
4615 4622
4616 4623 * IPython/genutils.py (clock): modified to return only user time
4617 4624 (not counting system time), after a discussion on scipy. While
4618 4625 system time may be a useful quantity occasionally, it may much
4619 4626 more easily be skewed by occasional swapping or other similar
4620 4627 activity.
4621 4628
4622 4629 2003-06-05 Fernando Perez <fperez@colorado.edu>
4623 4630
4624 4631 * IPython/numutils.py (identity): new function, for building
4625 4632 arbitrary rank Kronecker deltas (mostly backwards compatible with
4626 4633 Numeric.identity)
4627 4634
4628 4635 2003-06-03 Fernando Perez <fperez@colorado.edu>
4629 4636
4630 4637 * IPython/iplib.py (InteractiveShell.handle_magic): protect
4631 4638 arguments passed to magics with spaces, to allow trailing '\' to
4632 4639 work normally (mainly for Windows users).
4633 4640
4634 4641 2003-05-29 Fernando Perez <fperez@colorado.edu>
4635 4642
4636 4643 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
4637 4644 instead of pydoc.help. This fixes a bizarre behavior where
4638 4645 printing '%s' % locals() would trigger the help system. Now
4639 4646 ipython behaves like normal python does.
4640 4647
4641 4648 Note that if one does 'from pydoc import help', the bizarre
4642 4649 behavior returns, but this will also happen in normal python, so
4643 4650 it's not an ipython bug anymore (it has to do with how pydoc.help
4644 4651 is implemented).
4645 4652
4646 4653 2003-05-22 Fernando Perez <fperez@colorado.edu>
4647 4654
4648 4655 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
4649 4656 return [] instead of None when nothing matches, also match to end
4650 4657 of line. Patch by Gary Bishop.
4651 4658
4652 4659 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
4653 4660 protection as before, for files passed on the command line. This
4654 4661 prevents the CrashHandler from kicking in if user files call into
4655 4662 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
4656 4663 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
4657 4664
4658 4665 2003-05-20 *** Released version 0.4.0
4659 4666
4660 4667 2003-05-20 Fernando Perez <fperez@colorado.edu>
4661 4668
4662 4669 * setup.py: added support for manpages. It's a bit hackish b/c of
4663 4670 a bug in the way the bdist_rpm distutils target handles gzipped
4664 4671 manpages, but it works. After a patch by Jack.
4665 4672
4666 4673 2003-05-19 Fernando Perez <fperez@colorado.edu>
4667 4674
4668 4675 * IPython/numutils.py: added a mockup of the kinds module, since
4669 4676 it was recently removed from Numeric. This way, numutils will
4670 4677 work for all users even if they are missing kinds.
4671 4678
4672 4679 * IPython/Magic.py (Magic._ofind): Harden against an inspect
4673 4680 failure, which can occur with SWIG-wrapped extensions. After a
4674 4681 crash report from Prabhu.
4675 4682
4676 4683 2003-05-16 Fernando Perez <fperez@colorado.edu>
4677 4684
4678 4685 * IPython/iplib.py (InteractiveShell.excepthook): New method to
4679 4686 protect ipython from user code which may call directly
4680 4687 sys.excepthook (this looks like an ipython crash to the user, even
4681 4688 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4682 4689 This is especially important to help users of WxWindows, but may
4683 4690 also be useful in other cases.
4684 4691
4685 4692 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
4686 4693 an optional tb_offset to be specified, and to preserve exception
4687 4694 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4688 4695
4689 4696 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
4690 4697
4691 4698 2003-05-15 Fernando Perez <fperez@colorado.edu>
4692 4699
4693 4700 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
4694 4701 installing for a new user under Windows.
4695 4702
4696 4703 2003-05-12 Fernando Perez <fperez@colorado.edu>
4697 4704
4698 4705 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
4699 4706 handler for Emacs comint-based lines. Currently it doesn't do
4700 4707 much (but importantly, it doesn't update the history cache). In
4701 4708 the future it may be expanded if Alex needs more functionality
4702 4709 there.
4703 4710
4704 4711 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
4705 4712 info to crash reports.
4706 4713
4707 4714 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
4708 4715 just like Python's -c. Also fixed crash with invalid -color
4709 4716 option value at startup. Thanks to Will French
4710 4717 <wfrench-AT-bestweb.net> for the bug report.
4711 4718
4712 4719 2003-05-09 Fernando Perez <fperez@colorado.edu>
4713 4720
4714 4721 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
4715 4722 to EvalDict (it's a mapping, after all) and simplified its code
4716 4723 quite a bit, after a nice discussion on c.l.py where Gustavo
4717 4724 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
4718 4725
4719 4726 2003-04-30 Fernando Perez <fperez@colorado.edu>
4720 4727
4721 4728 * IPython/genutils.py (timings_out): modified it to reduce its
4722 4729 overhead in the common reps==1 case.
4723 4730
4724 4731 2003-04-29 Fernando Perez <fperez@colorado.edu>
4725 4732
4726 4733 * IPython/genutils.py (timings_out): Modified to use the resource
4727 4734 module, which avoids the wraparound problems of time.clock().
4728 4735
4729 4736 2003-04-17 *** Released version 0.2.15pre4
4730 4737
4731 4738 2003-04-17 Fernando Perez <fperez@colorado.edu>
4732 4739
4733 4740 * setup.py (scriptfiles): Split windows-specific stuff over to a
4734 4741 separate file, in an attempt to have a Windows GUI installer.
4735 4742 That didn't work, but part of the groundwork is done.
4736 4743
4737 4744 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
4738 4745 indent/unindent with 4 spaces. Particularly useful in combination
4739 4746 with the new auto-indent option.
4740 4747
4741 4748 2003-04-16 Fernando Perez <fperez@colorado.edu>
4742 4749
4743 4750 * IPython/Magic.py: various replacements of self.rc for
4744 4751 self.shell.rc. A lot more remains to be done to fully disentangle
4745 4752 this class from the main Shell class.
4746 4753
4747 4754 * IPython/GnuplotRuntime.py: added checks for mouse support so
4748 4755 that we don't try to enable it if the current gnuplot doesn't
4749 4756 really support it. Also added checks so that we don't try to
4750 4757 enable persist under Windows (where Gnuplot doesn't recognize the
4751 4758 option).
4752 4759
4753 4760 * IPython/iplib.py (InteractiveShell.interact): Added optional
4754 4761 auto-indenting code, after a patch by King C. Shu
4755 4762 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
4756 4763 get along well with pasting indented code. If I ever figure out
4757 4764 how to make that part go well, it will become on by default.
4758 4765
4759 4766 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
4760 4767 crash ipython if there was an unmatched '%' in the user's prompt
4761 4768 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4762 4769
4763 4770 * IPython/iplib.py (InteractiveShell.interact): removed the
4764 4771 ability to ask the user whether he wants to crash or not at the
4765 4772 'last line' exception handler. Calling functions at that point
4766 4773 changes the stack, and the error reports would have incorrect
4767 4774 tracebacks.
4768 4775
4769 4776 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
4770 4777 pass through a peger a pretty-printed form of any object. After a
4771 4778 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
4772 4779
4773 4780 2003-04-14 Fernando Perez <fperez@colorado.edu>
4774 4781
4775 4782 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
4776 4783 all files in ~ would be modified at first install (instead of
4777 4784 ~/.ipython). This could be potentially disastrous, as the
4778 4785 modification (make line-endings native) could damage binary files.
4779 4786
4780 4787 2003-04-10 Fernando Perez <fperez@colorado.edu>
4781 4788
4782 4789 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
4783 4790 handle only lines which are invalid python. This now means that
4784 4791 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
4785 4792 for the bug report.
4786 4793
4787 4794 2003-04-01 Fernando Perez <fperez@colorado.edu>
4788 4795
4789 4796 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
4790 4797 where failing to set sys.last_traceback would crash pdb.pm().
4791 4798 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
4792 4799 report.
4793 4800
4794 4801 2003-03-25 Fernando Perez <fperez@colorado.edu>
4795 4802
4796 4803 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
4797 4804 before printing it (it had a lot of spurious blank lines at the
4798 4805 end).
4799 4806
4800 4807 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
4801 4808 output would be sent 21 times! Obviously people don't use this
4802 4809 too often, or I would have heard about it.
4803 4810
4804 4811 2003-03-24 Fernando Perez <fperez@colorado.edu>
4805 4812
4806 4813 * setup.py (scriptfiles): renamed the data_files parameter from
4807 4814 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
4808 4815 for the patch.
4809 4816
4810 4817 2003-03-20 Fernando Perez <fperez@colorado.edu>
4811 4818
4812 4819 * IPython/genutils.py (error): added error() and fatal()
4813 4820 functions.
4814 4821
4815 4822 2003-03-18 *** Released version 0.2.15pre3
4816 4823
4817 4824 2003-03-18 Fernando Perez <fperez@colorado.edu>
4818 4825
4819 4826 * setupext/install_data_ext.py
4820 4827 (install_data_ext.initialize_options): Class contributed by Jack
4821 4828 Moffit for fixing the old distutils hack. He is sending this to
4822 4829 the distutils folks so in the future we may not need it as a
4823 4830 private fix.
4824 4831
4825 4832 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
4826 4833 changes for Debian packaging. See his patch for full details.
4827 4834 The old distutils hack of making the ipythonrc* files carry a
4828 4835 bogus .py extension is gone, at last. Examples were moved to a
4829 4836 separate subdir under doc/, and the separate executable scripts
4830 4837 now live in their own directory. Overall a great cleanup. The
4831 4838 manual was updated to use the new files, and setup.py has been
4832 4839 fixed for this setup.
4833 4840
4834 4841 * IPython/PyColorize.py (Parser.usage): made non-executable and
4835 4842 created a pycolor wrapper around it to be included as a script.
4836 4843
4837 4844 2003-03-12 *** Released version 0.2.15pre2
4838 4845
4839 4846 2003-03-12 Fernando Perez <fperez@colorado.edu>
4840 4847
4841 4848 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4842 4849 long-standing problem with garbage characters in some terminals.
4843 4850 The issue was really that the \001 and \002 escapes must _only_ be
4844 4851 passed to input prompts (which call readline), but _never_ to
4845 4852 normal text to be printed on screen. I changed ColorANSI to have
4846 4853 two classes: TermColors and InputTermColors, each with the
4847 4854 appropriate escapes for input prompts or normal text. The code in
4848 4855 Prompts.py got slightly more complicated, but this very old and
4849 4856 annoying bug is finally fixed.
4850 4857
4851 4858 All the credit for nailing down the real origin of this problem
4852 4859 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4853 4860 *Many* thanks to him for spending quite a bit of effort on this.
4854 4861
4855 4862 2003-03-05 *** Released version 0.2.15pre1
4856 4863
4857 4864 2003-03-03 Fernando Perez <fperez@colorado.edu>
4858 4865
4859 4866 * IPython/FakeModule.py: Moved the former _FakeModule to a
4860 4867 separate file, because it's also needed by Magic (to fix a similar
4861 4868 pickle-related issue in @run).
4862 4869
4863 4870 2003-03-02 Fernando Perez <fperez@colorado.edu>
4864 4871
4865 4872 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4866 4873 the autocall option at runtime.
4867 4874 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4868 4875 across Magic.py to start separating Magic from InteractiveShell.
4869 4876 (Magic._ofind): Fixed to return proper namespace for dotted
4870 4877 names. Before, a dotted name would always return 'not currently
4871 4878 defined', because it would find the 'parent'. s.x would be found,
4872 4879 but since 'x' isn't defined by itself, it would get confused.
4873 4880 (Magic.magic_run): Fixed pickling problems reported by Ralf
4874 4881 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4875 4882 that I'd used when Mike Heeter reported similar issues at the
4876 4883 top-level, but now for @run. It boils down to injecting the
4877 4884 namespace where code is being executed with something that looks
4878 4885 enough like a module to fool pickle.dump(). Since a pickle stores
4879 4886 a named reference to the importing module, we need this for
4880 4887 pickles to save something sensible.
4881 4888
4882 4889 * IPython/ipmaker.py (make_IPython): added an autocall option.
4883 4890
4884 4891 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4885 4892 the auto-eval code. Now autocalling is an option, and the code is
4886 4893 also vastly safer. There is no more eval() involved at all.
4887 4894
4888 4895 2003-03-01 Fernando Perez <fperez@colorado.edu>
4889 4896
4890 4897 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4891 4898 dict with named keys instead of a tuple.
4892 4899
4893 4900 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4894 4901
4895 4902 * setup.py (make_shortcut): Fixed message about directories
4896 4903 created during Windows installation (the directories were ok, just
4897 4904 the printed message was misleading). Thanks to Chris Liechti
4898 4905 <cliechti-AT-gmx.net> for the heads up.
4899 4906
4900 4907 2003-02-21 Fernando Perez <fperez@colorado.edu>
4901 4908
4902 4909 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
4903 4910 of ValueError exception when checking for auto-execution. This
4904 4911 one is raised by things like Numeric arrays arr.flat when the
4905 4912 array is non-contiguous.
4906 4913
4907 4914 2003-01-31 Fernando Perez <fperez@colorado.edu>
4908 4915
4909 4916 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
4910 4917 not return any value at all (even though the command would get
4911 4918 executed).
4912 4919 (xsys): Flush stdout right after printing the command to ensure
4913 4920 proper ordering of commands and command output in the total
4914 4921 output.
4915 4922 (SystemExec/xsys/bq): Switched the names of xsys/bq and
4916 4923 system/getoutput as defaults. The old ones are kept for
4917 4924 compatibility reasons, so no code which uses this library needs
4918 4925 changing.
4919 4926
4920 4927 2003-01-27 *** Released version 0.2.14
4921 4928
4922 4929 2003-01-25 Fernando Perez <fperez@colorado.edu>
4923 4930
4924 4931 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
4925 4932 functions defined in previous edit sessions could not be re-edited
4926 4933 (because the temp files were immediately removed). Now temp files
4927 4934 are removed only at IPython's exit.
4928 4935 (Magic.magic_run): Improved @run to perform shell-like expansions
4929 4936 on its arguments (~users and $VARS). With this, @run becomes more
4930 4937 like a normal command-line.
4931 4938
4932 4939 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
4933 4940 bugs related to embedding and cleaned up that code. A fairly
4934 4941 important one was the impossibility to access the global namespace
4935 4942 through the embedded IPython (only local variables were visible).
4936 4943
4937 4944 2003-01-14 Fernando Perez <fperez@colorado.edu>
4938 4945
4939 4946 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
4940 4947 auto-calling to be a bit more conservative. Now it doesn't get
4941 4948 triggered if any of '!=()<>' are in the rest of the input line, to
4942 4949 allow comparing callables. Thanks to Alex for the heads up.
4943 4950
4944 4951 2003-01-07 Fernando Perez <fperez@colorado.edu>
4945 4952
4946 4953 * IPython/genutils.py (page): fixed estimation of the number of
4947 4954 lines in a string to be paged to simply count newlines. This
4948 4955 prevents over-guessing due to embedded escape sequences. A better
4949 4956 long-term solution would involve stripping out the control chars
4950 4957 for the count, but it's potentially so expensive I just don't
4951 4958 think it's worth doing.
4952 4959
4953 4960 2002-12-19 *** Released version 0.2.14pre50
4954 4961
4955 4962 2002-12-19 Fernando Perez <fperez@colorado.edu>
4956 4963
4957 4964 * tools/release (version): Changed release scripts to inform
4958 4965 Andrea and build a NEWS file with a list of recent changes.
4959 4966
4960 4967 * IPython/ColorANSI.py (__all__): changed terminal detection
4961 4968 code. Seems to work better for xterms without breaking
4962 4969 konsole. Will need more testing to determine if WinXP and Mac OSX
4963 4970 also work ok.
4964 4971
4965 4972 2002-12-18 *** Released version 0.2.14pre49
4966 4973
4967 4974 2002-12-18 Fernando Perez <fperez@colorado.edu>
4968 4975
4969 4976 * Docs: added new info about Mac OSX, from Andrea.
4970 4977
4971 4978 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
4972 4979 allow direct plotting of python strings whose format is the same
4973 4980 of gnuplot data files.
4974 4981
4975 4982 2002-12-16 Fernando Perez <fperez@colorado.edu>
4976 4983
4977 4984 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
4978 4985 value of exit question to be acknowledged.
4979 4986
4980 4987 2002-12-03 Fernando Perez <fperez@colorado.edu>
4981 4988
4982 4989 * IPython/ipmaker.py: removed generators, which had been added
4983 4990 by mistake in an earlier debugging run. This was causing trouble
4984 4991 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
4985 4992 for pointing this out.
4986 4993
4987 4994 2002-11-17 Fernando Perez <fperez@colorado.edu>
4988 4995
4989 4996 * Manual: updated the Gnuplot section.
4990 4997
4991 4998 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4992 4999 a much better split of what goes in Runtime and what goes in
4993 5000 Interactive.
4994 5001
4995 5002 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4996 5003 being imported from iplib.
4997 5004
4998 5005 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4999 5006 for command-passing. Now the global Gnuplot instance is called
5000 5007 'gp' instead of 'g', which was really a far too fragile and
5001 5008 common name.
5002 5009
5003 5010 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
5004 5011 bounding boxes generated by Gnuplot for square plots.
5005 5012
5006 5013 * IPython/genutils.py (popkey): new function added. I should
5007 5014 suggest this on c.l.py as a dict method, it seems useful.
5008 5015
5009 5016 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
5010 5017 to transparently handle PostScript generation. MUCH better than
5011 5018 the previous plot_eps/replot_eps (which I removed now). The code
5012 5019 is also fairly clean and well documented now (including
5013 5020 docstrings).
5014 5021
5015 5022 2002-11-13 Fernando Perez <fperez@colorado.edu>
5016 5023
5017 5024 * IPython/Magic.py (Magic.magic_edit): fixed docstring
5018 5025 (inconsistent with options).
5019 5026
5020 5027 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
5021 5028 manually disabled, I don't know why. Fixed it.
5022 5029 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
5023 5030 eps output.
5024 5031
5025 5032 2002-11-12 Fernando Perez <fperez@colorado.edu>
5026 5033
5027 5034 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
5028 5035 don't propagate up to caller. Fixes crash reported by François
5029 5036 Pinard.
5030 5037
5031 5038 2002-11-09 Fernando Perez <fperez@colorado.edu>
5032 5039
5033 5040 * IPython/ipmaker.py (make_IPython): fixed problem with writing
5034 5041 history file for new users.
5035 5042 (make_IPython): fixed bug where initial install would leave the
5036 5043 user running in the .ipython dir.
5037 5044 (make_IPython): fixed bug where config dir .ipython would be
5038 5045 created regardless of the given -ipythondir option. Thanks to Cory
5039 5046 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
5040 5047
5041 5048 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
5042 5049 type confirmations. Will need to use it in all of IPython's code
5043 5050 consistently.
5044 5051
5045 5052 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
5046 5053 context to print 31 lines instead of the default 5. This will make
5047 5054 the crash reports extremely detailed in case the problem is in
5048 5055 libraries I don't have access to.
5049 5056
5050 5057 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
5051 5058 line of defense' code to still crash, but giving users fair
5052 5059 warning. I don't want internal errors to go unreported: if there's
5053 5060 an internal problem, IPython should crash and generate a full
5054 5061 report.
5055 5062
5056 5063 2002-11-08 Fernando Perez <fperez@colorado.edu>
5057 5064
5058 5065 * IPython/iplib.py (InteractiveShell.interact): added code to trap
5059 5066 otherwise uncaught exceptions which can appear if people set
5060 5067 sys.stdout to something badly broken. Thanks to a crash report
5061 5068 from henni-AT-mail.brainbot.com.
5062 5069
5063 5070 2002-11-04 Fernando Perez <fperez@colorado.edu>
5064 5071
5065 5072 * IPython/iplib.py (InteractiveShell.interact): added
5066 5073 __IPYTHON__active to the builtins. It's a flag which goes on when
5067 5074 the interaction starts and goes off again when it stops. This
5068 5075 allows embedding code to detect being inside IPython. Before this
5069 5076 was done via __IPYTHON__, but that only shows that an IPython
5070 5077 instance has been created.
5071 5078
5072 5079 * IPython/Magic.py (Magic.magic_env): I realized that in a
5073 5080 UserDict, instance.data holds the data as a normal dict. So I
5074 5081 modified @env to return os.environ.data instead of rebuilding a
5075 5082 dict by hand.
5076 5083
5077 5084 2002-11-02 Fernando Perez <fperez@colorado.edu>
5078 5085
5079 5086 * IPython/genutils.py (warn): changed so that level 1 prints no
5080 5087 header. Level 2 is now the default (with 'WARNING' header, as
5081 5088 before). I think I tracked all places where changes were needed in
5082 5089 IPython, but outside code using the old level numbering may have
5083 5090 broken.
5084 5091
5085 5092 * IPython/iplib.py (InteractiveShell.runcode): added this to
5086 5093 handle the tracebacks in SystemExit traps correctly. The previous
5087 5094 code (through interact) was printing more of the stack than
5088 5095 necessary, showing IPython internal code to the user.
5089 5096
5090 5097 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
5091 5098 default. Now that the default at the confirmation prompt is yes,
5092 5099 it's not so intrusive. François' argument that ipython sessions
5093 5100 tend to be complex enough not to lose them from an accidental C-d,
5094 5101 is a valid one.
5095 5102
5096 5103 * IPython/iplib.py (InteractiveShell.interact): added a
5097 5104 showtraceback() call to the SystemExit trap, and modified the exit
5098 5105 confirmation to have yes as the default.
5099 5106
5100 5107 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
5101 5108 this file. It's been gone from the code for a long time, this was
5102 5109 simply leftover junk.
5103 5110
5104 5111 2002-11-01 Fernando Perez <fperez@colorado.edu>
5105 5112
5106 5113 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
5107 5114 added. If set, IPython now traps EOF and asks for
5108 5115 confirmation. After a request by François Pinard.
5109 5116
5110 5117 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
5111 5118 of @abort, and with a new (better) mechanism for handling the
5112 5119 exceptions.
5113 5120
5114 5121 2002-10-27 Fernando Perez <fperez@colorado.edu>
5115 5122
5116 5123 * IPython/usage.py (__doc__): updated the --help information and
5117 5124 the ipythonrc file to indicate that -log generates
5118 5125 ./ipython.log. Also fixed the corresponding info in @logstart.
5119 5126 This and several other fixes in the manuals thanks to reports by
5120 5127 François Pinard <pinard-AT-iro.umontreal.ca>.
5121 5128
5122 5129 * IPython/Logger.py (Logger.switch_log): Fixed error message to
5123 5130 refer to @logstart (instead of @log, which doesn't exist).
5124 5131
5125 5132 * IPython/iplib.py (InteractiveShell._prefilter): fixed
5126 5133 AttributeError crash. Thanks to Christopher Armstrong
5127 5134 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
5128 5135 introduced recently (in 0.2.14pre37) with the fix to the eval
5129 5136 problem mentioned below.
5130 5137
5131 5138 2002-10-17 Fernando Perez <fperez@colorado.edu>
5132 5139
5133 5140 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
5134 5141 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
5135 5142
5136 5143 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
5137 5144 this function to fix a problem reported by Alex Schmolck. He saw
5138 5145 it with list comprehensions and generators, which were getting
5139 5146 called twice. The real problem was an 'eval' call in testing for
5140 5147 automagic which was evaluating the input line silently.
5141 5148
5142 5149 This is a potentially very nasty bug, if the input has side
5143 5150 effects which must not be repeated. The code is much cleaner now,
5144 5151 without any blanket 'except' left and with a regexp test for
5145 5152 actual function names.
5146 5153
5147 5154 But an eval remains, which I'm not fully comfortable with. I just
5148 5155 don't know how to find out if an expression could be a callable in
5149 5156 the user's namespace without doing an eval on the string. However
5150 5157 that string is now much more strictly checked so that no code
5151 5158 slips by, so the eval should only happen for things that can
5152 5159 really be only function/method names.
5153 5160
5154 5161 2002-10-15 Fernando Perez <fperez@colorado.edu>
5155 5162
5156 5163 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
5157 5164 OSX information to main manual, removed README_Mac_OSX file from
5158 5165 distribution. Also updated credits for recent additions.
5159 5166
5160 5167 2002-10-10 Fernando Perez <fperez@colorado.edu>
5161 5168
5162 5169 * README_Mac_OSX: Added a README for Mac OSX users for fixing
5163 5170 terminal-related issues. Many thanks to Andrea Riciputi
5164 5171 <andrea.riciputi-AT-libero.it> for writing it.
5165 5172
5166 5173 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
5167 5174 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5168 5175
5169 5176 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
5170 5177 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
5171 5178 <syver-en-AT-online.no> who both submitted patches for this problem.
5172 5179
5173 5180 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
5174 5181 global embedding to make sure that things don't overwrite user
5175 5182 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
5176 5183
5177 5184 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
5178 5185 compatibility. Thanks to Hayden Callow
5179 5186 <h.callow-AT-elec.canterbury.ac.nz>
5180 5187
5181 5188 2002-10-04 Fernando Perez <fperez@colorado.edu>
5182 5189
5183 5190 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
5184 5191 Gnuplot.File objects.
5185 5192
5186 5193 2002-07-23 Fernando Perez <fperez@colorado.edu>
5187 5194
5188 5195 * IPython/genutils.py (timing): Added timings() and timing() for
5189 5196 quick access to the most commonly needed data, the execution
5190 5197 times. Old timing() renamed to timings_out().
5191 5198
5192 5199 2002-07-18 Fernando Perez <fperez@colorado.edu>
5193 5200
5194 5201 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
5195 5202 bug with nested instances disrupting the parent's tab completion.
5196 5203
5197 5204 * IPython/iplib.py (all_completions): Added Alex Schmolck's
5198 5205 all_completions code to begin the emacs integration.
5199 5206
5200 5207 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
5201 5208 argument to allow titling individual arrays when plotting.
5202 5209
5203 5210 2002-07-15 Fernando Perez <fperez@colorado.edu>
5204 5211
5205 5212 * setup.py (make_shortcut): changed to retrieve the value of
5206 5213 'Program Files' directory from the registry (this value changes in
5207 5214 non-english versions of Windows). Thanks to Thomas Fanslau
5208 5215 <tfanslau-AT-gmx.de> for the report.
5209 5216
5210 5217 2002-07-10 Fernando Perez <fperez@colorado.edu>
5211 5218
5212 5219 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
5213 5220 a bug in pdb, which crashes if a line with only whitespace is
5214 5221 entered. Bug report submitted to sourceforge.
5215 5222
5216 5223 2002-07-09 Fernando Perez <fperez@colorado.edu>
5217 5224
5218 5225 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
5219 5226 reporting exceptions (it's a bug in inspect.py, I just set a
5220 5227 workaround).
5221 5228
5222 5229 2002-07-08 Fernando Perez <fperez@colorado.edu>
5223 5230
5224 5231 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
5225 5232 __IPYTHON__ in __builtins__ to show up in user_ns.
5226 5233
5227 5234 2002-07-03 Fernando Perez <fperez@colorado.edu>
5228 5235
5229 5236 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
5230 5237 name from @gp_set_instance to @gp_set_default.
5231 5238
5232 5239 * IPython/ipmaker.py (make_IPython): default editor value set to
5233 5240 '0' (a string), to match the rc file. Otherwise will crash when
5234 5241 .strip() is called on it.
5235 5242
5236 5243
5237 5244 2002-06-28 Fernando Perez <fperez@colorado.edu>
5238 5245
5239 5246 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
5240 5247 of files in current directory when a file is executed via
5241 5248 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
5242 5249
5243 5250 * setup.py (manfiles): fix for rpm builds, submitted by RA
5244 5251 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
5245 5252
5246 5253 * IPython/ipmaker.py (make_IPython): fixed lookup of default
5247 5254 editor when set to '0'. Problem was, '0' evaluates to True (it's a
5248 5255 string!). A. Schmolck caught this one.
5249 5256
5250 5257 2002-06-27 Fernando Perez <fperez@colorado.edu>
5251 5258
5252 5259 * IPython/ipmaker.py (make_IPython): fixed bug when running user
5253 5260 defined files at the cmd line. __name__ wasn't being set to
5254 5261 __main__.
5255 5262
5256 5263 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
5257 5264 regular lists and tuples besides Numeric arrays.
5258 5265
5259 5266 * IPython/Prompts.py (CachedOutput.__call__): Added output
5260 5267 supression for input ending with ';'. Similar to Mathematica and
5261 5268 Matlab. The _* vars and Out[] list are still updated, just like
5262 5269 Mathematica behaves.
5263 5270
5264 5271 2002-06-25 Fernando Perez <fperez@colorado.edu>
5265 5272
5266 5273 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
5267 5274 .ini extensions for profiels under Windows.
5268 5275
5269 5276 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
5270 5277 string form. Fix contributed by Alexander Schmolck
5271 5278 <a.schmolck-AT-gmx.net>
5272 5279
5273 5280 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
5274 5281 pre-configured Gnuplot instance.
5275 5282
5276 5283 2002-06-21 Fernando Perez <fperez@colorado.edu>
5277 5284
5278 5285 * IPython/numutils.py (exp_safe): new function, works around the
5279 5286 underflow problems in Numeric.
5280 5287 (log2): New fn. Safe log in base 2: returns exact integer answer
5281 5288 for exact integer powers of 2.
5282 5289
5283 5290 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
5284 5291 properly.
5285 5292
5286 5293 2002-06-20 Fernando Perez <fperez@colorado.edu>
5287 5294
5288 5295 * IPython/genutils.py (timing): new function like
5289 5296 Mathematica's. Similar to time_test, but returns more info.
5290 5297
5291 5298 2002-06-18 Fernando Perez <fperez@colorado.edu>
5292 5299
5293 5300 * IPython/Magic.py (Magic.magic_save): modified @save and @r
5294 5301 according to Mike Heeter's suggestions.
5295 5302
5296 5303 2002-06-16 Fernando Perez <fperez@colorado.edu>
5297 5304
5298 5305 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
5299 5306 system. GnuplotMagic is gone as a user-directory option. New files
5300 5307 make it easier to use all the gnuplot stuff both from external
5301 5308 programs as well as from IPython. Had to rewrite part of
5302 5309 hardcopy() b/c of a strange bug: often the ps files simply don't
5303 5310 get created, and require a repeat of the command (often several
5304 5311 times).
5305 5312
5306 5313 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
5307 5314 resolve output channel at call time, so that if sys.stderr has
5308 5315 been redirected by user this gets honored.
5309 5316
5310 5317 2002-06-13 Fernando Perez <fperez@colorado.edu>
5311 5318
5312 5319 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
5313 5320 IPShell. Kept a copy with the old names to avoid breaking people's
5314 5321 embedded code.
5315 5322
5316 5323 * IPython/ipython: simplified it to the bare minimum after
5317 5324 Holger's suggestions. Added info about how to use it in
5318 5325 PYTHONSTARTUP.
5319 5326
5320 5327 * IPython/Shell.py (IPythonShell): changed the options passing
5321 5328 from a string with funky %s replacements to a straight list. Maybe
5322 5329 a bit more typing, but it follows sys.argv conventions, so there's
5323 5330 less special-casing to remember.
5324 5331
5325 5332 2002-06-12 Fernando Perez <fperez@colorado.edu>
5326 5333
5327 5334 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
5328 5335 command. Thanks to a suggestion by Mike Heeter.
5329 5336 (Magic.magic_pfile): added behavior to look at filenames if given
5330 5337 arg is not a defined object.
5331 5338 (Magic.magic_save): New @save function to save code snippets. Also
5332 5339 a Mike Heeter idea.
5333 5340
5334 5341 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
5335 5342 plot() and replot(). Much more convenient now, especially for
5336 5343 interactive use.
5337 5344
5338 5345 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
5339 5346 filenames.
5340 5347
5341 5348 2002-06-02 Fernando Perez <fperez@colorado.edu>
5342 5349
5343 5350 * IPython/Struct.py (Struct.__init__): modified to admit
5344 5351 initialization via another struct.
5345 5352
5346 5353 * IPython/genutils.py (SystemExec.__init__): New stateful
5347 5354 interface to xsys and bq. Useful for writing system scripts.
5348 5355
5349 5356 2002-05-30 Fernando Perez <fperez@colorado.edu>
5350 5357
5351 5358 * MANIFEST.in: Changed docfile selection to exclude all the lyx
5352 5359 documents. This will make the user download smaller (it's getting
5353 5360 too big).
5354 5361
5355 5362 2002-05-29 Fernando Perez <fperez@colorado.edu>
5356 5363
5357 5364 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
5358 5365 fix problems with shelve and pickle. Seems to work, but I don't
5359 5366 know if corner cases break it. Thanks to Mike Heeter
5360 5367 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
5361 5368
5362 5369 2002-05-24 Fernando Perez <fperez@colorado.edu>
5363 5370
5364 5371 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
5365 5372 macros having broken.
5366 5373
5367 5374 2002-05-21 Fernando Perez <fperez@colorado.edu>
5368 5375
5369 5376 * IPython/Magic.py (Magic.magic_logstart): fixed recently
5370 5377 introduced logging bug: all history before logging started was
5371 5378 being written one character per line! This came from the redesign
5372 5379 of the input history as a special list which slices to strings,
5373 5380 not to lists.
5374 5381
5375 5382 2002-05-20 Fernando Perez <fperez@colorado.edu>
5376 5383
5377 5384 * IPython/Prompts.py (CachedOutput.__init__): made the color table
5378 5385 be an attribute of all classes in this module. The design of these
5379 5386 classes needs some serious overhauling.
5380 5387
5381 5388 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
5382 5389 which was ignoring '_' in option names.
5383 5390
5384 5391 * IPython/ultraTB.py (FormattedTB.__init__): Changed
5385 5392 'Verbose_novars' to 'Context' and made it the new default. It's a
5386 5393 bit more readable and also safer than verbose.
5387 5394
5388 5395 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
5389 5396 triple-quoted strings.
5390 5397
5391 5398 * IPython/OInspect.py (__all__): new module exposing the object
5392 5399 introspection facilities. Now the corresponding magics are dummy
5393 5400 wrappers around this. Having this module will make it much easier
5394 5401 to put these functions into our modified pdb.
5395 5402 This new object inspector system uses the new colorizing module,
5396 5403 so source code and other things are nicely syntax highlighted.
5397 5404
5398 5405 2002-05-18 Fernando Perez <fperez@colorado.edu>
5399 5406
5400 5407 * IPython/ColorANSI.py: Split the coloring tools into a separate
5401 5408 module so I can use them in other code easier (they were part of
5402 5409 ultraTB).
5403 5410
5404 5411 2002-05-17 Fernando Perez <fperez@colorado.edu>
5405 5412
5406 5413 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5407 5414 fixed it to set the global 'g' also to the called instance, as
5408 5415 long as 'g' was still a gnuplot instance (so it doesn't overwrite
5409 5416 user's 'g' variables).
5410 5417
5411 5418 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
5412 5419 global variables (aliases to _ih,_oh) so that users which expect
5413 5420 In[5] or Out[7] to work aren't unpleasantly surprised.
5414 5421 (InputList.__getslice__): new class to allow executing slices of
5415 5422 input history directly. Very simple class, complements the use of
5416 5423 macros.
5417 5424
5418 5425 2002-05-16 Fernando Perez <fperez@colorado.edu>
5419 5426
5420 5427 * setup.py (docdirbase): make doc directory be just doc/IPython
5421 5428 without version numbers, it will reduce clutter for users.
5422 5429
5423 5430 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
5424 5431 execfile call to prevent possible memory leak. See for details:
5425 5432 http://mail.python.org/pipermail/python-list/2002-February/088476.html
5426 5433
5427 5434 2002-05-15 Fernando Perez <fperez@colorado.edu>
5428 5435
5429 5436 * IPython/Magic.py (Magic.magic_psource): made the object
5430 5437 introspection names be more standard: pdoc, pdef, pfile and
5431 5438 psource. They all print/page their output, and it makes
5432 5439 remembering them easier. Kept old names for compatibility as
5433 5440 aliases.
5434 5441
5435 5442 2002-05-14 Fernando Perez <fperez@colorado.edu>
5436 5443
5437 5444 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
5438 5445 what the mouse problem was. The trick is to use gnuplot with temp
5439 5446 files and NOT with pipes (for data communication), because having
5440 5447 both pipes and the mouse on is bad news.
5441 5448
5442 5449 2002-05-13 Fernando Perez <fperez@colorado.edu>
5443 5450
5444 5451 * IPython/Magic.py (Magic._ofind): fixed namespace order search
5445 5452 bug. Information would be reported about builtins even when
5446 5453 user-defined functions overrode them.
5447 5454
5448 5455 2002-05-11 Fernando Perez <fperez@colorado.edu>
5449 5456
5450 5457 * IPython/__init__.py (__all__): removed FlexCompleter from
5451 5458 __all__ so that things don't fail in platforms without readline.
5452 5459
5453 5460 2002-05-10 Fernando Perez <fperez@colorado.edu>
5454 5461
5455 5462 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
5456 5463 it requires Numeric, effectively making Numeric a dependency for
5457 5464 IPython.
5458 5465
5459 5466 * Released 0.2.13
5460 5467
5461 5468 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
5462 5469 profiler interface. Now all the major options from the profiler
5463 5470 module are directly supported in IPython, both for single
5464 5471 expressions (@prun) and for full programs (@run -p).
5465 5472
5466 5473 2002-05-09 Fernando Perez <fperez@colorado.edu>
5467 5474
5468 5475 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
5469 5476 magic properly formatted for screen.
5470 5477
5471 5478 * setup.py (make_shortcut): Changed things to put pdf version in
5472 5479 doc/ instead of doc/manual (had to change lyxport a bit).
5473 5480
5474 5481 * IPython/Magic.py (Profile.string_stats): made profile runs go
5475 5482 through pager (they are long and a pager allows searching, saving,
5476 5483 etc.)
5477 5484
5478 5485 2002-05-08 Fernando Perez <fperez@colorado.edu>
5479 5486
5480 5487 * Released 0.2.12
5481 5488
5482 5489 2002-05-06 Fernando Perez <fperez@colorado.edu>
5483 5490
5484 5491 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
5485 5492 introduced); 'hist n1 n2' was broken.
5486 5493 (Magic.magic_pdb): added optional on/off arguments to @pdb
5487 5494 (Magic.magic_run): added option -i to @run, which executes code in
5488 5495 the IPython namespace instead of a clean one. Also added @irun as
5489 5496 an alias to @run -i.
5490 5497
5491 5498 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5492 5499 fixed (it didn't really do anything, the namespaces were wrong).
5493 5500
5494 5501 * IPython/Debugger.py (__init__): Added workaround for python 2.1
5495 5502
5496 5503 * IPython/__init__.py (__all__): Fixed package namespace, now
5497 5504 'import IPython' does give access to IPython.<all> as
5498 5505 expected. Also renamed __release__ to Release.
5499 5506
5500 5507 * IPython/Debugger.py (__license__): created new Pdb class which
5501 5508 functions like a drop-in for the normal pdb.Pdb but does NOT
5502 5509 import readline by default. This way it doesn't muck up IPython's
5503 5510 readline handling, and now tab-completion finally works in the
5504 5511 debugger -- sort of. It completes things globally visible, but the
5505 5512 completer doesn't track the stack as pdb walks it. That's a bit
5506 5513 tricky, and I'll have to implement it later.
5507 5514
5508 5515 2002-05-05 Fernando Perez <fperez@colorado.edu>
5509 5516
5510 5517 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
5511 5518 magic docstrings when printed via ? (explicit \'s were being
5512 5519 printed).
5513 5520
5514 5521 * IPython/ipmaker.py (make_IPython): fixed namespace
5515 5522 identification bug. Now variables loaded via logs or command-line
5516 5523 files are recognized in the interactive namespace by @who.
5517 5524
5518 5525 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
5519 5526 log replay system stemming from the string form of Structs.
5520 5527
5521 5528 * IPython/Magic.py (Macro.__init__): improved macros to properly
5522 5529 handle magic commands in them.
5523 5530 (Magic.magic_logstart): usernames are now expanded so 'logstart
5524 5531 ~/mylog' now works.
5525 5532
5526 5533 * IPython/iplib.py (complete): fixed bug where paths starting with
5527 5534 '/' would be completed as magic names.
5528 5535
5529 5536 2002-05-04 Fernando Perez <fperez@colorado.edu>
5530 5537
5531 5538 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
5532 5539 allow running full programs under the profiler's control.
5533 5540
5534 5541 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
5535 5542 mode to report exceptions verbosely but without formatting
5536 5543 variables. This addresses the issue of ipython 'freezing' (it's
5537 5544 not frozen, but caught in an expensive formatting loop) when huge
5538 5545 variables are in the context of an exception.
5539 5546 (VerboseTB.text): Added '--->' markers at line where exception was
5540 5547 triggered. Much clearer to read, especially in NoColor modes.
5541 5548
5542 5549 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
5543 5550 implemented in reverse when changing to the new parse_options().
5544 5551
5545 5552 2002-05-03 Fernando Perez <fperez@colorado.edu>
5546 5553
5547 5554 * IPython/Magic.py (Magic.parse_options): new function so that
5548 5555 magics can parse options easier.
5549 5556 (Magic.magic_prun): new function similar to profile.run(),
5550 5557 suggested by Chris Hart.
5551 5558 (Magic.magic_cd): fixed behavior so that it only changes if
5552 5559 directory actually is in history.
5553 5560
5554 5561 * IPython/usage.py (__doc__): added information about potential
5555 5562 slowness of Verbose exception mode when there are huge data
5556 5563 structures to be formatted (thanks to Archie Paulson).
5557 5564
5558 5565 * IPython/ipmaker.py (make_IPython): Changed default logging
5559 5566 (when simply called with -log) to use curr_dir/ipython.log in
5560 5567 rotate mode. Fixed crash which was occuring with -log before
5561 5568 (thanks to Jim Boyle).
5562 5569
5563 5570 2002-05-01 Fernando Perez <fperez@colorado.edu>
5564 5571
5565 5572 * Released 0.2.11 for these fixes (mainly the ultraTB one which
5566 5573 was nasty -- though somewhat of a corner case).
5567 5574
5568 5575 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
5569 5576 text (was a bug).
5570 5577
5571 5578 2002-04-30 Fernando Perez <fperez@colorado.edu>
5572 5579
5573 5580 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
5574 5581 a print after ^D or ^C from the user so that the In[] prompt
5575 5582 doesn't over-run the gnuplot one.
5576 5583
5577 5584 2002-04-29 Fernando Perez <fperez@colorado.edu>
5578 5585
5579 5586 * Released 0.2.10
5580 5587
5581 5588 * IPython/__release__.py (version): get date dynamically.
5582 5589
5583 5590 * Misc. documentation updates thanks to Arnd's comments. Also ran
5584 5591 a full spellcheck on the manual (hadn't been done in a while).
5585 5592
5586 5593 2002-04-27 Fernando Perez <fperez@colorado.edu>
5587 5594
5588 5595 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
5589 5596 starting a log in mid-session would reset the input history list.
5590 5597
5591 5598 2002-04-26 Fernando Perez <fperez@colorado.edu>
5592 5599
5593 5600 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
5594 5601 all files were being included in an update. Now anything in
5595 5602 UserConfig that matches [A-Za-z]*.py will go (this excludes
5596 5603 __init__.py)
5597 5604
5598 5605 2002-04-25 Fernando Perez <fperez@colorado.edu>
5599 5606
5600 5607 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
5601 5608 to __builtins__ so that any form of embedded or imported code can
5602 5609 test for being inside IPython.
5603 5610
5604 5611 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
5605 5612 changed to GnuplotMagic because it's now an importable module,
5606 5613 this makes the name follow that of the standard Gnuplot module.
5607 5614 GnuplotMagic can now be loaded at any time in mid-session.
5608 5615
5609 5616 2002-04-24 Fernando Perez <fperez@colorado.edu>
5610 5617
5611 5618 * IPython/numutils.py: removed SIUnits. It doesn't properly set
5612 5619 the globals (IPython has its own namespace) and the
5613 5620 PhysicalQuantity stuff is much better anyway.
5614 5621
5615 5622 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
5616 5623 embedding example to standard user directory for
5617 5624 distribution. Also put it in the manual.
5618 5625
5619 5626 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
5620 5627 instance as first argument (so it doesn't rely on some obscure
5621 5628 hidden global).
5622 5629
5623 5630 * IPython/UserConfig/ipythonrc.py: put () back in accepted
5624 5631 delimiters. While it prevents ().TAB from working, it allows
5625 5632 completions in open (... expressions. This is by far a more common
5626 5633 case.
5627 5634
5628 5635 2002-04-23 Fernando Perez <fperez@colorado.edu>
5629 5636
5630 5637 * IPython/Extensions/InterpreterPasteInput.py: new
5631 5638 syntax-processing module for pasting lines with >>> or ... at the
5632 5639 start.
5633 5640
5634 5641 * IPython/Extensions/PhysicalQ_Interactive.py
5635 5642 (PhysicalQuantityInteractive.__int__): fixed to work with either
5636 5643 Numeric or math.
5637 5644
5638 5645 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
5639 5646 provided profiles. Now we have:
5640 5647 -math -> math module as * and cmath with its own namespace.
5641 5648 -numeric -> Numeric as *, plus gnuplot & grace
5642 5649 -physics -> same as before
5643 5650
5644 5651 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
5645 5652 user-defined magics wouldn't be found by @magic if they were
5646 5653 defined as class methods. Also cleaned up the namespace search
5647 5654 logic and the string building (to use %s instead of many repeated
5648 5655 string adds).
5649 5656
5650 5657 * IPython/UserConfig/example-magic.py (magic_foo): updated example
5651 5658 of user-defined magics to operate with class methods (cleaner, in
5652 5659 line with the gnuplot code).
5653 5660
5654 5661 2002-04-22 Fernando Perez <fperez@colorado.edu>
5655 5662
5656 5663 * setup.py: updated dependency list so that manual is updated when
5657 5664 all included files change.
5658 5665
5659 5666 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
5660 5667 the delimiter removal option (the fix is ugly right now).
5661 5668
5662 5669 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
5663 5670 all of the math profile (quicker loading, no conflict between
5664 5671 g-9.8 and g-gnuplot).
5665 5672
5666 5673 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
5667 5674 name of post-mortem files to IPython_crash_report.txt.
5668 5675
5669 5676 * Cleanup/update of the docs. Added all the new readline info and
5670 5677 formatted all lists as 'real lists'.
5671 5678
5672 5679 * IPython/ipmaker.py (make_IPython): removed now-obsolete
5673 5680 tab-completion options, since the full readline parse_and_bind is
5674 5681 now accessible.
5675 5682
5676 5683 * IPython/iplib.py (InteractiveShell.init_readline): Changed
5677 5684 handling of readline options. Now users can specify any string to
5678 5685 be passed to parse_and_bind(), as well as the delimiters to be
5679 5686 removed.
5680 5687 (InteractiveShell.__init__): Added __name__ to the global
5681 5688 namespace so that things like Itpl which rely on its existence
5682 5689 don't crash.
5683 5690 (InteractiveShell._prefilter): Defined the default with a _ so
5684 5691 that prefilter() is easier to override, while the default one
5685 5692 remains available.
5686 5693
5687 5694 2002-04-18 Fernando Perez <fperez@colorado.edu>
5688 5695
5689 5696 * Added information about pdb in the docs.
5690 5697
5691 5698 2002-04-17 Fernando Perez <fperez@colorado.edu>
5692 5699
5693 5700 * IPython/ipmaker.py (make_IPython): added rc_override option to
5694 5701 allow passing config options at creation time which may override
5695 5702 anything set in the config files or command line. This is
5696 5703 particularly useful for configuring embedded instances.
5697 5704
5698 5705 2002-04-15 Fernando Perez <fperez@colorado.edu>
5699 5706
5700 5707 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
5701 5708 crash embedded instances because of the input cache falling out of
5702 5709 sync with the output counter.
5703 5710
5704 5711 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
5705 5712 mode which calls pdb after an uncaught exception in IPython itself.
5706 5713
5707 5714 2002-04-14 Fernando Perez <fperez@colorado.edu>
5708 5715
5709 5716 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
5710 5717 readline, fix it back after each call.
5711 5718
5712 5719 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
5713 5720 method to force all access via __call__(), which guarantees that
5714 5721 traceback references are properly deleted.
5715 5722
5716 5723 * IPython/Prompts.py (CachedOutput._display): minor fixes to
5717 5724 improve printing when pprint is in use.
5718 5725
5719 5726 2002-04-13 Fernando Perez <fperez@colorado.edu>
5720 5727
5721 5728 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
5722 5729 exceptions aren't caught anymore. If the user triggers one, he
5723 5730 should know why he's doing it and it should go all the way up,
5724 5731 just like any other exception. So now @abort will fully kill the
5725 5732 embedded interpreter and the embedding code (unless that happens
5726 5733 to catch SystemExit).
5727 5734
5728 5735 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
5729 5736 and a debugger() method to invoke the interactive pdb debugger
5730 5737 after printing exception information. Also added the corresponding
5731 5738 -pdb option and @pdb magic to control this feature, and updated
5732 5739 the docs. After a suggestion from Christopher Hart
5733 5740 (hart-AT-caltech.edu).
5734 5741
5735 5742 2002-04-12 Fernando Perez <fperez@colorado.edu>
5736 5743
5737 5744 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
5738 5745 the exception handlers defined by the user (not the CrashHandler)
5739 5746 so that user exceptions don't trigger an ipython bug report.
5740 5747
5741 5748 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
5742 5749 configurable (it should have always been so).
5743 5750
5744 5751 2002-03-26 Fernando Perez <fperez@colorado.edu>
5745 5752
5746 5753 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
5747 5754 and there to fix embedding namespace issues. This should all be
5748 5755 done in a more elegant way.
5749 5756
5750 5757 2002-03-25 Fernando Perez <fperez@colorado.edu>
5751 5758
5752 5759 * IPython/genutils.py (get_home_dir): Try to make it work under
5753 5760 win9x also.
5754 5761
5755 5762 2002-03-20 Fernando Perez <fperez@colorado.edu>
5756 5763
5757 5764 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
5758 5765 sys.displayhook untouched upon __init__.
5759 5766
5760 5767 2002-03-19 Fernando Perez <fperez@colorado.edu>
5761 5768
5762 5769 * Released 0.2.9 (for embedding bug, basically).
5763 5770
5764 5771 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
5765 5772 exceptions so that enclosing shell's state can be restored.
5766 5773
5767 5774 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
5768 5775 naming conventions in the .ipython/ dir.
5769 5776
5770 5777 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
5771 5778 from delimiters list so filenames with - in them get expanded.
5772 5779
5773 5780 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
5774 5781 sys.displayhook not being properly restored after an embedded call.
5775 5782
5776 5783 2002-03-18 Fernando Perez <fperez@colorado.edu>
5777 5784
5778 5785 * Released 0.2.8
5779 5786
5780 5787 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
5781 5788 some files weren't being included in a -upgrade.
5782 5789 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
5783 5790 on' so that the first tab completes.
5784 5791 (InteractiveShell.handle_magic): fixed bug with spaces around
5785 5792 quotes breaking many magic commands.
5786 5793
5787 5794 * setup.py: added note about ignoring the syntax error messages at
5788 5795 installation.
5789 5796
5790 5797 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
5791 5798 streamlining the gnuplot interface, now there's only one magic @gp.
5792 5799
5793 5800 2002-03-17 Fernando Perez <fperez@colorado.edu>
5794 5801
5795 5802 * IPython/UserConfig/magic_gnuplot.py: new name for the
5796 5803 example-magic_pm.py file. Much enhanced system, now with a shell
5797 5804 for communicating directly with gnuplot, one command at a time.
5798 5805
5799 5806 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
5800 5807 setting __name__=='__main__'.
5801 5808
5802 5809 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
5803 5810 mini-shell for accessing gnuplot from inside ipython. Should
5804 5811 extend it later for grace access too. Inspired by Arnd's
5805 5812 suggestion.
5806 5813
5807 5814 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
5808 5815 calling magic functions with () in their arguments. Thanks to Arnd
5809 5816 Baecker for pointing this to me.
5810 5817
5811 5818 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
5812 5819 infinitely for integer or complex arrays (only worked with floats).
5813 5820
5814 5821 2002-03-16 Fernando Perez <fperez@colorado.edu>
5815 5822
5816 5823 * setup.py: Merged setup and setup_windows into a single script
5817 5824 which properly handles things for windows users.
5818 5825
5819 5826 2002-03-15 Fernando Perez <fperez@colorado.edu>
5820 5827
5821 5828 * Big change to the manual: now the magics are all automatically
5822 5829 documented. This information is generated from their docstrings
5823 5830 and put in a latex file included by the manual lyx file. This way
5824 5831 we get always up to date information for the magics. The manual
5825 5832 now also has proper version information, also auto-synced.
5826 5833
5827 5834 For this to work, an undocumented --magic_docstrings option was added.
5828 5835
5829 5836 2002-03-13 Fernando Perez <fperez@colorado.edu>
5830 5837
5831 5838 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
5832 5839 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
5833 5840
5834 5841 2002-03-12 Fernando Perez <fperez@colorado.edu>
5835 5842
5836 5843 * IPython/ultraTB.py (TermColors): changed color escapes again to
5837 5844 fix the (old, reintroduced) line-wrapping bug. Basically, if
5838 5845 \001..\002 aren't given in the color escapes, lines get wrapped
5839 5846 weirdly. But giving those screws up old xterms and emacs terms. So
5840 5847 I added some logic for emacs terms to be ok, but I can't identify old
5841 5848 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5842 5849
5843 5850 2002-03-10 Fernando Perez <fperez@colorado.edu>
5844 5851
5845 5852 * IPython/usage.py (__doc__): Various documentation cleanups and
5846 5853 updates, both in usage docstrings and in the manual.
5847 5854
5848 5855 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
5849 5856 handling of caching. Set minimum acceptabe value for having a
5850 5857 cache at 20 values.
5851 5858
5852 5859 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5853 5860 install_first_time function to a method, renamed it and added an
5854 5861 'upgrade' mode. Now people can update their config directory with
5855 5862 a simple command line switch (-upgrade, also new).
5856 5863
5857 5864 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5858 5865 @file (convenient for automagic users under Python >= 2.2).
5859 5866 Removed @files (it seemed more like a plural than an abbrev. of
5860 5867 'file show').
5861 5868
5862 5869 * IPython/iplib.py (install_first_time): Fixed crash if there were
5863 5870 backup files ('~') in .ipython/ install directory.
5864 5871
5865 5872 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5866 5873 system. Things look fine, but these changes are fairly
5867 5874 intrusive. Test them for a few days.
5868 5875
5869 5876 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5870 5877 the prompts system. Now all in/out prompt strings are user
5871 5878 controllable. This is particularly useful for embedding, as one
5872 5879 can tag embedded instances with particular prompts.
5873 5880
5874 5881 Also removed global use of sys.ps1/2, which now allows nested
5875 5882 embeddings without any problems. Added command-line options for
5876 5883 the prompt strings.
5877 5884
5878 5885 2002-03-08 Fernando Perez <fperez@colorado.edu>
5879 5886
5880 5887 * IPython/UserConfig/example-embed-short.py (ipshell): added
5881 5888 example file with the bare minimum code for embedding.
5882 5889
5883 5890 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5884 5891 functionality for the embeddable shell to be activated/deactivated
5885 5892 either globally or at each call.
5886 5893
5887 5894 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5888 5895 rewriting the prompt with '--->' for auto-inputs with proper
5889 5896 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5890 5897 this is handled by the prompts class itself, as it should.
5891 5898
5892 5899 2002-03-05 Fernando Perez <fperez@colorado.edu>
5893 5900
5894 5901 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5895 5902 @logstart to avoid name clashes with the math log function.
5896 5903
5897 5904 * Big updates to X/Emacs section of the manual.
5898 5905
5899 5906 * Removed ipython_emacs. Milan explained to me how to pass
5900 5907 arguments to ipython through Emacs. Some day I'm going to end up
5901 5908 learning some lisp...
5902 5909
5903 5910 2002-03-04 Fernando Perez <fperez@colorado.edu>
5904 5911
5905 5912 * IPython/ipython_emacs: Created script to be used as the
5906 5913 py-python-command Emacs variable so we can pass IPython
5907 5914 parameters. I can't figure out how to tell Emacs directly to pass
5908 5915 parameters to IPython, so a dummy shell script will do it.
5909 5916
5910 5917 Other enhancements made for things to work better under Emacs'
5911 5918 various types of terminals. Many thanks to Milan Zamazal
5912 5919 <pdm-AT-zamazal.org> for all the suggestions and pointers.
5913 5920
5914 5921 2002-03-01 Fernando Perez <fperez@colorado.edu>
5915 5922
5916 5923 * IPython/ipmaker.py (make_IPython): added a --readline! option so
5917 5924 that loading of readline is now optional. This gives better
5918 5925 control to emacs users.
5919 5926
5920 5927 * IPython/ultraTB.py (__date__): Modified color escape sequences
5921 5928 and now things work fine under xterm and in Emacs' term buffers
5922 5929 (though not shell ones). Well, in emacs you get colors, but all
5923 5930 seem to be 'light' colors (no difference between dark and light
5924 5931 ones). But the garbage chars are gone, and also in xterms. It
5925 5932 seems that now I'm using 'cleaner' ansi sequences.
5926 5933
5927 5934 2002-02-21 Fernando Perez <fperez@colorado.edu>
5928 5935
5929 5936 * Released 0.2.7 (mainly to publish the scoping fix).
5930 5937
5931 5938 * IPython/Logger.py (Logger.logstate): added. A corresponding
5932 5939 @logstate magic was created.
5933 5940
5934 5941 * IPython/Magic.py: fixed nested scoping problem under Python
5935 5942 2.1.x (automagic wasn't working).
5936 5943
5937 5944 2002-02-20 Fernando Perez <fperez@colorado.edu>
5938 5945
5939 5946 * Released 0.2.6.
5940 5947
5941 5948 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
5942 5949 option so that logs can come out without any headers at all.
5943 5950
5944 5951 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
5945 5952 SciPy.
5946 5953
5947 5954 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
5948 5955 that embedded IPython calls don't require vars() to be explicitly
5949 5956 passed. Now they are extracted from the caller's frame (code
5950 5957 snatched from Eric Jones' weave). Added better documentation to
5951 5958 the section on embedding and the example file.
5952 5959
5953 5960 * IPython/genutils.py (page): Changed so that under emacs, it just
5954 5961 prints the string. You can then page up and down in the emacs
5955 5962 buffer itself. This is how the builtin help() works.
5956 5963
5957 5964 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
5958 5965 macro scoping: macros need to be executed in the user's namespace
5959 5966 to work as if they had been typed by the user.
5960 5967
5961 5968 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
5962 5969 execute automatically (no need to type 'exec...'). They then
5963 5970 behave like 'true macros'. The printing system was also modified
5964 5971 for this to work.
5965 5972
5966 5973 2002-02-19 Fernando Perez <fperez@colorado.edu>
5967 5974
5968 5975 * IPython/genutils.py (page_file): new function for paging files
5969 5976 in an OS-independent way. Also necessary for file viewing to work
5970 5977 well inside Emacs buffers.
5971 5978 (page): Added checks for being in an emacs buffer.
5972 5979 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
5973 5980 same bug in iplib.
5974 5981
5975 5982 2002-02-18 Fernando Perez <fperez@colorado.edu>
5976 5983
5977 5984 * IPython/iplib.py (InteractiveShell.init_readline): modified use
5978 5985 of readline so that IPython can work inside an Emacs buffer.
5979 5986
5980 5987 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
5981 5988 method signatures (they weren't really bugs, but it looks cleaner
5982 5989 and keeps PyChecker happy).
5983 5990
5984 5991 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
5985 5992 for implementing various user-defined hooks. Currently only
5986 5993 display is done.
5987 5994
5988 5995 * IPython/Prompts.py (CachedOutput._display): changed display
5989 5996 functions so that they can be dynamically changed by users easily.
5990 5997
5991 5998 * IPython/Extensions/numeric_formats.py (num_display): added an
5992 5999 extension for printing NumPy arrays in flexible manners. It
5993 6000 doesn't do anything yet, but all the structure is in
5994 6001 place. Ultimately the plan is to implement output format control
5995 6002 like in Octave.
5996 6003
5997 6004 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5998 6005 methods are found at run-time by all the automatic machinery.
5999 6006
6000 6007 2002-02-17 Fernando Perez <fperez@colorado.edu>
6001 6008
6002 6009 * setup_Windows.py (make_shortcut): documented. Cleaned up the
6003 6010 whole file a little.
6004 6011
6005 6012 * ToDo: closed this document. Now there's a new_design.lyx
6006 6013 document for all new ideas. Added making a pdf of it for the
6007 6014 end-user distro.
6008 6015
6009 6016 * IPython/Logger.py (Logger.switch_log): Created this to replace
6010 6017 logon() and logoff(). It also fixes a nasty crash reported by
6011 6018 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
6012 6019
6013 6020 * IPython/iplib.py (complete): got auto-completion to work with
6014 6021 automagic (I had wanted this for a long time).
6015 6022
6016 6023 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
6017 6024 to @file, since file() is now a builtin and clashes with automagic
6018 6025 for @file.
6019 6026
6020 6027 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
6021 6028 of this was previously in iplib, which had grown to more than 2000
6022 6029 lines, way too long. No new functionality, but it makes managing
6023 6030 the code a bit easier.
6024 6031
6025 6032 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
6026 6033 information to crash reports.
6027 6034
6028 6035 2002-02-12 Fernando Perez <fperez@colorado.edu>
6029 6036
6030 6037 * Released 0.2.5.
6031 6038
6032 6039 2002-02-11 Fernando Perez <fperez@colorado.edu>
6033 6040
6034 6041 * Wrote a relatively complete Windows installer. It puts
6035 6042 everything in place, creates Start Menu entries and fixes the
6036 6043 color issues. Nothing fancy, but it works.
6037 6044
6038 6045 2002-02-10 Fernando Perez <fperez@colorado.edu>
6039 6046
6040 6047 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
6041 6048 os.path.expanduser() call so that we can type @run ~/myfile.py and
6042 6049 have thigs work as expected.
6043 6050
6044 6051 * IPython/genutils.py (page): fixed exception handling so things
6045 6052 work both in Unix and Windows correctly. Quitting a pager triggers
6046 6053 an IOError/broken pipe in Unix, and in windows not finding a pager
6047 6054 is also an IOError, so I had to actually look at the return value
6048 6055 of the exception, not just the exception itself. Should be ok now.
6049 6056
6050 6057 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
6051 6058 modified to allow case-insensitive color scheme changes.
6052 6059
6053 6060 2002-02-09 Fernando Perez <fperez@colorado.edu>
6054 6061
6055 6062 * IPython/genutils.py (native_line_ends): new function to leave
6056 6063 user config files with os-native line-endings.
6057 6064
6058 6065 * README and manual updates.
6059 6066
6060 6067 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
6061 6068 instead of StringType to catch Unicode strings.
6062 6069
6063 6070 * IPython/genutils.py (filefind): fixed bug for paths with
6064 6071 embedded spaces (very common in Windows).
6065 6072
6066 6073 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
6067 6074 files under Windows, so that they get automatically associated
6068 6075 with a text editor. Windows makes it a pain to handle
6069 6076 extension-less files.
6070 6077
6071 6078 * IPython/iplib.py (InteractiveShell.init_readline): Made the
6072 6079 warning about readline only occur for Posix. In Windows there's no
6073 6080 way to get readline, so why bother with the warning.
6074 6081
6075 6082 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
6076 6083 for __str__ instead of dir(self), since dir() changed in 2.2.
6077 6084
6078 6085 * Ported to Windows! Tested on XP, I suspect it should work fine
6079 6086 on NT/2000, but I don't think it will work on 98 et al. That
6080 6087 series of Windows is such a piece of junk anyway that I won't try
6081 6088 porting it there. The XP port was straightforward, showed a few
6082 6089 bugs here and there (fixed all), in particular some string
6083 6090 handling stuff which required considering Unicode strings (which
6084 6091 Windows uses). This is good, but hasn't been too tested :) No
6085 6092 fancy installer yet, I'll put a note in the manual so people at
6086 6093 least make manually a shortcut.
6087 6094
6088 6095 * IPython/iplib.py (Magic.magic_colors): Unified the color options
6089 6096 into a single one, "colors". This now controls both prompt and
6090 6097 exception color schemes, and can be changed both at startup
6091 6098 (either via command-line switches or via ipythonrc files) and at
6092 6099 runtime, with @colors.
6093 6100 (Magic.magic_run): renamed @prun to @run and removed the old
6094 6101 @run. The two were too similar to warrant keeping both.
6095 6102
6096 6103 2002-02-03 Fernando Perez <fperez@colorado.edu>
6097 6104
6098 6105 * IPython/iplib.py (install_first_time): Added comment on how to
6099 6106 configure the color options for first-time users. Put a <return>
6100 6107 request at the end so that small-terminal users get a chance to
6101 6108 read the startup info.
6102 6109
6103 6110 2002-01-23 Fernando Perez <fperez@colorado.edu>
6104 6111
6105 6112 * IPython/iplib.py (CachedOutput.update): Changed output memory
6106 6113 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
6107 6114 input history we still use _i. Did this b/c these variable are
6108 6115 very commonly used in interactive work, so the less we need to
6109 6116 type the better off we are.
6110 6117 (Magic.magic_prun): updated @prun to better handle the namespaces
6111 6118 the file will run in, including a fix for __name__ not being set
6112 6119 before.
6113 6120
6114 6121 2002-01-20 Fernando Perez <fperez@colorado.edu>
6115 6122
6116 6123 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
6117 6124 extra garbage for Python 2.2. Need to look more carefully into
6118 6125 this later.
6119 6126
6120 6127 2002-01-19 Fernando Perez <fperez@colorado.edu>
6121 6128
6122 6129 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
6123 6130 display SyntaxError exceptions properly formatted when they occur
6124 6131 (they can be triggered by imported code).
6125 6132
6126 6133 2002-01-18 Fernando Perez <fperez@colorado.edu>
6127 6134
6128 6135 * IPython/iplib.py (InteractiveShell.safe_execfile): now
6129 6136 SyntaxError exceptions are reported nicely formatted, instead of
6130 6137 spitting out only offset information as before.
6131 6138 (Magic.magic_prun): Added the @prun function for executing
6132 6139 programs with command line args inside IPython.
6133 6140
6134 6141 2002-01-16 Fernando Perez <fperez@colorado.edu>
6135 6142
6136 6143 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
6137 6144 to *not* include the last item given in a range. This brings their
6138 6145 behavior in line with Python's slicing:
6139 6146 a[n1:n2] -> a[n1]...a[n2-1]
6140 6147 It may be a bit less convenient, but I prefer to stick to Python's
6141 6148 conventions *everywhere*, so users never have to wonder.
6142 6149 (Magic.magic_macro): Added @macro function to ease the creation of
6143 6150 macros.
6144 6151
6145 6152 2002-01-05 Fernando Perez <fperez@colorado.edu>
6146 6153
6147 6154 * Released 0.2.4.
6148 6155
6149 6156 * IPython/iplib.py (Magic.magic_pdef):
6150 6157 (InteractiveShell.safe_execfile): report magic lines and error
6151 6158 lines without line numbers so one can easily copy/paste them for
6152 6159 re-execution.
6153 6160
6154 6161 * Updated manual with recent changes.
6155 6162
6156 6163 * IPython/iplib.py (Magic.magic_oinfo): added constructor
6157 6164 docstring printing when class? is called. Very handy for knowing
6158 6165 how to create class instances (as long as __init__ is well
6159 6166 documented, of course :)
6160 6167 (Magic.magic_doc): print both class and constructor docstrings.
6161 6168 (Magic.magic_pdef): give constructor info if passed a class and
6162 6169 __call__ info for callable object instances.
6163 6170
6164 6171 2002-01-04 Fernando Perez <fperez@colorado.edu>
6165 6172
6166 6173 * Made deep_reload() off by default. It doesn't always work
6167 6174 exactly as intended, so it's probably safer to have it off. It's
6168 6175 still available as dreload() anyway, so nothing is lost.
6169 6176
6170 6177 2002-01-02 Fernando Perez <fperez@colorado.edu>
6171 6178
6172 6179 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
6173 6180 so I wanted an updated release).
6174 6181
6175 6182 2001-12-27 Fernando Perez <fperez@colorado.edu>
6176 6183
6177 6184 * IPython/iplib.py (InteractiveShell.interact): Added the original
6178 6185 code from 'code.py' for this module in order to change the
6179 6186 handling of a KeyboardInterrupt. This was necessary b/c otherwise
6180 6187 the history cache would break when the user hit Ctrl-C, and
6181 6188 interact() offers no way to add any hooks to it.
6182 6189
6183 6190 2001-12-23 Fernando Perez <fperez@colorado.edu>
6184 6191
6185 6192 * setup.py: added check for 'MANIFEST' before trying to remove
6186 6193 it. Thanks to Sean Reifschneider.
6187 6194
6188 6195 2001-12-22 Fernando Perez <fperez@colorado.edu>
6189 6196
6190 6197 * Released 0.2.2.
6191 6198
6192 6199 * Finished (reasonably) writing the manual. Later will add the
6193 6200 python-standard navigation stylesheets, but for the time being
6194 6201 it's fairly complete. Distribution will include html and pdf
6195 6202 versions.
6196 6203
6197 6204 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
6198 6205 (MayaVi author).
6199 6206
6200 6207 2001-12-21 Fernando Perez <fperez@colorado.edu>
6201 6208
6202 6209 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
6203 6210 good public release, I think (with the manual and the distutils
6204 6211 installer). The manual can use some work, but that can go
6205 6212 slowly. Otherwise I think it's quite nice for end users. Next
6206 6213 summer, rewrite the guts of it...
6207 6214
6208 6215 * Changed format of ipythonrc files to use whitespace as the
6209 6216 separator instead of an explicit '='. Cleaner.
6210 6217
6211 6218 2001-12-20 Fernando Perez <fperez@colorado.edu>
6212 6219
6213 6220 * Started a manual in LyX. For now it's just a quick merge of the
6214 6221 various internal docstrings and READMEs. Later it may grow into a
6215 6222 nice, full-blown manual.
6216 6223
6217 6224 * Set up a distutils based installer. Installation should now be
6218 6225 trivially simple for end-users.
6219 6226
6220 6227 2001-12-11 Fernando Perez <fperez@colorado.edu>
6221 6228
6222 6229 * Released 0.2.0. First public release, announced it at
6223 6230 comp.lang.python. From now on, just bugfixes...
6224 6231
6225 6232 * Went through all the files, set copyright/license notices and
6226 6233 cleaned up things. Ready for release.
6227 6234
6228 6235 2001-12-10 Fernando Perez <fperez@colorado.edu>
6229 6236
6230 6237 * Changed the first-time installer not to use tarfiles. It's more
6231 6238 robust now and less unix-dependent. Also makes it easier for
6232 6239 people to later upgrade versions.
6233 6240
6234 6241 * Changed @exit to @abort to reflect the fact that it's pretty
6235 6242 brutal (a sys.exit()). The difference between @abort and Ctrl-D
6236 6243 becomes significant only when IPyhton is embedded: in that case,
6237 6244 C-D closes IPython only, but @abort kills the enclosing program
6238 6245 too (unless it had called IPython inside a try catching
6239 6246 SystemExit).
6240 6247
6241 6248 * Created Shell module which exposes the actuall IPython Shell
6242 6249 classes, currently the normal and the embeddable one. This at
6243 6250 least offers a stable interface we won't need to change when
6244 6251 (later) the internals are rewritten. That rewrite will be confined
6245 6252 to iplib and ipmaker, but the Shell interface should remain as is.
6246 6253
6247 6254 * Added embed module which offers an embeddable IPShell object,
6248 6255 useful to fire up IPython *inside* a running program. Great for
6249 6256 debugging or dynamical data analysis.
6250 6257
6251 6258 2001-12-08 Fernando Perez <fperez@colorado.edu>
6252 6259
6253 6260 * Fixed small bug preventing seeing info from methods of defined
6254 6261 objects (incorrect namespace in _ofind()).
6255 6262
6256 6263 * Documentation cleanup. Moved the main usage docstrings to a
6257 6264 separate file, usage.py (cleaner to maintain, and hopefully in the
6258 6265 future some perlpod-like way of producing interactive, man and
6259 6266 html docs out of it will be found).
6260 6267
6261 6268 * Added @profile to see your profile at any time.
6262 6269
6263 6270 * Added @p as an alias for 'print'. It's especially convenient if
6264 6271 using automagic ('p x' prints x).
6265 6272
6266 6273 * Small cleanups and fixes after a pychecker run.
6267 6274
6268 6275 * Changed the @cd command to handle @cd - and @cd -<n> for
6269 6276 visiting any directory in _dh.
6270 6277
6271 6278 * Introduced _dh, a history of visited directories. @dhist prints
6272 6279 it out with numbers.
6273 6280
6274 6281 2001-12-07 Fernando Perez <fperez@colorado.edu>
6275 6282
6276 6283 * Released 0.1.22
6277 6284
6278 6285 * Made initialization a bit more robust against invalid color
6279 6286 options in user input (exit, not traceback-crash).
6280 6287
6281 6288 * Changed the bug crash reporter to write the report only in the
6282 6289 user's .ipython directory. That way IPython won't litter people's
6283 6290 hard disks with crash files all over the place. Also print on
6284 6291 screen the necessary mail command.
6285 6292
6286 6293 * With the new ultraTB, implemented LightBG color scheme for light
6287 6294 background terminals. A lot of people like white backgrounds, so I
6288 6295 guess we should at least give them something readable.
6289 6296
6290 6297 2001-12-06 Fernando Perez <fperez@colorado.edu>
6291 6298
6292 6299 * Modified the structure of ultraTB. Now there's a proper class
6293 6300 for tables of color schemes which allow adding schemes easily and
6294 6301 switching the active scheme without creating a new instance every
6295 6302 time (which was ridiculous). The syntax for creating new schemes
6296 6303 is also cleaner. I think ultraTB is finally done, with a clean
6297 6304 class structure. Names are also much cleaner (now there's proper
6298 6305 color tables, no need for every variable to also have 'color' in
6299 6306 its name).
6300 6307
6301 6308 * Broke down genutils into separate files. Now genutils only
6302 6309 contains utility functions, and classes have been moved to their
6303 6310 own files (they had enough independent functionality to warrant
6304 6311 it): ConfigLoader, OutputTrap, Struct.
6305 6312
6306 6313 2001-12-05 Fernando Perez <fperez@colorado.edu>
6307 6314
6308 6315 * IPython turns 21! Released version 0.1.21, as a candidate for
6309 6316 public consumption. If all goes well, release in a few days.
6310 6317
6311 6318 * Fixed path bug (files in Extensions/ directory wouldn't be found
6312 6319 unless IPython/ was explicitly in sys.path).
6313 6320
6314 6321 * Extended the FlexCompleter class as MagicCompleter to allow
6315 6322 completion of @-starting lines.
6316 6323
6317 6324 * Created __release__.py file as a central repository for release
6318 6325 info that other files can read from.
6319 6326
6320 6327 * Fixed small bug in logging: when logging was turned on in
6321 6328 mid-session, old lines with special meanings (!@?) were being
6322 6329 logged without the prepended comment, which is necessary since
6323 6330 they are not truly valid python syntax. This should make session
6324 6331 restores produce less errors.
6325 6332
6326 6333 * The namespace cleanup forced me to make a FlexCompleter class
6327 6334 which is nothing but a ripoff of rlcompleter, but with selectable
6328 6335 namespace (rlcompleter only works in __main__.__dict__). I'll try
6329 6336 to submit a note to the authors to see if this change can be
6330 6337 incorporated in future rlcompleter releases (Dec.6: done)
6331 6338
6332 6339 * More fixes to namespace handling. It was a mess! Now all
6333 6340 explicit references to __main__.__dict__ are gone (except when
6334 6341 really needed) and everything is handled through the namespace
6335 6342 dicts in the IPython instance. We seem to be getting somewhere
6336 6343 with this, finally...
6337 6344
6338 6345 * Small documentation updates.
6339 6346
6340 6347 * Created the Extensions directory under IPython (with an
6341 6348 __init__.py). Put the PhysicalQ stuff there. This directory should
6342 6349 be used for all special-purpose extensions.
6343 6350
6344 6351 * File renaming:
6345 6352 ipythonlib --> ipmaker
6346 6353 ipplib --> iplib
6347 6354 This makes a bit more sense in terms of what these files actually do.
6348 6355
6349 6356 * Moved all the classes and functions in ipythonlib to ipplib, so
6350 6357 now ipythonlib only has make_IPython(). This will ease up its
6351 6358 splitting in smaller functional chunks later.
6352 6359
6353 6360 * Cleaned up (done, I think) output of @whos. Better column
6354 6361 formatting, and now shows str(var) for as much as it can, which is
6355 6362 typically what one gets with a 'print var'.
6356 6363
6357 6364 2001-12-04 Fernando Perez <fperez@colorado.edu>
6358 6365
6359 6366 * Fixed namespace problems. Now builtin/IPyhton/user names get
6360 6367 properly reported in their namespace. Internal namespace handling
6361 6368 is finally getting decent (not perfect yet, but much better than
6362 6369 the ad-hoc mess we had).
6363 6370
6364 6371 * Removed -exit option. If people just want to run a python
6365 6372 script, that's what the normal interpreter is for. Less
6366 6373 unnecessary options, less chances for bugs.
6367 6374
6368 6375 * Added a crash handler which generates a complete post-mortem if
6369 6376 IPython crashes. This will help a lot in tracking bugs down the
6370 6377 road.
6371 6378
6372 6379 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
6373 6380 which were boud to functions being reassigned would bypass the
6374 6381 logger, breaking the sync of _il with the prompt counter. This
6375 6382 would then crash IPython later when a new line was logged.
6376 6383
6377 6384 2001-12-02 Fernando Perez <fperez@colorado.edu>
6378 6385
6379 6386 * Made IPython a package. This means people don't have to clutter
6380 6387 their sys.path with yet another directory. Changed the INSTALL
6381 6388 file accordingly.
6382 6389
6383 6390 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
6384 6391 sorts its output (so @who shows it sorted) and @whos formats the
6385 6392 table according to the width of the first column. Nicer, easier to
6386 6393 read. Todo: write a generic table_format() which takes a list of
6387 6394 lists and prints it nicely formatted, with optional row/column
6388 6395 separators and proper padding and justification.
6389 6396
6390 6397 * Released 0.1.20
6391 6398
6392 6399 * Fixed bug in @log which would reverse the inputcache list (a
6393 6400 copy operation was missing).
6394 6401
6395 6402 * Code cleanup. @config was changed to use page(). Better, since
6396 6403 its output is always quite long.
6397 6404
6398 6405 * Itpl is back as a dependency. I was having too many problems
6399 6406 getting the parametric aliases to work reliably, and it's just
6400 6407 easier to code weird string operations with it than playing %()s
6401 6408 games. It's only ~6k, so I don't think it's too big a deal.
6402 6409
6403 6410 * Found (and fixed) a very nasty bug with history. !lines weren't
6404 6411 getting cached, and the out of sync caches would crash
6405 6412 IPython. Fixed it by reorganizing the prefilter/handlers/logger
6406 6413 division of labor a bit better. Bug fixed, cleaner structure.
6407 6414
6408 6415 2001-12-01 Fernando Perez <fperez@colorado.edu>
6409 6416
6410 6417 * Released 0.1.19
6411 6418
6412 6419 * Added option -n to @hist to prevent line number printing. Much
6413 6420 easier to copy/paste code this way.
6414 6421
6415 6422 * Created global _il to hold the input list. Allows easy
6416 6423 re-execution of blocks of code by slicing it (inspired by Janko's
6417 6424 comment on 'macros').
6418 6425
6419 6426 * Small fixes and doc updates.
6420 6427
6421 6428 * Rewrote @history function (was @h). Renamed it to @hist, @h is
6422 6429 much too fragile with automagic. Handles properly multi-line
6423 6430 statements and takes parameters.
6424 6431
6425 6432 2001-11-30 Fernando Perez <fperez@colorado.edu>
6426 6433
6427 6434 * Version 0.1.18 released.
6428 6435
6429 6436 * Fixed nasty namespace bug in initial module imports.
6430 6437
6431 6438 * Added copyright/license notes to all code files (except
6432 6439 DPyGetOpt). For the time being, LGPL. That could change.
6433 6440
6434 6441 * Rewrote a much nicer README, updated INSTALL, cleaned up
6435 6442 ipythonrc-* samples.
6436 6443
6437 6444 * Overall code/documentation cleanup. Basically ready for
6438 6445 release. Only remaining thing: licence decision (LGPL?).
6439 6446
6440 6447 * Converted load_config to a class, ConfigLoader. Now recursion
6441 6448 control is better organized. Doesn't include the same file twice.
6442 6449
6443 6450 2001-11-29 Fernando Perez <fperez@colorado.edu>
6444 6451
6445 6452 * Got input history working. Changed output history variables from
6446 6453 _p to _o so that _i is for input and _o for output. Just cleaner
6447 6454 convention.
6448 6455
6449 6456 * Implemented parametric aliases. This pretty much allows the
6450 6457 alias system to offer full-blown shell convenience, I think.
6451 6458
6452 6459 * Version 0.1.17 released, 0.1.18 opened.
6453 6460
6454 6461 * dot_ipython/ipythonrc (alias): added documentation.
6455 6462 (xcolor): Fixed small bug (xcolors -> xcolor)
6456 6463
6457 6464 * Changed the alias system. Now alias is a magic command to define
6458 6465 aliases just like the shell. Rationale: the builtin magics should
6459 6466 be there for things deeply connected to IPython's
6460 6467 architecture. And this is a much lighter system for what I think
6461 6468 is the really important feature: allowing users to define quickly
6462 6469 magics that will do shell things for them, so they can customize
6463 6470 IPython easily to match their work habits. If someone is really
6464 6471 desperate to have another name for a builtin alias, they can
6465 6472 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
6466 6473 works.
6467 6474
6468 6475 2001-11-28 Fernando Perez <fperez@colorado.edu>
6469 6476
6470 6477 * Changed @file so that it opens the source file at the proper
6471 6478 line. Since it uses less, if your EDITOR environment is
6472 6479 configured, typing v will immediately open your editor of choice
6473 6480 right at the line where the object is defined. Not as quick as
6474 6481 having a direct @edit command, but for all intents and purposes it
6475 6482 works. And I don't have to worry about writing @edit to deal with
6476 6483 all the editors, less does that.
6477 6484
6478 6485 * Version 0.1.16 released, 0.1.17 opened.
6479 6486
6480 6487 * Fixed some nasty bugs in the page/page_dumb combo that could
6481 6488 crash IPython.
6482 6489
6483 6490 2001-11-27 Fernando Perez <fperez@colorado.edu>
6484 6491
6485 6492 * Version 0.1.15 released, 0.1.16 opened.
6486 6493
6487 6494 * Finally got ? and ?? to work for undefined things: now it's
6488 6495 possible to type {}.get? and get information about the get method
6489 6496 of dicts, or os.path? even if only os is defined (so technically
6490 6497 os.path isn't). Works at any level. For example, after import os,
6491 6498 os?, os.path?, os.path.abspath? all work. This is great, took some
6492 6499 work in _ofind.
6493 6500
6494 6501 * Fixed more bugs with logging. The sanest way to do it was to add
6495 6502 to @log a 'mode' parameter. Killed two in one shot (this mode
6496 6503 option was a request of Janko's). I think it's finally clean
6497 6504 (famous last words).
6498 6505
6499 6506 * Added a page_dumb() pager which does a decent job of paging on
6500 6507 screen, if better things (like less) aren't available. One less
6501 6508 unix dependency (someday maybe somebody will port this to
6502 6509 windows).
6503 6510
6504 6511 * Fixed problem in magic_log: would lock of logging out if log
6505 6512 creation failed (because it would still think it had succeeded).
6506 6513
6507 6514 * Improved the page() function using curses to auto-detect screen
6508 6515 size. Now it can make a much better decision on whether to print
6509 6516 or page a string. Option screen_length was modified: a value 0
6510 6517 means auto-detect, and that's the default now.
6511 6518
6512 6519 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
6513 6520 go out. I'll test it for a few days, then talk to Janko about
6514 6521 licences and announce it.
6515 6522
6516 6523 * Fixed the length of the auto-generated ---> prompt which appears
6517 6524 for auto-parens and auto-quotes. Getting this right isn't trivial,
6518 6525 with all the color escapes, different prompt types and optional
6519 6526 separators. But it seems to be working in all the combinations.
6520 6527
6521 6528 2001-11-26 Fernando Perez <fperez@colorado.edu>
6522 6529
6523 6530 * Wrote a regexp filter to get option types from the option names
6524 6531 string. This eliminates the need to manually keep two duplicate
6525 6532 lists.
6526 6533
6527 6534 * Removed the unneeded check_option_names. Now options are handled
6528 6535 in a much saner manner and it's easy to visually check that things
6529 6536 are ok.
6530 6537
6531 6538 * Updated version numbers on all files I modified to carry a
6532 6539 notice so Janko and Nathan have clear version markers.
6533 6540
6534 6541 * Updated docstring for ultraTB with my changes. I should send
6535 6542 this to Nathan.
6536 6543
6537 6544 * Lots of small fixes. Ran everything through pychecker again.
6538 6545
6539 6546 * Made loading of deep_reload an cmd line option. If it's not too
6540 6547 kosher, now people can just disable it. With -nodeep_reload it's
6541 6548 still available as dreload(), it just won't overwrite reload().
6542 6549
6543 6550 * Moved many options to the no| form (-opt and -noopt
6544 6551 accepted). Cleaner.
6545 6552
6546 6553 * Changed magic_log so that if called with no parameters, it uses
6547 6554 'rotate' mode. That way auto-generated logs aren't automatically
6548 6555 over-written. For normal logs, now a backup is made if it exists
6549 6556 (only 1 level of backups). A new 'backup' mode was added to the
6550 6557 Logger class to support this. This was a request by Janko.
6551 6558
6552 6559 * Added @logoff/@logon to stop/restart an active log.
6553 6560
6554 6561 * Fixed a lot of bugs in log saving/replay. It was pretty
6555 6562 broken. Now special lines (!@,/) appear properly in the command
6556 6563 history after a log replay.
6557 6564
6558 6565 * Tried and failed to implement full session saving via pickle. My
6559 6566 idea was to pickle __main__.__dict__, but modules can't be
6560 6567 pickled. This would be a better alternative to replaying logs, but
6561 6568 seems quite tricky to get to work. Changed -session to be called
6562 6569 -logplay, which more accurately reflects what it does. And if we
6563 6570 ever get real session saving working, -session is now available.
6564 6571
6565 6572 * Implemented color schemes for prompts also. As for tracebacks,
6566 6573 currently only NoColor and Linux are supported. But now the
6567 6574 infrastructure is in place, based on a generic ColorScheme
6568 6575 class. So writing and activating new schemes both for the prompts
6569 6576 and the tracebacks should be straightforward.
6570 6577
6571 6578 * Version 0.1.13 released, 0.1.14 opened.
6572 6579
6573 6580 * Changed handling of options for output cache. Now counter is
6574 6581 hardwired starting at 1 and one specifies the maximum number of
6575 6582 entries *in the outcache* (not the max prompt counter). This is
6576 6583 much better, since many statements won't increase the cache
6577 6584 count. It also eliminated some confusing options, now there's only
6578 6585 one: cache_size.
6579 6586
6580 6587 * Added 'alias' magic function and magic_alias option in the
6581 6588 ipythonrc file. Now the user can easily define whatever names he
6582 6589 wants for the magic functions without having to play weird
6583 6590 namespace games. This gives IPython a real shell-like feel.
6584 6591
6585 6592 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
6586 6593 @ or not).
6587 6594
6588 6595 This was one of the last remaining 'visible' bugs (that I know
6589 6596 of). I think if I can clean up the session loading so it works
6590 6597 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
6591 6598 about licensing).
6592 6599
6593 6600 2001-11-25 Fernando Perez <fperez@colorado.edu>
6594 6601
6595 6602 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
6596 6603 there's a cleaner distinction between what ? and ?? show.
6597 6604
6598 6605 * Added screen_length option. Now the user can define his own
6599 6606 screen size for page() operations.
6600 6607
6601 6608 * Implemented magic shell-like functions with automatic code
6602 6609 generation. Now adding another function is just a matter of adding
6603 6610 an entry to a dict, and the function is dynamically generated at
6604 6611 run-time. Python has some really cool features!
6605 6612
6606 6613 * Renamed many options to cleanup conventions a little. Now all
6607 6614 are lowercase, and only underscores where needed. Also in the code
6608 6615 option name tables are clearer.
6609 6616
6610 6617 * Changed prompts a little. Now input is 'In [n]:' instead of
6611 6618 'In[n]:='. This allows it the numbers to be aligned with the
6612 6619 Out[n] numbers, and removes usage of ':=' which doesn't exist in
6613 6620 Python (it was a Mathematica thing). The '...' continuation prompt
6614 6621 was also changed a little to align better.
6615 6622
6616 6623 * Fixed bug when flushing output cache. Not all _p<n> variables
6617 6624 exist, so their deletion needs to be wrapped in a try:
6618 6625
6619 6626 * Figured out how to properly use inspect.formatargspec() (it
6620 6627 requires the args preceded by *). So I removed all the code from
6621 6628 _get_pdef in Magic, which was just replicating that.
6622 6629
6623 6630 * Added test to prefilter to allow redefining magic function names
6624 6631 as variables. This is ok, since the @ form is always available,
6625 6632 but whe should allow the user to define a variable called 'ls' if
6626 6633 he needs it.
6627 6634
6628 6635 * Moved the ToDo information from README into a separate ToDo.
6629 6636
6630 6637 * General code cleanup and small bugfixes. I think it's close to a
6631 6638 state where it can be released, obviously with a big 'beta'
6632 6639 warning on it.
6633 6640
6634 6641 * Got the magic function split to work. Now all magics are defined
6635 6642 in a separate class. It just organizes things a bit, and now
6636 6643 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
6637 6644 was too long).
6638 6645
6639 6646 * Changed @clear to @reset to avoid potential confusions with
6640 6647 the shell command clear. Also renamed @cl to @clear, which does
6641 6648 exactly what people expect it to from their shell experience.
6642 6649
6643 6650 Added a check to the @reset command (since it's so
6644 6651 destructive, it's probably a good idea to ask for confirmation).
6645 6652 But now reset only works for full namespace resetting. Since the
6646 6653 del keyword is already there for deleting a few specific
6647 6654 variables, I don't see the point of having a redundant magic
6648 6655 function for the same task.
6649 6656
6650 6657 2001-11-24 Fernando Perez <fperez@colorado.edu>
6651 6658
6652 6659 * Updated the builtin docs (esp. the ? ones).
6653 6660
6654 6661 * Ran all the code through pychecker. Not terribly impressed with
6655 6662 it: lots of spurious warnings and didn't really find anything of
6656 6663 substance (just a few modules being imported and not used).
6657 6664
6658 6665 * Implemented the new ultraTB functionality into IPython. New
6659 6666 option: xcolors. This chooses color scheme. xmode now only selects
6660 6667 between Plain and Verbose. Better orthogonality.
6661 6668
6662 6669 * Large rewrite of ultraTB. Much cleaner now, with a separation of
6663 6670 mode and color scheme for the exception handlers. Now it's
6664 6671 possible to have the verbose traceback with no coloring.
6665 6672
6666 6673 2001-11-23 Fernando Perez <fperez@colorado.edu>
6667 6674
6668 6675 * Version 0.1.12 released, 0.1.13 opened.
6669 6676
6670 6677 * Removed option to set auto-quote and auto-paren escapes by
6671 6678 user. The chances of breaking valid syntax are just too high. If
6672 6679 someone *really* wants, they can always dig into the code.
6673 6680
6674 6681 * Made prompt separators configurable.
6675 6682
6676 6683 2001-11-22 Fernando Perez <fperez@colorado.edu>
6677 6684
6678 6685 * Small bugfixes in many places.
6679 6686
6680 6687 * Removed the MyCompleter class from ipplib. It seemed redundant
6681 6688 with the C-p,C-n history search functionality. Less code to
6682 6689 maintain.
6683 6690
6684 6691 * Moved all the original ipython.py code into ipythonlib.py. Right
6685 6692 now it's just one big dump into a function called make_IPython, so
6686 6693 no real modularity has been gained. But at least it makes the
6687 6694 wrapper script tiny, and since ipythonlib is a module, it gets
6688 6695 compiled and startup is much faster.
6689 6696
6690 6697 This is a reasobably 'deep' change, so we should test it for a
6691 6698 while without messing too much more with the code.
6692 6699
6693 6700 2001-11-21 Fernando Perez <fperez@colorado.edu>
6694 6701
6695 6702 * Version 0.1.11 released, 0.1.12 opened for further work.
6696 6703
6697 6704 * Removed dependency on Itpl. It was only needed in one place. It
6698 6705 would be nice if this became part of python, though. It makes life
6699 6706 *a lot* easier in some cases.
6700 6707
6701 6708 * Simplified the prefilter code a bit. Now all handlers are
6702 6709 expected to explicitly return a value (at least a blank string).
6703 6710
6704 6711 * Heavy edits in ipplib. Removed the help system altogether. Now
6705 6712 obj?/?? is used for inspecting objects, a magic @doc prints
6706 6713 docstrings, and full-blown Python help is accessed via the 'help'
6707 6714 keyword. This cleans up a lot of code (less to maintain) and does
6708 6715 the job. Since 'help' is now a standard Python component, might as
6709 6716 well use it and remove duplicate functionality.
6710 6717
6711 6718 Also removed the option to use ipplib as a standalone program. By
6712 6719 now it's too dependent on other parts of IPython to function alone.
6713 6720
6714 6721 * Fixed bug in genutils.pager. It would crash if the pager was
6715 6722 exited immediately after opening (broken pipe).
6716 6723
6717 6724 * Trimmed down the VerboseTB reporting a little. The header is
6718 6725 much shorter now and the repeated exception arguments at the end
6719 6726 have been removed. For interactive use the old header seemed a bit
6720 6727 excessive.
6721 6728
6722 6729 * Fixed small bug in output of @whos for variables with multi-word
6723 6730 types (only first word was displayed).
6724 6731
6725 6732 2001-11-17 Fernando Perez <fperez@colorado.edu>
6726 6733
6727 6734 * Version 0.1.10 released, 0.1.11 opened for further work.
6728 6735
6729 6736 * Modified dirs and friends. dirs now *returns* the stack (not
6730 6737 prints), so one can manipulate it as a variable. Convenient to
6731 6738 travel along many directories.
6732 6739
6733 6740 * Fixed bug in magic_pdef: would only work with functions with
6734 6741 arguments with default values.
6735 6742
6736 6743 2001-11-14 Fernando Perez <fperez@colorado.edu>
6737 6744
6738 6745 * Added the PhysicsInput stuff to dot_ipython so it ships as an
6739 6746 example with IPython. Various other minor fixes and cleanups.
6740 6747
6741 6748 * Version 0.1.9 released, 0.1.10 opened for further work.
6742 6749
6743 6750 * Added sys.path to the list of directories searched in the
6744 6751 execfile= option. It used to be the current directory and the
6745 6752 user's IPYTHONDIR only.
6746 6753
6747 6754 2001-11-13 Fernando Perez <fperez@colorado.edu>
6748 6755
6749 6756 * Reinstated the raw_input/prefilter separation that Janko had
6750 6757 initially. This gives a more convenient setup for extending the
6751 6758 pre-processor from the outside: raw_input always gets a string,
6752 6759 and prefilter has to process it. We can then redefine prefilter
6753 6760 from the outside and implement extensions for special
6754 6761 purposes.
6755 6762
6756 6763 Today I got one for inputting PhysicalQuantity objects
6757 6764 (from Scientific) without needing any function calls at
6758 6765 all. Extremely convenient, and it's all done as a user-level
6759 6766 extension (no IPython code was touched). Now instead of:
6760 6767 a = PhysicalQuantity(4.2,'m/s**2')
6761 6768 one can simply say
6762 6769 a = 4.2 m/s**2
6763 6770 or even
6764 6771 a = 4.2 m/s^2
6765 6772
6766 6773 I use this, but it's also a proof of concept: IPython really is
6767 6774 fully user-extensible, even at the level of the parsing of the
6768 6775 command line. It's not trivial, but it's perfectly doable.
6769 6776
6770 6777 * Added 'add_flip' method to inclusion conflict resolver. Fixes
6771 6778 the problem of modules being loaded in the inverse order in which
6772 6779 they were defined in
6773 6780
6774 6781 * Version 0.1.8 released, 0.1.9 opened for further work.
6775 6782
6776 6783 * Added magics pdef, source and file. They respectively show the
6777 6784 definition line ('prototype' in C), source code and full python
6778 6785 file for any callable object. The object inspector oinfo uses
6779 6786 these to show the same information.
6780 6787
6781 6788 * Version 0.1.7 released, 0.1.8 opened for further work.
6782 6789
6783 6790 * Separated all the magic functions into a class called Magic. The
6784 6791 InteractiveShell class was becoming too big for Xemacs to handle
6785 6792 (de-indenting a line would lock it up for 10 seconds while it
6786 6793 backtracked on the whole class!)
6787 6794
6788 6795 FIXME: didn't work. It can be done, but right now namespaces are
6789 6796 all messed up. Do it later (reverted it for now, so at least
6790 6797 everything works as before).
6791 6798
6792 6799 * Got the object introspection system (magic_oinfo) working! I
6793 6800 think this is pretty much ready for release to Janko, so he can
6794 6801 test it for a while and then announce it. Pretty much 100% of what
6795 6802 I wanted for the 'phase 1' release is ready. Happy, tired.
6796 6803
6797 6804 2001-11-12 Fernando Perez <fperez@colorado.edu>
6798 6805
6799 6806 * Version 0.1.6 released, 0.1.7 opened for further work.
6800 6807
6801 6808 * Fixed bug in printing: it used to test for truth before
6802 6809 printing, so 0 wouldn't print. Now checks for None.
6803 6810
6804 6811 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
6805 6812 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
6806 6813 reaches by hand into the outputcache. Think of a better way to do
6807 6814 this later.
6808 6815
6809 6816 * Various small fixes thanks to Nathan's comments.
6810 6817
6811 6818 * Changed magic_pprint to magic_Pprint. This way it doesn't
6812 6819 collide with pprint() and the name is consistent with the command
6813 6820 line option.
6814 6821
6815 6822 * Changed prompt counter behavior to be fully like
6816 6823 Mathematica's. That is, even input that doesn't return a result
6817 6824 raises the prompt counter. The old behavior was kind of confusing
6818 6825 (getting the same prompt number several times if the operation
6819 6826 didn't return a result).
6820 6827
6821 6828 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
6822 6829
6823 6830 * Fixed -Classic mode (wasn't working anymore).
6824 6831
6825 6832 * Added colored prompts using Nathan's new code. Colors are
6826 6833 currently hardwired, they can be user-configurable. For
6827 6834 developers, they can be chosen in file ipythonlib.py, at the
6828 6835 beginning of the CachedOutput class def.
6829 6836
6830 6837 2001-11-11 Fernando Perez <fperez@colorado.edu>
6831 6838
6832 6839 * Version 0.1.5 released, 0.1.6 opened for further work.
6833 6840
6834 6841 * Changed magic_env to *return* the environment as a dict (not to
6835 6842 print it). This way it prints, but it can also be processed.
6836 6843
6837 6844 * Added Verbose exception reporting to interactive
6838 6845 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6839 6846 traceback. Had to make some changes to the ultraTB file. This is
6840 6847 probably the last 'big' thing in my mental todo list. This ties
6841 6848 in with the next entry:
6842 6849
6843 6850 * Changed -Xi and -Xf to a single -xmode option. Now all the user
6844 6851 has to specify is Plain, Color or Verbose for all exception
6845 6852 handling.
6846 6853
6847 6854 * Removed ShellServices option. All this can really be done via
6848 6855 the magic system. It's easier to extend, cleaner and has automatic
6849 6856 namespace protection and documentation.
6850 6857
6851 6858 2001-11-09 Fernando Perez <fperez@colorado.edu>
6852 6859
6853 6860 * Fixed bug in output cache flushing (missing parameter to
6854 6861 __init__). Other small bugs fixed (found using pychecker).
6855 6862
6856 6863 * Version 0.1.4 opened for bugfixing.
6857 6864
6858 6865 2001-11-07 Fernando Perez <fperez@colorado.edu>
6859 6866
6860 6867 * Version 0.1.3 released, mainly because of the raw_input bug.
6861 6868
6862 6869 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6863 6870 and when testing for whether things were callable, a call could
6864 6871 actually be made to certain functions. They would get called again
6865 6872 once 'really' executed, with a resulting double call. A disaster
6866 6873 in many cases (list.reverse() would never work!).
6867 6874
6868 6875 * Removed prefilter() function, moved its code to raw_input (which
6869 6876 after all was just a near-empty caller for prefilter). This saves
6870 6877 a function call on every prompt, and simplifies the class a tiny bit.
6871 6878
6872 6879 * Fix _ip to __ip name in magic example file.
6873 6880
6874 6881 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6875 6882 work with non-gnu versions of tar.
6876 6883
6877 6884 2001-11-06 Fernando Perez <fperez@colorado.edu>
6878 6885
6879 6886 * Version 0.1.2. Just to keep track of the recent changes.
6880 6887
6881 6888 * Fixed nasty bug in output prompt routine. It used to check 'if
6882 6889 arg != None...'. Problem is, this fails if arg implements a
6883 6890 special comparison (__cmp__) which disallows comparing to
6884 6891 None. Found it when trying to use the PhysicalQuantity module from
6885 6892 ScientificPython.
6886 6893
6887 6894 2001-11-05 Fernando Perez <fperez@colorado.edu>
6888 6895
6889 6896 * Also added dirs. Now the pushd/popd/dirs family functions
6890 6897 basically like the shell, with the added convenience of going home
6891 6898 when called with no args.
6892 6899
6893 6900 * pushd/popd slightly modified to mimic shell behavior more
6894 6901 closely.
6895 6902
6896 6903 * Added env,pushd,popd from ShellServices as magic functions. I
6897 6904 think the cleanest will be to port all desired functions from
6898 6905 ShellServices as magics and remove ShellServices altogether. This
6899 6906 will provide a single, clean way of adding functionality
6900 6907 (shell-type or otherwise) to IP.
6901 6908
6902 6909 2001-11-04 Fernando Perez <fperez@colorado.edu>
6903 6910
6904 6911 * Added .ipython/ directory to sys.path. This way users can keep
6905 6912 customizations there and access them via import.
6906 6913
6907 6914 2001-11-03 Fernando Perez <fperez@colorado.edu>
6908 6915
6909 6916 * Opened version 0.1.1 for new changes.
6910 6917
6911 6918 * Changed version number to 0.1.0: first 'public' release, sent to
6912 6919 Nathan and Janko.
6913 6920
6914 6921 * Lots of small fixes and tweaks.
6915 6922
6916 6923 * Minor changes to whos format. Now strings are shown, snipped if
6917 6924 too long.
6918 6925
6919 6926 * Changed ShellServices to work on __main__ so they show up in @who
6920 6927
6921 6928 * Help also works with ? at the end of a line:
6922 6929 ?sin and sin?
6923 6930 both produce the same effect. This is nice, as often I use the
6924 6931 tab-complete to find the name of a method, but I used to then have
6925 6932 to go to the beginning of the line to put a ? if I wanted more
6926 6933 info. Now I can just add the ? and hit return. Convenient.
6927 6934
6928 6935 2001-11-02 Fernando Perez <fperez@colorado.edu>
6929 6936
6930 6937 * Python version check (>=2.1) added.
6931 6938
6932 6939 * Added LazyPython documentation. At this point the docs are quite
6933 6940 a mess. A cleanup is in order.
6934 6941
6935 6942 * Auto-installer created. For some bizarre reason, the zipfiles
6936 6943 module isn't working on my system. So I made a tar version
6937 6944 (hopefully the command line options in various systems won't kill
6938 6945 me).
6939 6946
6940 6947 * Fixes to Struct in genutils. Now all dictionary-like methods are
6941 6948 protected (reasonably).
6942 6949
6943 6950 * Added pager function to genutils and changed ? to print usage
6944 6951 note through it (it was too long).
6945 6952
6946 6953 * Added the LazyPython functionality. Works great! I changed the
6947 6954 auto-quote escape to ';', it's on home row and next to '. But
6948 6955 both auto-quote and auto-paren (still /) escapes are command-line
6949 6956 parameters.
6950 6957
6951 6958
6952 6959 2001-11-01 Fernando Perez <fperez@colorado.edu>
6953 6960
6954 6961 * Version changed to 0.0.7. Fairly large change: configuration now
6955 6962 is all stored in a directory, by default .ipython. There, all
6956 6963 config files have normal looking names (not .names)
6957 6964
6958 6965 * Version 0.0.6 Released first to Lucas and Archie as a test
6959 6966 run. Since it's the first 'semi-public' release, change version to
6960 6967 > 0.0.6 for any changes now.
6961 6968
6962 6969 * Stuff I had put in the ipplib.py changelog:
6963 6970
6964 6971 Changes to InteractiveShell:
6965 6972
6966 6973 - Made the usage message a parameter.
6967 6974
6968 6975 - Require the name of the shell variable to be given. It's a bit
6969 6976 of a hack, but allows the name 'shell' not to be hardwired in the
6970 6977 magic (@) handler, which is problematic b/c it requires
6971 6978 polluting the global namespace with 'shell'. This in turn is
6972 6979 fragile: if a user redefines a variable called shell, things
6973 6980 break.
6974 6981
6975 6982 - magic @: all functions available through @ need to be defined
6976 6983 as magic_<name>, even though they can be called simply as
6977 6984 @<name>. This allows the special command @magic to gather
6978 6985 information automatically about all existing magic functions,
6979 6986 even if they are run-time user extensions, by parsing the shell
6980 6987 instance __dict__ looking for special magic_ names.
6981 6988
6982 6989 - mainloop: added *two* local namespace parameters. This allows
6983 6990 the class to differentiate between parameters which were there
6984 6991 before and after command line initialization was processed. This
6985 6992 way, later @who can show things loaded at startup by the
6986 6993 user. This trick was necessary to make session saving/reloading
6987 6994 really work: ideally after saving/exiting/reloading a session,
6988 6995 *everything* should look the same, including the output of @who. I
6989 6996 was only able to make this work with this double namespace
6990 6997 trick.
6991 6998
6992 6999 - added a header to the logfile which allows (almost) full
6993 7000 session restoring.
6994 7001
6995 7002 - prepend lines beginning with @ or !, with a and log
6996 7003 them. Why? !lines: may be useful to know what you did @lines:
6997 7004 they may affect session state. So when restoring a session, at
6998 7005 least inform the user of their presence. I couldn't quite get
6999 7006 them to properly re-execute, but at least the user is warned.
7000 7007
7001 7008 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now