##// END OF EJS Templates
route around SuperPack bug where UserConfig can't be found
vivainio -
Show More
@@ -1,2557 +1,2569 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 2763 2007-09-14 06:35:44Z fperez $
9 $Id: iplib.py 2844 2007-10-24 14:34:18Z vivainio $
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 exceptions
45 45 import glob
46 46 import inspect
47 47 import keyword
48 48 import new
49 49 import os
50 50 import pydoc
51 51 import re
52 52 import shutil
53 53 import string
54 54 import sys
55 55 import tempfile
56 56 import traceback
57 57 import types
58 58 import pickleshare
59 59 from sets import Set
60 60 from pprint import pprint, pformat
61 61
62 62 # IPython's own modules
63 63 #import IPython
64 64 from IPython import Debugger,OInspect,PyColorize,ultraTB
65 65 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
66 66 from IPython.FakeModule import FakeModule
67 67 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
68 68 from IPython.Logger import Logger
69 69 from IPython.Magic import Magic
70 70 from IPython.Prompts import CachedOutput
71 71 from IPython.ipstruct import Struct
72 72 from IPython.background_jobs import BackgroundJobManager
73 73 from IPython.usage import cmd_line_usage,interactive_usage
74 74 from IPython.genutils import *
75 75 from IPython.strdispatch import StrDispatch
76 76 import IPython.ipapi
77 77 import IPython.history
78 78 import IPython.prefilter as prefilter
79 79 import IPython.shadowns
80 80 # Globals
81 81
82 82 # store the builtin raw_input globally, and use this always, in case user code
83 83 # overwrites it (like wx.py.PyShell does)
84 84 raw_input_original = raw_input
85 85
86 86 # compiled regexps for autoindent management
87 87 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
88 88
89 89
90 90 #****************************************************************************
91 91 # Some utility function definitions
92 92
93 93 ini_spaces_re = re.compile(r'^(\s+)')
94 94
95 95 def num_ini_spaces(strng):
96 96 """Return the number of initial spaces in a string"""
97 97
98 98 ini_spaces = ini_spaces_re.match(strng)
99 99 if ini_spaces:
100 100 return ini_spaces.end()
101 101 else:
102 102 return 0
103 103
104 104 def softspace(file, newvalue):
105 105 """Copied from code.py, to remove the dependency"""
106 106
107 107 oldvalue = 0
108 108 try:
109 109 oldvalue = file.softspace
110 110 except AttributeError:
111 111 pass
112 112 try:
113 113 file.softspace = newvalue
114 114 except (AttributeError, TypeError):
115 115 # "attribute-less object" or "read-only attributes"
116 116 pass
117 117 return oldvalue
118 118
119 119
120 120 #****************************************************************************
121 121 # Local use exceptions
122 122 class SpaceInInput(exceptions.Exception): pass
123 123
124 124
125 125 #****************************************************************************
126 126 # Local use classes
127 127 class Bunch: pass
128 128
129 129 class Undefined: pass
130 130
131 131 class Quitter(object):
132 132 """Simple class to handle exit, similar to Python 2.5's.
133 133
134 134 It handles exiting in an ipython-safe manner, which the one in Python 2.5
135 135 doesn't do (obviously, since it doesn't know about ipython)."""
136 136
137 137 def __init__(self,shell,name):
138 138 self.shell = shell
139 139 self.name = name
140 140
141 141 def __repr__(self):
142 142 return 'Type %s() to exit.' % self.name
143 143 __str__ = __repr__
144 144
145 145 def __call__(self):
146 146 self.shell.exit()
147 147
148 148 class InputList(list):
149 149 """Class to store user input.
150 150
151 151 It's basically a list, but slices return a string instead of a list, thus
152 152 allowing things like (assuming 'In' is an instance):
153 153
154 154 exec In[4:7]
155 155
156 156 or
157 157
158 158 exec In[5:9] + In[14] + In[21:25]"""
159 159
160 160 def __getslice__(self,i,j):
161 161 return ''.join(list.__getslice__(self,i,j))
162 162
163 163 class SyntaxTB(ultraTB.ListTB):
164 164 """Extension which holds some state: the last exception value"""
165 165
166 166 def __init__(self,color_scheme = 'NoColor'):
167 167 ultraTB.ListTB.__init__(self,color_scheme)
168 168 self.last_syntax_error = None
169 169
170 170 def __call__(self, etype, value, elist):
171 171 self.last_syntax_error = value
172 172 ultraTB.ListTB.__call__(self,etype,value,elist)
173 173
174 174 def clear_err_state(self):
175 175 """Return the current error state and clear it"""
176 176 e = self.last_syntax_error
177 177 self.last_syntax_error = None
178 178 return e
179 179
180 180 #****************************************************************************
181 181 # Main IPython class
182 182
183 183 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
184 184 # until a full rewrite is made. I've cleaned all cross-class uses of
185 185 # attributes and methods, but too much user code out there relies on the
186 186 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
187 187 #
188 188 # But at least now, all the pieces have been separated and we could, in
189 189 # principle, stop using the mixin. This will ease the transition to the
190 190 # chainsaw branch.
191 191
192 192 # For reference, the following is the list of 'self.foo' uses in the Magic
193 193 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
194 194 # class, to prevent clashes.
195 195
196 196 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
197 197 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
198 198 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
199 199 # 'self.value']
200 200
201 201 class InteractiveShell(object,Magic):
202 202 """An enhanced console for Python."""
203 203
204 204 # class attribute to indicate whether the class supports threads or not.
205 205 # Subclasses with thread support should override this as needed.
206 206 isthreaded = False
207 207
208 208 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
209 209 user_ns = None,user_global_ns=None,banner2='',
210 210 custom_exceptions=((),None),embedded=False):
211 211
212 212 # log system
213 213 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
214 214
215 215 # some minimal strict typechecks. For some core data structures, I
216 216 # want actual basic python types, not just anything that looks like
217 217 # one. This is especially true for namespaces.
218 218 for ns in (user_ns,user_global_ns):
219 219 if ns is not None and type(ns) != types.DictType:
220 220 raise TypeError,'namespace must be a dictionary'
221 221
222 222 # Job manager (for jobs run as background threads)
223 223 self.jobs = BackgroundJobManager()
224 224
225 225 # Store the actual shell's name
226 226 self.name = name
227 227
228 228 # We need to know whether the instance is meant for embedding, since
229 229 # global/local namespaces need to be handled differently in that case
230 230 self.embedded = embedded
231 231 if embedded:
232 232 # Control variable so users can, from within the embedded instance,
233 233 # permanently deactivate it.
234 234 self.embedded_active = True
235 235
236 236 # command compiler
237 237 self.compile = codeop.CommandCompiler()
238 238
239 239 # User input buffer
240 240 self.buffer = []
241 241
242 242 # Default name given in compilation of code
243 243 self.filename = '<ipython console>'
244 244
245 245 # Install our own quitter instead of the builtins. For python2.3-2.4,
246 246 # this brings in behavior like 2.5, and for 2.5 it's identical.
247 247 __builtin__.exit = Quitter(self,'exit')
248 248 __builtin__.quit = Quitter(self,'quit')
249 249
250 250 # Make an empty namespace, which extension writers can rely on both
251 251 # existing and NEVER being used by ipython itself. This gives them a
252 252 # convenient location for storing additional information and state
253 253 # their extensions may require, without fear of collisions with other
254 254 # ipython names that may develop later.
255 255 self.meta = Struct()
256 256
257 257 # Create the namespace where the user will operate. user_ns is
258 258 # normally the only one used, and it is passed to the exec calls as
259 259 # the locals argument. But we do carry a user_global_ns namespace
260 260 # given as the exec 'globals' argument, This is useful in embedding
261 261 # situations where the ipython shell opens in a context where the
262 262 # distinction between locals and globals is meaningful.
263 263
264 264 # FIXME. For some strange reason, __builtins__ is showing up at user
265 265 # level as a dict instead of a module. This is a manual fix, but I
266 266 # should really track down where the problem is coming from. Alex
267 267 # Schmolck reported this problem first.
268 268
269 269 # A useful post by Alex Martelli on this topic:
270 270 # Re: inconsistent value from __builtins__
271 271 # Von: Alex Martelli <aleaxit@yahoo.com>
272 272 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
273 273 # Gruppen: comp.lang.python
274 274
275 275 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
276 276 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
277 277 # > <type 'dict'>
278 278 # > >>> print type(__builtins__)
279 279 # > <type 'module'>
280 280 # > Is this difference in return value intentional?
281 281
282 282 # Well, it's documented that '__builtins__' can be either a dictionary
283 283 # or a module, and it's been that way for a long time. Whether it's
284 284 # intentional (or sensible), I don't know. In any case, the idea is
285 285 # that if you need to access the built-in namespace directly, you
286 286 # should start with "import __builtin__" (note, no 's') which will
287 287 # definitely give you a module. Yeah, it's somewhat confusing:-(.
288 288
289 289 # These routines return properly built dicts as needed by the rest of
290 290 # the code, and can also be used by extension writers to generate
291 291 # properly initialized namespaces.
292 292 user_ns = IPython.ipapi.make_user_ns(user_ns)
293 293 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
294 294
295 295 # Assign namespaces
296 296 # This is the namespace where all normal user variables live
297 297 self.user_ns = user_ns
298 298 # Embedded instances require a separate namespace for globals.
299 299 # Normally this one is unused by non-embedded instances.
300 300 self.user_global_ns = user_global_ns
301 301 # A namespace to keep track of internal data structures to prevent
302 302 # them from cluttering user-visible stuff. Will be updated later
303 303 self.internal_ns = {}
304 304
305 305 # Namespace of system aliases. Each entry in the alias
306 306 # table must be a 2-tuple of the form (N,name), where N is the number
307 307 # of positional arguments of the alias.
308 308 self.alias_table = {}
309 309
310 310 # A table holding all the namespaces IPython deals with, so that
311 311 # introspection facilities can search easily.
312 312 self.ns_table = {'user':user_ns,
313 313 'user_global':user_global_ns,
314 314 'alias':self.alias_table,
315 315 'internal':self.internal_ns,
316 316 'builtin':__builtin__.__dict__
317 317 }
318 318 # The user namespace MUST have a pointer to the shell itself.
319 319 self.user_ns[name] = self
320 320
321 321 # We need to insert into sys.modules something that looks like a
322 322 # module but which accesses the IPython namespace, for shelve and
323 323 # pickle to work interactively. Normally they rely on getting
324 324 # everything out of __main__, but for embedding purposes each IPython
325 325 # instance has its own private namespace, so we can't go shoving
326 326 # everything into __main__.
327 327
328 328 # note, however, that we should only do this for non-embedded
329 329 # ipythons, which really mimic the __main__.__dict__ with their own
330 330 # namespace. Embedded instances, on the other hand, should not do
331 331 # this because they need to manage the user local/global namespaces
332 332 # only, but they live within a 'normal' __main__ (meaning, they
333 333 # shouldn't overtake the execution environment of the script they're
334 334 # embedded in).
335 335
336 336 if not embedded:
337 337 try:
338 338 main_name = self.user_ns['__name__']
339 339 except KeyError:
340 340 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
341 341 else:
342 342 #print "pickle hack in place" # dbg
343 343 #print 'main_name:',main_name # dbg
344 344 sys.modules[main_name] = FakeModule(self.user_ns)
345 345
346 346 # Now that FakeModule produces a real module, we've run into a nasty
347 347 # problem: after script execution (via %run), the module where the user
348 348 # code ran is deleted. Now that this object is a true module (needed
349 349 # so docetst and other tools work correctly), the Python module
350 350 # teardown mechanism runs over it, and sets to None every variable
351 351 # present in that module. This means that later calls to functions
352 352 # defined in the script (which have become interactively visible after
353 353 # script exit) fail, because they hold references to objects that have
354 354 # become overwritten into None. The only solution I see right now is
355 355 # to protect every FakeModule used by %run by holding an internal
356 356 # reference to it. This private list will be used for that. The
357 357 # %reset command will flush it as well.
358 358 self._user_main_modules = []
359 359
360 360 # List of input with multi-line handling.
361 361 # Fill its zero entry, user counter starts at 1
362 362 self.input_hist = InputList(['\n'])
363 363 # This one will hold the 'raw' input history, without any
364 364 # pre-processing. This will allow users to retrieve the input just as
365 365 # it was exactly typed in by the user, with %hist -r.
366 366 self.input_hist_raw = InputList(['\n'])
367 367
368 368 # list of visited directories
369 369 try:
370 370 self.dir_hist = [os.getcwd()]
371 371 except OSError:
372 372 self.dir_hist = []
373 373
374 374 # dict of output history
375 375 self.output_hist = {}
376 376
377 377 # Get system encoding at startup time. Certain terminals (like Emacs
378 378 # under Win32 have it set to None, and we need to have a known valid
379 379 # encoding to use in the raw_input() method
380 380 self.stdin_encoding = sys.stdin.encoding or 'ascii'
381 381
382 382 # dict of things NOT to alias (keywords, builtins and some magics)
383 383 no_alias = {}
384 384 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
385 385 for key in keyword.kwlist + no_alias_magics:
386 386 no_alias[key] = 1
387 387 no_alias.update(__builtin__.__dict__)
388 388 self.no_alias = no_alias
389 389
390 390 # make global variables for user access to these
391 391 self.user_ns['_ih'] = self.input_hist
392 392 self.user_ns['_oh'] = self.output_hist
393 393 self.user_ns['_dh'] = self.dir_hist
394 394
395 395 # user aliases to input and output histories
396 396 self.user_ns['In'] = self.input_hist
397 397 self.user_ns['Out'] = self.output_hist
398 398
399 399 self.user_ns['_sh'] = IPython.shadowns
400 400 # Object variable to store code object waiting execution. This is
401 401 # used mainly by the multithreaded shells, but it can come in handy in
402 402 # other situations. No need to use a Queue here, since it's a single
403 403 # item which gets cleared once run.
404 404 self.code_to_run = None
405 405
406 406 # escapes for automatic behavior on the command line
407 407 self.ESC_SHELL = '!'
408 408 self.ESC_SH_CAP = '!!'
409 409 self.ESC_HELP = '?'
410 410 self.ESC_MAGIC = '%'
411 411 self.ESC_QUOTE = ','
412 412 self.ESC_QUOTE2 = ';'
413 413 self.ESC_PAREN = '/'
414 414
415 415 # And their associated handlers
416 416 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
417 417 self.ESC_QUOTE : self.handle_auto,
418 418 self.ESC_QUOTE2 : self.handle_auto,
419 419 self.ESC_MAGIC : self.handle_magic,
420 420 self.ESC_HELP : self.handle_help,
421 421 self.ESC_SHELL : self.handle_shell_escape,
422 422 self.ESC_SH_CAP : self.handle_shell_escape,
423 423 }
424 424
425 425 # class initializations
426 426 Magic.__init__(self,self)
427 427
428 428 # Python source parser/formatter for syntax highlighting
429 429 pyformat = PyColorize.Parser().format
430 430 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
431 431
432 432 # hooks holds pointers used for user-side customizations
433 433 self.hooks = Struct()
434 434
435 435 self.strdispatchers = {}
436 436
437 437 # Set all default hooks, defined in the IPython.hooks module.
438 438 hooks = IPython.hooks
439 439 for hook_name in hooks.__all__:
440 440 # default hooks have priority 100, i.e. low; user hooks should have
441 441 # 0-100 priority
442 442 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
443 443 #print "bound hook",hook_name
444 444
445 445 # Flag to mark unconditional exit
446 446 self.exit_now = False
447 447
448 448 self.usage_min = """\
449 449 An enhanced console for Python.
450 450 Some of its features are:
451 451 - Readline support if the readline library is present.
452 452 - Tab completion in the local namespace.
453 453 - Logging of input, see command-line options.
454 454 - System shell escape via ! , eg !ls.
455 455 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
456 456 - Keeps track of locally defined variables via %who, %whos.
457 457 - Show object information with a ? eg ?x or x? (use ?? for more info).
458 458 """
459 459 if usage: self.usage = usage
460 460 else: self.usage = self.usage_min
461 461
462 462 # Storage
463 463 self.rc = rc # This will hold all configuration information
464 464 self.pager = 'less'
465 465 # temporary files used for various purposes. Deleted at exit.
466 466 self.tempfiles = []
467 467
468 468 # Keep track of readline usage (later set by init_readline)
469 469 self.has_readline = False
470 470
471 471 # template for logfile headers. It gets resolved at runtime by the
472 472 # logstart method.
473 473 self.loghead_tpl = \
474 474 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
475 475 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
476 476 #log# opts = %s
477 477 #log# args = %s
478 478 #log# It is safe to make manual edits below here.
479 479 #log#-----------------------------------------------------------------------
480 480 """
481 481 # for pushd/popd management
482 482 try:
483 483 self.home_dir = get_home_dir()
484 484 except HomeDirError,msg:
485 485 fatal(msg)
486 486
487 487 self.dir_stack = []
488 488
489 489 # Functions to call the underlying shell.
490 490
491 491 # The first is similar to os.system, but it doesn't return a value,
492 492 # and it allows interpolation of variables in the user's namespace.
493 493 self.system = lambda cmd: \
494 494 shell(self.var_expand(cmd,depth=2),
495 495 header=self.rc.system_header,
496 496 verbose=self.rc.system_verbose)
497 497
498 498 # These are for getoutput and getoutputerror:
499 499 self.getoutput = lambda cmd: \
500 500 getoutput(self.var_expand(cmd,depth=2),
501 501 header=self.rc.system_header,
502 502 verbose=self.rc.system_verbose)
503 503
504 504 self.getoutputerror = lambda cmd: \
505 505 getoutputerror(self.var_expand(cmd,depth=2),
506 506 header=self.rc.system_header,
507 507 verbose=self.rc.system_verbose)
508 508
509 509
510 510 # keep track of where we started running (mainly for crash post-mortem)
511 511 self.starting_dir = os.getcwd()
512 512
513 513 # Various switches which can be set
514 514 self.CACHELENGTH = 5000 # this is cheap, it's just text
515 515 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
516 516 self.banner2 = banner2
517 517
518 518 # TraceBack handlers:
519 519
520 520 # Syntax error handler.
521 521 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
522 522
523 523 # The interactive one is initialized with an offset, meaning we always
524 524 # want to remove the topmost item in the traceback, which is our own
525 525 # internal code. Valid modes: ['Plain','Context','Verbose']
526 526 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
527 527 color_scheme='NoColor',
528 528 tb_offset = 1)
529 529
530 530 # IPython itself shouldn't crash. This will produce a detailed
531 531 # post-mortem if it does. But we only install the crash handler for
532 532 # non-threaded shells, the threaded ones use a normal verbose reporter
533 533 # and lose the crash handler. This is because exceptions in the main
534 534 # thread (such as in GUI code) propagate directly to sys.excepthook,
535 535 # and there's no point in printing crash dumps for every user exception.
536 536 if self.isthreaded:
537 537 ipCrashHandler = ultraTB.FormattedTB()
538 538 else:
539 539 from IPython import CrashHandler
540 540 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
541 541 self.set_crash_handler(ipCrashHandler)
542 542
543 543 # and add any custom exception handlers the user may have specified
544 544 self.set_custom_exc(*custom_exceptions)
545 545
546 546 # indentation management
547 547 self.autoindent = False
548 548 self.indent_current_nsp = 0
549 549
550 550 # Make some aliases automatically
551 551 # Prepare list of shell aliases to auto-define
552 552 if os.name == 'posix':
553 553 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
554 554 'mv mv -i','rm rm -i','cp cp -i',
555 555 'cat cat','less less','clear clear',
556 556 # a better ls
557 557 'ls ls -F',
558 558 # long ls
559 559 'll ls -lF')
560 560 # Extra ls aliases with color, which need special treatment on BSD
561 561 # variants
562 562 ls_extra = ( # color ls
563 563 'lc ls -F -o --color',
564 564 # ls normal files only
565 565 'lf ls -F -o --color %l | grep ^-',
566 566 # ls symbolic links
567 567 'lk ls -F -o --color %l | grep ^l',
568 568 # directories or links to directories,
569 569 'ldir ls -F -o --color %l | grep /$',
570 570 # things which are executable
571 571 'lx ls -F -o --color %l | grep ^-..x',
572 572 )
573 573 # The BSDs don't ship GNU ls, so they don't understand the
574 574 # --color switch out of the box
575 575 if 'bsd' in sys.platform:
576 576 ls_extra = ( # ls normal files only
577 577 'lf ls -lF | grep ^-',
578 578 # ls symbolic links
579 579 'lk ls -lF | grep ^l',
580 580 # directories or links to directories,
581 581 'ldir ls -lF | grep /$',
582 582 # things which are executable
583 583 'lx ls -lF | grep ^-..x',
584 584 )
585 585 auto_alias = auto_alias + ls_extra
586 586 elif os.name in ['nt','dos']:
587 587 auto_alias = ('ls dir /on',
588 588 'ddir dir /ad /on', 'ldir dir /ad /on',
589 589 'mkdir mkdir','rmdir rmdir','echo echo',
590 590 'ren ren','cls cls','copy copy')
591 591 else:
592 592 auto_alias = ()
593 593 self.auto_alias = [s.split(None,1) for s in auto_alias]
594 594
595 595 # Produce a public API instance
596 596 self.api = IPython.ipapi.IPApi(self)
597 597
598 598 # Call the actual (public) initializer
599 599 self.init_auto_alias()
600 600
601 601 # track which builtins we add, so we can clean up later
602 602 self.builtins_added = {}
603 603 # This method will add the necessary builtins for operation, but
604 604 # tracking what it did via the builtins_added dict.
605 605 self.add_builtins()
606 606
607 607
608 608
609 609 # end __init__
610 610
611 611 def var_expand(self,cmd,depth=0):
612 612 """Expand python variables in a string.
613 613
614 614 The depth argument indicates how many frames above the caller should
615 615 be walked to look for the local namespace where to expand variables.
616 616
617 617 The global namespace for expansion is always the user's interactive
618 618 namespace.
619 619 """
620 620
621 621 return str(ItplNS(cmd.replace('#','\#'),
622 622 self.user_ns, # globals
623 623 # Skip our own frame in searching for locals:
624 624 sys._getframe(depth+1).f_locals # locals
625 625 ))
626 626
627 627 def pre_config_initialization(self):
628 628 """Pre-configuration init method
629 629
630 630 This is called before the configuration files are processed to
631 631 prepare the services the config files might need.
632 632
633 633 self.rc already has reasonable default values at this point.
634 634 """
635 635 rc = self.rc
636 636 try:
637 637 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
638 638 except exceptions.UnicodeDecodeError:
639 639 print "Your ipythondir can't be decoded to unicode!"
640 640 print "Please set HOME environment variable to something that"
641 641 print r"only has ASCII characters, e.g. c:\home"
642 642 print "Now it is",rc.ipythondir
643 643 sys.exit()
644 644 self.shadowhist = IPython.history.ShadowHist(self.db)
645 645
646 646
647 647 def post_config_initialization(self):
648 648 """Post configuration init method
649 649
650 650 This is called after the configuration files have been processed to
651 651 'finalize' the initialization."""
652 652
653 653 rc = self.rc
654 654
655 655 # Object inspector
656 656 self.inspector = OInspect.Inspector(OInspect.InspectColors,
657 657 PyColorize.ANSICodeColors,
658 658 'NoColor',
659 659 rc.object_info_string_level)
660 660
661 661 self.rl_next_input = None
662 662 self.rl_do_indent = False
663 663 # Load readline proper
664 664 if rc.readline:
665 665 self.init_readline()
666 666
667 667
668 668 # local shortcut, this is used a LOT
669 669 self.log = self.logger.log
670 670
671 671 # Initialize cache, set in/out prompts and printing system
672 672 self.outputcache = CachedOutput(self,
673 673 rc.cache_size,
674 674 rc.pprint,
675 675 input_sep = rc.separate_in,
676 676 output_sep = rc.separate_out,
677 677 output_sep2 = rc.separate_out2,
678 678 ps1 = rc.prompt_in1,
679 679 ps2 = rc.prompt_in2,
680 680 ps_out = rc.prompt_out,
681 681 pad_left = rc.prompts_pad_left)
682 682
683 683 # user may have over-ridden the default print hook:
684 684 try:
685 685 self.outputcache.__class__.display = self.hooks.display
686 686 except AttributeError:
687 687 pass
688 688
689 689 # I don't like assigning globally to sys, because it means when
690 690 # embedding instances, each embedded instance overrides the previous
691 691 # choice. But sys.displayhook seems to be called internally by exec,
692 692 # so I don't see a way around it. We first save the original and then
693 693 # overwrite it.
694 694 self.sys_displayhook = sys.displayhook
695 695 sys.displayhook = self.outputcache
696 696
697 697 # Do a proper resetting of doctest, including the necessary displayhook
698 698 # monkeypatching
699 699 doctest_reload()
700 700
701 701 # Set user colors (don't do it in the constructor above so that it
702 702 # doesn't crash if colors option is invalid)
703 703 self.magic_colors(rc.colors)
704 704
705 705 # Set calling of pdb on exceptions
706 706 self.call_pdb = rc.pdb
707 707
708 708 # Load user aliases
709 709 for alias in rc.alias:
710 710 self.magic_alias(alias)
711 711
712 712 self.hooks.late_startup_hook()
713 713
714 714 batchrun = False
715 715 for batchfile in [path(arg) for arg in self.rc.args
716 716 if arg.lower().endswith('.ipy')]:
717 717 if not batchfile.isfile():
718 718 print "No such batch file:", batchfile
719 719 continue
720 720 self.api.runlines(batchfile.text())
721 721 batchrun = True
722 722 # without -i option, exit after running the batch file
723 723 if batchrun and not self.rc.interact:
724 724 self.exit_now = True
725 725
726 726 def add_builtins(self):
727 727 """Store ipython references into the builtin namespace.
728 728
729 729 Some parts of ipython operate via builtins injected here, which hold a
730 730 reference to IPython itself."""
731 731
732 732 # TODO: deprecate all except _ip; 'jobs' should be installed
733 733 # by an extension and the rest are under _ip, ipalias is redundant
734 734 builtins_new = dict(__IPYTHON__ = self,
735 735 ip_set_hook = self.set_hook,
736 736 jobs = self.jobs,
737 737 ipmagic = wrap_deprecated(self.ipmagic,'_ip.magic()'),
738 738 ipalias = wrap_deprecated(self.ipalias),
739 739 ipsystem = wrap_deprecated(self.ipsystem,'_ip.system()'),
740 740 _ip = self.api
741 741 )
742 742 for biname,bival in builtins_new.items():
743 743 try:
744 744 # store the orignal value so we can restore it
745 745 self.builtins_added[biname] = __builtin__.__dict__[biname]
746 746 except KeyError:
747 747 # or mark that it wasn't defined, and we'll just delete it at
748 748 # cleanup
749 749 self.builtins_added[biname] = Undefined
750 750 __builtin__.__dict__[biname] = bival
751 751
752 752 # Keep in the builtins a flag for when IPython is active. We set it
753 753 # with setdefault so that multiple nested IPythons don't clobber one
754 754 # another. Each will increase its value by one upon being activated,
755 755 # which also gives us a way to determine the nesting level.
756 756 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
757 757
758 758 def clean_builtins(self):
759 759 """Remove any builtins which might have been added by add_builtins, or
760 760 restore overwritten ones to their previous values."""
761 761 for biname,bival in self.builtins_added.items():
762 762 if bival is Undefined:
763 763 del __builtin__.__dict__[biname]
764 764 else:
765 765 __builtin__.__dict__[biname] = bival
766 766 self.builtins_added.clear()
767 767
768 768 def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
769 769 """set_hook(name,hook) -> sets an internal IPython hook.
770 770
771 771 IPython exposes some of its internal API as user-modifiable hooks. By
772 772 adding your function to one of these hooks, you can modify IPython's
773 773 behavior to call at runtime your own routines."""
774 774
775 775 # At some point in the future, this should validate the hook before it
776 776 # accepts it. Probably at least check that the hook takes the number
777 777 # of args it's supposed to.
778 778
779 779 f = new.instancemethod(hook,self,self.__class__)
780 780
781 781 # check if the hook is for strdispatcher first
782 782 if str_key is not None:
783 783 sdp = self.strdispatchers.get(name, StrDispatch())
784 784 sdp.add_s(str_key, f, priority )
785 785 self.strdispatchers[name] = sdp
786 786 return
787 787 if re_key is not None:
788 788 sdp = self.strdispatchers.get(name, StrDispatch())
789 789 sdp.add_re(re.compile(re_key), f, priority )
790 790 self.strdispatchers[name] = sdp
791 791 return
792 792
793 793 dp = getattr(self.hooks, name, None)
794 794 if name not in IPython.hooks.__all__:
795 795 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
796 796 if not dp:
797 797 dp = IPython.hooks.CommandChainDispatcher()
798 798
799 799 try:
800 800 dp.add(f,priority)
801 801 except AttributeError:
802 802 # it was not commandchain, plain old func - replace
803 803 dp = f
804 804
805 805 setattr(self.hooks,name, dp)
806 806
807 807
808 808 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
809 809
810 810 def set_crash_handler(self,crashHandler):
811 811 """Set the IPython crash handler.
812 812
813 813 This must be a callable with a signature suitable for use as
814 814 sys.excepthook."""
815 815
816 816 # Install the given crash handler as the Python exception hook
817 817 sys.excepthook = crashHandler
818 818
819 819 # The instance will store a pointer to this, so that runtime code
820 820 # (such as magics) can access it. This is because during the
821 821 # read-eval loop, it gets temporarily overwritten (to deal with GUI
822 822 # frameworks).
823 823 self.sys_excepthook = sys.excepthook
824 824
825 825
826 826 def set_custom_exc(self,exc_tuple,handler):
827 827 """set_custom_exc(exc_tuple,handler)
828 828
829 829 Set a custom exception handler, which will be called if any of the
830 830 exceptions in exc_tuple occur in the mainloop (specifically, in the
831 831 runcode() method.
832 832
833 833 Inputs:
834 834
835 835 - exc_tuple: a *tuple* of valid exceptions to call the defined
836 836 handler for. It is very important that you use a tuple, and NOT A
837 837 LIST here, because of the way Python's except statement works. If
838 838 you only want to trap a single exception, use a singleton tuple:
839 839
840 840 exc_tuple == (MyCustomException,)
841 841
842 842 - handler: this must be defined as a function with the following
843 843 basic interface: def my_handler(self,etype,value,tb).
844 844
845 845 This will be made into an instance method (via new.instancemethod)
846 846 of IPython itself, and it will be called if any of the exceptions
847 847 listed in the exc_tuple are caught. If the handler is None, an
848 848 internal basic one is used, which just prints basic info.
849 849
850 850 WARNING: by putting in your own exception handler into IPython's main
851 851 execution loop, you run a very good chance of nasty crashes. This
852 852 facility should only be used if you really know what you are doing."""
853 853
854 854 assert type(exc_tuple)==type(()) , \
855 855 "The custom exceptions must be given AS A TUPLE."
856 856
857 857 def dummy_handler(self,etype,value,tb):
858 858 print '*** Simple custom exception handler ***'
859 859 print 'Exception type :',etype
860 860 print 'Exception value:',value
861 861 print 'Traceback :',tb
862 862 print 'Source code :','\n'.join(self.buffer)
863 863
864 864 if handler is None: handler = dummy_handler
865 865
866 866 self.CustomTB = new.instancemethod(handler,self,self.__class__)
867 867 self.custom_exceptions = exc_tuple
868 868
869 869 def set_custom_completer(self,completer,pos=0):
870 870 """set_custom_completer(completer,pos=0)
871 871
872 872 Adds a new custom completer function.
873 873
874 874 The position argument (defaults to 0) is the index in the completers
875 875 list where you want the completer to be inserted."""
876 876
877 877 newcomp = new.instancemethod(completer,self.Completer,
878 878 self.Completer.__class__)
879 879 self.Completer.matchers.insert(pos,newcomp)
880 880
881 881 def set_completer(self):
882 882 """reset readline's completer to be our own."""
883 883 self.readline.set_completer(self.Completer.complete)
884 884
885 885 def _get_call_pdb(self):
886 886 return self._call_pdb
887 887
888 888 def _set_call_pdb(self,val):
889 889
890 890 if val not in (0,1,False,True):
891 891 raise ValueError,'new call_pdb value must be boolean'
892 892
893 893 # store value in instance
894 894 self._call_pdb = val
895 895
896 896 # notify the actual exception handlers
897 897 self.InteractiveTB.call_pdb = val
898 898 if self.isthreaded:
899 899 try:
900 900 self.sys_excepthook.call_pdb = val
901 901 except:
902 902 warn('Failed to activate pdb for threaded exception handler')
903 903
904 904 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
905 905 'Control auto-activation of pdb at exceptions')
906 906
907 907
908 908 # These special functions get installed in the builtin namespace, to
909 909 # provide programmatic (pure python) access to magics, aliases and system
910 910 # calls. This is important for logging, user scripting, and more.
911 911
912 912 # We are basically exposing, via normal python functions, the three
913 913 # mechanisms in which ipython offers special call modes (magics for
914 914 # internal control, aliases for direct system access via pre-selected
915 915 # names, and !cmd for calling arbitrary system commands).
916 916
917 917 def ipmagic(self,arg_s):
918 918 """Call a magic function by name.
919 919
920 920 Input: a string containing the name of the magic function to call and any
921 921 additional arguments to be passed to the magic.
922 922
923 923 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
924 924 prompt:
925 925
926 926 In[1]: %name -opt foo bar
927 927
928 928 To call a magic without arguments, simply use ipmagic('name').
929 929
930 930 This provides a proper Python function to call IPython's magics in any
931 931 valid Python code you can type at the interpreter, including loops and
932 932 compound statements. It is added by IPython to the Python builtin
933 933 namespace upon initialization."""
934 934
935 935 args = arg_s.split(' ',1)
936 936 magic_name = args[0]
937 937 magic_name = magic_name.lstrip(self.ESC_MAGIC)
938 938
939 939 try:
940 940 magic_args = args[1]
941 941 except IndexError:
942 942 magic_args = ''
943 943 fn = getattr(self,'magic_'+magic_name,None)
944 944 if fn is None:
945 945 error("Magic function `%s` not found." % magic_name)
946 946 else:
947 947 magic_args = self.var_expand(magic_args,1)
948 948 return fn(magic_args)
949 949
950 950 def ipalias(self,arg_s):
951 951 """Call an alias by name.
952 952
953 953 Input: a string containing the name of the alias to call and any
954 954 additional arguments to be passed to the magic.
955 955
956 956 ipalias('name -opt foo bar') is equivalent to typing at the ipython
957 957 prompt:
958 958
959 959 In[1]: name -opt foo bar
960 960
961 961 To call an alias without arguments, simply use ipalias('name').
962 962
963 963 This provides a proper Python function to call IPython's aliases in any
964 964 valid Python code you can type at the interpreter, including loops and
965 965 compound statements. It is added by IPython to the Python builtin
966 966 namespace upon initialization."""
967 967
968 968 args = arg_s.split(' ',1)
969 969 alias_name = args[0]
970 970 try:
971 971 alias_args = args[1]
972 972 except IndexError:
973 973 alias_args = ''
974 974 if alias_name in self.alias_table:
975 975 self.call_alias(alias_name,alias_args)
976 976 else:
977 977 error("Alias `%s` not found." % alias_name)
978 978
979 979 def ipsystem(self,arg_s):
980 980 """Make a system call, using IPython."""
981 981
982 982 self.system(arg_s)
983 983
984 984 def complete(self,text):
985 985 """Return a sorted list of all possible completions on text.
986 986
987 987 Inputs:
988 988
989 989 - text: a string of text to be completed on.
990 990
991 991 This is a wrapper around the completion mechanism, similar to what
992 992 readline does at the command line when the TAB key is hit. By
993 993 exposing it as a method, it can be used by other non-readline
994 994 environments (such as GUIs) for text completion.
995 995
996 996 Simple usage example:
997 997
998 998 In [1]: x = 'hello'
999 999
1000 1000 In [2]: __IP.complete('x.l')
1001 1001 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
1002 1002
1003 1003 complete = self.Completer.complete
1004 1004 state = 0
1005 1005 # use a dict so we get unique keys, since ipyhton's multiple
1006 1006 # completers can return duplicates. When we make 2.4 a requirement,
1007 1007 # start using sets instead, which are faster.
1008 1008 comps = {}
1009 1009 while True:
1010 1010 newcomp = complete(text,state,line_buffer=text)
1011 1011 if newcomp is None:
1012 1012 break
1013 1013 comps[newcomp] = 1
1014 1014 state += 1
1015 1015 outcomps = comps.keys()
1016 1016 outcomps.sort()
1017 1017 return outcomps
1018 1018
1019 1019 def set_completer_frame(self, frame=None):
1020 1020 if frame:
1021 1021 self.Completer.namespace = frame.f_locals
1022 1022 self.Completer.global_namespace = frame.f_globals
1023 1023 else:
1024 1024 self.Completer.namespace = self.user_ns
1025 1025 self.Completer.global_namespace = self.user_global_ns
1026 1026
1027 1027 def init_auto_alias(self):
1028 1028 """Define some aliases automatically.
1029 1029
1030 1030 These are ALL parameter-less aliases"""
1031 1031
1032 1032 for alias,cmd in self.auto_alias:
1033 1033 self.getapi().defalias(alias,cmd)
1034 1034
1035 1035
1036 1036 def alias_table_validate(self,verbose=0):
1037 1037 """Update information about the alias table.
1038 1038
1039 1039 In particular, make sure no Python keywords/builtins are in it."""
1040 1040
1041 1041 no_alias = self.no_alias
1042 1042 for k in self.alias_table.keys():
1043 1043 if k in no_alias:
1044 1044 del self.alias_table[k]
1045 1045 if verbose:
1046 1046 print ("Deleting alias <%s>, it's a Python "
1047 1047 "keyword or builtin." % k)
1048 1048
1049 1049 def set_autoindent(self,value=None):
1050 1050 """Set the autoindent flag, checking for readline support.
1051 1051
1052 1052 If called with no arguments, it acts as a toggle."""
1053 1053
1054 1054 if not self.has_readline:
1055 1055 if os.name == 'posix':
1056 1056 warn("The auto-indent feature requires the readline library")
1057 1057 self.autoindent = 0
1058 1058 return
1059 1059 if value is None:
1060 1060 self.autoindent = not self.autoindent
1061 1061 else:
1062 1062 self.autoindent = value
1063 1063
1064 1064 def rc_set_toggle(self,rc_field,value=None):
1065 1065 """Set or toggle a field in IPython's rc config. structure.
1066 1066
1067 1067 If called with no arguments, it acts as a toggle.
1068 1068
1069 1069 If called with a non-existent field, the resulting AttributeError
1070 1070 exception will propagate out."""
1071 1071
1072 1072 rc_val = getattr(self.rc,rc_field)
1073 1073 if value is None:
1074 1074 value = not rc_val
1075 1075 setattr(self.rc,rc_field,value)
1076 1076
1077 1077 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1078 1078 """Install the user configuration directory.
1079 1079
1080 1080 Can be called when running for the first time or to upgrade the user's
1081 1081 .ipython/ directory with the mode parameter. Valid modes are 'install'
1082 1082 and 'upgrade'."""
1083 1083
1084 1084 def wait():
1085 1085 try:
1086 1086 raw_input("Please press <RETURN> to start IPython.")
1087 1087 except EOFError:
1088 1088 print >> Term.cout
1089 1089 print '*'*70
1090 1090
1091 1091 cwd = os.getcwd() # remember where we started
1092 1092 glb = glob.glob
1093 1093 print '*'*70
1094 1094 if mode == 'install':
1095 1095 print \
1096 1096 """Welcome to IPython. I will try to create a personal configuration directory
1097 1097 where you can customize many aspects of IPython's functionality in:\n"""
1098 1098 else:
1099 1099 print 'I am going to upgrade your configuration in:'
1100 1100
1101 1101 print ipythondir
1102 1102
1103 1103 rcdirend = os.path.join('IPython','UserConfig')
1104 1104 cfg = lambda d: os.path.join(d,rcdirend)
1105 1105 try:
1106 1106 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1107 except IOError:
1107 print "Initializing from configuration",rcdir
1108 except IndexError:
1108 1109 warning = """
1109 1110 Installation error. IPython's directory was not found.
1110 1111
1111 1112 Check the following:
1112 1113
1113 1114 The ipython/IPython directory should be in a directory belonging to your
1114 1115 PYTHONPATH environment variable (that is, it should be in a directory
1115 1116 belonging to sys.path). You can copy it explicitly there or just link to it.
1116 1117
1117 IPython will proceed with builtin defaults.
1118 IPython will create a minimal default configuration for you.
1119
1118 1120 """
1119 1121 warn(warning)
1120 1122 wait()
1123
1124 if sys.platform =='win32':
1125 inif = 'ipythonrc.ini'
1126 else:
1127 inif = 'ipythonrc'
1128 minimal_setup = {'ipy_user_conf.py' : 'import ipy_defaults', inif : '# intentionally left blank' }
1129 os.makedirs(ipythondir)
1130 for f, cont in minimal_setup.items():
1131 open(ipythondir + '/' + f,'w').write(cont)
1132
1121 1133 return
1122 1134
1123 1135 if mode == 'install':
1124 1136 try:
1125 1137 shutil.copytree(rcdir,ipythondir)
1126 1138 os.chdir(ipythondir)
1127 1139 rc_files = glb("ipythonrc*")
1128 1140 for rc_file in rc_files:
1129 1141 os.rename(rc_file,rc_file+rc_suffix)
1130 1142 except:
1131 1143 warning = """
1132 1144
1133 1145 There was a problem with the installation:
1134 1146 %s
1135 1147 Try to correct it or contact the developers if you think it's a bug.
1136 1148 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1137 1149 warn(warning)
1138 1150 wait()
1139 1151 return
1140 1152
1141 1153 elif mode == 'upgrade':
1142 1154 try:
1143 1155 os.chdir(ipythondir)
1144 1156 except:
1145 1157 print """
1146 1158 Can not upgrade: changing to directory %s failed. Details:
1147 1159 %s
1148 1160 """ % (ipythondir,sys.exc_info()[1])
1149 1161 wait()
1150 1162 return
1151 1163 else:
1152 1164 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1153 1165 for new_full_path in sources:
1154 1166 new_filename = os.path.basename(new_full_path)
1155 1167 if new_filename.startswith('ipythonrc'):
1156 1168 new_filename = new_filename + rc_suffix
1157 1169 # The config directory should only contain files, skip any
1158 1170 # directories which may be there (like CVS)
1159 1171 if os.path.isdir(new_full_path):
1160 1172 continue
1161 1173 if os.path.exists(new_filename):
1162 1174 old_file = new_filename+'.old'
1163 1175 if os.path.exists(old_file):
1164 1176 os.remove(old_file)
1165 1177 os.rename(new_filename,old_file)
1166 1178 shutil.copy(new_full_path,new_filename)
1167 1179 else:
1168 1180 raise ValueError,'unrecognized mode for install:',`mode`
1169 1181
1170 1182 # Fix line-endings to those native to each platform in the config
1171 1183 # directory.
1172 1184 try:
1173 1185 os.chdir(ipythondir)
1174 1186 except:
1175 1187 print """
1176 1188 Problem: changing to directory %s failed.
1177 1189 Details:
1178 1190 %s
1179 1191
1180 1192 Some configuration files may have incorrect line endings. This should not
1181 1193 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1182 1194 wait()
1183 1195 else:
1184 1196 for fname in glb('ipythonrc*'):
1185 1197 try:
1186 1198 native_line_ends(fname,backup=0)
1187 1199 except IOError:
1188 1200 pass
1189 1201
1190 1202 if mode == 'install':
1191 1203 print """
1192 1204 Successful installation!
1193 1205
1194 1206 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1195 1207 IPython manual (there are both HTML and PDF versions supplied with the
1196 1208 distribution) to make sure that your system environment is properly configured
1197 1209 to take advantage of IPython's features.
1198 1210
1199 1211 Important note: the configuration system has changed! The old system is
1200 1212 still in place, but its setting may be partly overridden by the settings in
1201 1213 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1202 1214 if some of the new settings bother you.
1203 1215
1204 1216 """
1205 1217 else:
1206 1218 print """
1207 1219 Successful upgrade!
1208 1220
1209 1221 All files in your directory:
1210 1222 %(ipythondir)s
1211 1223 which would have been overwritten by the upgrade were backed up with a .old
1212 1224 extension. If you had made particular customizations in those files you may
1213 1225 want to merge them back into the new files.""" % locals()
1214 1226 wait()
1215 1227 os.chdir(cwd)
1216 1228 # end user_setup()
1217 1229
1218 1230 def atexit_operations(self):
1219 1231 """This will be executed at the time of exit.
1220 1232
1221 1233 Saving of persistent data should be performed here. """
1222 1234
1223 1235 #print '*** IPython exit cleanup ***' # dbg
1224 1236 # input history
1225 1237 self.savehist()
1226 1238
1227 1239 # Cleanup all tempfiles left around
1228 1240 for tfile in self.tempfiles:
1229 1241 try:
1230 1242 os.unlink(tfile)
1231 1243 except OSError:
1232 1244 pass
1233 1245
1234 1246 self.hooks.shutdown_hook()
1235 1247
1236 1248 def savehist(self):
1237 1249 """Save input history to a file (via readline library)."""
1238 1250 try:
1239 1251 self.readline.write_history_file(self.histfile)
1240 1252 except:
1241 1253 print 'Unable to save IPython command history to file: ' + \
1242 1254 `self.histfile`
1243 1255
1244 1256 def reloadhist(self):
1245 1257 """Reload the input history from disk file."""
1246 1258
1247 1259 if self.has_readline:
1248 1260 self.readline.clear_history()
1249 1261 self.readline.read_history_file(self.shell.histfile)
1250 1262
1251 1263 def history_saving_wrapper(self, func):
1252 1264 """ Wrap func for readline history saving
1253 1265
1254 1266 Convert func into callable that saves & restores
1255 1267 history around the call """
1256 1268
1257 1269 if not self.has_readline:
1258 1270 return func
1259 1271
1260 1272 def wrapper():
1261 1273 self.savehist()
1262 1274 try:
1263 1275 func()
1264 1276 finally:
1265 1277 readline.read_history_file(self.histfile)
1266 1278 return wrapper
1267 1279
1268 1280
1269 1281 def pre_readline(self):
1270 1282 """readline hook to be used at the start of each line.
1271 1283
1272 1284 Currently it handles auto-indent only."""
1273 1285
1274 1286 #debugx('self.indent_current_nsp','pre_readline:')
1275 1287
1276 1288 if self.rl_do_indent:
1277 1289 self.readline.insert_text(self.indent_current_str())
1278 1290 if self.rl_next_input is not None:
1279 1291 self.readline.insert_text(self.rl_next_input)
1280 1292 self.rl_next_input = None
1281 1293
1282 1294 def init_readline(self):
1283 1295 """Command history completion/saving/reloading."""
1284 1296
1285 1297
1286 1298 import IPython.rlineimpl as readline
1287 1299
1288 1300 if not readline.have_readline:
1289 1301 self.has_readline = 0
1290 1302 self.readline = None
1291 1303 # no point in bugging windows users with this every time:
1292 1304 warn('Readline services not available on this platform.')
1293 1305 else:
1294 1306 sys.modules['readline'] = readline
1295 1307 import atexit
1296 1308 from IPython.completer import IPCompleter
1297 1309 self.Completer = IPCompleter(self,
1298 1310 self.user_ns,
1299 1311 self.user_global_ns,
1300 1312 self.rc.readline_omit__names,
1301 1313 self.alias_table)
1302 1314 sdisp = self.strdispatchers.get('complete_command', StrDispatch())
1303 1315 self.strdispatchers['complete_command'] = sdisp
1304 1316 self.Completer.custom_completers = sdisp
1305 1317 # Platform-specific configuration
1306 1318 if os.name == 'nt':
1307 1319 self.readline_startup_hook = readline.set_pre_input_hook
1308 1320 else:
1309 1321 self.readline_startup_hook = readline.set_startup_hook
1310 1322
1311 1323 # Load user's initrc file (readline config)
1312 1324 inputrc_name = os.environ.get('INPUTRC')
1313 1325 if inputrc_name is None:
1314 1326 home_dir = get_home_dir()
1315 1327 if home_dir is not None:
1316 1328 inputrc_name = os.path.join(home_dir,'.inputrc')
1317 1329 if os.path.isfile(inputrc_name):
1318 1330 try:
1319 1331 readline.read_init_file(inputrc_name)
1320 1332 except:
1321 1333 warn('Problems reading readline initialization file <%s>'
1322 1334 % inputrc_name)
1323 1335
1324 1336 self.has_readline = 1
1325 1337 self.readline = readline
1326 1338 # save this in sys so embedded copies can restore it properly
1327 1339 sys.ipcompleter = self.Completer.complete
1328 1340 self.set_completer()
1329 1341
1330 1342 # Configure readline according to user's prefs
1331 1343 for rlcommand in self.rc.readline_parse_and_bind:
1332 1344 readline.parse_and_bind(rlcommand)
1333 1345
1334 1346 # remove some chars from the delimiters list
1335 1347 delims = readline.get_completer_delims()
1336 1348 delims = delims.translate(string._idmap,
1337 1349 self.rc.readline_remove_delims)
1338 1350 readline.set_completer_delims(delims)
1339 1351 # otherwise we end up with a monster history after a while:
1340 1352 readline.set_history_length(1000)
1341 1353 try:
1342 1354 #print '*** Reading readline history' # dbg
1343 1355 readline.read_history_file(self.histfile)
1344 1356 except IOError:
1345 1357 pass # It doesn't exist yet.
1346 1358
1347 1359 atexit.register(self.atexit_operations)
1348 1360 del atexit
1349 1361
1350 1362 # Configure auto-indent for all platforms
1351 1363 self.set_autoindent(self.rc.autoindent)
1352 1364
1353 1365 def ask_yes_no(self,prompt,default=True):
1354 1366 if self.rc.quiet:
1355 1367 return True
1356 1368 return ask_yes_no(prompt,default)
1357 1369
1358 1370 def _should_recompile(self,e):
1359 1371 """Utility routine for edit_syntax_error"""
1360 1372
1361 1373 if e.filename in ('<ipython console>','<input>','<string>',
1362 1374 '<console>','<BackgroundJob compilation>',
1363 1375 None):
1364 1376
1365 1377 return False
1366 1378 try:
1367 1379 if (self.rc.autoedit_syntax and
1368 1380 not self.ask_yes_no('Return to editor to correct syntax error? '
1369 1381 '[Y/n] ','y')):
1370 1382 return False
1371 1383 except EOFError:
1372 1384 return False
1373 1385
1374 1386 def int0(x):
1375 1387 try:
1376 1388 return int(x)
1377 1389 except TypeError:
1378 1390 return 0
1379 1391 # always pass integer line and offset values to editor hook
1380 1392 self.hooks.fix_error_editor(e.filename,
1381 1393 int0(e.lineno),int0(e.offset),e.msg)
1382 1394 return True
1383 1395
1384 1396 def edit_syntax_error(self):
1385 1397 """The bottom half of the syntax error handler called in the main loop.
1386 1398
1387 1399 Loop until syntax error is fixed or user cancels.
1388 1400 """
1389 1401
1390 1402 while self.SyntaxTB.last_syntax_error:
1391 1403 # copy and clear last_syntax_error
1392 1404 err = self.SyntaxTB.clear_err_state()
1393 1405 if not self._should_recompile(err):
1394 1406 return
1395 1407 try:
1396 1408 # may set last_syntax_error again if a SyntaxError is raised
1397 1409 self.safe_execfile(err.filename,self.user_ns)
1398 1410 except:
1399 1411 self.showtraceback()
1400 1412 else:
1401 1413 try:
1402 1414 f = file(err.filename)
1403 1415 try:
1404 1416 sys.displayhook(f.read())
1405 1417 finally:
1406 1418 f.close()
1407 1419 except:
1408 1420 self.showtraceback()
1409 1421
1410 1422 def showsyntaxerror(self, filename=None):
1411 1423 """Display the syntax error that just occurred.
1412 1424
1413 1425 This doesn't display a stack trace because there isn't one.
1414 1426
1415 1427 If a filename is given, it is stuffed in the exception instead
1416 1428 of what was there before (because Python's parser always uses
1417 1429 "<string>" when reading from a string).
1418 1430 """
1419 1431 etype, value, last_traceback = sys.exc_info()
1420 1432
1421 1433 # See note about these variables in showtraceback() below
1422 1434 sys.last_type = etype
1423 1435 sys.last_value = value
1424 1436 sys.last_traceback = last_traceback
1425 1437
1426 1438 if filename and etype is SyntaxError:
1427 1439 # Work hard to stuff the correct filename in the exception
1428 1440 try:
1429 1441 msg, (dummy_filename, lineno, offset, line) = value
1430 1442 except:
1431 1443 # Not the format we expect; leave it alone
1432 1444 pass
1433 1445 else:
1434 1446 # Stuff in the right filename
1435 1447 try:
1436 1448 # Assume SyntaxError is a class exception
1437 1449 value = SyntaxError(msg, (filename, lineno, offset, line))
1438 1450 except:
1439 1451 # If that failed, assume SyntaxError is a string
1440 1452 value = msg, (filename, lineno, offset, line)
1441 1453 self.SyntaxTB(etype,value,[])
1442 1454
1443 1455 def debugger(self,force=False):
1444 1456 """Call the pydb/pdb debugger.
1445 1457
1446 1458 Keywords:
1447 1459
1448 1460 - force(False): by default, this routine checks the instance call_pdb
1449 1461 flag and does not actually invoke the debugger if the flag is false.
1450 1462 The 'force' option forces the debugger to activate even if the flag
1451 1463 is false.
1452 1464 """
1453 1465
1454 1466 if not (force or self.call_pdb):
1455 1467 return
1456 1468
1457 1469 if not hasattr(sys,'last_traceback'):
1458 1470 error('No traceback has been produced, nothing to debug.')
1459 1471 return
1460 1472
1461 1473 # use pydb if available
1462 1474 if Debugger.has_pydb:
1463 1475 from pydb import pm
1464 1476 else:
1465 1477 # fallback to our internal debugger
1466 1478 pm = lambda : self.InteractiveTB.debugger(force=True)
1467 1479 self.history_saving_wrapper(pm)()
1468 1480
1469 1481 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1470 1482 """Display the exception that just occurred.
1471 1483
1472 1484 If nothing is known about the exception, this is the method which
1473 1485 should be used throughout the code for presenting user tracebacks,
1474 1486 rather than directly invoking the InteractiveTB object.
1475 1487
1476 1488 A specific showsyntaxerror() also exists, but this method can take
1477 1489 care of calling it if needed, so unless you are explicitly catching a
1478 1490 SyntaxError exception, don't try to analyze the stack manually and
1479 1491 simply call this method."""
1480 1492
1481 1493
1482 1494 # Though this won't be called by syntax errors in the input line,
1483 1495 # there may be SyntaxError cases whith imported code.
1484 1496
1485 1497
1486 1498 if exc_tuple is None:
1487 1499 etype, value, tb = sys.exc_info()
1488 1500 else:
1489 1501 etype, value, tb = exc_tuple
1490 1502
1491 1503 if etype is SyntaxError:
1492 1504 self.showsyntaxerror(filename)
1493 1505 elif etype is IPython.ipapi.UsageError:
1494 1506 print "UsageError:", value
1495 1507 else:
1496 1508 # WARNING: these variables are somewhat deprecated and not
1497 1509 # necessarily safe to use in a threaded environment, but tools
1498 1510 # like pdb depend on their existence, so let's set them. If we
1499 1511 # find problems in the field, we'll need to revisit their use.
1500 1512 sys.last_type = etype
1501 1513 sys.last_value = value
1502 1514 sys.last_traceback = tb
1503 1515
1504 1516 if etype in self.custom_exceptions:
1505 1517 self.CustomTB(etype,value,tb)
1506 1518 else:
1507 1519 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1508 1520 if self.InteractiveTB.call_pdb and self.has_readline:
1509 1521 # pdb mucks up readline, fix it back
1510 1522 self.set_completer()
1511 1523
1512 1524
1513 1525 def mainloop(self,banner=None):
1514 1526 """Creates the local namespace and starts the mainloop.
1515 1527
1516 1528 If an optional banner argument is given, it will override the
1517 1529 internally created default banner."""
1518 1530
1519 1531 if self.rc.c: # Emulate Python's -c option
1520 1532 self.exec_init_cmd()
1521 1533 if banner is None:
1522 1534 if not self.rc.banner:
1523 1535 banner = ''
1524 1536 # banner is string? Use it directly!
1525 1537 elif isinstance(self.rc.banner,basestring):
1526 1538 banner = self.rc.banner
1527 1539 else:
1528 1540 banner = self.BANNER+self.banner2
1529 1541
1530 1542 self.interact(banner)
1531 1543
1532 1544 def exec_init_cmd(self):
1533 1545 """Execute a command given at the command line.
1534 1546
1535 1547 This emulates Python's -c option."""
1536 1548
1537 1549 #sys.argv = ['-c']
1538 1550 self.push(self.prefilter(self.rc.c, False))
1539 1551 if not self.rc.interact:
1540 1552 self.exit_now = True
1541 1553
1542 1554 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1543 1555 """Embeds IPython into a running python program.
1544 1556
1545 1557 Input:
1546 1558
1547 1559 - header: An optional header message can be specified.
1548 1560
1549 1561 - local_ns, global_ns: working namespaces. If given as None, the
1550 1562 IPython-initialized one is updated with __main__.__dict__, so that
1551 1563 program variables become visible but user-specific configuration
1552 1564 remains possible.
1553 1565
1554 1566 - stack_depth: specifies how many levels in the stack to go to
1555 1567 looking for namespaces (when local_ns and global_ns are None). This
1556 1568 allows an intermediate caller to make sure that this function gets
1557 1569 the namespace from the intended level in the stack. By default (0)
1558 1570 it will get its locals and globals from the immediate caller.
1559 1571
1560 1572 Warning: it's possible to use this in a program which is being run by
1561 1573 IPython itself (via %run), but some funny things will happen (a few
1562 1574 globals get overwritten). In the future this will be cleaned up, as
1563 1575 there is no fundamental reason why it can't work perfectly."""
1564 1576
1565 1577 # Get locals and globals from caller
1566 1578 if local_ns is None or global_ns is None:
1567 1579 call_frame = sys._getframe(stack_depth).f_back
1568 1580
1569 1581 if local_ns is None:
1570 1582 local_ns = call_frame.f_locals
1571 1583 if global_ns is None:
1572 1584 global_ns = call_frame.f_globals
1573 1585
1574 1586 # Update namespaces and fire up interpreter
1575 1587
1576 1588 # The global one is easy, we can just throw it in
1577 1589 self.user_global_ns = global_ns
1578 1590
1579 1591 # but the user/local one is tricky: ipython needs it to store internal
1580 1592 # data, but we also need the locals. We'll copy locals in the user
1581 1593 # one, but will track what got copied so we can delete them at exit.
1582 1594 # This is so that a later embedded call doesn't see locals from a
1583 1595 # previous call (which most likely existed in a separate scope).
1584 1596 local_varnames = local_ns.keys()
1585 1597 self.user_ns.update(local_ns)
1586 1598
1587 1599 # Patch for global embedding to make sure that things don't overwrite
1588 1600 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1589 1601 # FIXME. Test this a bit more carefully (the if.. is new)
1590 1602 if local_ns is None and global_ns is None:
1591 1603 self.user_global_ns.update(__main__.__dict__)
1592 1604
1593 1605 # make sure the tab-completer has the correct frame information, so it
1594 1606 # actually completes using the frame's locals/globals
1595 1607 self.set_completer_frame()
1596 1608
1597 1609 # before activating the interactive mode, we need to make sure that
1598 1610 # all names in the builtin namespace needed by ipython point to
1599 1611 # ourselves, and not to other instances.
1600 1612 self.add_builtins()
1601 1613
1602 1614 self.interact(header)
1603 1615
1604 1616 # now, purge out the user namespace from anything we might have added
1605 1617 # from the caller's local namespace
1606 1618 delvar = self.user_ns.pop
1607 1619 for var in local_varnames:
1608 1620 delvar(var,None)
1609 1621 # and clean builtins we may have overridden
1610 1622 self.clean_builtins()
1611 1623
1612 1624 def interact(self, banner=None):
1613 1625 """Closely emulate the interactive Python console.
1614 1626
1615 1627 The optional banner argument specify the banner to print
1616 1628 before the first interaction; by default it prints a banner
1617 1629 similar to the one printed by the real Python interpreter,
1618 1630 followed by the current class name in parentheses (so as not
1619 1631 to confuse this with the real interpreter -- since it's so
1620 1632 close!).
1621 1633
1622 1634 """
1623 1635
1624 1636 if self.exit_now:
1625 1637 # batch run -> do not interact
1626 1638 return
1627 1639 cprt = 'Type "copyright", "credits" or "license" for more information.'
1628 1640 if banner is None:
1629 1641 self.write("Python %s on %s\n%s\n(%s)\n" %
1630 1642 (sys.version, sys.platform, cprt,
1631 1643 self.__class__.__name__))
1632 1644 else:
1633 1645 self.write(banner)
1634 1646
1635 1647 more = 0
1636 1648
1637 1649 # Mark activity in the builtins
1638 1650 __builtin__.__dict__['__IPYTHON__active'] += 1
1639 1651
1640 1652 if self.has_readline:
1641 1653 self.readline_startup_hook(self.pre_readline)
1642 1654 # exit_now is set by a call to %Exit or %Quit
1643 1655
1644 1656 while not self.exit_now:
1645 1657 if more:
1646 1658 prompt = self.hooks.generate_prompt(True)
1647 1659 if self.autoindent:
1648 1660 self.rl_do_indent = True
1649 1661
1650 1662 else:
1651 1663 prompt = self.hooks.generate_prompt(False)
1652 1664 try:
1653 1665 line = self.raw_input(prompt,more)
1654 1666 if self.exit_now:
1655 1667 # quick exit on sys.std[in|out] close
1656 1668 break
1657 1669 if self.autoindent:
1658 1670 self.rl_do_indent = False
1659 1671
1660 1672 except KeyboardInterrupt:
1661 1673 self.write('\nKeyboardInterrupt\n')
1662 1674 self.resetbuffer()
1663 1675 # keep cache in sync with the prompt counter:
1664 1676 self.outputcache.prompt_count -= 1
1665 1677
1666 1678 if self.autoindent:
1667 1679 self.indent_current_nsp = 0
1668 1680 more = 0
1669 1681 except EOFError:
1670 1682 if self.autoindent:
1671 1683 self.rl_do_indent = False
1672 1684 self.readline_startup_hook(None)
1673 1685 self.write('\n')
1674 1686 self.exit()
1675 1687 except bdb.BdbQuit:
1676 1688 warn('The Python debugger has exited with a BdbQuit exception.\n'
1677 1689 'Because of how pdb handles the stack, it is impossible\n'
1678 1690 'for IPython to properly format this particular exception.\n'
1679 1691 'IPython will resume normal operation.')
1680 1692 except:
1681 1693 # exceptions here are VERY RARE, but they can be triggered
1682 1694 # asynchronously by signal handlers, for example.
1683 1695 self.showtraceback()
1684 1696 else:
1685 1697 more = self.push(line)
1686 1698 if (self.SyntaxTB.last_syntax_error and
1687 1699 self.rc.autoedit_syntax):
1688 1700 self.edit_syntax_error()
1689 1701
1690 1702 # We are off again...
1691 1703 __builtin__.__dict__['__IPYTHON__active'] -= 1
1692 1704
1693 1705 def excepthook(self, etype, value, tb):
1694 1706 """One more defense for GUI apps that call sys.excepthook.
1695 1707
1696 1708 GUI frameworks like wxPython trap exceptions and call
1697 1709 sys.excepthook themselves. I guess this is a feature that
1698 1710 enables them to keep running after exceptions that would
1699 1711 otherwise kill their mainloop. This is a bother for IPython
1700 1712 which excepts to catch all of the program exceptions with a try:
1701 1713 except: statement.
1702 1714
1703 1715 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1704 1716 any app directly invokes sys.excepthook, it will look to the user like
1705 1717 IPython crashed. In order to work around this, we can disable the
1706 1718 CrashHandler and replace it with this excepthook instead, which prints a
1707 1719 regular traceback using our InteractiveTB. In this fashion, apps which
1708 1720 call sys.excepthook will generate a regular-looking exception from
1709 1721 IPython, and the CrashHandler will only be triggered by real IPython
1710 1722 crashes.
1711 1723
1712 1724 This hook should be used sparingly, only in places which are not likely
1713 1725 to be true IPython errors.
1714 1726 """
1715 1727 self.showtraceback((etype,value,tb),tb_offset=0)
1716 1728
1717 1729 def expand_aliases(self,fn,rest):
1718 1730 """ Expand multiple levels of aliases:
1719 1731
1720 1732 if:
1721 1733
1722 1734 alias foo bar /tmp
1723 1735 alias baz foo
1724 1736
1725 1737 then:
1726 1738
1727 1739 baz huhhahhei -> bar /tmp huhhahhei
1728 1740
1729 1741 """
1730 1742 line = fn + " " + rest
1731 1743
1732 1744 done = Set()
1733 1745 while 1:
1734 1746 pre,fn,rest = prefilter.splitUserInput(line,
1735 1747 prefilter.shell_line_split)
1736 1748 if fn in self.alias_table:
1737 1749 if fn in done:
1738 1750 warn("Cyclic alias definition, repeated '%s'" % fn)
1739 1751 return ""
1740 1752 done.add(fn)
1741 1753
1742 1754 l2 = self.transform_alias(fn,rest)
1743 1755 # dir -> dir
1744 1756 # print "alias",line, "->",l2 #dbg
1745 1757 if l2 == line:
1746 1758 break
1747 1759 # ls -> ls -F should not recurse forever
1748 1760 if l2.split(None,1)[0] == line.split(None,1)[0]:
1749 1761 line = l2
1750 1762 break
1751 1763
1752 1764 line=l2
1753 1765
1754 1766
1755 1767 # print "al expand to",line #dbg
1756 1768 else:
1757 1769 break
1758 1770
1759 1771 return line
1760 1772
1761 1773 def transform_alias(self, alias,rest=''):
1762 1774 """ Transform alias to system command string.
1763 1775 """
1764 1776 trg = self.alias_table[alias]
1765 1777
1766 1778 nargs,cmd = trg
1767 1779 # print trg #dbg
1768 1780 if ' ' in cmd and os.path.isfile(cmd):
1769 1781 cmd = '"%s"' % cmd
1770 1782
1771 1783 # Expand the %l special to be the user's input line
1772 1784 if cmd.find('%l') >= 0:
1773 1785 cmd = cmd.replace('%l',rest)
1774 1786 rest = ''
1775 1787 if nargs==0:
1776 1788 # Simple, argument-less aliases
1777 1789 cmd = '%s %s' % (cmd,rest)
1778 1790 else:
1779 1791 # Handle aliases with positional arguments
1780 1792 args = rest.split(None,nargs)
1781 1793 if len(args)< nargs:
1782 1794 error('Alias <%s> requires %s arguments, %s given.' %
1783 1795 (alias,nargs,len(args)))
1784 1796 return None
1785 1797 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1786 1798 # Now call the macro, evaluating in the user's namespace
1787 1799 #print 'new command: <%r>' % cmd # dbg
1788 1800 return cmd
1789 1801
1790 1802 def call_alias(self,alias,rest=''):
1791 1803 """Call an alias given its name and the rest of the line.
1792 1804
1793 1805 This is only used to provide backwards compatibility for users of
1794 1806 ipalias(), use of which is not recommended for anymore."""
1795 1807
1796 1808 # Now call the macro, evaluating in the user's namespace
1797 1809 cmd = self.transform_alias(alias, rest)
1798 1810 try:
1799 1811 self.system(cmd)
1800 1812 except:
1801 1813 self.showtraceback()
1802 1814
1803 1815 def indent_current_str(self):
1804 1816 """return the current level of indentation as a string"""
1805 1817 return self.indent_current_nsp * ' '
1806 1818
1807 1819 def autoindent_update(self,line):
1808 1820 """Keep track of the indent level."""
1809 1821
1810 1822 #debugx('line')
1811 1823 #debugx('self.indent_current_nsp')
1812 1824 if self.autoindent:
1813 1825 if line:
1814 1826 inisp = num_ini_spaces(line)
1815 1827 if inisp < self.indent_current_nsp:
1816 1828 self.indent_current_nsp = inisp
1817 1829
1818 1830 if line[-1] == ':':
1819 1831 self.indent_current_nsp += 4
1820 1832 elif dedent_re.match(line):
1821 1833 self.indent_current_nsp -= 4
1822 1834 else:
1823 1835 self.indent_current_nsp = 0
1824 1836 def runlines(self,lines):
1825 1837 """Run a string of one or more lines of source.
1826 1838
1827 1839 This method is capable of running a string containing multiple source
1828 1840 lines, as if they had been entered at the IPython prompt. Since it
1829 1841 exposes IPython's processing machinery, the given strings can contain
1830 1842 magic calls (%magic), special shell access (!cmd), etc."""
1831 1843
1832 1844 # We must start with a clean buffer, in case this is run from an
1833 1845 # interactive IPython session (via a magic, for example).
1834 1846 self.resetbuffer()
1835 1847 lines = lines.split('\n')
1836 1848 more = 0
1837 1849
1838 1850 for line in lines:
1839 1851 # skip blank lines so we don't mess up the prompt counter, but do
1840 1852 # NOT skip even a blank line if we are in a code block (more is
1841 1853 # true)
1842 1854
1843 1855
1844 1856 if line or more:
1845 1857 # push to raw history, so hist line numbers stay in sync
1846 1858 self.input_hist_raw.append("# " + line + "\n")
1847 1859 more = self.push(self.prefilter(line,more))
1848 1860 # IPython's runsource returns None if there was an error
1849 1861 # compiling the code. This allows us to stop processing right
1850 1862 # away, so the user gets the error message at the right place.
1851 1863 if more is None:
1852 1864 break
1853 1865 else:
1854 1866 self.input_hist_raw.append("\n")
1855 1867 # final newline in case the input didn't have it, so that the code
1856 1868 # actually does get executed
1857 1869 if more:
1858 1870 self.push('\n')
1859 1871
1860 1872 def runsource(self, source, filename='<input>', symbol='single'):
1861 1873 """Compile and run some source in the interpreter.
1862 1874
1863 1875 Arguments are as for compile_command().
1864 1876
1865 1877 One several things can happen:
1866 1878
1867 1879 1) The input is incorrect; compile_command() raised an
1868 1880 exception (SyntaxError or OverflowError). A syntax traceback
1869 1881 will be printed by calling the showsyntaxerror() method.
1870 1882
1871 1883 2) The input is incomplete, and more input is required;
1872 1884 compile_command() returned None. Nothing happens.
1873 1885
1874 1886 3) The input is complete; compile_command() returned a code
1875 1887 object. The code is executed by calling self.runcode() (which
1876 1888 also handles run-time exceptions, except for SystemExit).
1877 1889
1878 1890 The return value is:
1879 1891
1880 1892 - True in case 2
1881 1893
1882 1894 - False in the other cases, unless an exception is raised, where
1883 1895 None is returned instead. This can be used by external callers to
1884 1896 know whether to continue feeding input or not.
1885 1897
1886 1898 The return value can be used to decide whether to use sys.ps1 or
1887 1899 sys.ps2 to prompt the next line."""
1888 1900
1889 1901 # if the source code has leading blanks, add 'if 1:\n' to it
1890 1902 # this allows execution of indented pasted code. It is tempting
1891 1903 # to add '\n' at the end of source to run commands like ' a=1'
1892 1904 # directly, but this fails for more complicated scenarios
1893 1905 if source[:1] in [' ', '\t']:
1894 1906 source = 'if 1:\n%s' % source
1895 1907
1896 1908 try:
1897 1909 code = self.compile(source,filename,symbol)
1898 1910 except (OverflowError, SyntaxError, ValueError):
1899 1911 # Case 1
1900 1912 self.showsyntaxerror(filename)
1901 1913 return None
1902 1914
1903 1915 if code is None:
1904 1916 # Case 2
1905 1917 return True
1906 1918
1907 1919 # Case 3
1908 1920 # We store the code object so that threaded shells and
1909 1921 # custom exception handlers can access all this info if needed.
1910 1922 # The source corresponding to this can be obtained from the
1911 1923 # buffer attribute as '\n'.join(self.buffer).
1912 1924 self.code_to_run = code
1913 1925 # now actually execute the code object
1914 1926 if self.runcode(code) == 0:
1915 1927 return False
1916 1928 else:
1917 1929 return None
1918 1930
1919 1931 def runcode(self,code_obj):
1920 1932 """Execute a code object.
1921 1933
1922 1934 When an exception occurs, self.showtraceback() is called to display a
1923 1935 traceback.
1924 1936
1925 1937 Return value: a flag indicating whether the code to be run completed
1926 1938 successfully:
1927 1939
1928 1940 - 0: successful execution.
1929 1941 - 1: an error occurred.
1930 1942 """
1931 1943
1932 1944 # Set our own excepthook in case the user code tries to call it
1933 1945 # directly, so that the IPython crash handler doesn't get triggered
1934 1946 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1935 1947
1936 1948 # we save the original sys.excepthook in the instance, in case config
1937 1949 # code (such as magics) needs access to it.
1938 1950 self.sys_excepthook = old_excepthook
1939 1951 outflag = 1 # happens in more places, so it's easier as default
1940 1952 try:
1941 1953 try:
1942 1954 # Embedded instances require separate global/local namespaces
1943 1955 # so they can see both the surrounding (local) namespace and
1944 1956 # the module-level globals when called inside another function.
1945 1957 if self.embedded:
1946 1958 exec code_obj in self.user_global_ns, self.user_ns
1947 1959 # Normal (non-embedded) instances should only have a single
1948 1960 # namespace for user code execution, otherwise functions won't
1949 1961 # see interactive top-level globals.
1950 1962 else:
1951 1963 exec code_obj in self.user_ns
1952 1964 finally:
1953 1965 # Reset our crash handler in place
1954 1966 sys.excepthook = old_excepthook
1955 1967 except SystemExit:
1956 1968 self.resetbuffer()
1957 1969 self.showtraceback()
1958 1970 warn("Type %exit or %quit to exit IPython "
1959 1971 "(%Exit or %Quit do so unconditionally).",level=1)
1960 1972 except self.custom_exceptions:
1961 1973 etype,value,tb = sys.exc_info()
1962 1974 self.CustomTB(etype,value,tb)
1963 1975 except:
1964 1976 self.showtraceback()
1965 1977 else:
1966 1978 outflag = 0
1967 1979 if softspace(sys.stdout, 0):
1968 1980 print
1969 1981 # Flush out code object which has been run (and source)
1970 1982 self.code_to_run = None
1971 1983 return outflag
1972 1984
1973 1985 def push(self, line):
1974 1986 """Push a line to the interpreter.
1975 1987
1976 1988 The line should not have a trailing newline; it may have
1977 1989 internal newlines. The line is appended to a buffer and the
1978 1990 interpreter's runsource() method is called with the
1979 1991 concatenated contents of the buffer as source. If this
1980 1992 indicates that the command was executed or invalid, the buffer
1981 1993 is reset; otherwise, the command is incomplete, and the buffer
1982 1994 is left as it was after the line was appended. The return
1983 1995 value is 1 if more input is required, 0 if the line was dealt
1984 1996 with in some way (this is the same as runsource()).
1985 1997 """
1986 1998
1987 1999 # autoindent management should be done here, and not in the
1988 2000 # interactive loop, since that one is only seen by keyboard input. We
1989 2001 # need this done correctly even for code run via runlines (which uses
1990 2002 # push).
1991 2003
1992 2004 #print 'push line: <%s>' % line # dbg
1993 2005 for subline in line.splitlines():
1994 2006 self.autoindent_update(subline)
1995 2007 self.buffer.append(line)
1996 2008 more = self.runsource('\n'.join(self.buffer), self.filename)
1997 2009 if not more:
1998 2010 self.resetbuffer()
1999 2011 return more
2000 2012
2001 2013 def split_user_input(self, line):
2002 2014 # This is really a hold-over to support ipapi and some extensions
2003 2015 return prefilter.splitUserInput(line)
2004 2016
2005 2017 def resetbuffer(self):
2006 2018 """Reset the input buffer."""
2007 2019 self.buffer[:] = []
2008 2020
2009 2021 def raw_input(self,prompt='',continue_prompt=False):
2010 2022 """Write a prompt and read a line.
2011 2023
2012 2024 The returned line does not include the trailing newline.
2013 2025 When the user enters the EOF key sequence, EOFError is raised.
2014 2026
2015 2027 Optional inputs:
2016 2028
2017 2029 - prompt(''): a string to be printed to prompt the user.
2018 2030
2019 2031 - continue_prompt(False): whether this line is the first one or a
2020 2032 continuation in a sequence of inputs.
2021 2033 """
2022 2034
2023 2035 # Code run by the user may have modified the readline completer state.
2024 2036 # We must ensure that our completer is back in place.
2025 2037 if self.has_readline:
2026 2038 self.set_completer()
2027 2039
2028 2040 try:
2029 2041 line = raw_input_original(prompt).decode(self.stdin_encoding)
2030 2042 except ValueError:
2031 2043 warn("\n********\nYou or a %run:ed script called sys.stdin.close()"
2032 2044 " or sys.stdout.close()!\nExiting IPython!")
2033 2045 self.exit_now = True
2034 2046 return ""
2035 2047
2036 2048 # Try to be reasonably smart about not re-indenting pasted input more
2037 2049 # than necessary. We do this by trimming out the auto-indent initial
2038 2050 # spaces, if the user's actual input started itself with whitespace.
2039 2051 #debugx('self.buffer[-1]')
2040 2052
2041 2053 if self.autoindent:
2042 2054 if num_ini_spaces(line) > self.indent_current_nsp:
2043 2055 line = line[self.indent_current_nsp:]
2044 2056 self.indent_current_nsp = 0
2045 2057
2046 2058 # store the unfiltered input before the user has any chance to modify
2047 2059 # it.
2048 2060 if line.strip():
2049 2061 if continue_prompt:
2050 2062 self.input_hist_raw[-1] += '%s\n' % line
2051 2063 if self.has_readline: # and some config option is set?
2052 2064 try:
2053 2065 histlen = self.readline.get_current_history_length()
2054 2066 newhist = self.input_hist_raw[-1].rstrip()
2055 2067 self.readline.remove_history_item(histlen-1)
2056 2068 self.readline.replace_history_item(histlen-2,newhist)
2057 2069 except AttributeError:
2058 2070 pass # re{move,place}_history_item are new in 2.4.
2059 2071 else:
2060 2072 self.input_hist_raw.append('%s\n' % line)
2061 2073 # only entries starting at first column go to shadow history
2062 2074 if line.lstrip() == line:
2063 2075 self.shadowhist.add(line.strip())
2064 2076 elif not continue_prompt:
2065 2077 self.input_hist_raw.append('\n')
2066 2078 try:
2067 2079 lineout = self.prefilter(line,continue_prompt)
2068 2080 except:
2069 2081 # blanket except, in case a user-defined prefilter crashes, so it
2070 2082 # can't take all of ipython with it.
2071 2083 self.showtraceback()
2072 2084 return ''
2073 2085 else:
2074 2086 return lineout
2075 2087
2076 2088 def _prefilter(self, line, continue_prompt):
2077 2089 """Calls different preprocessors, depending on the form of line."""
2078 2090
2079 2091 # All handlers *must* return a value, even if it's blank ('').
2080 2092
2081 2093 # Lines are NOT logged here. Handlers should process the line as
2082 2094 # needed, update the cache AND log it (so that the input cache array
2083 2095 # stays synced).
2084 2096
2085 2097 #.....................................................................
2086 2098 # Code begins
2087 2099
2088 2100 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
2089 2101
2090 2102 # save the line away in case we crash, so the post-mortem handler can
2091 2103 # record it
2092 2104 self._last_input_line = line
2093 2105
2094 2106 #print '***line: <%s>' % line # dbg
2095 2107
2096 2108 if not line:
2097 2109 # Return immediately on purely empty lines, so that if the user
2098 2110 # previously typed some whitespace that started a continuation
2099 2111 # prompt, he can break out of that loop with just an empty line.
2100 2112 # This is how the default python prompt works.
2101 2113
2102 2114 # Only return if the accumulated input buffer was just whitespace!
2103 2115 if ''.join(self.buffer).isspace():
2104 2116 self.buffer[:] = []
2105 2117 return ''
2106 2118
2107 2119 line_info = prefilter.LineInfo(line, continue_prompt)
2108 2120
2109 2121 # the input history needs to track even empty lines
2110 2122 stripped = line.strip()
2111 2123
2112 2124 if not stripped:
2113 2125 if not continue_prompt:
2114 2126 self.outputcache.prompt_count -= 1
2115 2127 return self.handle_normal(line_info)
2116 2128
2117 2129 # print '***cont',continue_prompt # dbg
2118 2130 # special handlers are only allowed for single line statements
2119 2131 if continue_prompt and not self.rc.multi_line_specials:
2120 2132 return self.handle_normal(line_info)
2121 2133
2122 2134
2123 2135 # See whether any pre-existing handler can take care of it
2124 2136 rewritten = self.hooks.input_prefilter(stripped)
2125 2137 if rewritten != stripped: # ok, some prefilter did something
2126 2138 rewritten = line_info.pre + rewritten # add indentation
2127 2139 return self.handle_normal(prefilter.LineInfo(rewritten,
2128 2140 continue_prompt))
2129 2141
2130 2142 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2131 2143
2132 2144 return prefilter.prefilter(line_info, self)
2133 2145
2134 2146
2135 2147 def _prefilter_dumb(self, line, continue_prompt):
2136 2148 """simple prefilter function, for debugging"""
2137 2149 return self.handle_normal(line,continue_prompt)
2138 2150
2139 2151
2140 2152 def multiline_prefilter(self, line, continue_prompt):
2141 2153 """ Run _prefilter for each line of input
2142 2154
2143 2155 Covers cases where there are multiple lines in the user entry,
2144 2156 which is the case when the user goes back to a multiline history
2145 2157 entry and presses enter.
2146 2158
2147 2159 """
2148 2160 out = []
2149 2161 for l in line.rstrip('\n').split('\n'):
2150 2162 out.append(self._prefilter(l, continue_prompt))
2151 2163 return '\n'.join(out)
2152 2164
2153 2165 # Set the default prefilter() function (this can be user-overridden)
2154 2166 prefilter = multiline_prefilter
2155 2167
2156 2168 def handle_normal(self,line_info):
2157 2169 """Handle normal input lines. Use as a template for handlers."""
2158 2170
2159 2171 # With autoindent on, we need some way to exit the input loop, and I
2160 2172 # don't want to force the user to have to backspace all the way to
2161 2173 # clear the line. The rule will be in this case, that either two
2162 2174 # lines of pure whitespace in a row, or a line of pure whitespace but
2163 2175 # of a size different to the indent level, will exit the input loop.
2164 2176 line = line_info.line
2165 2177 continue_prompt = line_info.continue_prompt
2166 2178
2167 2179 if (continue_prompt and self.autoindent and line.isspace() and
2168 2180 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2169 2181 (self.buffer[-1]).isspace() )):
2170 2182 line = ''
2171 2183
2172 2184 self.log(line,line,continue_prompt)
2173 2185 return line
2174 2186
2175 2187 def handle_alias(self,line_info):
2176 2188 """Handle alias input lines. """
2177 2189 tgt = self.alias_table[line_info.iFun]
2178 2190 # print "=>",tgt #dbg
2179 2191 if callable(tgt):
2180 2192 if '$' in line_info.line:
2181 2193 call_meth = '(_ip, _ip.itpl(%s))'
2182 2194 else:
2183 2195 call_meth = '(_ip,%s)'
2184 2196 line_out = ("%s_sh.%s" + call_meth) % (line_info.preWhitespace,
2185 2197 line_info.iFun,
2186 2198 make_quoted_expr(line_info.line))
2187 2199 else:
2188 2200 transformed = self.expand_aliases(line_info.iFun,line_info.theRest)
2189 2201
2190 2202 # pre is needed, because it carries the leading whitespace. Otherwise
2191 2203 # aliases won't work in indented sections.
2192 2204 line_out = '%s_ip.system(%s)' % (line_info.preWhitespace,
2193 2205 make_quoted_expr( transformed ))
2194 2206
2195 2207 self.log(line_info.line,line_out,line_info.continue_prompt)
2196 2208 #print 'line out:',line_out # dbg
2197 2209 return line_out
2198 2210
2199 2211 def handle_shell_escape(self, line_info):
2200 2212 """Execute the line in a shell, empty return value"""
2201 2213 #print 'line in :', `line` # dbg
2202 2214 line = line_info.line
2203 2215 if line.lstrip().startswith('!!'):
2204 2216 # rewrite LineInfo's line, iFun and theRest to properly hold the
2205 2217 # call to %sx and the actual command to be executed, so
2206 2218 # handle_magic can work correctly. Note that this works even if
2207 2219 # the line is indented, so it handles multi_line_specials
2208 2220 # properly.
2209 2221 new_rest = line.lstrip()[2:]
2210 2222 line_info.line = '%ssx %s' % (self.ESC_MAGIC,new_rest)
2211 2223 line_info.iFun = 'sx'
2212 2224 line_info.theRest = new_rest
2213 2225 return self.handle_magic(line_info)
2214 2226 else:
2215 2227 cmd = line.lstrip().lstrip('!')
2216 2228 line_out = '%s_ip.system(%s)' % (line_info.preWhitespace,
2217 2229 make_quoted_expr(cmd))
2218 2230 # update cache/log and return
2219 2231 self.log(line,line_out,line_info.continue_prompt)
2220 2232 return line_out
2221 2233
2222 2234 def handle_magic(self, line_info):
2223 2235 """Execute magic functions."""
2224 2236 iFun = line_info.iFun
2225 2237 theRest = line_info.theRest
2226 2238 cmd = '%s_ip.magic(%s)' % (line_info.preWhitespace,
2227 2239 make_quoted_expr(iFun + " " + theRest))
2228 2240 self.log(line_info.line,cmd,line_info.continue_prompt)
2229 2241 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2230 2242 return cmd
2231 2243
2232 2244 def handle_auto(self, line_info):
2233 2245 """Hande lines which can be auto-executed, quoting if requested."""
2234 2246
2235 2247 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2236 2248 line = line_info.line
2237 2249 iFun = line_info.iFun
2238 2250 theRest = line_info.theRest
2239 2251 pre = line_info.pre
2240 2252 continue_prompt = line_info.continue_prompt
2241 2253 obj = line_info.ofind(self)['obj']
2242 2254
2243 2255 # This should only be active for single-line input!
2244 2256 if continue_prompt:
2245 2257 self.log(line,line,continue_prompt)
2246 2258 return line
2247 2259
2248 2260 force_auto = isinstance(obj, IPython.ipapi.IPyAutocall)
2249 2261 auto_rewrite = True
2250 2262
2251 2263 if pre == self.ESC_QUOTE:
2252 2264 # Auto-quote splitting on whitespace
2253 2265 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2254 2266 elif pre == self.ESC_QUOTE2:
2255 2267 # Auto-quote whole string
2256 2268 newcmd = '%s("%s")' % (iFun,theRest)
2257 2269 elif pre == self.ESC_PAREN:
2258 2270 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2259 2271 else:
2260 2272 # Auto-paren.
2261 2273 # We only apply it to argument-less calls if the autocall
2262 2274 # parameter is set to 2. We only need to check that autocall is <
2263 2275 # 2, since this function isn't called unless it's at least 1.
2264 2276 if not theRest and (self.rc.autocall < 2) and not force_auto:
2265 2277 newcmd = '%s %s' % (iFun,theRest)
2266 2278 auto_rewrite = False
2267 2279 else:
2268 2280 if not force_auto and theRest.startswith('['):
2269 2281 if hasattr(obj,'__getitem__'):
2270 2282 # Don't autocall in this case: item access for an object
2271 2283 # which is BOTH callable and implements __getitem__.
2272 2284 newcmd = '%s %s' % (iFun,theRest)
2273 2285 auto_rewrite = False
2274 2286 else:
2275 2287 # if the object doesn't support [] access, go ahead and
2276 2288 # autocall
2277 2289 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2278 2290 elif theRest.endswith(';'):
2279 2291 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2280 2292 else:
2281 2293 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2282 2294
2283 2295 if auto_rewrite:
2284 2296 rw = self.outputcache.prompt1.auto_rewrite() + newcmd
2285 2297
2286 2298 try:
2287 2299 # plain ascii works better w/ pyreadline, on some machines, so
2288 2300 # we use it and only print uncolored rewrite if we have unicode
2289 2301 rw = str(rw)
2290 2302 print >>Term.cout, rw
2291 2303 except UnicodeEncodeError:
2292 2304 print "-------------->" + newcmd
2293 2305
2294 2306 # log what is now valid Python, not the actual user input (without the
2295 2307 # final newline)
2296 2308 self.log(line,newcmd,continue_prompt)
2297 2309 return newcmd
2298 2310
2299 2311 def handle_help(self, line_info):
2300 2312 """Try to get some help for the object.
2301 2313
2302 2314 obj? or ?obj -> basic information.
2303 2315 obj?? or ??obj -> more details.
2304 2316 """
2305 2317
2306 2318 line = line_info.line
2307 2319 # We need to make sure that we don't process lines which would be
2308 2320 # otherwise valid python, such as "x=1 # what?"
2309 2321 try:
2310 2322 codeop.compile_command(line)
2311 2323 except SyntaxError:
2312 2324 # We should only handle as help stuff which is NOT valid syntax
2313 2325 if line[0]==self.ESC_HELP:
2314 2326 line = line[1:]
2315 2327 elif line[-1]==self.ESC_HELP:
2316 2328 line = line[:-1]
2317 2329 self.log(line,'#?'+line,line_info.continue_prompt)
2318 2330 if line:
2319 2331 #print 'line:<%r>' % line # dbg
2320 2332 self.magic_pinfo(line)
2321 2333 else:
2322 2334 page(self.usage,screen_lines=self.rc.screen_length)
2323 2335 return '' # Empty string is needed here!
2324 2336 except:
2325 2337 # Pass any other exceptions through to the normal handler
2326 2338 return self.handle_normal(line_info)
2327 2339 else:
2328 2340 # If the code compiles ok, we should handle it normally
2329 2341 return self.handle_normal(line_info)
2330 2342
2331 2343 def getapi(self):
2332 2344 """ Get an IPApi object for this shell instance
2333 2345
2334 2346 Getting an IPApi object is always preferable to accessing the shell
2335 2347 directly, but this holds true especially for extensions.
2336 2348
2337 2349 It should always be possible to implement an extension with IPApi
2338 2350 alone. If not, contact maintainer to request an addition.
2339 2351
2340 2352 """
2341 2353 return self.api
2342 2354
2343 2355 def handle_emacs(self, line_info):
2344 2356 """Handle input lines marked by python-mode."""
2345 2357
2346 2358 # Currently, nothing is done. Later more functionality can be added
2347 2359 # here if needed.
2348 2360
2349 2361 # The input cache shouldn't be updated
2350 2362 return line_info.line
2351 2363
2352 2364
2353 2365 def mktempfile(self,data=None):
2354 2366 """Make a new tempfile and return its filename.
2355 2367
2356 2368 This makes a call to tempfile.mktemp, but it registers the created
2357 2369 filename internally so ipython cleans it up at exit time.
2358 2370
2359 2371 Optional inputs:
2360 2372
2361 2373 - data(None): if data is given, it gets written out to the temp file
2362 2374 immediately, and the file is closed again."""
2363 2375
2364 2376 filename = tempfile.mktemp('.py','ipython_edit_')
2365 2377 self.tempfiles.append(filename)
2366 2378
2367 2379 if data:
2368 2380 tmp_file = open(filename,'w')
2369 2381 tmp_file.write(data)
2370 2382 tmp_file.close()
2371 2383 return filename
2372 2384
2373 2385 def write(self,data):
2374 2386 """Write a string to the default output"""
2375 2387 Term.cout.write(data)
2376 2388
2377 2389 def write_err(self,data):
2378 2390 """Write a string to the default error output"""
2379 2391 Term.cerr.write(data)
2380 2392
2381 2393 def exit(self):
2382 2394 """Handle interactive exit.
2383 2395
2384 2396 This method sets the exit_now attribute."""
2385 2397
2386 2398 if self.rc.confirm_exit:
2387 2399 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2388 2400 self.exit_now = True
2389 2401 else:
2390 2402 self.exit_now = True
2391 2403
2392 2404 def safe_execfile(self,fname,*where,**kw):
2393 2405 """A safe version of the builtin execfile().
2394 2406
2395 2407 This version will never throw an exception, and knows how to handle
2396 2408 ipython logs as well.
2397 2409
2398 2410 :Parameters:
2399 2411 fname : string
2400 2412 Name of the file to be executed.
2401 2413
2402 2414 where : tuple
2403 2415 One or two namespaces, passed to execfile() as (globals,locals).
2404 2416 If only one is given, it is passed as both.
2405 2417
2406 2418 :Keywords:
2407 2419 islog : boolean (False)
2408 2420
2409 2421 quiet : boolean (True)
2410 2422
2411 2423 exit_ignore : boolean (False)
2412 2424 """
2413 2425
2414 2426 def syspath_cleanup():
2415 2427 """Internal cleanup routine for sys.path."""
2416 2428 if add_dname:
2417 2429 try:
2418 2430 sys.path.remove(dname)
2419 2431 except ValueError:
2420 2432 # For some reason the user has already removed it, ignore.
2421 2433 pass
2422 2434
2423 2435 fname = os.path.expanduser(fname)
2424 2436
2425 2437 # Find things also in current directory. This is needed to mimic the
2426 2438 # behavior of running a script from the system command line, where
2427 2439 # Python inserts the script's directory into sys.path
2428 2440 dname = os.path.dirname(os.path.abspath(fname))
2429 2441 add_dname = False
2430 2442 if dname not in sys.path:
2431 2443 sys.path.insert(0,dname)
2432 2444 add_dname = True
2433 2445
2434 2446 try:
2435 2447 xfile = open(fname)
2436 2448 except:
2437 2449 print >> Term.cerr, \
2438 2450 'Could not open file <%s> for safe execution.' % fname
2439 2451 syspath_cleanup()
2440 2452 return None
2441 2453
2442 2454 kw.setdefault('islog',0)
2443 2455 kw.setdefault('quiet',1)
2444 2456 kw.setdefault('exit_ignore',0)
2445 2457
2446 2458 first = xfile.readline()
2447 2459 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2448 2460 xfile.close()
2449 2461 # line by line execution
2450 2462 if first.startswith(loghead) or kw['islog']:
2451 2463 print 'Loading log file <%s> one line at a time...' % fname
2452 2464 if kw['quiet']:
2453 2465 stdout_save = sys.stdout
2454 2466 sys.stdout = StringIO.StringIO()
2455 2467 try:
2456 2468 globs,locs = where[0:2]
2457 2469 except:
2458 2470 try:
2459 2471 globs = locs = where[0]
2460 2472 except:
2461 2473 globs = locs = globals()
2462 2474 badblocks = []
2463 2475
2464 2476 # we also need to identify indented blocks of code when replaying
2465 2477 # logs and put them together before passing them to an exec
2466 2478 # statement. This takes a bit of regexp and look-ahead work in the
2467 2479 # file. It's easiest if we swallow the whole thing in memory
2468 2480 # first, and manually walk through the lines list moving the
2469 2481 # counter ourselves.
2470 2482 indent_re = re.compile('\s+\S')
2471 2483 xfile = open(fname)
2472 2484 filelines = xfile.readlines()
2473 2485 xfile.close()
2474 2486 nlines = len(filelines)
2475 2487 lnum = 0
2476 2488 while lnum < nlines:
2477 2489 line = filelines[lnum]
2478 2490 lnum += 1
2479 2491 # don't re-insert logger status info into cache
2480 2492 if line.startswith('#log#'):
2481 2493 continue
2482 2494 else:
2483 2495 # build a block of code (maybe a single line) for execution
2484 2496 block = line
2485 2497 try:
2486 2498 next = filelines[lnum] # lnum has already incremented
2487 2499 except:
2488 2500 next = None
2489 2501 while next and indent_re.match(next):
2490 2502 block += next
2491 2503 lnum += 1
2492 2504 try:
2493 2505 next = filelines[lnum]
2494 2506 except:
2495 2507 next = None
2496 2508 # now execute the block of one or more lines
2497 2509 try:
2498 2510 exec block in globs,locs
2499 2511 except SystemExit:
2500 2512 pass
2501 2513 except:
2502 2514 badblocks.append(block.rstrip())
2503 2515 if kw['quiet']: # restore stdout
2504 2516 sys.stdout.close()
2505 2517 sys.stdout = stdout_save
2506 2518 print 'Finished replaying log file <%s>' % fname
2507 2519 if badblocks:
2508 2520 print >> sys.stderr, ('\nThe following lines/blocks in file '
2509 2521 '<%s> reported errors:' % fname)
2510 2522
2511 2523 for badline in badblocks:
2512 2524 print >> sys.stderr, badline
2513 2525 else: # regular file execution
2514 2526 try:
2515 2527 if sys.platform == 'win32' and sys.version_info < (2,5,1):
2516 2528 # Work around a bug in Python for Windows. The bug was
2517 2529 # fixed in in Python 2.5 r54159 and 54158, but that's still
2518 2530 # SVN Python as of March/07. For details, see:
2519 2531 # http://projects.scipy.org/ipython/ipython/ticket/123
2520 2532 try:
2521 2533 globs,locs = where[0:2]
2522 2534 except:
2523 2535 try:
2524 2536 globs = locs = where[0]
2525 2537 except:
2526 2538 globs = locs = globals()
2527 2539 exec file(fname) in globs,locs
2528 2540 else:
2529 2541 execfile(fname,*where)
2530 2542 except SyntaxError:
2531 2543 self.showsyntaxerror()
2532 2544 warn('Failure executing file: <%s>' % fname)
2533 2545 except SystemExit,status:
2534 2546 # Code that correctly sets the exit status flag to success (0)
2535 2547 # shouldn't be bothered with a traceback. Note that a plain
2536 2548 # sys.exit() does NOT set the message to 0 (it's empty) so that
2537 2549 # will still get a traceback. Note that the structure of the
2538 2550 # SystemExit exception changed between Python 2.4 and 2.5, so
2539 2551 # the checks must be done in a version-dependent way.
2540 2552 show = False
2541 2553
2542 2554 if sys.version_info[:2] > (2,5):
2543 2555 if status.message!=0 and not kw['exit_ignore']:
2544 2556 show = True
2545 2557 else:
2546 2558 if status.code and not kw['exit_ignore']:
2547 2559 show = True
2548 2560 if show:
2549 2561 self.showtraceback()
2550 2562 warn('Failure executing file: <%s>' % fname)
2551 2563 except:
2552 2564 self.showtraceback()
2553 2565 warn('Failure executing file: <%s>' % fname)
2554 2566
2555 2567 syspath_cleanup()
2556 2568
2557 2569 #************************* end of file <iplib.py> *****************************
@@ -1,7203 +1,7208 b''
1 2007-10-24 Ville Vainio <vivainio@gmail.com>
2
3 * iplib.py(user_setup): To route around buggy installations where
4 UserConfig is not available, create a minimal _ipython.
5
1 6 2007-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
2 7
3 8 * IPython/OInspect.py (Inspector.pinfo): fix bug that could arise
4 9 when querying objects with no __class__ attribute (such as
5 10 f2py-generated modules).
6 11
7 12 2007-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
8 13
9 14 * IPython/Magic.py (magic_time): track compilation time and report
10 15 it if longer than 0.1s (fix done to %time and %timeit). After a
11 16 SAGE bug report: http://trac.sagemath.org/sage_trac/ticket/632.
12 17
13 18 2007-09-18 Ville Vainio <vivainio@gmail.com>
14 19
15 20 * genutils.py(make_quoted_expr): Do not use Itpl, it does
16 21 not support unicode at the moment. Fixes (many) magic calls with
17 22 special characters.
18 23
19 24 2007-09-14 Fernando Perez <Fernando.Perez@colorado.edu>
20 25
21 26 * IPython/genutils.py (doctest_reload): expose the doctest
22 27 reloader to the user so that people can easily reset doctest while
23 28 using it interactively. Fixes a problem reported by Jorgen.
24 29
25 30 * IPython/iplib.py (InteractiveShell.__init__): protect the
26 31 FakeModule instances used for __main__ in %run calls from
27 32 deletion, so that user code defined in them isn't left with
28 33 dangling references due to the Python module deletion machinery.
29 34 This should fix the problems reported by Darren.
30 35
31 36 2007-09-10 Darren Dale <dd55@cornell.edu>
32 37
33 38 * Cleanup of IPShellQt and IPShellQt4
34 39
35 40 2007-09-09 Fernando Perez <Fernando.Perez@colorado.edu>
36 41
37 42 * IPython/FakeModule.py (FakeModule.__init__): further fixes for
38 43 doctest support.
39 44
40 45 * IPython/iplib.py (safe_execfile): minor docstring improvements.
41 46
42 47 2007-09-08 Ville Vainio <vivainio@gmail.com>
43 48
44 49 * Magic.py (%pushd, %popd, %dirs): Fix dir stack - push *current*
45 50 directory, not the target directory.
46 51
47 52 * ipapi.py, Magic.py, iplib.py: Add ipapi.UsageError, a lighter weight
48 53 exception that won't print the tracebacks. Switched many magics to
49 54 raise them on error situations, also GetoptError is not printed
50 55 anymore.
51 56
52 57 2007-09-07 Ville Vainio <vivainio@gmail.com>
53 58
54 59 * iplib.py: do not auto-alias "dir", it screws up other dir auto
55 60 aliases.
56 61
57 62 * genutils.py: SList.grep() implemented.
58 63
59 64 * ipy_editors.py, UserConfig/ipy_user_conf.py: Add some editors
60 65 for easy "out of the box" setup of several common editors, so that
61 66 e.g. '%edit os.path.isfile' will jump to the correct line
62 67 automatically. Contributions for command lines of your favourite
63 68 editors welcome.
64 69
65 70 2007-09-07 Fernando Perez <Fernando.Perez@colorado.edu>
66 71
67 72 * IPython/OInspect.py (Inspector.pinfo): fixed bug that was
68 73 preventing source display in certain cases. In reality I think
69 74 the problem is with Ubuntu's Python build, but this change works
70 75 around the issue in some cases (not in all, unfortunately). I'd
71 76 filed a Python bug on this with more details, but in the change of
72 77 bug trackers it seems to have been lost.
73 78
74 79 * IPython/Magic.py (magic_dhist): restore %dhist. No, cd -TAB is
75 80 not the same, it's not self-documenting, doesn't allow range
76 81 selection, and sorts alphabetically instead of numerically.
77 82 (magic_r): restore %r. No, "up + enter. One char magic" is not
78 83 the same thing, since %r takes parameters to allow fast retrieval
79 84 of old commands. I've received emails from users who use this a
80 85 LOT, so it stays.
81 86 (magic_automagic): restore %automagic. "use _ip.option.automagic"
82 87 is not a valid replacement b/c it doesn't provide an complete
83 88 explanation (which the automagic docstring does).
84 89 (magic_autocall): restore %autocall, with improved docstring.
85 90 Same argument as for others, "use _ip.options.autocall" is not a
86 91 valid replacement.
87 92 (magic_pdef): restore %pdef & friends. Used widely, mentioned in
88 93 tutorials and online docs.
89 94
90 95 2007-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
91 96
92 97 * IPython/usage.py (quick_reference): mention magics in quickref,
93 98 modified main banner to mention %quickref.
94 99
95 100 * IPython/FakeModule.py (FakeModule): fixes for doctest compatibility.
96 101
97 102 2007-09-06 Ville Vainio <vivainio@gmail.com>
98 103
99 104 * ipy_rehashdir.py, ipy_workdir.py, ipy_fsops.py, iplib.py:
100 105 Callable aliases now pass the _ip as first arg. This breaks
101 106 compatibility with earlier 0.8.2.svn series! (though they should
102 107 not have been in use yet outside these few extensions)
103 108
104 109 2007-09-05 Ville Vainio <vivainio@gmail.com>
105 110
106 111 * external/mglob.py: expand('dirname') => ['dirname'], instead
107 112 of ['dirname/foo','dirname/bar', ...].
108 113
109 114 * Extensions/ipy_fsops.py: added, has usefull shell utils for plain
110 115 win32 installations: icp, imv, imkdir, igrep, irm, collect (collect
111 116 is useful for others as well).
112 117
113 118 * iplib.py: on callable aliases (as opposed to old style aliases),
114 119 do var_expand() immediately, and use make_quoted_expr instead
115 120 of hardcoded r"""
116 121
117 122 * Extensions/ipy_profile_sh.py: Try to detect cygwin on win32,
118 123 if not available load ipy_fsops.py for cp, mv, etc. replacements
119 124
120 125 * OInspect.py, ipy_which.py: improve %which and obj? for callable
121 126 aliases
122 127
123 128 2007-09-04 Ville Vainio <vivainio@gmail.com>
124 129
125 130 * ipy_profile_zope.py: add zope profile, by Stefan Eletzhofer.
126 131 Relicensed under BSD with the authors approval.
127 132
128 133 * ipmaker.py, usage.py: Remove %magic from default banner, improve
129 134 %quickref
130 135
131 136 2007-09-03 Ville Vainio <vivainio@gmail.com>
132 137
133 138 * Magic.py: %time now passes expression through prefilter,
134 139 allowing IPython syntax.
135 140
136 141 2007-09-01 Ville Vainio <vivainio@gmail.com>
137 142
138 143 * ipmaker.py: Always show full traceback when newstyle config fails
139 144
140 145 2007-08-27 Ville Vainio <vivainio@gmail.com>
141 146
142 147 * Magic.py: fix %cd for nonexistent dir when dhist is empty, close #180
143 148
144 149 2007-08-26 Ville Vainio <vivainio@gmail.com>
145 150
146 151 * ipmaker.py: Command line args have the highest priority again
147 152
148 153 * iplib.py, ipmaker.py: -i command line argument now behaves as in
149 154 normal python, i.e. leaves the IPython session running after -c
150 155 command or running a batch file from command line.
151 156
152 157 2007-08-22 Ville Vainio <vivainio@gmail.com>
153 158
154 159 * iplib.py: no extra empty (last) line in raw hist w/ multiline
155 160 statements
156 161
157 162 * logger.py: Fix bug where blank lines in history were not
158 163 added until AFTER adding the current line; translated and raw
159 164 history should finally be in sync with prompt now.
160 165
161 166 * ipy_completers.py: quick_completer now makes it easy to create
162 167 trivial custom completers
163 168
164 169 * clearcmd.py: shadow history compression & erasing, fixed input hist
165 170 clearing.
166 171
167 172 * envpersist.py, history.py: %env (sh profile only), %hist completers
168 173
169 174 * genutils.py, Prompts.py, Magic.py: win32 - prompt (with \yDEPTH) and
170 175 term title now include the drive letter, and always use / instead of
171 176 os.sep (as per recommended approach for win32 ipython in general).
172 177
173 178 * ipykit.py, ipy_kitcfg.py: special launcher for ipykit. Allows running
174 179 plain python scripts from ipykit command line by running
175 180 "py myscript.py", even w/o installed python.
176 181
177 182 2007-08-21 Ville Vainio <vivainio@gmail.com>
178 183
179 184 * ipmaker.py: finding ipythonrc-PROF now skips ipy_profile_PROF.
180 185 (for backwards compatibility)
181 186
182 187 * history.py: switch back to %hist -t from %hist -r as default.
183 188 At least until raw history is fixed for good.
184 189
185 190 2007-08-20 Ville Vainio <vivainio@gmail.com>
186 191
187 192 * ipapi.py, iplib.py: DebugTools accessible via _ip.dbg, to catch &
188 193 locate alias redeclarations etc. Also, avoid handling
189 194 _ip.IP.alias_table directly, prefer using _ip.defalias.
190 195
191 196
192 197 2007-08-15 Ville Vainio <vivainio@gmail.com>
193 198
194 199 * prefilter.py: ! is now always served first
195 200
196 201 2007-08-15 Fernando Perez <Fernando.Perez@colorado.edu>
197 202
198 203 * IPython/iplib.py (safe_execfile): fix the SystemExit
199 204 auto-suppression code to work in Python2.4 (the internal structure
200 205 of that exception changed and I'd only tested the code with 2.5).
201 206 Bug reported by a SciPy attendee.
202 207
203 208 2007-08-13 Ville Vainio <vivainio@gmail.com>
204 209
205 210 * prefilter.py: reverted !c:/bin/foo fix, made % in
206 211 multiline specials work again
207 212
208 213 2007-08-13 Ville Vainio <vivainio@gmail.com>
209 214
210 215 * prefilter.py: Take more care to special-case !, so that
211 216 !c:/bin/foo.exe works.
212 217
213 218 * setup.py: if we are building eggs, strip all docs and
214 219 examples (it doesn't make sense to bytecompile examples,
215 220 and docs would be in an awkward place anyway).
216 221
217 222 * Ryan Krauss' patch fixes start menu shortcuts when IPython
218 223 is installed into a directory that has spaces in the name.
219 224
220 225 2007-08-13 Fernando Perez <Fernando.Perez@colorado.edu>
221 226
222 227 * IPython/Magic.py (magic_doctest_mode): fix prompt separators in
223 228 doctest profile and %doctest_mode, so they actually generate the
224 229 blank lines needed by doctest to separate individual tests.
225 230
226 231 * IPython/iplib.py (safe_execfile): modify so that running code
227 232 which calls sys.exit(0) (or equivalently, raise SystemExit(0))
228 233 doesn't get a printed traceback. Any other value in sys.exit(),
229 234 including the empty call, still generates a traceback. This
230 235 enables use of %run without having to pass '-e' for codes that
231 236 correctly set the exit status flag.
232 237
233 238 2007-08-12 Fernando Perez <Fernando.Perez@colorado.edu>
234 239
235 240 * IPython/iplib.py (InteractiveShell.post_config_initialization):
236 241 fix problems with doctests failing when run inside IPython due to
237 242 IPython's modifications of sys.displayhook.
238 243
239 244 2007-8-9 Fernando Perez <fperez@planck.colorado.edu>
240 245
241 246 * IPython/ipapi.py (to_user_ns): update to accept a dict as well as
242 247 a string with names.
243 248
244 249 2007-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
245 250
246 251 * IPython/Magic.py (magic_doctest_mode): added new %doctest_mode
247 252 magic to toggle on/off the doctest pasting support without having
248 253 to leave a session to switch to a separate profile.
249 254
250 255 2007-08-08 Fernando Perez <Fernando.Perez@colorado.edu>
251 256
252 257 * IPython/Extensions/ipy_profile_doctest.py (main): fix prompt to
253 258 introduce a blank line between inputs, to conform to doctest
254 259 requirements.
255 260
256 261 * IPython/OInspect.py (Inspector.pinfo): fix another part where
257 262 auto-generated docstrings for new-style classes were showing up.
258 263
259 264 2007-08-07 Fernando Perez <Fernando.Perez@colorado.edu>
260 265
261 266 * api_changes: Add new file to track backward-incompatible
262 267 user-visible changes.
263 268
264 269 2007-08-06 Ville Vainio <vivainio@gmail.com>
265 270
266 271 * ipmaker.py: fix bug where user_config_ns didn't exist at all
267 272 before all the config files were handled.
268 273
269 274 2007-08-04 Fernando Perez <Fernando.Perez@colorado.edu>
270 275
271 276 * IPython/irunner.py (RunnerFactory): Add new factory class for
272 277 creating reusable runners based on filenames.
273 278
274 279 * IPython/Extensions/ipy_profile_doctest.py: New profile for
275 280 doctest support. It sets prompts/exceptions as similar to
276 281 standard Python as possible, so that ipython sessions in this
277 282 profile can be easily pasted as doctests with minimal
278 283 modifications. It also enables pasting of doctests from external
279 284 sources (even if they have leading whitespace), so that you can
280 285 rerun doctests from existing sources.
281 286
282 287 * IPython/iplib.py (_prefilter): fix a buglet where after entering
283 288 some whitespace, the prompt would become a continuation prompt
284 289 with no way of exiting it other than Ctrl-C. This fix brings us
285 290 into conformity with how the default python prompt works.
286 291
287 292 * IPython/Extensions/InterpreterPasteInput.py (prefilter_paste):
288 293 Add support for pasting not only lines that start with '>>>', but
289 294 also with ' >>>'. That is, arbitrary whitespace can now precede
290 295 the prompts. This makes the system useful for pasting doctests
291 296 from docstrings back into a normal session.
292 297
293 298 2007-08-02 Fernando Perez <Fernando.Perez@colorado.edu>
294 299
295 300 * IPython/Shell.py (IPShellEmbed.__call__): fix bug introduced in
296 301 r1357, which had killed multiple invocations of an embedded
297 302 ipython (this means that example-embed has been broken for over 1
298 303 year!!!). Rather than possibly breaking the batch stuff for which
299 304 the code in iplib.py/interact was introduced, I worked around the
300 305 problem in the embedding class in Shell.py. We really need a
301 306 bloody test suite for this code, I'm sick of finding stuff that
302 307 used to work breaking left and right every time I use an old
303 308 feature I hadn't touched in a few months.
304 309 (kill_embedded): Add a new magic that only shows up in embedded
305 310 mode, to allow users to permanently deactivate an embedded instance.
306 311
307 312 2007-08-01 Ville Vainio <vivainio@gmail.com>
308 313
309 314 * iplib.py, ipy_profile_sh.py (runlines): Fix the bug where raw
310 315 history gets out of sync on runlines (e.g. when running macros).
311 316
312 317 2007-07-31 Fernando Perez <Fernando.Perez@colorado.edu>
313 318
314 319 * IPython/Magic.py (magic_colors): fix win32-related error message
315 320 that could appear under *nix when readline was missing. Patch by
316 321 Scott Jackson, closes #175.
317 322
318 323 2007-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
319 324
320 325 * IPython/Extensions/ipy_traits_completer.py: Add a new custom
321 326 completer that it traits-aware, so that traits objects don't show
322 327 all of their internal attributes all the time.
323 328
324 329 * IPython/genutils.py (dir2): moved this code from inside
325 330 completer.py to expose it publicly, so I could use it in the
326 331 wildcards bugfix.
327 332
328 333 * IPython/wildcard.py (NameSpace.__init__): fix a bug reported by
329 334 Stefan with Traits.
330 335
331 336 * IPython/completer.py (Completer.attr_matches): change internal
332 337 var name from 'object' to 'obj', since 'object' is now a builtin
333 338 and this can lead to weird bugs if reusing this code elsewhere.
334 339
335 340 2007-07-25 Fernando Perez <Fernando.Perez@colorado.edu>
336 341
337 342 * IPython/OInspect.py (Inspector.pinfo): fix small glitches in
338 343 'foo?' and update the code to prevent printing of default
339 344 docstrings that started appearing after I added support for
340 345 new-style classes. The approach I'm using isn't ideal (I just
341 346 special-case those strings) but I'm not sure how to more robustly
342 347 differentiate between truly user-written strings and Python's
343 348 automatic ones.
344 349
345 350 2007-07-09 Ville Vainio <vivainio@gmail.com>
346 351
347 352 * completer.py: Applied Matthew Neeley's patch:
348 353 Dynamic attributes from trait_names and _getAttributeNames are added
349 354 to the list of tab completions, but when this happens, the attribute
350 355 list is turned into a set, so the attributes are unordered when
351 356 printed, which makes it hard to find the right completion. This patch
352 357 turns this set back into a list and sort it.
353 358
354 359 2007-07-06 Fernando Perez <Fernando.Perez@colorado.edu>
355 360
356 361 * IPython/OInspect.py (Inspector.pinfo): Add support for new-style
357 362 classes in various inspector functions.
358 363
359 364 2007-06-28 Ville Vainio <vivainio@gmail.com>
360 365
361 366 * shadowns.py, iplib.py, ipapi.py, OInspect.py:
362 367 Implement "shadow" namespace, and callable aliases that reside there.
363 368 Use them by:
364 369
365 370 _ip.defalias('foo',myfunc) # creates _sh.foo that points to myfunc
366 371
367 372 foo hello world
368 373 (gets translated to:)
369 374 _sh.foo(r"""hello world""")
370 375
371 376 In practice, this kind of alias can take the role of a magic function
372 377
373 378 * New generic inspect_object, called on obj? and obj??
374 379
375 380 2007-06-15 Fernando Perez <Fernando.Perez@colorado.edu>
376 381
377 382 * IPython/ultraTB.py (findsource): fix a problem with
378 383 inspect.getfile that can cause crashes during traceback construction.
379 384
380 385 2007-06-14 Ville Vainio <vivainio@gmail.com>
381 386
382 387 * iplib.py (handle_auto): Try to use ascii for printing "--->"
383 388 autocall rewrite indication, becausesometimes unicode fails to print
384 389 properly (and you get ' - - - '). Use plain uncoloured ---> for
385 390 unicode.
386 391
387 392 * shadow history. Usable through "%hist -g <pat>" and "%rep 0123".
388 393
389 394 . pickleshare 'hash' commands (hget, hset, hcompress,
390 395 hdict) for efficient shadow history storage.
391 396
392 397 2007-06-13 Ville Vainio <vivainio@gmail.com>
393 398
394 399 * ipapi.py: _ip.to_user_ns(vars, interactive = True).
395 400 Added kw arg 'interactive', tell whether vars should be visible
396 401 with %whos.
397 402
398 403 2007-06-11 Ville Vainio <vivainio@gmail.com>
399 404
400 405 * pspersistence.py, Magic.py, iplib.py: directory history now saved
401 406 to db
402 407
403 408 * iplib.py: "ipython -c <cmd>" now passes the command through prefilter.
404 409 Also, it exits IPython immediately after evaluating the command (just like
405 410 std python)
406 411
407 412 2007-06-05 Walter Doerwald <walter@livinglogic.de>
408 413
409 414 * IPython/Extensions/ipipe.py: Added a new table icap, which executes a
410 415 Python string and captures the output. (Idea and original patch by
411 416 Stefan van der Walt)
412 417
413 418 2007-06-01 Fernando Perez <Fernando.Perez@colorado.edu>
414 419
415 420 * IPython/ultraTB.py (VerboseTB.text): update printing of
416 421 exception types for Python 2.5 (now all exceptions in the stdlib
417 422 are new-style classes).
418 423
419 424 2007-05-31 Walter Doerwald <walter@livinglogic.de>
420 425
421 426 * IPython/Extensions/igrid.py: Add new commands refresh and
422 427 refresh_timer (mapped to "R"/"F5" and to the menu) which restarts
423 428 the iterator once (refresh) or after every x seconds (refresh_timer).
424 429 Add a working implementation of "searchexpression", where the text
425 430 entered is not the text to search for, but an expression that must
426 431 be true. Added display of shortcuts to the menu. Added commands "pickinput"
427 432 and "pickinputattr" that put the object or attribute under the cursor
428 433 in the input line. Split the statusbar to be able to display the currently
429 434 active refresh interval. (Patch by Nik Tautenhahn)
430 435
431 436 2007-05-29 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
432 437
433 438 * fixing set_term_title to use ctypes as default
434 439
435 440 * fixing set_term_title fallback to work when curent dir
436 441 is on a windows network share
437 442
438 443 2007-05-28 Ville Vainio <vivainio@gmail.com>
439 444
440 445 * %cpaste: strip + with > from left (diffs).
441 446
442 447 * iplib.py: Fix crash when readline not installed
443 448
444 449 2007-05-26 Ville Vainio <vivainio@gmail.com>
445 450
446 451 * generics.py: intruduce easy to extend result_display generic
447 452 function (using simplegeneric.py).
448 453
449 454 * Fixed the append functionality of %set.
450 455
451 456 2007-05-25 Ville Vainio <vivainio@gmail.com>
452 457
453 458 * New magic: %rep (fetch / run old commands from history)
454 459
455 460 * New extension: mglob (%mglob magic), for powerful glob / find /filter
456 461 like functionality
457 462
458 463 % maghistory.py: %hist -g PATTERM greps the history for pattern
459 464
460 465 2007-05-24 Walter Doerwald <walter@livinglogic.de>
461 466
462 467 * IPython/Extensions/ipipe.py: Added a Table ihist that can be used to
463 468 browse the IPython input history
464 469
465 470 * IPython/Extensions/ibrowse.py: Added two command to ibrowse: pickinput
466 471 (mapped to "i") can be used to put the object under the curser in the input
467 472 line. pickinputattr (mapped to "I") does the same for the attribute under
468 473 the cursor.
469 474
470 475 2007-05-24 Ville Vainio <vivainio@gmail.com>
471 476
472 477 * Grand magic cleansing (changeset [2380]):
473 478
474 479 * Introduce ipy_legacy.py where the following magics were
475 480 moved:
476 481
477 482 pdef pdoc psource pfile rehash dhist Quit p r automagic autocall
478 483
479 484 If you need them, either use default profile or "import ipy_legacy"
480 485 in your ipy_user_conf.py
481 486
482 487 * Move sh and scipy profile to Extensions from UserConfig. this implies
483 488 you should not edit them, but you don't need to run %upgrade when
484 489 upgrading IPython anymore.
485 490
486 491 * %hist/%history now operates in "raw" mode by default. To get the old
487 492 behaviour, run '%hist -n' (native mode).
488 493
489 494 * split ipy_stock_completers.py to ipy_stock_completers.py and
490 495 ipy_app_completers.py. Stock completers (%cd, import, %run) are now
491 496 installed as default.
492 497
493 498 * sh profile now installs ipy_signals.py, for (hopefully) better ctrl+c
494 499 handling.
495 500
496 501 * iplib.py, ipapi.py: _ip.set_next_input(s) sets the next ("default")
497 502 input if readline is available.
498 503
499 504 2007-05-23 Ville Vainio <vivainio@gmail.com>
500 505
501 506 * macro.py: %store uses __getstate__ properly
502 507
503 508 * exesetup.py: added new setup script for creating
504 509 standalone IPython executables with py2exe (i.e.
505 510 no python installation required).
506 511
507 512 * Removed ipythonrc-scipy, ipy_profile_scipy.py takes
508 513 its place.
509 514
510 515 * rlineimpl.py, genutils.py (get_home_dir): py2exe support
511 516
512 517 2007-05-21 Ville Vainio <vivainio@gmail.com>
513 518
514 519 * platutil_win32.py (set_term_title): handle
515 520 failure of 'title' system call properly.
516 521
517 522 2007-05-17 Walter Doerwald <walter@livinglogic.de>
518 523
519 524 * IPython/Extensions/ipipe.py: Fix xrepr for ifiles.
520 525 (Bug detected by Paul Mueller).
521 526
522 527 2007-05-16 Ville Vainio <vivainio@gmail.com>
523 528
524 529 * ipy_profile_sci.py, ipython_win_post_install.py: Create
525 530 new "sci" profile, effectively a modern version of the old
526 531 "scipy" profile (which is now slated for deprecation).
527 532
528 533 2007-05-15 Ville Vainio <vivainio@gmail.com>
529 534
530 535 * pycolorize.py, pycolor.1: Paul Mueller's patches that
531 536 make pycolorize read input from stdin when run without arguments.
532 537
533 538 * Magic.py: do not require 'PATH' in %rehash/%rehashx. Closes #155
534 539
535 540 * ipy_rehashdir.py: rename ext_rehashdir to ipy_rehashdir, import
536 541 it in sh profile (instead of ipy_system_conf.py).
537 542
538 543 * Magic.py, ipy_rehashdir.py, ipy_profile_sh.py: System command
539 544 aliases are now lower case on windows (MyCommand.exe => mycommand).
540 545
541 546 * macro.py, ipapi.py, iplib.py, Prompts.py: Macro system rehaul.
542 547 Macros are now callable objects that inherit from ipapi.IPyAutocall,
543 548 i.e. get autocalled regardless of system autocall setting.
544 549
545 550 2007-05-10 Fernando Perez <Fernando.Perez@colorado.edu>
546 551
547 552 * IPython/rlineimpl.py: check for clear_history in readline and
548 553 make it a dummy no-op if not available. This function isn't
549 554 guaranteed to be in the API and appeared in Python 2.4, so we need
550 555 to check it ourselves. Also, clean up this file quite a bit.
551 556
552 557 * ipython.1: update man page and full manual with information
553 558 about threads (remove outdated warning). Closes #151.
554 559
555 560 2007-05-09 Fernando Perez <Fernando.Perez@colorado.edu>
556 561
557 562 * IPython/Extensions/ipy_constants.py: Add Gael's constants module
558 563 in trunk (note that this made it into the 0.8.1 release already,
559 564 but the changelogs didn't get coordinated). Many thanks to Gael
560 565 Varoquaux <gael.varoquaux-AT-normalesup.org>
561 566
562 567 2007-05-09 *** Released version 0.8.1
563 568
564 569 2007-05-10 Walter Doerwald <walter@livinglogic.de>
565 570
566 571 * IPython/Extensions/igrid.py: Incorporate html help into
567 572 the module, so we don't have to search for the file.
568 573
569 574 2007-05-02 Fernando Perez <Fernando.Perez@colorado.edu>
570 575
571 576 * test/test_irunner.py (RunnerTestCase._test_runner): Close #147.
572 577
573 578 2007-04-30 Ville Vainio <vivainio@gmail.com>
574 579
575 580 * iplib.py: (pre_config_initialization) Catch UnicodeDecodeError if the
576 581 user has illegal (non-ascii) home directory name
577 582
578 583 2007-04-27 Ville Vainio <vivainio@gmail.com>
579 584
580 585 * platutils_win32.py: implement set_term_title for windows
581 586
582 587 * Update version number
583 588
584 589 * ipy_profile_sh.py: more informative prompt (2 dir levels)
585 590
586 591 2007-04-26 Walter Doerwald <walter@livinglogic.de>
587 592
588 593 * IPython/Extensions/igrid.py: (igrid) Fix bug that surfaced
589 594 when the igrid input raised an exception. (Patch by Nik Tautenhahn,
590 595 bug discovered by Ville).
591 596
592 597 2007-04-26 Ville Vainio <vivainio@gmail.com>
593 598
594 599 * Extensions/ipy_completers.py: Olivier's module completer now
595 600 saves the list of root modules if it takes > 4 secs on the first run.
596 601
597 602 * Magic.py (%rehashx): %rehashx now clears the completer cache
598 603
599 604
600 605 2007-04-26 Fernando Perez <Fernando.Perez@colorado.edu>
601 606
602 607 * ipython.el: fix incorrect color scheme, reported by Stefan.
603 608 Closes #149.
604 609
605 610 * IPython/PyColorize.py (Parser.format2): fix state-handling
606 611 logic. I still don't like how that code handles state, but at
607 612 least now it should be correct, if inelegant. Closes #146.
608 613
609 614 2007-04-25 Ville Vainio <vivainio@gmail.com>
610 615
611 616 * Extensions/ipy_which.py: added extension for %which magic, works
612 617 a lot like unix 'which' but also finds and expands aliases, and
613 618 allows wildcards.
614 619
615 620 * ipapi.py (expand_alias): Now actually *return* the expanded alias,
616 621 as opposed to returning nothing.
617 622
618 623 * UserConfig/ipy_user_conf.py, ipy_profile_sh.py: do not import
619 624 ipy_stock_completers on default profile, do import on sh profile.
620 625
621 626 2007-04-22 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
622 627
623 628 * Fix bug in iplib.py/safe_execfile when launching ipython with a script
624 629 like ipython.py foo.py which raised a IndexError.
625 630
626 631 2007-04-21 Ville Vainio <vivainio@gmail.com>
627 632
628 633 * Extensions/ipy_extutil.py: added extension to manage other ipython
629 634 extensions. Now only supports 'ls' == list extensions.
630 635
631 636 2007-04-20 Fernando Perez <Fernando.Perez@colorado.edu>
632 637
633 638 * IPython/Debugger.py (BdbQuit_excepthook): fix small bug that
634 639 would prevent use of the exception system outside of a running
635 640 IPython instance.
636 641
637 642 2007-04-20 Ville Vainio <vivainio@gmail.com>
638 643
639 644 * Extensions/ipy_render.py: added extension for easy
640 645 interactive text template rendering (to clipboard). Uses Ka-Ping Yee's
641 646 'Iptl' template notation,
642 647
643 648 * Extensions/ipy_completers.py: introduced Olivier Lauzanne's
644 649 safer & faster 'import' completer.
645 650
646 651 * ipapi.py: Introduced new ipapi methods, _ip.defmacro(name, value)
647 652 and _ip.defalias(name, command).
648 653
649 654 * Extensions/ipy_exportdb.py: New extension for exporting all the
650 655 %store'd data in a portable format (normal ipapi calls like
651 656 defmacro() etc.)
652 657
653 658 2007-04-19 Ville Vainio <vivainio@gmail.com>
654 659
655 660 * upgrade_dir.py: skip junk files like *.pyc
656 661
657 662 * Release.py: version number to 0.8.1
658 663
659 664 2007-04-18 Ville Vainio <vivainio@gmail.com>
660 665
661 666 * iplib.py (safe_execfile): make "ipython foo.py" work with 2.5.1c1
662 667 and later on win32.
663 668
664 669 2007-04-16 Ville Vainio <vivainio@gmail.com>
665 670
666 671 * iplib.py (showtraceback): Do not crash when running w/o readline.
667 672
668 673 2007-04-12 Walter Doerwald <walter@livinglogic.de>
669 674
670 675 * IPython/Extensions/ipipe.py: (ils) Directoy listings are now
671 676 sorted (case sensitive with files and dirs mixed).
672 677
673 678 2007-04-10 Fernando Perez <Fernando.Perez@colorado.edu>
674 679
675 680 * IPython/Release.py (version): Open trunk for 0.8.1 development.
676 681
677 682 2007-04-10 *** Released version 0.8.0
678 683
679 684 2007-04-07 Fernando Perez <Fernando.Perez@colorado.edu>
680 685
681 686 * Tag 0.8.0 for release.
682 687
683 688 * IPython/iplib.py (reloadhist): add API function to cleanly
684 689 reload the readline history, which was growing inappropriately on
685 690 every %run call.
686 691
687 692 * win32_manual_post_install.py (run): apply last part of Nicolas
688 693 Pernetty's patch (I'd accidentally applied it in a different
689 694 directory and this particular file didn't get patched).
690 695
691 696 2007-04-05 Fernando Perez <Fernando.Perez@colorado.edu>
692 697
693 698 * IPython/Shell.py (MAIN_THREAD_ID): get rid of my stupid hack to
694 699 find the main thread id and use the proper API call. Thanks to
695 700 Stefan for the fix.
696 701
697 702 * test/test_prefilter.py (esc_handler_tests): udpate one of Dan's
698 703 unit tests to reflect fixed ticket #52, and add more tests sent by
699 704 him.
700 705
701 706 * IPython/iplib.py (raw_input): restore the readline completer
702 707 state on every input, in case third-party code messed it up.
703 708 (_prefilter): revert recent addition of early-escape checks which
704 709 prevent many valid alias calls from working.
705 710
706 711 * IPython/Shell.py (MTInteractiveShell.runcode): add a tracking
707 712 flag for sigint handler so we don't run a full signal() call on
708 713 each runcode access.
709 714
710 715 * IPython/Magic.py (magic_whos): small improvement to diagnostic
711 716 message.
712 717
713 718 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
714 719
715 720 * IPython/Shell.py (sigint_handler): I *THINK* I finally got
716 721 asynchronous exceptions working, i.e., Ctrl-C can actually
717 722 interrupt long-running code in the multithreaded shells.
718 723
719 724 This is using Tomer Filiba's great ctypes-based trick:
720 725 http://sebulba.wikispaces.com/recipe+thread2. I'd already tried
721 726 this in the past, but hadn't been able to make it work before. So
722 727 far it looks like it's actually running, but this needs more
723 728 testing. If it really works, I'll be *very* happy, and we'll owe
724 729 a huge thank you to Tomer. My current implementation is ugly,
725 730 hackish and uses nasty globals, but I don't want to try and clean
726 731 anything up until we know if it actually works.
727 732
728 733 NOTE: this feature needs ctypes to work. ctypes is included in
729 734 Python2.5, but 2.4 users will need to manually install it. This
730 735 feature makes multi-threaded shells so much more usable that it's
731 736 a minor price to pay (ctypes is very easy to install, already a
732 737 requirement for win32 and available in major linux distros).
733 738
734 739 2007-04-04 Ville Vainio <vivainio@gmail.com>
735 740
736 741 * Extensions/ipy_completers.py, ipy_stock_completers.py:
737 742 Moved implementations of 'bundled' completers to ipy_completers.py,
738 743 they are only enabled in ipy_stock_completers.py.
739 744
740 745 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
741 746
742 747 * IPython/PyColorize.py (Parser.format2): Fix identation of
743 748 colorzied output and return early if color scheme is NoColor, to
744 749 avoid unnecessary and expensive tokenization. Closes #131.
745 750
746 751 2007-04-03 Fernando Perez <Fernando.Perez@colorado.edu>
747 752
748 753 * IPython/Debugger.py: disable the use of pydb version 1.17. It
749 754 has a critical bug (a missing import that makes post-mortem not
750 755 work at all). Unfortunately as of this time, this is the version
751 756 shipped with Ubuntu Edgy, so quite a few people have this one. I
752 757 hope Edgy will update to a more recent package.
753 758
754 759 2007-04-02 Fernando Perez <Fernando.Perez@colorado.edu>
755 760
756 761 * IPython/iplib.py (_prefilter): close #52, second part of a patch
757 762 set by Stefan (only the first part had been applied before).
758 763
759 764 * IPython/Extensions/ipy_stock_completers.py (module_completer):
760 765 remove usage of the dangerous pkgutil.walk_packages(). See
761 766 details in comments left in the code.
762 767
763 768 * IPython/Magic.py (magic_whos): add support for numpy arrays
764 769 similar to what we had for Numeric.
765 770
766 771 * IPython/completer.py (IPCompleter.complete): extend the
767 772 complete() call API to support completions by other mechanisms
768 773 than readline. Closes #109.
769 774
770 775 * IPython/iplib.py (safe_execfile): add a safeguard under Win32 to
771 776 protect against a bug in Python's execfile(). Closes #123.
772 777
773 778 2007-04-01 Fernando Perez <Fernando.Perez@colorado.edu>
774 779
775 780 * IPython/iplib.py (split_user_input): ensure that when splitting
776 781 user input, the part that can be treated as a python name is pure
777 782 ascii (Python identifiers MUST be pure ascii). Part of the
778 783 ongoing Unicode support work.
779 784
780 785 * IPython/Prompts.py (prompt_specials_color): Add \N for the
781 786 actual prompt number, without any coloring. This allows users to
782 787 produce numbered prompts with their own colors. Added after a
783 788 report/request by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
784 789
785 790 2007-03-31 Walter Doerwald <walter@livinglogic.de>
786 791
787 792 * IPython/Extensions/igrid.py: Map the return key
788 793 to enter() and shift-return to enterattr().
789 794
790 795 2007-03-30 Fernando Perez <Fernando.Perez@colorado.edu>
791 796
792 797 * IPython/Magic.py (magic_psearch): add unicode support by
793 798 encoding to ascii the input, since this routine also only deals
794 799 with valid Python names. Fixes a bug reported by Stefan.
795 800
796 801 2007-03-29 Fernando Perez <Fernando.Perez@colorado.edu>
797 802
798 803 * IPython/Magic.py (_inspect): convert unicode input into ascii
799 804 before trying to evaluate it as a Python identifier. This fixes a
800 805 problem that the new unicode support had introduced when analyzing
801 806 long definition lines for functions.
802 807
803 808 2007-03-24 Walter Doerwald <walter@livinglogic.de>
804 809
805 810 * IPython/Extensions/igrid.py: Fix picking. Using
806 811 igrid with wxPython 2.6 and -wthread should work now.
807 812 igrid.display() simply tries to create a frame without
808 813 an application. Only if this fails an application is created.
809 814
810 815 2007-03-23 Walter Doerwald <walter@livinglogic.de>
811 816
812 817 * IPython/Extensions/path.py: Updated to version 2.2.
813 818
814 819 2007-03-23 Ville Vainio <vivainio@gmail.com>
815 820
816 821 * iplib.py: recursive alias expansion now works better, so that
817 822 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
818 823 doesn't trip up the process, if 'd' has been aliased to 'ls'.
819 824
820 825 * Extensions/ipy_gnuglobal.py added, provides %global magic
821 826 for users of http://www.gnu.org/software/global
822 827
823 828 * iplib.py: '!command /?' now doesn't invoke IPython's help system.
824 829 Closes #52. Patch by Stefan van der Walt.
825 830
826 831 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
827 832
828 833 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
829 834 respect the __file__ attribute when using %run. Thanks to a bug
830 835 report by Sebastian Rooks <sebastian.rooks-AT-free.fr>.
831 836
832 837 2007-03-22 Fernando Perez <Fernando.Perez@colorado.edu>
833 838
834 839 * IPython/iplib.py (raw_input): Fix mishandling of unicode at
835 840 input. Patch sent by Stefan.
836 841
837 842 2007-03-20 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
838 843 * IPython/Extensions/ipy_stock_completer.py
839 844 shlex_split, fix bug in shlex_split. len function
840 845 call was missing an if statement. Caused shlex_split to
841 846 sometimes return "" as last element.
842 847
843 848 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
844 849
845 850 * IPython/completer.py
846 851 (IPCompleter.file_matches.single_dir_expand): fix a problem
847 852 reported by Stefan, where directories containign a single subdir
848 853 would be completed too early.
849 854
850 855 * IPython/Shell.py (_load_pylab): Make the execution of 'from
851 856 pylab import *' when -pylab is given be optional. A new flag,
852 857 pylab_import_all controls this behavior, the default is True for
853 858 backwards compatibility.
854 859
855 860 * IPython/ultraTB.py (_formatTracebackLines): Added (slightly
856 861 modified) R. Bernstein's patch for fully syntax highlighted
857 862 tracebacks. The functionality is also available under ultraTB for
858 863 non-ipython users (someone using ultraTB but outside an ipython
859 864 session). They can select the color scheme by setting the
860 865 module-level global DEFAULT_SCHEME. The highlight functionality
861 866 also works when debugging.
862 867
863 868 * IPython/genutils.py (IOStream.close): small patch by
864 869 R. Bernstein for improved pydb support.
865 870
866 871 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
867 872 DaveS <davls@telus.net> to improve support of debugging under
868 873 NTEmacs, including improved pydb behavior.
869 874
870 875 * IPython/Magic.py (magic_prun): Fix saving of profile info for
871 876 Python 2.5, where the stats object API changed a little. Thanks
872 877 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
873 878
874 879 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
875 880 Pernetty's patch to improve support for (X)Emacs under Win32.
876 881
877 882 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
878 883
879 884 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
880 885 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
881 886 a report by Nik Tautenhahn.
882 887
883 888 2007-03-16 Walter Doerwald <walter@livinglogic.de>
884 889
885 890 * setup.py: Add the igrid help files to the list of data files
886 891 to be installed alongside igrid.
887 892 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
888 893 Show the input object of the igrid browser as the window tile.
889 894 Show the object the cursor is on in the statusbar.
890 895
891 896 2007-03-15 Ville Vainio <vivainio@gmail.com>
892 897
893 898 * Extensions/ipy_stock_completers.py: Fixed exception
894 899 on mismatching quotes in %run completer. Patch by
895 900 Jorgen Stenarson. Closes #127.
896 901
897 902 2007-03-14 Ville Vainio <vivainio@gmail.com>
898 903
899 904 * Extensions/ext_rehashdir.py: Do not do auto_alias
900 905 in %rehashdir, it clobbers %store'd aliases.
901 906
902 907 * UserConfig/ipy_profile_sh.py: envpersist.py extension
903 908 (beefed up %env) imported for sh profile.
904 909
905 910 2007-03-10 Walter Doerwald <walter@livinglogic.de>
906 911
907 912 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
908 913 as the default browser.
909 914 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
910 915 As igrid displays all attributes it ever encounters, fetch() (which has
911 916 been renamed to _fetch()) doesn't have to recalculate the display attributes
912 917 every time a new item is fetched. This should speed up scrolling.
913 918
914 919 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
915 920
916 921 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
917 922 Schmolck's recently reported tab-completion bug (my previous one
918 923 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
919 924
920 925 2007-03-09 Walter Doerwald <walter@livinglogic.de>
921 926
922 927 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
923 928 Close help window if exiting igrid.
924 929
925 930 2007-03-02 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
926 931
927 932 * IPython/Extensions/ipy_defaults.py: Check if readline is available
928 933 before calling functions from readline.
929 934
930 935 2007-03-02 Walter Doerwald <walter@livinglogic.de>
931 936
932 937 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
933 938 igrid is a wxPython-based display object for ipipe. If your system has
934 939 wx installed igrid will be the default display. Without wx ipipe falls
935 940 back to ibrowse (which needs curses). If no curses is installed ipipe
936 941 falls back to idump.
937 942
938 943 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
939 944
940 945 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
941 946 my changes from yesterday, they introduced bugs. Will reactivate
942 947 once I get a correct solution, which will be much easier thanks to
943 948 Dan Milstein's new prefilter test suite.
944 949
945 950 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
946 951
947 952 * IPython/iplib.py (split_user_input): fix input splitting so we
948 953 don't attempt attribute accesses on things that can't possibly be
949 954 valid Python attributes. After a bug report by Alex Schmolck.
950 955 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
951 956 %magic with explicit % prefix.
952 957
953 958 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
954 959
955 960 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
956 961 avoid a DeprecationWarning from GTK.
957 962
958 963 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
959 964
960 965 * IPython/genutils.py (clock): I modified clock() to return total
961 966 time, user+system. This is a more commonly needed metric. I also
962 967 introduced the new clocku/clocks to get only user/system time if
963 968 one wants those instead.
964 969
965 970 ***WARNING: API CHANGE*** clock() used to return only user time,
966 971 so if you want exactly the same results as before, use clocku
967 972 instead.
968 973
969 974 2007-02-22 Ville Vainio <vivainio@gmail.com>
970 975
971 976 * IPython/Extensions/ipy_p4.py: Extension for improved
972 977 p4 (perforce version control system) experience.
973 978 Adds %p4 magic with p4 command completion and
974 979 automatic -G argument (marshall output as python dict)
975 980
976 981 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
977 982
978 983 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
979 984 stop marks.
980 985 (ClearingMixin): a simple mixin to easily make a Demo class clear
981 986 the screen in between blocks and have empty marquees. The
982 987 ClearDemo and ClearIPDemo classes that use it are included.
983 988
984 989 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
985 990
986 991 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
987 992 protect against exceptions at Python shutdown time. Patch
988 993 sumbmitted to upstream.
989 994
990 995 2007-02-14 Walter Doerwald <walter@livinglogic.de>
991 996
992 997 * IPython/Extensions/ibrowse.py: If entering the first object level
993 998 (i.e. the object for which the browser has been started) fails,
994 999 now the error is raised directly (aborting the browser) instead of
995 1000 running into an empty levels list later.
996 1001
997 1002 2007-02-03 Walter Doerwald <walter@livinglogic.de>
998 1003
999 1004 * IPython/Extensions/ipipe.py: Add an xrepr implementation
1000 1005 for the noitem object.
1001 1006
1002 1007 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
1003 1008
1004 1009 * IPython/completer.py (Completer.attr_matches): Fix small
1005 1010 tab-completion bug with Enthought Traits objects with units.
1006 1011 Thanks to a bug report by Tom Denniston
1007 1012 <tom.denniston-AT-alum.dartmouth.org>.
1008 1013
1009 1014 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
1010 1015
1011 1016 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
1012 1017 bug where only .ipy or .py would be completed. Once the first
1013 1018 argument to %run has been given, all completions are valid because
1014 1019 they are the arguments to the script, which may well be non-python
1015 1020 filenames.
1016 1021
1017 1022 * IPython/irunner.py (InteractiveRunner.run_source): major updates
1018 1023 to irunner to allow it to correctly support real doctesting of
1019 1024 out-of-process ipython code.
1020 1025
1021 1026 * IPython/Magic.py (magic_cd): Make the setting of the terminal
1022 1027 title an option (-noterm_title) because it completely breaks
1023 1028 doctesting.
1024 1029
1025 1030 * IPython/demo.py: fix IPythonDemo class that was not actually working.
1026 1031
1027 1032 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
1028 1033
1029 1034 * IPython/irunner.py (main): fix small bug where extensions were
1030 1035 not being correctly recognized.
1031 1036
1032 1037 2007-01-23 Walter Doerwald <walter@livinglogic.de>
1033 1038
1034 1039 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
1035 1040 a string containing a single line yields the string itself as the
1036 1041 only item.
1037 1042
1038 1043 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
1039 1044 object if it's the same as the one on the last level (This avoids
1040 1045 infinite recursion for one line strings).
1041 1046
1042 1047 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1043 1048
1044 1049 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
1045 1050 all output streams before printing tracebacks. This ensures that
1046 1051 user output doesn't end up interleaved with traceback output.
1047 1052
1048 1053 2007-01-10 Ville Vainio <vivainio@gmail.com>
1049 1054
1050 1055 * Extensions/envpersist.py: Turbocharged %env that remembers
1051 1056 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
1052 1057 "%env VISUAL=jed".
1053 1058
1054 1059 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
1055 1060
1056 1061 * IPython/iplib.py (showtraceback): ensure that we correctly call
1057 1062 custom handlers in all cases (some with pdb were slipping through,
1058 1063 but I'm not exactly sure why).
1059 1064
1060 1065 * IPython/Debugger.py (Tracer.__init__): added new class to
1061 1066 support set_trace-like usage of IPython's enhanced debugger.
1062 1067
1063 1068 2006-12-24 Ville Vainio <vivainio@gmail.com>
1064 1069
1065 1070 * ipmaker.py: more informative message when ipy_user_conf
1066 1071 import fails (suggest running %upgrade).
1067 1072
1068 1073 * tools/run_ipy_in_profiler.py: Utility to see where
1069 1074 the time during IPython startup is spent.
1070 1075
1071 1076 2006-12-20 Ville Vainio <vivainio@gmail.com>
1072 1077
1073 1078 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
1074 1079
1075 1080 * ipapi.py: Add new ipapi method, expand_alias.
1076 1081
1077 1082 * Release.py: Bump up version to 0.7.4.svn
1078 1083
1079 1084 2006-12-17 Ville Vainio <vivainio@gmail.com>
1080 1085
1081 1086 * Extensions/jobctrl.py: Fixed &cmd arg arg...
1082 1087 to work properly on posix too
1083 1088
1084 1089 * Release.py: Update revnum (version is still just 0.7.3).
1085 1090
1086 1091 2006-12-15 Ville Vainio <vivainio@gmail.com>
1087 1092
1088 1093 * scripts/ipython_win_post_install: create ipython.py in
1089 1094 prefix + "/scripts".
1090 1095
1091 1096 * Release.py: Update version to 0.7.3.
1092 1097
1093 1098 2006-12-14 Ville Vainio <vivainio@gmail.com>
1094 1099
1095 1100 * scripts/ipython_win_post_install: Overwrite old shortcuts
1096 1101 if they already exist
1097 1102
1098 1103 * Release.py: release 0.7.3rc2
1099 1104
1100 1105 2006-12-13 Ville Vainio <vivainio@gmail.com>
1101 1106
1102 1107 * Branch and update Release.py for 0.7.3rc1
1103 1108
1104 1109 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
1105 1110
1106 1111 * IPython/Shell.py (IPShellWX): update for current WX naming
1107 1112 conventions, to avoid a deprecation warning with current WX
1108 1113 versions. Thanks to a report by Danny Shevitz.
1109 1114
1110 1115 2006-12-12 Ville Vainio <vivainio@gmail.com>
1111 1116
1112 1117 * ipmaker.py: apply david cournapeau's patch to make
1113 1118 import_some work properly even when ipythonrc does
1114 1119 import_some on empty list (it was an old bug!).
1115 1120
1116 1121 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
1117 1122 Add deprecation note to ipythonrc and a url to wiki
1118 1123 in ipy_user_conf.py
1119 1124
1120 1125
1121 1126 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
1122 1127 as if it was typed on IPython command prompt, i.e.
1123 1128 as IPython script.
1124 1129
1125 1130 * example-magic.py, magic_grepl.py: remove outdated examples
1126 1131
1127 1132 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
1128 1133
1129 1134 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
1130 1135 is called before any exception has occurred.
1131 1136
1132 1137 2006-12-08 Ville Vainio <vivainio@gmail.com>
1133 1138
1134 1139 * Extensions/ipy_stock_completers.py: fix cd completer
1135 1140 to translate /'s to \'s again.
1136 1141
1137 1142 * completer.py: prevent traceback on file completions w/
1138 1143 backslash.
1139 1144
1140 1145 * Release.py: Update release number to 0.7.3b3 for release
1141 1146
1142 1147 2006-12-07 Ville Vainio <vivainio@gmail.com>
1143 1148
1144 1149 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
1145 1150 while executing external code. Provides more shell-like behaviour
1146 1151 and overall better response to ctrl + C / ctrl + break.
1147 1152
1148 1153 * tools/make_tarball.py: new script to create tarball straight from svn
1149 1154 (setup.py sdist doesn't work on win32).
1150 1155
1151 1156 * Extensions/ipy_stock_completers.py: fix cd completer to give up
1152 1157 on dirnames with spaces and use the default completer instead.
1153 1158
1154 1159 * Revision.py: Change version to 0.7.3b2 for release.
1155 1160
1156 1161 2006-12-05 Ville Vainio <vivainio@gmail.com>
1157 1162
1158 1163 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
1159 1164 pydb patch 4 (rm debug printing, py 2.5 checking)
1160 1165
1161 1166 2006-11-30 Walter Doerwald <walter@livinglogic.de>
1162 1167 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
1163 1168 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
1164 1169 "refreshfind" (mapped to "R") does the same but tries to go back to the same
1165 1170 object the cursor was on before the refresh. The command "markrange" is
1166 1171 mapped to "%" now.
1167 1172 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
1168 1173
1169 1174 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
1170 1175
1171 1176 * IPython/Magic.py (magic_debug): new %debug magic to activate the
1172 1177 interactive debugger on the last traceback, without having to call
1173 1178 %pdb and rerun your code. Made minor changes in various modules,
1174 1179 should automatically recognize pydb if available.
1175 1180
1176 1181 2006-11-28 Ville Vainio <vivainio@gmail.com>
1177 1182
1178 1183 * completer.py: If the text start with !, show file completions
1179 1184 properly. This helps when trying to complete command name
1180 1185 for shell escapes.
1181 1186
1182 1187 2006-11-27 Ville Vainio <vivainio@gmail.com>
1183 1188
1184 1189 * ipy_stock_completers.py: bzr completer submitted by Stefan van
1185 1190 der Walt. Clean up svn and hg completers by using a common
1186 1191 vcs_completer.
1187 1192
1188 1193 2006-11-26 Ville Vainio <vivainio@gmail.com>
1189 1194
1190 1195 * Remove ipconfig and %config; you should use _ip.options structure
1191 1196 directly instead!
1192 1197
1193 1198 * genutils.py: add wrap_deprecated function for deprecating callables
1194 1199
1195 1200 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
1196 1201 _ip.system instead. ipalias is redundant.
1197 1202
1198 1203 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
1199 1204 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
1200 1205 explicit.
1201 1206
1202 1207 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
1203 1208 completer. Try it by entering 'hg ' and pressing tab.
1204 1209
1205 1210 * macro.py: Give Macro a useful __repr__ method
1206 1211
1207 1212 * Magic.py: %whos abbreviates the typename of Macro for brevity.
1208 1213
1209 1214 2006-11-24 Walter Doerwald <walter@livinglogic.de>
1210 1215 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
1211 1216 we don't get a duplicate ipipe module, where registration of the xrepr
1212 1217 implementation for Text is useless.
1213 1218
1214 1219 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
1215 1220
1216 1221 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
1217 1222
1218 1223 2006-11-24 Ville Vainio <vivainio@gmail.com>
1219 1224
1220 1225 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
1221 1226 try to use "cProfile" instead of the slower pure python
1222 1227 "profile"
1223 1228
1224 1229 2006-11-23 Ville Vainio <vivainio@gmail.com>
1225 1230
1226 1231 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
1227 1232 Qt+IPython+Designer link in documentation.
1228 1233
1229 1234 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
1230 1235 correct Pdb object to %pydb.
1231 1236
1232 1237
1233 1238 2006-11-22 Walter Doerwald <walter@livinglogic.de>
1234 1239 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
1235 1240 generic xrepr(), otherwise the list implementation would kick in.
1236 1241
1237 1242 2006-11-21 Ville Vainio <vivainio@gmail.com>
1238 1243
1239 1244 * upgrade_dir.py: Now actually overwrites a nonmodified user file
1240 1245 with one from UserConfig.
1241 1246
1242 1247 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
1243 1248 it was missing which broke the sh profile.
1244 1249
1245 1250 * completer.py: file completer now uses explicit '/' instead
1246 1251 of os.path.join, expansion of 'foo' was broken on win32
1247 1252 if there was one directory with name 'foobar'.
1248 1253
1249 1254 * A bunch of patches from Kirill Smelkov:
1250 1255
1251 1256 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
1252 1257
1253 1258 * [patch 7/9] Implement %page -r (page in raw mode) -
1254 1259
1255 1260 * [patch 5/9] ScientificPython webpage has moved
1256 1261
1257 1262 * [patch 4/9] The manual mentions %ds, should be %dhist
1258 1263
1259 1264 * [patch 3/9] Kill old bits from %prun doc.
1260 1265
1261 1266 * [patch 1/9] Fix typos here and there.
1262 1267
1263 1268 2006-11-08 Ville Vainio <vivainio@gmail.com>
1264 1269
1265 1270 * completer.py (attr_matches): catch all exceptions raised
1266 1271 by eval of expr with dots.
1267 1272
1268 1273 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
1269 1274
1270 1275 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
1271 1276 input if it starts with whitespace. This allows you to paste
1272 1277 indented input from any editor without manually having to type in
1273 1278 the 'if 1:', which is convenient when working interactively.
1274 1279 Slightly modifed version of a patch by Bo Peng
1275 1280 <bpeng-AT-rice.edu>.
1276 1281
1277 1282 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1278 1283
1279 1284 * IPython/irunner.py (main): modified irunner so it automatically
1280 1285 recognizes the right runner to use based on the extension (.py for
1281 1286 python, .ipy for ipython and .sage for sage).
1282 1287
1283 1288 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
1284 1289 visible in ipapi as ip.config(), to programatically control the
1285 1290 internal rc object. There's an accompanying %config magic for
1286 1291 interactive use, which has been enhanced to match the
1287 1292 funtionality in ipconfig.
1288 1293
1289 1294 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
1290 1295 so it's not just a toggle, it now takes an argument. Add support
1291 1296 for a customizable header when making system calls, as the new
1292 1297 system_header variable in the ipythonrc file.
1293 1298
1294 1299 2006-11-03 Walter Doerwald <walter@livinglogic.de>
1295 1300
1296 1301 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
1297 1302 generic functions (using Philip J. Eby's simplegeneric package).
1298 1303 This makes it possible to customize the display of third-party classes
1299 1304 without having to monkeypatch them. xiter() no longer supports a mode
1300 1305 argument and the XMode class has been removed. The same functionality can
1301 1306 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
1302 1307 One consequence of the switch to generic functions is that xrepr() and
1303 1308 xattrs() implementation must define the default value for the mode
1304 1309 argument themselves and xattrs() implementations must return real
1305 1310 descriptors.
1306 1311
1307 1312 * IPython/external: This new subpackage will contain all third-party
1308 1313 packages that are bundled with IPython. (The first one is simplegeneric).
1309 1314
1310 1315 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
1311 1316 directory which as been dropped in r1703.
1312 1317
1313 1318 * IPython/Extensions/ipipe.py (iless): Fixed.
1314 1319
1315 1320 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
1316 1321
1317 1322 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1318 1323
1319 1324 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
1320 1325 handling in variable expansion so that shells and magics recognize
1321 1326 function local scopes correctly. Bug reported by Brian.
1322 1327
1323 1328 * scripts/ipython: remove the very first entry in sys.path which
1324 1329 Python auto-inserts for scripts, so that sys.path under IPython is
1325 1330 as similar as possible to that under plain Python.
1326 1331
1327 1332 * IPython/completer.py (IPCompleter.file_matches): Fix
1328 1333 tab-completion so that quotes are not closed unless the completion
1329 1334 is unambiguous. After a request by Stefan. Minor cleanups in
1330 1335 ipy_stock_completers.
1331 1336
1332 1337 2006-11-02 Ville Vainio <vivainio@gmail.com>
1333 1338
1334 1339 * ipy_stock_completers.py: Add %run and %cd completers.
1335 1340
1336 1341 * completer.py: Try running custom completer for both
1337 1342 "foo" and "%foo" if the command is just "foo". Ignore case
1338 1343 when filtering possible completions.
1339 1344
1340 1345 * UserConfig/ipy_user_conf.py: install stock completers as default
1341 1346
1342 1347 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
1343 1348 simplified readline history save / restore through a wrapper
1344 1349 function
1345 1350
1346 1351
1347 1352 2006-10-31 Ville Vainio <vivainio@gmail.com>
1348 1353
1349 1354 * strdispatch.py, completer.py, ipy_stock_completers.py:
1350 1355 Allow str_key ("command") in completer hooks. Implement
1351 1356 trivial completer for 'import' (stdlib modules only). Rename
1352 1357 ipy_linux_package_managers.py to ipy_stock_completers.py.
1353 1358 SVN completer.
1354 1359
1355 1360 * Extensions/ledit.py: %magic line editor for easily and
1356 1361 incrementally manipulating lists of strings. The magic command
1357 1362 name is %led.
1358 1363
1359 1364 2006-10-30 Ville Vainio <vivainio@gmail.com>
1360 1365
1361 1366 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
1362 1367 Bernsteins's patches for pydb integration.
1363 1368 http://bashdb.sourceforge.net/pydb/
1364 1369
1365 1370 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
1366 1371 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
1367 1372 custom completer hook to allow the users to implement their own
1368 1373 completers. See ipy_linux_package_managers.py for example. The
1369 1374 hook name is 'complete_command'.
1370 1375
1371 1376 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
1372 1377
1373 1378 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
1374 1379 Numeric leftovers.
1375 1380
1376 1381 * ipython.el (py-execute-region): apply Stefan's patch to fix
1377 1382 garbled results if the python shell hasn't been previously started.
1378 1383
1379 1384 * IPython/genutils.py (arg_split): moved to genutils, since it's a
1380 1385 pretty generic function and useful for other things.
1381 1386
1382 1387 * IPython/OInspect.py (getsource): Add customizable source
1383 1388 extractor. After a request/patch form W. Stein (SAGE).
1384 1389
1385 1390 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
1386 1391 window size to a more reasonable value from what pexpect does,
1387 1392 since their choice causes wrapping bugs with long input lines.
1388 1393
1389 1394 2006-10-28 Ville Vainio <vivainio@gmail.com>
1390 1395
1391 1396 * Magic.py (%run): Save and restore the readline history from
1392 1397 file around %run commands to prevent side effects from
1393 1398 %runned programs that might use readline (e.g. pydb).
1394 1399
1395 1400 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
1396 1401 invoking the pydb enhanced debugger.
1397 1402
1398 1403 2006-10-23 Walter Doerwald <walter@livinglogic.de>
1399 1404
1400 1405 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
1401 1406 call the base class method and propagate the return value to
1402 1407 ifile. This is now done by path itself.
1403 1408
1404 1409 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1405 1410
1406 1411 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
1407 1412 api: set_crash_handler(), to expose the ability to change the
1408 1413 internal crash handler.
1409 1414
1410 1415 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
1411 1416 the various parameters of the crash handler so that apps using
1412 1417 IPython as their engine can customize crash handling. Ipmlemented
1413 1418 at the request of SAGE.
1414 1419
1415 1420 2006-10-14 Ville Vainio <vivainio@gmail.com>
1416 1421
1417 1422 * Magic.py, ipython.el: applied first "safe" part of Rocky
1418 1423 Bernstein's patch set for pydb integration.
1419 1424
1420 1425 * Magic.py (%unalias, %alias): %store'd aliases can now be
1421 1426 removed with '%unalias'. %alias w/o args now shows most
1422 1427 interesting (stored / manually defined) aliases last
1423 1428 where they catch the eye w/o scrolling.
1424 1429
1425 1430 * Magic.py (%rehashx), ext_rehashdir.py: files with
1426 1431 'py' extension are always considered executable, even
1427 1432 when not in PATHEXT environment variable.
1428 1433
1429 1434 2006-10-12 Ville Vainio <vivainio@gmail.com>
1430 1435
1431 1436 * jobctrl.py: Add new "jobctrl" extension for spawning background
1432 1437 processes with "&find /". 'import jobctrl' to try it out. Requires
1433 1438 'subprocess' module, standard in python 2.4+.
1434 1439
1435 1440 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
1436 1441 so if foo -> bar and bar -> baz, then foo -> baz.
1437 1442
1438 1443 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
1439 1444
1440 1445 * IPython/Magic.py (Magic.parse_options): add a new posix option
1441 1446 to allow parsing of input args in magics that doesn't strip quotes
1442 1447 (if posix=False). This also closes %timeit bug reported by
1443 1448 Stefan.
1444 1449
1445 1450 2006-10-03 Ville Vainio <vivainio@gmail.com>
1446 1451
1447 1452 * iplib.py (raw_input, interact): Return ValueError catching for
1448 1453 raw_input. Fixes infinite loop for sys.stdin.close() or
1449 1454 sys.stdout.close().
1450 1455
1451 1456 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1452 1457
1453 1458 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
1454 1459 to help in handling doctests. irunner is now pretty useful for
1455 1460 running standalone scripts and simulate a full interactive session
1456 1461 in a format that can be then pasted as a doctest.
1457 1462
1458 1463 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
1459 1464 on top of the default (useless) ones. This also fixes the nasty
1460 1465 way in which 2.5's Quitter() exits (reverted [1785]).
1461 1466
1462 1467 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
1463 1468 2.5.
1464 1469
1465 1470 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
1466 1471 color scheme is updated as well when color scheme is changed
1467 1472 interactively.
1468 1473
1469 1474 2006-09-27 Ville Vainio <vivainio@gmail.com>
1470 1475
1471 1476 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
1472 1477 infinite loop and just exit. It's a hack, but will do for a while.
1473 1478
1474 1479 2006-08-25 Walter Doerwald <walter@livinglogic.de>
1475 1480
1476 1481 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
1477 1482 the constructor, this makes it possible to get a list of only directories
1478 1483 or only files.
1479 1484
1480 1485 2006-08-12 Ville Vainio <vivainio@gmail.com>
1481 1486
1482 1487 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
1483 1488 they broke unittest
1484 1489
1485 1490 2006-08-11 Ville Vainio <vivainio@gmail.com>
1486 1491
1487 1492 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
1488 1493 by resolving issue properly, i.e. by inheriting FakeModule
1489 1494 from types.ModuleType. Pickling ipython interactive data
1490 1495 should still work as usual (testing appreciated).
1491 1496
1492 1497 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
1493 1498
1494 1499 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
1495 1500 running under python 2.3 with code from 2.4 to fix a bug with
1496 1501 help(). Reported by the Debian maintainers, Norbert Tretkowski
1497 1502 <norbert-AT-tretkowski.de> and Alexandre Fayolle
1498 1503 <afayolle-AT-debian.org>.
1499 1504
1500 1505 2006-08-04 Walter Doerwald <walter@livinglogic.de>
1501 1506
1502 1507 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
1503 1508 (which was displaying "quit" twice).
1504 1509
1505 1510 2006-07-28 Walter Doerwald <walter@livinglogic.de>
1506 1511
1507 1512 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
1508 1513 the mode argument).
1509 1514
1510 1515 2006-07-27 Walter Doerwald <walter@livinglogic.de>
1511 1516
1512 1517 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
1513 1518 not running under IPython.
1514 1519
1515 1520 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
1516 1521 and make it iterable (iterating over the attribute itself). Add two new
1517 1522 magic strings for __xattrs__(): If the string starts with "-", the attribute
1518 1523 will not be displayed in ibrowse's detail view (but it can still be
1519 1524 iterated over). This makes it possible to add attributes that are large
1520 1525 lists or generator methods to the detail view. Replace magic attribute names
1521 1526 and _attrname() and _getattr() with "descriptors": For each type of magic
1522 1527 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
1523 1528 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
1524 1529 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
1525 1530 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
1526 1531 are still supported.
1527 1532
1528 1533 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
1529 1534 fails in ibrowse.fetch(), the exception object is added as the last item
1530 1535 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
1531 1536 a generator throws an exception midway through execution.
1532 1537
1533 1538 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
1534 1539 encoding into methods.
1535 1540
1536 1541 2006-07-26 Ville Vainio <vivainio@gmail.com>
1537 1542
1538 1543 * iplib.py: history now stores multiline input as single
1539 1544 history entries. Patch by Jorgen Cederlof.
1540 1545
1541 1546 2006-07-18 Walter Doerwald <walter@livinglogic.de>
1542 1547
1543 1548 * IPython/Extensions/ibrowse.py: Make cursor visible over
1544 1549 non existing attributes.
1545 1550
1546 1551 2006-07-14 Walter Doerwald <walter@livinglogic.de>
1547 1552
1548 1553 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
1549 1554 error output of the running command doesn't mess up the screen.
1550 1555
1551 1556 2006-07-13 Walter Doerwald <walter@livinglogic.de>
1552 1557
1553 1558 * IPython/Extensions/ipipe.py (isort): Make isort usable without
1554 1559 argument. This sorts the items themselves.
1555 1560
1556 1561 2006-07-12 Walter Doerwald <walter@livinglogic.de>
1557 1562
1558 1563 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
1559 1564 Compile expression strings into code objects. This should speed
1560 1565 up ifilter and friends somewhat.
1561 1566
1562 1567 2006-07-08 Ville Vainio <vivainio@gmail.com>
1563 1568
1564 1569 * Magic.py: %cpaste now strips > from the beginning of lines
1565 1570 to ease pasting quoted code from emails. Contributed by
1566 1571 Stefan van der Walt.
1567 1572
1568 1573 2006-06-29 Ville Vainio <vivainio@gmail.com>
1569 1574
1570 1575 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
1571 1576 mode, patch contributed by Darren Dale. NEEDS TESTING!
1572 1577
1573 1578 2006-06-28 Walter Doerwald <walter@livinglogic.de>
1574 1579
1575 1580 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
1576 1581 a blue background. Fix fetching new display rows when the browser
1577 1582 scrolls more than a screenful (e.g. by using the goto command).
1578 1583
1579 1584 2006-06-27 Ville Vainio <vivainio@gmail.com>
1580 1585
1581 1586 * Magic.py (_inspect, _ofind) Apply David Huard's
1582 1587 patch for displaying the correct docstring for 'property'
1583 1588 attributes.
1584 1589
1585 1590 2006-06-23 Walter Doerwald <walter@livinglogic.de>
1586 1591
1587 1592 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
1588 1593 commands into the methods implementing them.
1589 1594
1590 1595 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
1591 1596
1592 1597 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
1593 1598 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
1594 1599 autoindent support was authored by Jin Liu.
1595 1600
1596 1601 2006-06-22 Walter Doerwald <walter@livinglogic.de>
1597 1602
1598 1603 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
1599 1604 for keymaps with a custom class that simplifies handling.
1600 1605
1601 1606 2006-06-19 Walter Doerwald <walter@livinglogic.de>
1602 1607
1603 1608 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
1604 1609 resizing. This requires Python 2.5 to work.
1605 1610
1606 1611 2006-06-16 Walter Doerwald <walter@livinglogic.de>
1607 1612
1608 1613 * IPython/Extensions/ibrowse.py: Add two new commands to
1609 1614 ibrowse: "hideattr" (mapped to "h") hides the attribute under
1610 1615 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
1611 1616 attributes again. Remapped the help command to "?". Display
1612 1617 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
1613 1618 as keys for the "home" and "end" commands. Add three new commands
1614 1619 to the input mode for "find" and friends: "delend" (CTRL-K)
1615 1620 deletes to the end of line. "incsearchup" searches upwards in the
1616 1621 command history for an input that starts with the text before the cursor.
1617 1622 "incsearchdown" does the same downwards. Removed a bogus mapping of
1618 1623 the x key to "delete".
1619 1624
1620 1625 2006-06-15 Ville Vainio <vivainio@gmail.com>
1621 1626
1622 1627 * iplib.py, hooks.py: Added new generate_prompt hook that can be
1623 1628 used to create prompts dynamically, instead of the "old" way of
1624 1629 assigning "magic" strings to prompt_in1 and prompt_in2. The old
1625 1630 way still works (it's invoked by the default hook), of course.
1626 1631
1627 1632 * Prompts.py: added generate_output_prompt hook for altering output
1628 1633 prompt
1629 1634
1630 1635 * Release.py: Changed version string to 0.7.3.svn.
1631 1636
1632 1637 2006-06-15 Walter Doerwald <walter@livinglogic.de>
1633 1638
1634 1639 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
1635 1640 the call to fetch() always tries to fetch enough data for at least one
1636 1641 full screen. This makes it possible to simply call moveto(0,0,True) in
1637 1642 the constructor. Fix typos and removed the obsolete goto attribute.
1638 1643
1639 1644 2006-06-12 Ville Vainio <vivainio@gmail.com>
1640 1645
1641 1646 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
1642 1647 allowing $variable interpolation within multiline statements,
1643 1648 though so far only with "sh" profile for a testing period.
1644 1649 The patch also enables splitting long commands with \ but it
1645 1650 doesn't work properly yet.
1646 1651
1647 1652 2006-06-12 Walter Doerwald <walter@livinglogic.de>
1648 1653
1649 1654 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
1650 1655 input history and the position of the cursor in the input history for
1651 1656 the find, findbackwards and goto command.
1652 1657
1653 1658 2006-06-10 Walter Doerwald <walter@livinglogic.de>
1654 1659
1655 1660 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
1656 1661 implements the basic functionality of browser commands that require
1657 1662 input. Reimplement the goto, find and findbackwards commands as
1658 1663 subclasses of _CommandInput. Add an input history and keymaps to those
1659 1664 commands. Add "\r" as a keyboard shortcut for the enterdefault and
1660 1665 execute commands.
1661 1666
1662 1667 2006-06-07 Ville Vainio <vivainio@gmail.com>
1663 1668
1664 1669 * iplib.py: ipython mybatch.ipy exits ipython immediately after
1665 1670 running the batch files instead of leaving the session open.
1666 1671
1667 1672 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
1668 1673
1669 1674 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
1670 1675 the original fix was incomplete. Patch submitted by W. Maier.
1671 1676
1672 1677 2006-06-07 Ville Vainio <vivainio@gmail.com>
1673 1678
1674 1679 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
1675 1680 Confirmation prompts can be supressed by 'quiet' option.
1676 1681 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
1677 1682
1678 1683 2006-06-06 *** Released version 0.7.2
1679 1684
1680 1685 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
1681 1686
1682 1687 * IPython/Release.py (version): Made 0.7.2 final for release.
1683 1688 Repo tagged and release cut.
1684 1689
1685 1690 2006-06-05 Ville Vainio <vivainio@gmail.com>
1686 1691
1687 1692 * Magic.py (magic_rehashx): Honor no_alias list earlier in
1688 1693 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
1689 1694
1690 1695 * upgrade_dir.py: try import 'path' module a bit harder
1691 1696 (for %upgrade)
1692 1697
1693 1698 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
1694 1699
1695 1700 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
1696 1701 instead of looping 20 times.
1697 1702
1698 1703 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
1699 1704 correctly at initialization time. Bug reported by Krishna Mohan
1700 1705 Gundu <gkmohan-AT-gmail.com> on the user list.
1701 1706
1702 1707 * IPython/Release.py (version): Mark 0.7.2 version to start
1703 1708 testing for release on 06/06.
1704 1709
1705 1710 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
1706 1711
1707 1712 * scripts/irunner: thin script interface so users don't have to
1708 1713 find the module and call it as an executable, since modules rarely
1709 1714 live in people's PATH.
1710 1715
1711 1716 * IPython/irunner.py (InteractiveRunner.__init__): added
1712 1717 delaybeforesend attribute to control delays with newer versions of
1713 1718 pexpect. Thanks to detailed help from pexpect's author, Noah
1714 1719 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
1715 1720 correctly (it works in NoColor mode).
1716 1721
1717 1722 * IPython/iplib.py (handle_normal): fix nasty crash reported on
1718 1723 SAGE list, from improper log() calls.
1719 1724
1720 1725 2006-05-31 Ville Vainio <vivainio@gmail.com>
1721 1726
1722 1727 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
1723 1728 with args in parens to work correctly with dirs that have spaces.
1724 1729
1725 1730 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
1726 1731
1727 1732 * IPython/Logger.py (Logger.logstart): add option to log raw input
1728 1733 instead of the processed one. A -r flag was added to the
1729 1734 %logstart magic used for controlling logging.
1730 1735
1731 1736 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
1732 1737
1733 1738 * IPython/iplib.py (InteractiveShell.__init__): add check for the
1734 1739 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
1735 1740 recognize the option. After a bug report by Will Maier. This
1736 1741 closes #64 (will do it after confirmation from W. Maier).
1737 1742
1738 1743 * IPython/irunner.py: New module to run scripts as if manually
1739 1744 typed into an interactive environment, based on pexpect. After a
1740 1745 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
1741 1746 ipython-user list. Simple unittests in the tests/ directory.
1742 1747
1743 1748 * tools/release: add Will Maier, OpenBSD port maintainer, to
1744 1749 recepients list. We are now officially part of the OpenBSD ports:
1745 1750 http://www.openbsd.org/ports.html ! Many thanks to Will for the
1746 1751 work.
1747 1752
1748 1753 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
1749 1754
1750 1755 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
1751 1756 so that it doesn't break tkinter apps.
1752 1757
1753 1758 * IPython/iplib.py (_prefilter): fix bug where aliases would
1754 1759 shadow variables when autocall was fully off. Reported by SAGE
1755 1760 author William Stein.
1756 1761
1757 1762 * IPython/OInspect.py (Inspector.__init__): add a flag to control
1758 1763 at what detail level strings are computed when foo? is requested.
1759 1764 This allows users to ask for example that the string form of an
1760 1765 object is only computed when foo?? is called, or even never, by
1761 1766 setting the object_info_string_level >= 2 in the configuration
1762 1767 file. This new option has been added and documented. After a
1763 1768 request by SAGE to be able to control the printing of very large
1764 1769 objects more easily.
1765 1770
1766 1771 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
1767 1772
1768 1773 * IPython/ipmaker.py (make_IPython): remove the ipython call path
1769 1774 from sys.argv, to be 100% consistent with how Python itself works
1770 1775 (as seen for example with python -i file.py). After a bug report
1771 1776 by Jeffrey Collins.
1772 1777
1773 1778 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
1774 1779 nasty bug which was preventing custom namespaces with -pylab,
1775 1780 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
1776 1781 compatibility (long gone from mpl).
1777 1782
1778 1783 * IPython/ipapi.py (make_session): name change: create->make. We
1779 1784 use make in other places (ipmaker,...), it's shorter and easier to
1780 1785 type and say, etc. I'm trying to clean things before 0.7.2 so
1781 1786 that I can keep things stable wrt to ipapi in the chainsaw branch.
1782 1787
1783 1788 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
1784 1789 python-mode recognizes our debugger mode. Add support for
1785 1790 autoindent inside (X)emacs. After a patch sent in by Jin Liu
1786 1791 <m.liu.jin-AT-gmail.com> originally written by
1787 1792 doxgen-AT-newsmth.net (with minor modifications for xemacs
1788 1793 compatibility)
1789 1794
1790 1795 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
1791 1796 tracebacks when walking the stack so that the stack tracking system
1792 1797 in emacs' python-mode can identify the frames correctly.
1793 1798
1794 1799 * IPython/ipmaker.py (make_IPython): make the internal (and
1795 1800 default config) autoedit_syntax value false by default. Too many
1796 1801 users have complained to me (both on and off-list) about problems
1797 1802 with this option being on by default, so I'm making it default to
1798 1803 off. It can still be enabled by anyone via the usual mechanisms.
1799 1804
1800 1805 * IPython/completer.py (Completer.attr_matches): add support for
1801 1806 PyCrust-style _getAttributeNames magic method. Patch contributed
1802 1807 by <mscott-AT-goldenspud.com>. Closes #50.
1803 1808
1804 1809 * IPython/iplib.py (InteractiveShell.__init__): remove the
1805 1810 deletion of exit/quit from __builtin__, which can break
1806 1811 third-party tools like the Zope debugging console. The
1807 1812 %exit/%quit magics remain. In general, it's probably a good idea
1808 1813 not to delete anything from __builtin__, since we never know what
1809 1814 that will break. In any case, python now (for 2.5) will support
1810 1815 'real' exit/quit, so this issue is moot. Closes #55.
1811 1816
1812 1817 * IPython/genutils.py (with_obj): rename the 'with' function to
1813 1818 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
1814 1819 becomes a language keyword. Closes #53.
1815 1820
1816 1821 * IPython/FakeModule.py (FakeModule.__init__): add a proper
1817 1822 __file__ attribute to this so it fools more things into thinking
1818 1823 it is a real module. Closes #59.
1819 1824
1820 1825 * IPython/Magic.py (magic_edit): add -n option to open the editor
1821 1826 at a specific line number. After a patch by Stefan van der Walt.
1822 1827
1823 1828 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
1824 1829
1825 1830 * IPython/iplib.py (edit_syntax_error): fix crash when for some
1826 1831 reason the file could not be opened. After automatic crash
1827 1832 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
1828 1833 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
1829 1834 (_should_recompile): Don't fire editor if using %bg, since there
1830 1835 is no file in the first place. From the same report as above.
1831 1836 (raw_input): protect against faulty third-party prefilters. After
1832 1837 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
1833 1838 while running under SAGE.
1834 1839
1835 1840 2006-05-23 Ville Vainio <vivainio@gmail.com>
1836 1841
1837 1842 * ipapi.py: Stripped down ip.to_user_ns() to work only as
1838 1843 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
1839 1844 now returns None (again), unless dummy is specifically allowed by
1840 1845 ipapi.get(allow_dummy=True).
1841 1846
1842 1847 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
1843 1848
1844 1849 * IPython: remove all 2.2-compatibility objects and hacks from
1845 1850 everywhere, since we only support 2.3 at this point. Docs
1846 1851 updated.
1847 1852
1848 1853 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
1849 1854 Anything requiring extra validation can be turned into a Python
1850 1855 property in the future. I used a property for the db one b/c
1851 1856 there was a nasty circularity problem with the initialization
1852 1857 order, which right now I don't have time to clean up.
1853 1858
1854 1859 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
1855 1860 another locking bug reported by Jorgen. I'm not 100% sure though,
1856 1861 so more testing is needed...
1857 1862
1858 1863 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
1859 1864
1860 1865 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
1861 1866 local variables from any routine in user code (typically executed
1862 1867 with %run) directly into the interactive namespace. Very useful
1863 1868 when doing complex debugging.
1864 1869 (IPythonNotRunning): Changed the default None object to a dummy
1865 1870 whose attributes can be queried as well as called without
1866 1871 exploding, to ease writing code which works transparently both in
1867 1872 and out of ipython and uses some of this API.
1868 1873
1869 1874 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
1870 1875
1871 1876 * IPython/hooks.py (result_display): Fix the fact that our display
1872 1877 hook was using str() instead of repr(), as the default python
1873 1878 console does. This had gone unnoticed b/c it only happened if
1874 1879 %Pprint was off, but the inconsistency was there.
1875 1880
1876 1881 2006-05-15 Ville Vainio <vivainio@gmail.com>
1877 1882
1878 1883 * Oinspect.py: Only show docstring for nonexisting/binary files
1879 1884 when doing object??, closing ticket #62
1880 1885
1881 1886 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
1882 1887
1883 1888 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
1884 1889 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
1885 1890 was being released in a routine which hadn't checked if it had
1886 1891 been the one to acquire it.
1887 1892
1888 1893 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
1889 1894
1890 1895 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
1891 1896
1892 1897 2006-04-11 Ville Vainio <vivainio@gmail.com>
1893 1898
1894 1899 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
1895 1900 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
1896 1901 prefilters, allowing stuff like magics and aliases in the file.
1897 1902
1898 1903 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
1899 1904 added. Supported now are "%clear in" and "%clear out" (clear input and
1900 1905 output history, respectively). Also fixed CachedOutput.flush to
1901 1906 properly flush the output cache.
1902 1907
1903 1908 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
1904 1909 half-success (and fail explicitly).
1905 1910
1906 1911 2006-03-28 Ville Vainio <vivainio@gmail.com>
1907 1912
1908 1913 * iplib.py: Fix quoting of aliases so that only argless ones
1909 1914 are quoted
1910 1915
1911 1916 2006-03-28 Ville Vainio <vivainio@gmail.com>
1912 1917
1913 1918 * iplib.py: Quote aliases with spaces in the name.
1914 1919 "c:\program files\blah\bin" is now legal alias target.
1915 1920
1916 1921 * ext_rehashdir.py: Space no longer allowed as arg
1917 1922 separator, since space is legal in path names.
1918 1923
1919 1924 2006-03-16 Ville Vainio <vivainio@gmail.com>
1920 1925
1921 1926 * upgrade_dir.py: Take path.py from Extensions, correcting
1922 1927 %upgrade magic
1923 1928
1924 1929 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
1925 1930
1926 1931 * hooks.py: Only enclose editor binary in quotes if legal and
1927 1932 necessary (space in the name, and is an existing file). Fixes a bug
1928 1933 reported by Zachary Pincus.
1929 1934
1930 1935 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
1931 1936
1932 1937 * Manual: thanks to a tip on proper color handling for Emacs, by
1933 1938 Eric J Haywiser <ejh1-AT-MIT.EDU>.
1934 1939
1935 1940 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
1936 1941 by applying the provided patch. Thanks to Liu Jin
1937 1942 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
1938 1943 XEmacs/Linux, I'm trusting the submitter that it actually helps
1939 1944 under win32/GNU Emacs. Will revisit if any problems are reported.
1940 1945
1941 1946 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1942 1947
1943 1948 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
1944 1949 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
1945 1950
1946 1951 2006-03-12 Ville Vainio <vivainio@gmail.com>
1947 1952
1948 1953 * Magic.py (magic_timeit): Added %timeit magic, contributed by
1949 1954 Torsten Marek.
1950 1955
1951 1956 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1952 1957
1953 1958 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
1954 1959 line ranges works again.
1955 1960
1956 1961 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
1957 1962
1958 1963 * IPython/iplib.py (showtraceback): add back sys.last_traceback
1959 1964 and friends, after a discussion with Zach Pincus on ipython-user.
1960 1965 I'm not 100% sure, but after thinking about it quite a bit, it may
1961 1966 be OK. Testing with the multithreaded shells didn't reveal any
1962 1967 problems, but let's keep an eye out.
1963 1968
1964 1969 In the process, I fixed a few things which were calling
1965 1970 self.InteractiveTB() directly (like safe_execfile), which is a
1966 1971 mistake: ALL exception reporting should be done by calling
1967 1972 self.showtraceback(), which handles state and tab-completion and
1968 1973 more.
1969 1974
1970 1975 2006-03-01 Ville Vainio <vivainio@gmail.com>
1971 1976
1972 1977 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
1973 1978 To use, do "from ipipe import *".
1974 1979
1975 1980 2006-02-24 Ville Vainio <vivainio@gmail.com>
1976 1981
1977 1982 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
1978 1983 "cleanly" and safely than the older upgrade mechanism.
1979 1984
1980 1985 2006-02-21 Ville Vainio <vivainio@gmail.com>
1981 1986
1982 1987 * Magic.py: %save works again.
1983 1988
1984 1989 2006-02-15 Ville Vainio <vivainio@gmail.com>
1985 1990
1986 1991 * Magic.py: %Pprint works again
1987 1992
1988 1993 * Extensions/ipy_sane_defaults.py: Provide everything provided
1989 1994 in default ipythonrc, to make it possible to have a completely empty
1990 1995 ipythonrc (and thus completely rc-file free configuration)
1991 1996
1992 1997 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
1993 1998
1994 1999 * IPython/hooks.py (editor): quote the call to the editor command,
1995 2000 to allow commands with spaces in them. Problem noted by watching
1996 2001 Ian Oswald's video about textpad under win32 at
1997 2002 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
1998 2003
1999 2004 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
2000 2005 describing magics (we haven't used @ for a loong time).
2001 2006
2002 2007 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
2003 2008 contributed by marienz to close
2004 2009 http://www.scipy.net/roundup/ipython/issue53.
2005 2010
2006 2011 2006-02-10 Ville Vainio <vivainio@gmail.com>
2007 2012
2008 2013 * genutils.py: getoutput now works in win32 too
2009 2014
2010 2015 * completer.py: alias and magic completion only invoked
2011 2016 at the first "item" in the line, to avoid "cd %store"
2012 2017 nonsense.
2013 2018
2014 2019 2006-02-09 Ville Vainio <vivainio@gmail.com>
2015 2020
2016 2021 * test/*: Added a unit testing framework (finally).
2017 2022 '%run runtests.py' to run test_*.
2018 2023
2019 2024 * ipapi.py: Exposed runlines and set_custom_exc
2020 2025
2021 2026 2006-02-07 Ville Vainio <vivainio@gmail.com>
2022 2027
2023 2028 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
2024 2029 instead use "f(1 2)" as before.
2025 2030
2026 2031 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
2027 2032
2028 2033 * IPython/demo.py (IPythonDemo): Add new classes to the demo
2029 2034 facilities, for demos processed by the IPython input filter
2030 2035 (IPythonDemo), and for running a script one-line-at-a-time as a
2031 2036 demo, both for pure Python (LineDemo) and for IPython-processed
2032 2037 input (IPythonLineDemo). After a request by Dave Kohel, from the
2033 2038 SAGE team.
2034 2039 (Demo.edit): added an edit() method to the demo objects, to edit
2035 2040 the in-memory copy of the last executed block.
2036 2041
2037 2042 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
2038 2043 processing to %edit, %macro and %save. These commands can now be
2039 2044 invoked on the unprocessed input as it was typed by the user
2040 2045 (without any prefilters applied). After requests by the SAGE team
2041 2046 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
2042 2047
2043 2048 2006-02-01 Ville Vainio <vivainio@gmail.com>
2044 2049
2045 2050 * setup.py, eggsetup.py: easy_install ipython==dev works
2046 2051 correctly now (on Linux)
2047 2052
2048 2053 * ipy_user_conf,ipmaker: user config changes, removed spurious
2049 2054 warnings
2050 2055
2051 2056 * iplib: if rc.banner is string, use it as is.
2052 2057
2053 2058 * Magic: %pycat accepts a string argument and pages it's contents.
2054 2059
2055 2060
2056 2061 2006-01-30 Ville Vainio <vivainio@gmail.com>
2057 2062
2058 2063 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
2059 2064 Now %store and bookmarks work through PickleShare, meaning that
2060 2065 concurrent access is possible and all ipython sessions see the
2061 2066 same database situation all the time, instead of snapshot of
2062 2067 the situation when the session was started. Hence, %bookmark
2063 2068 results are immediately accessible from othes sessions. The database
2064 2069 is also available for use by user extensions. See:
2065 2070 http://www.python.org/pypi/pickleshare
2066 2071
2067 2072 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
2068 2073
2069 2074 * aliases can now be %store'd
2070 2075
2071 2076 * path.py moved to Extensions so that pickleshare does not need
2072 2077 IPython-specific import. Extensions added to pythonpath right
2073 2078 at __init__.
2074 2079
2075 2080 * iplib.py: ipalias deprecated/redundant; aliases are converted and
2076 2081 called with _ip.system and the pre-transformed command string.
2077 2082
2078 2083 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
2079 2084
2080 2085 * IPython/iplib.py (interact): Fix that we were not catching
2081 2086 KeyboardInterrupt exceptions properly. I'm not quite sure why the
2082 2087 logic here had to change, but it's fixed now.
2083 2088
2084 2089 2006-01-29 Ville Vainio <vivainio@gmail.com>
2085 2090
2086 2091 * iplib.py: Try to import pyreadline on Windows.
2087 2092
2088 2093 2006-01-27 Ville Vainio <vivainio@gmail.com>
2089 2094
2090 2095 * iplib.py: Expose ipapi as _ip in builtin namespace.
2091 2096 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
2092 2097 and ip_set_hook (-> _ip.set_hook) redundant. % and !
2093 2098 syntax now produce _ip.* variant of the commands.
2094 2099
2095 2100 * "_ip.options().autoedit_syntax = 2" automatically throws
2096 2101 user to editor for syntax error correction without prompting.
2097 2102
2098 2103 2006-01-27 Ville Vainio <vivainio@gmail.com>
2099 2104
2100 2105 * ipmaker.py: Give "realistic" sys.argv for scripts (without
2101 2106 'ipython' at argv[0]) executed through command line.
2102 2107 NOTE: this DEPRECATES calling ipython with multiple scripts
2103 2108 ("ipython a.py b.py c.py")
2104 2109
2105 2110 * iplib.py, hooks.py: Added configurable input prefilter,
2106 2111 named 'input_prefilter'. See ext_rescapture.py for example
2107 2112 usage.
2108 2113
2109 2114 * ext_rescapture.py, Magic.py: Better system command output capture
2110 2115 through 'var = !ls' (deprecates user-visible %sc). Same notation
2111 2116 applies for magics, 'var = %alias' assigns alias list to var.
2112 2117
2113 2118 * ipapi.py: added meta() for accessing extension-usable data store.
2114 2119
2115 2120 * iplib.py: added InteractiveShell.getapi(). New magics should be
2116 2121 written doing self.getapi() instead of using the shell directly.
2117 2122
2118 2123 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
2119 2124 %store foo >> ~/myfoo.txt to store variables to files (in clean
2120 2125 textual form, not a restorable pickle).
2121 2126
2122 2127 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
2123 2128
2124 2129 * usage.py, Magic.py: added %quickref
2125 2130
2126 2131 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
2127 2132
2128 2133 * GetoptErrors when invoking magics etc. with wrong args
2129 2134 are now more helpful:
2130 2135 GetoptError: option -l not recognized (allowed: "qb" )
2131 2136
2132 2137 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
2133 2138
2134 2139 * IPython/demo.py (Demo.show): Flush stdout after each block, so
2135 2140 computationally intensive blocks don't appear to stall the demo.
2136 2141
2137 2142 2006-01-24 Ville Vainio <vivainio@gmail.com>
2138 2143
2139 2144 * iplib.py, hooks.py: 'result_display' hook can return a non-None
2140 2145 value to manipulate resulting history entry.
2141 2146
2142 2147 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
2143 2148 to instance methods of IPApi class, to make extending an embedded
2144 2149 IPython feasible. See ext_rehashdir.py for example usage.
2145 2150
2146 2151 * Merged 1071-1076 from branches/0.7.1
2147 2152
2148 2153
2149 2154 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
2150 2155
2151 2156 * tools/release (daystamp): Fix build tools to use the new
2152 2157 eggsetup.py script to build lightweight eggs.
2153 2158
2154 2159 * Applied changesets 1062 and 1064 before 0.7.1 release.
2155 2160
2156 2161 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
2157 2162 see the raw input history (without conversions like %ls ->
2158 2163 ipmagic("ls")). After a request from W. Stein, SAGE
2159 2164 (http://modular.ucsd.edu/sage) developer. This information is
2160 2165 stored in the input_hist_raw attribute of the IPython instance, so
2161 2166 developers can access it if needed (it's an InputList instance).
2162 2167
2163 2168 * Versionstring = 0.7.2.svn
2164 2169
2165 2170 * eggsetup.py: A separate script for constructing eggs, creates
2166 2171 proper launch scripts even on Windows (an .exe file in
2167 2172 \python24\scripts).
2168 2173
2169 2174 * ipapi.py: launch_new_instance, launch entry point needed for the
2170 2175 egg.
2171 2176
2172 2177 2006-01-23 Ville Vainio <vivainio@gmail.com>
2173 2178
2174 2179 * Added %cpaste magic for pasting python code
2175 2180
2176 2181 2006-01-22 Ville Vainio <vivainio@gmail.com>
2177 2182
2178 2183 * Merge from branches/0.7.1 into trunk, revs 1052-1057
2179 2184
2180 2185 * Versionstring = 0.7.2.svn
2181 2186
2182 2187 * eggsetup.py: A separate script for constructing eggs, creates
2183 2188 proper launch scripts even on Windows (an .exe file in
2184 2189 \python24\scripts).
2185 2190
2186 2191 * ipapi.py: launch_new_instance, launch entry point needed for the
2187 2192 egg.
2188 2193
2189 2194 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
2190 2195
2191 2196 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
2192 2197 %pfile foo would print the file for foo even if it was a binary.
2193 2198 Now, extensions '.so' and '.dll' are skipped.
2194 2199
2195 2200 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
2196 2201 bug, where macros would fail in all threaded modes. I'm not 100%
2197 2202 sure, so I'm going to put out an rc instead of making a release
2198 2203 today, and wait for feedback for at least a few days.
2199 2204
2200 2205 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
2201 2206 it...) the handling of pasting external code with autoindent on.
2202 2207 To get out of a multiline input, the rule will appear for most
2203 2208 users unchanged: two blank lines or change the indent level
2204 2209 proposed by IPython. But there is a twist now: you can
2205 2210 add/subtract only *one or two spaces*. If you add/subtract three
2206 2211 or more (unless you completely delete the line), IPython will
2207 2212 accept that line, and you'll need to enter a second one of pure
2208 2213 whitespace. I know it sounds complicated, but I can't find a
2209 2214 different solution that covers all the cases, with the right
2210 2215 heuristics. Hopefully in actual use, nobody will really notice
2211 2216 all these strange rules and things will 'just work'.
2212 2217
2213 2218 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
2214 2219
2215 2220 * IPython/iplib.py (interact): catch exceptions which can be
2216 2221 triggered asynchronously by signal handlers. Thanks to an
2217 2222 automatic crash report, submitted by Colin Kingsley
2218 2223 <tercel-AT-gentoo.org>.
2219 2224
2220 2225 2006-01-20 Ville Vainio <vivainio@gmail.com>
2221 2226
2222 2227 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
2223 2228 (%rehashdir, very useful, try it out) of how to extend ipython
2224 2229 with new magics. Also added Extensions dir to pythonpath to make
2225 2230 importing extensions easy.
2226 2231
2227 2232 * %store now complains when trying to store interactively declared
2228 2233 classes / instances of those classes.
2229 2234
2230 2235 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
2231 2236 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
2232 2237 if they exist, and ipy_user_conf.py with some defaults is created for
2233 2238 the user.
2234 2239
2235 2240 * Startup rehashing done by the config file, not InterpreterExec.
2236 2241 This means system commands are available even without selecting the
2237 2242 pysh profile. It's the sensible default after all.
2238 2243
2239 2244 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
2240 2245
2241 2246 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
2242 2247 multiline code with autoindent on working. But I am really not
2243 2248 sure, so this needs more testing. Will commit a debug-enabled
2244 2249 version for now, while I test it some more, so that Ville and
2245 2250 others may also catch any problems. Also made
2246 2251 self.indent_current_str() a method, to ensure that there's no
2247 2252 chance of the indent space count and the corresponding string
2248 2253 falling out of sync. All code needing the string should just call
2249 2254 the method.
2250 2255
2251 2256 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
2252 2257
2253 2258 * IPython/Magic.py (magic_edit): fix check for when users don't
2254 2259 save their output files, the try/except was in the wrong section.
2255 2260
2256 2261 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
2257 2262
2258 2263 * IPython/Magic.py (magic_run): fix __file__ global missing from
2259 2264 script's namespace when executed via %run. After a report by
2260 2265 Vivian.
2261 2266
2262 2267 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
2263 2268 when using python 2.4. The parent constructor changed in 2.4, and
2264 2269 we need to track it directly (we can't call it, as it messes up
2265 2270 readline and tab-completion inside our pdb would stop working).
2266 2271 After a bug report by R. Bernstein <rocky-AT-panix.com>.
2267 2272
2268 2273 2006-01-16 Ville Vainio <vivainio@gmail.com>
2269 2274
2270 2275 * Ipython/magic.py: Reverted back to old %edit functionality
2271 2276 that returns file contents on exit.
2272 2277
2273 2278 * IPython/path.py: Added Jason Orendorff's "path" module to
2274 2279 IPython tree, http://www.jorendorff.com/articles/python/path/.
2275 2280 You can get path objects conveniently through %sc, and !!, e.g.:
2276 2281 sc files=ls
2277 2282 for p in files.paths: # or files.p
2278 2283 print p,p.mtime
2279 2284
2280 2285 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
2281 2286 now work again without considering the exclusion regexp -
2282 2287 hence, things like ',foo my/path' turn to 'foo("my/path")'
2283 2288 instead of syntax error.
2284 2289
2285 2290
2286 2291 2006-01-14 Ville Vainio <vivainio@gmail.com>
2287 2292
2288 2293 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
2289 2294 ipapi decorators for python 2.4 users, options() provides access to rc
2290 2295 data.
2291 2296
2292 2297 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
2293 2298 as path separators (even on Linux ;-). Space character after
2294 2299 backslash (as yielded by tab completer) is still space;
2295 2300 "%cd long\ name" works as expected.
2296 2301
2297 2302 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
2298 2303 as "chain of command", with priority. API stays the same,
2299 2304 TryNext exception raised by a hook function signals that
2300 2305 current hook failed and next hook should try handling it, as
2301 2306 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
2302 2307 requested configurable display hook, which is now implemented.
2303 2308
2304 2309 2006-01-13 Ville Vainio <vivainio@gmail.com>
2305 2310
2306 2311 * IPython/platutils*.py: platform specific utility functions,
2307 2312 so far only set_term_title is implemented (change terminal
2308 2313 label in windowing systems). %cd now changes the title to
2309 2314 current dir.
2310 2315
2311 2316 * IPython/Release.py: Added myself to "authors" list,
2312 2317 had to create new files.
2313 2318
2314 2319 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
2315 2320 shell escape; not a known bug but had potential to be one in the
2316 2321 future.
2317 2322
2318 2323 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
2319 2324 extension API for IPython! See the module for usage example. Fix
2320 2325 OInspect for docstring-less magic functions.
2321 2326
2322 2327
2323 2328 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
2324 2329
2325 2330 * IPython/iplib.py (raw_input): temporarily deactivate all
2326 2331 attempts at allowing pasting of code with autoindent on. It
2327 2332 introduced bugs (reported by Prabhu) and I can't seem to find a
2328 2333 robust combination which works in all cases. Will have to revisit
2329 2334 later.
2330 2335
2331 2336 * IPython/genutils.py: remove isspace() function. We've dropped
2332 2337 2.2 compatibility, so it's OK to use the string method.
2333 2338
2334 2339 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2335 2340
2336 2341 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
2337 2342 matching what NOT to autocall on, to include all python binary
2338 2343 operators (including things like 'and', 'or', 'is' and 'in').
2339 2344 Prompted by a bug report on 'foo & bar', but I realized we had
2340 2345 many more potential bug cases with other operators. The regexp is
2341 2346 self.re_exclude_auto, it's fairly commented.
2342 2347
2343 2348 2006-01-12 Ville Vainio <vivainio@gmail.com>
2344 2349
2345 2350 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
2346 2351 Prettified and hardened string/backslash quoting with ipsystem(),
2347 2352 ipalias() and ipmagic(). Now even \ characters are passed to
2348 2353 %magics, !shell escapes and aliases exactly as they are in the
2349 2354 ipython command line. Should improve backslash experience,
2350 2355 particularly in Windows (path delimiter for some commands that
2351 2356 won't understand '/'), but Unix benefits as well (regexps). %cd
2352 2357 magic still doesn't support backslash path delimiters, though. Also
2353 2358 deleted all pretense of supporting multiline command strings in
2354 2359 !system or %magic commands. Thanks to Jerry McRae for suggestions.
2355 2360
2356 2361 * doc/build_doc_instructions.txt added. Documentation on how to
2357 2362 use doc/update_manual.py, added yesterday. Both files contributed
2358 2363 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
2359 2364 doc/*.sh for deprecation at a later date.
2360 2365
2361 2366 * /ipython.py Added ipython.py to root directory for
2362 2367 zero-installation (tar xzvf ipython.tgz; cd ipython; python
2363 2368 ipython.py) and development convenience (no need to keep doing
2364 2369 "setup.py install" between changes).
2365 2370
2366 2371 * Made ! and !! shell escapes work (again) in multiline expressions:
2367 2372 if 1:
2368 2373 !ls
2369 2374 !!ls
2370 2375
2371 2376 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2372 2377
2373 2378 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
2374 2379 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
2375 2380 module in case-insensitive installation. Was causing crashes
2376 2381 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
2377 2382
2378 2383 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
2379 2384 <marienz-AT-gentoo.org>, closes
2380 2385 http://www.scipy.net/roundup/ipython/issue51.
2381 2386
2382 2387 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
2383 2388
2384 2389 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
2385 2390 problem of excessive CPU usage under *nix and keyboard lag under
2386 2391 win32.
2387 2392
2388 2393 2006-01-10 *** Released version 0.7.0
2389 2394
2390 2395 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
2391 2396
2392 2397 * IPython/Release.py (revision): tag version number to 0.7.0,
2393 2398 ready for release.
2394 2399
2395 2400 * IPython/Magic.py (magic_edit): Add print statement to %edit so
2396 2401 it informs the user of the name of the temp. file used. This can
2397 2402 help if you decide later to reuse that same file, so you know
2398 2403 where to copy the info from.
2399 2404
2400 2405 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
2401 2406
2402 2407 * setup_bdist_egg.py: little script to build an egg. Added
2403 2408 support in the release tools as well.
2404 2409
2405 2410 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
2406 2411
2407 2412 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
2408 2413 version selection (new -wxversion command line and ipythonrc
2409 2414 parameter). Patch contributed by Arnd Baecker
2410 2415 <arnd.baecker-AT-web.de>.
2411 2416
2412 2417 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2413 2418 embedded instances, for variables defined at the interactive
2414 2419 prompt of the embedded ipython. Reported by Arnd.
2415 2420
2416 2421 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
2417 2422 it can be used as a (stateful) toggle, or with a direct parameter.
2418 2423
2419 2424 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
2420 2425 could be triggered in certain cases and cause the traceback
2421 2426 printer not to work.
2422 2427
2423 2428 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
2424 2429
2425 2430 * IPython/iplib.py (_should_recompile): Small fix, closes
2426 2431 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
2427 2432
2428 2433 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
2429 2434
2430 2435 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
2431 2436 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
2432 2437 Moad for help with tracking it down.
2433 2438
2434 2439 * IPython/iplib.py (handle_auto): fix autocall handling for
2435 2440 objects which support BOTH __getitem__ and __call__ (so that f [x]
2436 2441 is left alone, instead of becoming f([x]) automatically).
2437 2442
2438 2443 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
2439 2444 Ville's patch.
2440 2445
2441 2446 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
2442 2447
2443 2448 * IPython/iplib.py (handle_auto): changed autocall semantics to
2444 2449 include 'smart' mode, where the autocall transformation is NOT
2445 2450 applied if there are no arguments on the line. This allows you to
2446 2451 just type 'foo' if foo is a callable to see its internal form,
2447 2452 instead of having it called with no arguments (typically a
2448 2453 mistake). The old 'full' autocall still exists: for that, you
2449 2454 need to set the 'autocall' parameter to 2 in your ipythonrc file.
2450 2455
2451 2456 * IPython/completer.py (Completer.attr_matches): add
2452 2457 tab-completion support for Enthoughts' traits. After a report by
2453 2458 Arnd and a patch by Prabhu.
2454 2459
2455 2460 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
2456 2461
2457 2462 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
2458 2463 Schmolck's patch to fix inspect.getinnerframes().
2459 2464
2460 2465 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
2461 2466 for embedded instances, regarding handling of namespaces and items
2462 2467 added to the __builtin__ one. Multiple embedded instances and
2463 2468 recursive embeddings should work better now (though I'm not sure
2464 2469 I've got all the corner cases fixed, that code is a bit of a brain
2465 2470 twister).
2466 2471
2467 2472 * IPython/Magic.py (magic_edit): added support to edit in-memory
2468 2473 macros (automatically creates the necessary temp files). %edit
2469 2474 also doesn't return the file contents anymore, it's just noise.
2470 2475
2471 2476 * IPython/completer.py (Completer.attr_matches): revert change to
2472 2477 complete only on attributes listed in __all__. I realized it
2473 2478 cripples the tab-completion system as a tool for exploring the
2474 2479 internals of unknown libraries (it renders any non-__all__
2475 2480 attribute off-limits). I got bit by this when trying to see
2476 2481 something inside the dis module.
2477 2482
2478 2483 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
2479 2484
2480 2485 * IPython/iplib.py (InteractiveShell.__init__): add .meta
2481 2486 namespace for users and extension writers to hold data in. This
2482 2487 follows the discussion in
2483 2488 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
2484 2489
2485 2490 * IPython/completer.py (IPCompleter.complete): small patch to help
2486 2491 tab-completion under Emacs, after a suggestion by John Barnard
2487 2492 <barnarj-AT-ccf.org>.
2488 2493
2489 2494 * IPython/Magic.py (Magic.extract_input_slices): added support for
2490 2495 the slice notation in magics to use N-M to represent numbers N...M
2491 2496 (closed endpoints). This is used by %macro and %save.
2492 2497
2493 2498 * IPython/completer.py (Completer.attr_matches): for modules which
2494 2499 define __all__, complete only on those. After a patch by Jeffrey
2495 2500 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
2496 2501 speed up this routine.
2497 2502
2498 2503 * IPython/Logger.py (Logger.log): fix a history handling bug. I
2499 2504 don't know if this is the end of it, but the behavior now is
2500 2505 certainly much more correct. Note that coupled with macros,
2501 2506 slightly surprising (at first) behavior may occur: a macro will in
2502 2507 general expand to multiple lines of input, so upon exiting, the
2503 2508 in/out counters will both be bumped by the corresponding amount
2504 2509 (as if the macro's contents had been typed interactively). Typing
2505 2510 %hist will reveal the intermediate (silently processed) lines.
2506 2511
2507 2512 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
2508 2513 pickle to fail (%run was overwriting __main__ and not restoring
2509 2514 it, but pickle relies on __main__ to operate).
2510 2515
2511 2516 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
2512 2517 using properties, but forgot to make the main InteractiveShell
2513 2518 class a new-style class. Properties fail silently, and
2514 2519 mysteriously, with old-style class (getters work, but
2515 2520 setters don't do anything).
2516 2521
2517 2522 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
2518 2523
2519 2524 * IPython/Magic.py (magic_history): fix history reporting bug (I
2520 2525 know some nasties are still there, I just can't seem to find a
2521 2526 reproducible test case to track them down; the input history is
2522 2527 falling out of sync...)
2523 2528
2524 2529 * IPython/iplib.py (handle_shell_escape): fix bug where both
2525 2530 aliases and system accesses where broken for indented code (such
2526 2531 as loops).
2527 2532
2528 2533 * IPython/genutils.py (shell): fix small but critical bug for
2529 2534 win32 system access.
2530 2535
2531 2536 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2532 2537
2533 2538 * IPython/iplib.py (showtraceback): remove use of the
2534 2539 sys.last_{type/value/traceback} structures, which are non
2535 2540 thread-safe.
2536 2541 (_prefilter): change control flow to ensure that we NEVER
2537 2542 introspect objects when autocall is off. This will guarantee that
2538 2543 having an input line of the form 'x.y', where access to attribute
2539 2544 'y' has side effects, doesn't trigger the side effect TWICE. It
2540 2545 is important to note that, with autocall on, these side effects
2541 2546 can still happen.
2542 2547 (ipsystem): new builtin, to complete the ip{magic/alias/system}
2543 2548 trio. IPython offers these three kinds of special calls which are
2544 2549 not python code, and it's a good thing to have their call method
2545 2550 be accessible as pure python functions (not just special syntax at
2546 2551 the command line). It gives us a better internal implementation
2547 2552 structure, as well as exposing these for user scripting more
2548 2553 cleanly.
2549 2554
2550 2555 * IPython/macro.py (Macro.__init__): moved macros to a standalone
2551 2556 file. Now that they'll be more likely to be used with the
2552 2557 persistance system (%store), I want to make sure their module path
2553 2558 doesn't change in the future, so that we don't break things for
2554 2559 users' persisted data.
2555 2560
2556 2561 * IPython/iplib.py (autoindent_update): move indentation
2557 2562 management into the _text_ processing loop, not the keyboard
2558 2563 interactive one. This is necessary to correctly process non-typed
2559 2564 multiline input (such as macros).
2560 2565
2561 2566 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
2562 2567 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
2563 2568 which was producing problems in the resulting manual.
2564 2569 (magic_whos): improve reporting of instances (show their class,
2565 2570 instead of simply printing 'instance' which isn't terribly
2566 2571 informative).
2567 2572
2568 2573 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
2569 2574 (minor mods) to support network shares under win32.
2570 2575
2571 2576 * IPython/winconsole.py (get_console_size): add new winconsole
2572 2577 module and fixes to page_dumb() to improve its behavior under
2573 2578 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
2574 2579
2575 2580 * IPython/Magic.py (Macro): simplified Macro class to just
2576 2581 subclass list. We've had only 2.2 compatibility for a very long
2577 2582 time, yet I was still avoiding subclassing the builtin types. No
2578 2583 more (I'm also starting to use properties, though I won't shift to
2579 2584 2.3-specific features quite yet).
2580 2585 (magic_store): added Ville's patch for lightweight variable
2581 2586 persistence, after a request on the user list by Matt Wilkie
2582 2587 <maphew-AT-gmail.com>. The new %store magic's docstring has full
2583 2588 details.
2584 2589
2585 2590 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2586 2591 changed the default logfile name from 'ipython.log' to
2587 2592 'ipython_log.py'. These logs are real python files, and now that
2588 2593 we have much better multiline support, people are more likely to
2589 2594 want to use them as such. Might as well name them correctly.
2590 2595
2591 2596 * IPython/Magic.py: substantial cleanup. While we can't stop
2592 2597 using magics as mixins, due to the existing customizations 'out
2593 2598 there' which rely on the mixin naming conventions, at least I
2594 2599 cleaned out all cross-class name usage. So once we are OK with
2595 2600 breaking compatibility, the two systems can be separated.
2596 2601
2597 2602 * IPython/Logger.py: major cleanup. This one is NOT a mixin
2598 2603 anymore, and the class is a fair bit less hideous as well. New
2599 2604 features were also introduced: timestamping of input, and logging
2600 2605 of output results. These are user-visible with the -t and -o
2601 2606 options to %logstart. Closes
2602 2607 http://www.scipy.net/roundup/ipython/issue11 and a request by
2603 2608 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
2604 2609
2605 2610 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
2606 2611
2607 2612 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
2608 2613 better handle backslashes in paths. See the thread 'More Windows
2609 2614 questions part 2 - \/ characters revisited' on the iypthon user
2610 2615 list:
2611 2616 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
2612 2617
2613 2618 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
2614 2619
2615 2620 (InteractiveShell.__init__): change threaded shells to not use the
2616 2621 ipython crash handler. This was causing more problems than not,
2617 2622 as exceptions in the main thread (GUI code, typically) would
2618 2623 always show up as a 'crash', when they really weren't.
2619 2624
2620 2625 The colors and exception mode commands (%colors/%xmode) have been
2621 2626 synchronized to also take this into account, so users can get
2622 2627 verbose exceptions for their threaded code as well. I also added
2623 2628 support for activating pdb inside this exception handler as well,
2624 2629 so now GUI authors can use IPython's enhanced pdb at runtime.
2625 2630
2626 2631 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
2627 2632 true by default, and add it to the shipped ipythonrc file. Since
2628 2633 this asks the user before proceeding, I think it's OK to make it
2629 2634 true by default.
2630 2635
2631 2636 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
2632 2637 of the previous special-casing of input in the eval loop. I think
2633 2638 this is cleaner, as they really are commands and shouldn't have
2634 2639 a special role in the middle of the core code.
2635 2640
2636 2641 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
2637 2642
2638 2643 * IPython/iplib.py (edit_syntax_error): added support for
2639 2644 automatically reopening the editor if the file had a syntax error
2640 2645 in it. Thanks to scottt who provided the patch at:
2641 2646 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
2642 2647 version committed).
2643 2648
2644 2649 * IPython/iplib.py (handle_normal): add suport for multi-line
2645 2650 input with emtpy lines. This fixes
2646 2651 http://www.scipy.net/roundup/ipython/issue43 and a similar
2647 2652 discussion on the user list.
2648 2653
2649 2654 WARNING: a behavior change is necessarily introduced to support
2650 2655 blank lines: now a single blank line with whitespace does NOT
2651 2656 break the input loop, which means that when autoindent is on, by
2652 2657 default hitting return on the next (indented) line does NOT exit.
2653 2658
2654 2659 Instead, to exit a multiline input you can either have:
2655 2660
2656 2661 - TWO whitespace lines (just hit return again), or
2657 2662 - a single whitespace line of a different length than provided
2658 2663 by the autoindent (add or remove a space).
2659 2664
2660 2665 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
2661 2666 module to better organize all readline-related functionality.
2662 2667 I've deleted FlexCompleter and put all completion clases here.
2663 2668
2664 2669 * IPython/iplib.py (raw_input): improve indentation management.
2665 2670 It is now possible to paste indented code with autoindent on, and
2666 2671 the code is interpreted correctly (though it still looks bad on
2667 2672 screen, due to the line-oriented nature of ipython).
2668 2673 (MagicCompleter.complete): change behavior so that a TAB key on an
2669 2674 otherwise empty line actually inserts a tab, instead of completing
2670 2675 on the entire global namespace. This makes it easier to use the
2671 2676 TAB key for indentation. After a request by Hans Meine
2672 2677 <hans_meine-AT-gmx.net>
2673 2678 (_prefilter): add support so that typing plain 'exit' or 'quit'
2674 2679 does a sensible thing. Originally I tried to deviate as little as
2675 2680 possible from the default python behavior, but even that one may
2676 2681 change in this direction (thread on python-dev to that effect).
2677 2682 Regardless, ipython should do the right thing even if CPython's
2678 2683 '>>>' prompt doesn't.
2679 2684 (InteractiveShell): removed subclassing code.InteractiveConsole
2680 2685 class. By now we'd overridden just about all of its methods: I've
2681 2686 copied the remaining two over, and now ipython is a standalone
2682 2687 class. This will provide a clearer picture for the chainsaw
2683 2688 branch refactoring.
2684 2689
2685 2690 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
2686 2691
2687 2692 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
2688 2693 failures for objects which break when dir() is called on them.
2689 2694
2690 2695 * IPython/FlexCompleter.py (Completer.__init__): Added support for
2691 2696 distinct local and global namespaces in the completer API. This
2692 2697 change allows us to properly handle completion with distinct
2693 2698 scopes, including in embedded instances (this had never really
2694 2699 worked correctly).
2695 2700
2696 2701 Note: this introduces a change in the constructor for
2697 2702 MagicCompleter, as a new global_namespace parameter is now the
2698 2703 second argument (the others were bumped one position).
2699 2704
2700 2705 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
2701 2706
2702 2707 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2703 2708 embedded instances (which can be done now thanks to Vivian's
2704 2709 frame-handling fixes for pdb).
2705 2710 (InteractiveShell.__init__): Fix namespace handling problem in
2706 2711 embedded instances. We were overwriting __main__ unconditionally,
2707 2712 and this should only be done for 'full' (non-embedded) IPython;
2708 2713 embedded instances must respect the caller's __main__. Thanks to
2709 2714 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
2710 2715
2711 2716 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
2712 2717
2713 2718 * setup.py: added download_url to setup(). This registers the
2714 2719 download address at PyPI, which is not only useful to humans
2715 2720 browsing the site, but is also picked up by setuptools (the Eggs
2716 2721 machinery). Thanks to Ville and R. Kern for the info/discussion
2717 2722 on this.
2718 2723
2719 2724 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
2720 2725
2721 2726 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
2722 2727 This brings a lot of nice functionality to the pdb mode, which now
2723 2728 has tab-completion, syntax highlighting, and better stack handling
2724 2729 than before. Many thanks to Vivian De Smedt
2725 2730 <vivian-AT-vdesmedt.com> for the original patches.
2726 2731
2727 2732 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
2728 2733
2729 2734 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
2730 2735 sequence to consistently accept the banner argument. The
2731 2736 inconsistency was tripping SAGE, thanks to Gary Zablackis
2732 2737 <gzabl-AT-yahoo.com> for the report.
2733 2738
2734 2739 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2735 2740
2736 2741 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2737 2742 Fix bug where a naked 'alias' call in the ipythonrc file would
2738 2743 cause a crash. Bug reported by Jorgen Stenarson.
2739 2744
2740 2745 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2741 2746
2742 2747 * IPython/ipmaker.py (make_IPython): cleanups which should improve
2743 2748 startup time.
2744 2749
2745 2750 * IPython/iplib.py (runcode): my globals 'fix' for embedded
2746 2751 instances had introduced a bug with globals in normal code. Now
2747 2752 it's working in all cases.
2748 2753
2749 2754 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
2750 2755 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
2751 2756 has been introduced to set the default case sensitivity of the
2752 2757 searches. Users can still select either mode at runtime on a
2753 2758 per-search basis.
2754 2759
2755 2760 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
2756 2761
2757 2762 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
2758 2763 attributes in wildcard searches for subclasses. Modified version
2759 2764 of a patch by Jorgen.
2760 2765
2761 2766 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
2762 2767
2763 2768 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
2764 2769 embedded instances. I added a user_global_ns attribute to the
2765 2770 InteractiveShell class to handle this.
2766 2771
2767 2772 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
2768 2773
2769 2774 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
2770 2775 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
2771 2776 (reported under win32, but may happen also in other platforms).
2772 2777 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
2773 2778
2774 2779 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
2775 2780
2776 2781 * IPython/Magic.py (magic_psearch): new support for wildcard
2777 2782 patterns. Now, typing ?a*b will list all names which begin with a
2778 2783 and end in b, for example. The %psearch magic has full
2779 2784 docstrings. Many thanks to JΓΆrgen Stenarson
2780 2785 <jorgen.stenarson-AT-bostream.nu>, author of the patches
2781 2786 implementing this functionality.
2782 2787
2783 2788 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2784 2789
2785 2790 * Manual: fixed long-standing annoyance of double-dashes (as in
2786 2791 --prefix=~, for example) being stripped in the HTML version. This
2787 2792 is a latex2html bug, but a workaround was provided. Many thanks
2788 2793 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
2789 2794 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
2790 2795 rolling. This seemingly small issue had tripped a number of users
2791 2796 when first installing, so I'm glad to see it gone.
2792 2797
2793 2798 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2794 2799
2795 2800 * IPython/Extensions/numeric_formats.py: fix missing import,
2796 2801 reported by Stephen Walton.
2797 2802
2798 2803 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
2799 2804
2800 2805 * IPython/demo.py: finish demo module, fully documented now.
2801 2806
2802 2807 * IPython/genutils.py (file_read): simple little utility to read a
2803 2808 file and ensure it's closed afterwards.
2804 2809
2805 2810 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
2806 2811
2807 2812 * IPython/demo.py (Demo.__init__): added support for individually
2808 2813 tagging blocks for automatic execution.
2809 2814
2810 2815 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
2811 2816 syntax-highlighted python sources, requested by John.
2812 2817
2813 2818 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
2814 2819
2815 2820 * IPython/demo.py (Demo.again): fix bug where again() blocks after
2816 2821 finishing.
2817 2822
2818 2823 * IPython/genutils.py (shlex_split): moved from Magic to here,
2819 2824 where all 2.2 compatibility stuff lives. I needed it for demo.py.
2820 2825
2821 2826 * IPython/demo.py (Demo.__init__): added support for silent
2822 2827 blocks, improved marks as regexps, docstrings written.
2823 2828 (Demo.__init__): better docstring, added support for sys.argv.
2824 2829
2825 2830 * IPython/genutils.py (marquee): little utility used by the demo
2826 2831 code, handy in general.
2827 2832
2828 2833 * IPython/demo.py (Demo.__init__): new class for interactive
2829 2834 demos. Not documented yet, I just wrote it in a hurry for
2830 2835 scipy'05. Will docstring later.
2831 2836
2832 2837 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
2833 2838
2834 2839 * IPython/Shell.py (sigint_handler): Drastic simplification which
2835 2840 also seems to make Ctrl-C work correctly across threads! This is
2836 2841 so simple, that I can't beleive I'd missed it before. Needs more
2837 2842 testing, though.
2838 2843 (KBINT): Never mind, revert changes. I'm sure I'd tried something
2839 2844 like this before...
2840 2845
2841 2846 * IPython/genutils.py (get_home_dir): add protection against
2842 2847 non-dirs in win32 registry.
2843 2848
2844 2849 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
2845 2850 bug where dict was mutated while iterating (pysh crash).
2846 2851
2847 2852 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
2848 2853
2849 2854 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
2850 2855 spurious newlines added by this routine. After a report by
2851 2856 F. Mantegazza.
2852 2857
2853 2858 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
2854 2859
2855 2860 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
2856 2861 calls. These were a leftover from the GTK 1.x days, and can cause
2857 2862 problems in certain cases (after a report by John Hunter).
2858 2863
2859 2864 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
2860 2865 os.getcwd() fails at init time. Thanks to patch from David Remahl
2861 2866 <chmod007-AT-mac.com>.
2862 2867 (InteractiveShell.__init__): prevent certain special magics from
2863 2868 being shadowed by aliases. Closes
2864 2869 http://www.scipy.net/roundup/ipython/issue41.
2865 2870
2866 2871 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
2867 2872
2868 2873 * IPython/iplib.py (InteractiveShell.complete): Added new
2869 2874 top-level completion method to expose the completion mechanism
2870 2875 beyond readline-based environments.
2871 2876
2872 2877 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
2873 2878
2874 2879 * tools/ipsvnc (svnversion): fix svnversion capture.
2875 2880
2876 2881 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
2877 2882 attribute to self, which was missing. Before, it was set by a
2878 2883 routine which in certain cases wasn't being called, so the
2879 2884 instance could end up missing the attribute. This caused a crash.
2880 2885 Closes http://www.scipy.net/roundup/ipython/issue40.
2881 2886
2882 2887 2005-08-16 Fernando Perez <fperez@colorado.edu>
2883 2888
2884 2889 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
2885 2890 contains non-string attribute. Closes
2886 2891 http://www.scipy.net/roundup/ipython/issue38.
2887 2892
2888 2893 2005-08-14 Fernando Perez <fperez@colorado.edu>
2889 2894
2890 2895 * tools/ipsvnc: Minor improvements, to add changeset info.
2891 2896
2892 2897 2005-08-12 Fernando Perez <fperez@colorado.edu>
2893 2898
2894 2899 * IPython/iplib.py (runsource): remove self.code_to_run_src
2895 2900 attribute. I realized this is nothing more than
2896 2901 '\n'.join(self.buffer), and having the same data in two different
2897 2902 places is just asking for synchronization bugs. This may impact
2898 2903 people who have custom exception handlers, so I need to warn
2899 2904 ipython-dev about it (F. Mantegazza may use them).
2900 2905
2901 2906 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
2902 2907
2903 2908 * IPython/genutils.py: fix 2.2 compatibility (generators)
2904 2909
2905 2910 2005-07-18 Fernando Perez <fperez@colorado.edu>
2906 2911
2907 2912 * IPython/genutils.py (get_home_dir): fix to help users with
2908 2913 invalid $HOME under win32.
2909 2914
2910 2915 2005-07-17 Fernando Perez <fperez@colorado.edu>
2911 2916
2912 2917 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
2913 2918 some old hacks and clean up a bit other routines; code should be
2914 2919 simpler and a bit faster.
2915 2920
2916 2921 * IPython/iplib.py (interact): removed some last-resort attempts
2917 2922 to survive broken stdout/stderr. That code was only making it
2918 2923 harder to abstract out the i/o (necessary for gui integration),
2919 2924 and the crashes it could prevent were extremely rare in practice
2920 2925 (besides being fully user-induced in a pretty violent manner).
2921 2926
2922 2927 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
2923 2928 Nothing major yet, but the code is simpler to read; this should
2924 2929 make it easier to do more serious modifications in the future.
2925 2930
2926 2931 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
2927 2932 which broke in .15 (thanks to a report by Ville).
2928 2933
2929 2934 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
2930 2935 be quite correct, I know next to nothing about unicode). This
2931 2936 will allow unicode strings to be used in prompts, amongst other
2932 2937 cases. It also will prevent ipython from crashing when unicode
2933 2938 shows up unexpectedly in many places. If ascii encoding fails, we
2934 2939 assume utf_8. Currently the encoding is not a user-visible
2935 2940 setting, though it could be made so if there is demand for it.
2936 2941
2937 2942 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
2938 2943
2939 2944 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
2940 2945
2941 2946 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
2942 2947
2943 2948 * IPython/genutils.py: Add 2.2 compatibility here, so all other
2944 2949 code can work transparently for 2.2/2.3.
2945 2950
2946 2951 2005-07-16 Fernando Perez <fperez@colorado.edu>
2947 2952
2948 2953 * IPython/ultraTB.py (ExceptionColors): Make a global variable
2949 2954 out of the color scheme table used for coloring exception
2950 2955 tracebacks. This allows user code to add new schemes at runtime.
2951 2956 This is a minimally modified version of the patch at
2952 2957 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
2953 2958 for the contribution.
2954 2959
2955 2960 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
2956 2961 slightly modified version of the patch in
2957 2962 http://www.scipy.net/roundup/ipython/issue34, which also allows me
2958 2963 to remove the previous try/except solution (which was costlier).
2959 2964 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
2960 2965
2961 2966 2005-06-08 Fernando Perez <fperez@colorado.edu>
2962 2967
2963 2968 * IPython/iplib.py (write/write_err): Add methods to abstract all
2964 2969 I/O a bit more.
2965 2970
2966 2971 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
2967 2972 warning, reported by Aric Hagberg, fix by JD Hunter.
2968 2973
2969 2974 2005-06-02 *** Released version 0.6.15
2970 2975
2971 2976 2005-06-01 Fernando Perez <fperez@colorado.edu>
2972 2977
2973 2978 * IPython/iplib.py (MagicCompleter.file_matches): Fix
2974 2979 tab-completion of filenames within open-quoted strings. Note that
2975 2980 this requires that in ~/.ipython/ipythonrc, users change the
2976 2981 readline delimiters configuration to read:
2977 2982
2978 2983 readline_remove_delims -/~
2979 2984
2980 2985
2981 2986 2005-05-31 *** Released version 0.6.14
2982 2987
2983 2988 2005-05-29 Fernando Perez <fperez@colorado.edu>
2984 2989
2985 2990 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
2986 2991 with files not on the filesystem. Reported by Eliyahu Sandler
2987 2992 <eli@gondolin.net>
2988 2993
2989 2994 2005-05-22 Fernando Perez <fperez@colorado.edu>
2990 2995
2991 2996 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
2992 2997 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
2993 2998
2994 2999 2005-05-19 Fernando Perez <fperez@colorado.edu>
2995 3000
2996 3001 * IPython/iplib.py (safe_execfile): close a file which could be
2997 3002 left open (causing problems in win32, which locks open files).
2998 3003 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
2999 3004
3000 3005 2005-05-18 Fernando Perez <fperez@colorado.edu>
3001 3006
3002 3007 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
3003 3008 keyword arguments correctly to safe_execfile().
3004 3009
3005 3010 2005-05-13 Fernando Perez <fperez@colorado.edu>
3006 3011
3007 3012 * ipython.1: Added info about Qt to manpage, and threads warning
3008 3013 to usage page (invoked with --help).
3009 3014
3010 3015 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
3011 3016 new matcher (it goes at the end of the priority list) to do
3012 3017 tab-completion on named function arguments. Submitted by George
3013 3018 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
3014 3019 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
3015 3020 for more details.
3016 3021
3017 3022 * IPython/Magic.py (magic_run): Added new -e flag to ignore
3018 3023 SystemExit exceptions in the script being run. Thanks to a report
3019 3024 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
3020 3025 producing very annoying behavior when running unit tests.
3021 3026
3022 3027 2005-05-12 Fernando Perez <fperez@colorado.edu>
3023 3028
3024 3029 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
3025 3030 which I'd broken (again) due to a changed regexp. In the process,
3026 3031 added ';' as an escape to auto-quote the whole line without
3027 3032 splitting its arguments. Thanks to a report by Jerry McRae
3028 3033 <qrs0xyc02-AT-sneakemail.com>.
3029 3034
3030 3035 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
3031 3036 possible crashes caused by a TokenError. Reported by Ed Schofield
3032 3037 <schofield-AT-ftw.at>.
3033 3038
3034 3039 2005-05-06 Fernando Perez <fperez@colorado.edu>
3035 3040
3036 3041 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
3037 3042
3038 3043 2005-04-29 Fernando Perez <fperez@colorado.edu>
3039 3044
3040 3045 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
3041 3046 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
3042 3047 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
3043 3048 which provides support for Qt interactive usage (similar to the
3044 3049 existing one for WX and GTK). This had been often requested.
3045 3050
3046 3051 2005-04-14 *** Released version 0.6.13
3047 3052
3048 3053 2005-04-08 Fernando Perez <fperez@colorado.edu>
3049 3054
3050 3055 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
3051 3056 from _ofind, which gets called on almost every input line. Now,
3052 3057 we only try to get docstrings if they are actually going to be
3053 3058 used (the overhead of fetching unnecessary docstrings can be
3054 3059 noticeable for certain objects, such as Pyro proxies).
3055 3060
3056 3061 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
3057 3062 for completers. For some reason I had been passing them the state
3058 3063 variable, which completers never actually need, and was in
3059 3064 conflict with the rlcompleter API. Custom completers ONLY need to
3060 3065 take the text parameter.
3061 3066
3062 3067 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
3063 3068 work correctly in pysh. I've also moved all the logic which used
3064 3069 to be in pysh.py here, which will prevent problems with future
3065 3070 upgrades. However, this time I must warn users to update their
3066 3071 pysh profile to include the line
3067 3072
3068 3073 import_all IPython.Extensions.InterpreterExec
3069 3074
3070 3075 because otherwise things won't work for them. They MUST also
3071 3076 delete pysh.py and the line
3072 3077
3073 3078 execfile pysh.py
3074 3079
3075 3080 from their ipythonrc-pysh.
3076 3081
3077 3082 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
3078 3083 robust in the face of objects whose dir() returns non-strings
3079 3084 (which it shouldn't, but some broken libs like ITK do). Thanks to
3080 3085 a patch by John Hunter (implemented differently, though). Also
3081 3086 minor improvements by using .extend instead of + on lists.
3082 3087
3083 3088 * pysh.py:
3084 3089
3085 3090 2005-04-06 Fernando Perez <fperez@colorado.edu>
3086 3091
3087 3092 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
3088 3093 by default, so that all users benefit from it. Those who don't
3089 3094 want it can still turn it off.
3090 3095
3091 3096 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
3092 3097 config file, I'd forgotten about this, so users were getting it
3093 3098 off by default.
3094 3099
3095 3100 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
3096 3101 consistency. Now magics can be called in multiline statements,
3097 3102 and python variables can be expanded in magic calls via $var.
3098 3103 This makes the magic system behave just like aliases or !system
3099 3104 calls.
3100 3105
3101 3106 2005-03-28 Fernando Perez <fperez@colorado.edu>
3102 3107
3103 3108 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
3104 3109 expensive string additions for building command. Add support for
3105 3110 trailing ';' when autocall is used.
3106 3111
3107 3112 2005-03-26 Fernando Perez <fperez@colorado.edu>
3108 3113
3109 3114 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
3110 3115 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
3111 3116 ipython.el robust against prompts with any number of spaces
3112 3117 (including 0) after the ':' character.
3113 3118
3114 3119 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
3115 3120 continuation prompt, which misled users to think the line was
3116 3121 already indented. Closes debian Bug#300847, reported to me by
3117 3122 Norbert Tretkowski <tretkowski-AT-inittab.de>.
3118 3123
3119 3124 2005-03-23 Fernando Perez <fperez@colorado.edu>
3120 3125
3121 3126 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
3122 3127 properly aligned if they have embedded newlines.
3123 3128
3124 3129 * IPython/iplib.py (runlines): Add a public method to expose
3125 3130 IPython's code execution machinery, so that users can run strings
3126 3131 as if they had been typed at the prompt interactively.
3127 3132 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
3128 3133 methods which can call the system shell, but with python variable
3129 3134 expansion. The three such methods are: __IPYTHON__.system,
3130 3135 .getoutput and .getoutputerror. These need to be documented in a
3131 3136 'public API' section (to be written) of the manual.
3132 3137
3133 3138 2005-03-20 Fernando Perez <fperez@colorado.edu>
3134 3139
3135 3140 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
3136 3141 for custom exception handling. This is quite powerful, and it
3137 3142 allows for user-installable exception handlers which can trap
3138 3143 custom exceptions at runtime and treat them separately from
3139 3144 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
3140 3145 Mantegazza <mantegazza-AT-ill.fr>.
3141 3146 (InteractiveShell.set_custom_completer): public API function to
3142 3147 add new completers at runtime.
3143 3148
3144 3149 2005-03-19 Fernando Perez <fperez@colorado.edu>
3145 3150
3146 3151 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
3147 3152 allow objects which provide their docstrings via non-standard
3148 3153 mechanisms (like Pyro proxies) to still be inspected by ipython's
3149 3154 ? system.
3150 3155
3151 3156 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
3152 3157 automatic capture system. I tried quite hard to make it work
3153 3158 reliably, and simply failed. I tried many combinations with the
3154 3159 subprocess module, but eventually nothing worked in all needed
3155 3160 cases (not blocking stdin for the child, duplicating stdout
3156 3161 without blocking, etc). The new %sc/%sx still do capture to these
3157 3162 magical list/string objects which make shell use much more
3158 3163 conveninent, so not all is lost.
3159 3164
3160 3165 XXX - FIX MANUAL for the change above!
3161 3166
3162 3167 (runsource): I copied code.py's runsource() into ipython to modify
3163 3168 it a bit. Now the code object and source to be executed are
3164 3169 stored in ipython. This makes this info accessible to third-party
3165 3170 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
3166 3171 Mantegazza <mantegazza-AT-ill.fr>.
3167 3172
3168 3173 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
3169 3174 history-search via readline (like C-p/C-n). I'd wanted this for a
3170 3175 long time, but only recently found out how to do it. For users
3171 3176 who already have their ipythonrc files made and want this, just
3172 3177 add:
3173 3178
3174 3179 readline_parse_and_bind "\e[A": history-search-backward
3175 3180 readline_parse_and_bind "\e[B": history-search-forward
3176 3181
3177 3182 2005-03-18 Fernando Perez <fperez@colorado.edu>
3178 3183
3179 3184 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
3180 3185 LSString and SList classes which allow transparent conversions
3181 3186 between list mode and whitespace-separated string.
3182 3187 (magic_r): Fix recursion problem in %r.
3183 3188
3184 3189 * IPython/genutils.py (LSString): New class to be used for
3185 3190 automatic storage of the results of all alias/system calls in _o
3186 3191 and _e (stdout/err). These provide a .l/.list attribute which
3187 3192 does automatic splitting on newlines. This means that for most
3188 3193 uses, you'll never need to do capturing of output with %sc/%sx
3189 3194 anymore, since ipython keeps this always done for you. Note that
3190 3195 only the LAST results are stored, the _o/e variables are
3191 3196 overwritten on each call. If you need to save their contents
3192 3197 further, simply bind them to any other name.
3193 3198
3194 3199 2005-03-17 Fernando Perez <fperez@colorado.edu>
3195 3200
3196 3201 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
3197 3202 prompt namespace handling.
3198 3203
3199 3204 2005-03-16 Fernando Perez <fperez@colorado.edu>
3200 3205
3201 3206 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
3202 3207 classic prompts to be '>>> ' (final space was missing, and it
3203 3208 trips the emacs python mode).
3204 3209 (BasePrompt.__str__): Added safe support for dynamic prompt
3205 3210 strings. Now you can set your prompt string to be '$x', and the
3206 3211 value of x will be printed from your interactive namespace. The
3207 3212 interpolation syntax includes the full Itpl support, so
3208 3213 ${foo()+x+bar()} is a valid prompt string now, and the function
3209 3214 calls will be made at runtime.
3210 3215
3211 3216 2005-03-15 Fernando Perez <fperez@colorado.edu>
3212 3217
3213 3218 * IPython/Magic.py (magic_history): renamed %hist to %history, to
3214 3219 avoid name clashes in pylab. %hist still works, it just forwards
3215 3220 the call to %history.
3216 3221
3217 3222 2005-03-02 *** Released version 0.6.12
3218 3223
3219 3224 2005-03-02 Fernando Perez <fperez@colorado.edu>
3220 3225
3221 3226 * IPython/iplib.py (handle_magic): log magic calls properly as
3222 3227 ipmagic() function calls.
3223 3228
3224 3229 * IPython/Magic.py (magic_time): Improved %time to support
3225 3230 statements and provide wall-clock as well as CPU time.
3226 3231
3227 3232 2005-02-27 Fernando Perez <fperez@colorado.edu>
3228 3233
3229 3234 * IPython/hooks.py: New hooks module, to expose user-modifiable
3230 3235 IPython functionality in a clean manner. For now only the editor
3231 3236 hook is actually written, and other thigns which I intend to turn
3232 3237 into proper hooks aren't yet there. The display and prefilter
3233 3238 stuff, for example, should be hooks. But at least now the
3234 3239 framework is in place, and the rest can be moved here with more
3235 3240 time later. IPython had had a .hooks variable for a long time for
3236 3241 this purpose, but I'd never actually used it for anything.
3237 3242
3238 3243 2005-02-26 Fernando Perez <fperez@colorado.edu>
3239 3244
3240 3245 * IPython/ipmaker.py (make_IPython): make the default ipython
3241 3246 directory be called _ipython under win32, to follow more the
3242 3247 naming peculiarities of that platform (where buggy software like
3243 3248 Visual Sourcesafe breaks with .named directories). Reported by
3244 3249 Ville Vainio.
3245 3250
3246 3251 2005-02-23 Fernando Perez <fperez@colorado.edu>
3247 3252
3248 3253 * IPython/iplib.py (InteractiveShell.__init__): removed a few
3249 3254 auto_aliases for win32 which were causing problems. Users can
3250 3255 define the ones they personally like.
3251 3256
3252 3257 2005-02-21 Fernando Perez <fperez@colorado.edu>
3253 3258
3254 3259 * IPython/Magic.py (magic_time): new magic to time execution of
3255 3260 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
3256 3261
3257 3262 2005-02-19 Fernando Perez <fperez@colorado.edu>
3258 3263
3259 3264 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
3260 3265 into keys (for prompts, for example).
3261 3266
3262 3267 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
3263 3268 prompts in case users want them. This introduces a small behavior
3264 3269 change: ipython does not automatically add a space to all prompts
3265 3270 anymore. To get the old prompts with a space, users should add it
3266 3271 manually to their ipythonrc file, so for example prompt_in1 should
3267 3272 now read 'In [\#]: ' instead of 'In [\#]:'.
3268 3273 (BasePrompt.__init__): New option prompts_pad_left (only in rc
3269 3274 file) to control left-padding of secondary prompts.
3270 3275
3271 3276 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
3272 3277 the profiler can't be imported. Fix for Debian, which removed
3273 3278 profile.py because of License issues. I applied a slightly
3274 3279 modified version of the original Debian patch at
3275 3280 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
3276 3281
3277 3282 2005-02-17 Fernando Perez <fperez@colorado.edu>
3278 3283
3279 3284 * IPython/genutils.py (native_line_ends): Fix bug which would
3280 3285 cause improper line-ends under win32 b/c I was not opening files
3281 3286 in binary mode. Bug report and fix thanks to Ville.
3282 3287
3283 3288 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
3284 3289 trying to catch spurious foo[1] autocalls. My fix actually broke
3285 3290 ',/' autoquote/call with explicit escape (bad regexp).
3286 3291
3287 3292 2005-02-15 *** Released version 0.6.11
3288 3293
3289 3294 2005-02-14 Fernando Perez <fperez@colorado.edu>
3290 3295
3291 3296 * IPython/background_jobs.py: New background job management
3292 3297 subsystem. This is implemented via a new set of classes, and
3293 3298 IPython now provides a builtin 'jobs' object for background job
3294 3299 execution. A convenience %bg magic serves as a lightweight
3295 3300 frontend for starting the more common type of calls. This was
3296 3301 inspired by discussions with B. Granger and the BackgroundCommand
3297 3302 class described in the book Python Scripting for Computational
3298 3303 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
3299 3304 (although ultimately no code from this text was used, as IPython's
3300 3305 system is a separate implementation).
3301 3306
3302 3307 * IPython/iplib.py (MagicCompleter.python_matches): add new option
3303 3308 to control the completion of single/double underscore names
3304 3309 separately. As documented in the example ipytonrc file, the
3305 3310 readline_omit__names variable can now be set to 2, to omit even
3306 3311 single underscore names. Thanks to a patch by Brian Wong
3307 3312 <BrianWong-AT-AirgoNetworks.Com>.
3308 3313 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
3309 3314 be autocalled as foo([1]) if foo were callable. A problem for
3310 3315 things which are both callable and implement __getitem__.
3311 3316 (init_readline): Fix autoindentation for win32. Thanks to a patch
3312 3317 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
3313 3318
3314 3319 2005-02-12 Fernando Perez <fperez@colorado.edu>
3315 3320
3316 3321 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
3317 3322 which I had written long ago to sort out user error messages which
3318 3323 may occur during startup. This seemed like a good idea initially,
3319 3324 but it has proven a disaster in retrospect. I don't want to
3320 3325 change much code for now, so my fix is to set the internal 'debug'
3321 3326 flag to true everywhere, whose only job was precisely to control
3322 3327 this subsystem. This closes issue 28 (as well as avoiding all
3323 3328 sorts of strange hangups which occur from time to time).
3324 3329
3325 3330 2005-02-07 Fernando Perez <fperez@colorado.edu>
3326 3331
3327 3332 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
3328 3333 previous call produced a syntax error.
3329 3334
3330 3335 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3331 3336 classes without constructor.
3332 3337
3333 3338 2005-02-06 Fernando Perez <fperez@colorado.edu>
3334 3339
3335 3340 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
3336 3341 completions with the results of each matcher, so we return results
3337 3342 to the user from all namespaces. This breaks with ipython
3338 3343 tradition, but I think it's a nicer behavior. Now you get all
3339 3344 possible completions listed, from all possible namespaces (python,
3340 3345 filesystem, magics...) After a request by John Hunter
3341 3346 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3342 3347
3343 3348 2005-02-05 Fernando Perez <fperez@colorado.edu>
3344 3349
3345 3350 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
3346 3351 the call had quote characters in it (the quotes were stripped).
3347 3352
3348 3353 2005-01-31 Fernando Perez <fperez@colorado.edu>
3349 3354
3350 3355 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
3351 3356 Itpl.itpl() to make the code more robust against psyco
3352 3357 optimizations.
3353 3358
3354 3359 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
3355 3360 of causing an exception. Quicker, cleaner.
3356 3361
3357 3362 2005-01-28 Fernando Perez <fperez@colorado.edu>
3358 3363
3359 3364 * scripts/ipython_win_post_install.py (install): hardcode
3360 3365 sys.prefix+'python.exe' as the executable path. It turns out that
3361 3366 during the post-installation run, sys.executable resolves to the
3362 3367 name of the binary installer! I should report this as a distutils
3363 3368 bug, I think. I updated the .10 release with this tiny fix, to
3364 3369 avoid annoying the lists further.
3365 3370
3366 3371 2005-01-27 *** Released version 0.6.10
3367 3372
3368 3373 2005-01-27 Fernando Perez <fperez@colorado.edu>
3369 3374
3370 3375 * IPython/numutils.py (norm): Added 'inf' as optional name for
3371 3376 L-infinity norm, included references to mathworld.com for vector
3372 3377 norm definitions.
3373 3378 (amin/amax): added amin/amax for array min/max. Similar to what
3374 3379 pylab ships with after the recent reorganization of names.
3375 3380 (spike/spike_odd): removed deprecated spike/spike_odd functions.
3376 3381
3377 3382 * ipython.el: committed Alex's recent fixes and improvements.
3378 3383 Tested with python-mode from CVS, and it looks excellent. Since
3379 3384 python-mode hasn't released anything in a while, I'm temporarily
3380 3385 putting a copy of today's CVS (v 4.70) of python-mode in:
3381 3386 http://ipython.scipy.org/tmp/python-mode.el
3382 3387
3383 3388 * scripts/ipython_win_post_install.py (install): Win32 fix to use
3384 3389 sys.executable for the executable name, instead of assuming it's
3385 3390 called 'python.exe' (the post-installer would have produced broken
3386 3391 setups on systems with a differently named python binary).
3387 3392
3388 3393 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
3389 3394 references to os.linesep, to make the code more
3390 3395 platform-independent. This is also part of the win32 coloring
3391 3396 fixes.
3392 3397
3393 3398 * IPython/genutils.py (page_dumb): Remove attempts to chop long
3394 3399 lines, which actually cause coloring bugs because the length of
3395 3400 the line is very difficult to correctly compute with embedded
3396 3401 escapes. This was the source of all the coloring problems under
3397 3402 Win32. I think that _finally_, Win32 users have a properly
3398 3403 working ipython in all respects. This would never have happened
3399 3404 if not for Gary Bishop and Viktor Ransmayr's great help and work.
3400 3405
3401 3406 2005-01-26 *** Released version 0.6.9
3402 3407
3403 3408 2005-01-25 Fernando Perez <fperez@colorado.edu>
3404 3409
3405 3410 * setup.py: finally, we have a true Windows installer, thanks to
3406 3411 the excellent work of Viktor Ransmayr
3407 3412 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
3408 3413 Windows users. The setup routine is quite a bit cleaner thanks to
3409 3414 this, and the post-install script uses the proper functions to
3410 3415 allow a clean de-installation using the standard Windows Control
3411 3416 Panel.
3412 3417
3413 3418 * IPython/genutils.py (get_home_dir): changed to use the $HOME
3414 3419 environment variable under all OSes (including win32) if
3415 3420 available. This will give consistency to win32 users who have set
3416 3421 this variable for any reason. If os.environ['HOME'] fails, the
3417 3422 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
3418 3423
3419 3424 2005-01-24 Fernando Perez <fperez@colorado.edu>
3420 3425
3421 3426 * IPython/numutils.py (empty_like): add empty_like(), similar to
3422 3427 zeros_like() but taking advantage of the new empty() Numeric routine.
3423 3428
3424 3429 2005-01-23 *** Released version 0.6.8
3425 3430
3426 3431 2005-01-22 Fernando Perez <fperez@colorado.edu>
3427 3432
3428 3433 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
3429 3434 automatic show() calls. After discussing things with JDH, it
3430 3435 turns out there are too many corner cases where this can go wrong.
3431 3436 It's best not to try to be 'too smart', and simply have ipython
3432 3437 reproduce as much as possible the default behavior of a normal
3433 3438 python shell.
3434 3439
3435 3440 * IPython/iplib.py (InteractiveShell.__init__): Modified the
3436 3441 line-splitting regexp and _prefilter() to avoid calling getattr()
3437 3442 on assignments. This closes
3438 3443 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
3439 3444 readline uses getattr(), so a simple <TAB> keypress is still
3440 3445 enough to trigger getattr() calls on an object.
3441 3446
3442 3447 2005-01-21 Fernando Perez <fperez@colorado.edu>
3443 3448
3444 3449 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
3445 3450 docstring under pylab so it doesn't mask the original.
3446 3451
3447 3452 2005-01-21 *** Released version 0.6.7
3448 3453
3449 3454 2005-01-21 Fernando Perez <fperez@colorado.edu>
3450 3455
3451 3456 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
3452 3457 signal handling for win32 users in multithreaded mode.
3453 3458
3454 3459 2005-01-17 Fernando Perez <fperez@colorado.edu>
3455 3460
3456 3461 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3457 3462 instances with no __init__. After a crash report by Norbert Nemec
3458 3463 <Norbert-AT-nemec-online.de>.
3459 3464
3460 3465 2005-01-14 Fernando Perez <fperez@colorado.edu>
3461 3466
3462 3467 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
3463 3468 names for verbose exceptions, when multiple dotted names and the
3464 3469 'parent' object were present on the same line.
3465 3470
3466 3471 2005-01-11 Fernando Perez <fperez@colorado.edu>
3467 3472
3468 3473 * IPython/genutils.py (flag_calls): new utility to trap and flag
3469 3474 calls in functions. I need it to clean up matplotlib support.
3470 3475 Also removed some deprecated code in genutils.
3471 3476
3472 3477 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
3473 3478 that matplotlib scripts called with %run, which don't call show()
3474 3479 themselves, still have their plotting windows open.
3475 3480
3476 3481 2005-01-05 Fernando Perez <fperez@colorado.edu>
3477 3482
3478 3483 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
3479 3484 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
3480 3485
3481 3486 2004-12-19 Fernando Perez <fperez@colorado.edu>
3482 3487
3483 3488 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
3484 3489 parent_runcode, which was an eyesore. The same result can be
3485 3490 obtained with Python's regular superclass mechanisms.
3486 3491
3487 3492 2004-12-17 Fernando Perez <fperez@colorado.edu>
3488 3493
3489 3494 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
3490 3495 reported by Prabhu.
3491 3496 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
3492 3497 sys.stderr) instead of explicitly calling sys.stderr. This helps
3493 3498 maintain our I/O abstractions clean, for future GUI embeddings.
3494 3499
3495 3500 * IPython/genutils.py (info): added new utility for sys.stderr
3496 3501 unified info message handling (thin wrapper around warn()).
3497 3502
3498 3503 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
3499 3504 composite (dotted) names on verbose exceptions.
3500 3505 (VerboseTB.nullrepr): harden against another kind of errors which
3501 3506 Python's inspect module can trigger, and which were crashing
3502 3507 IPython. Thanks to a report by Marco Lombardi
3503 3508 <mlombard-AT-ma010192.hq.eso.org>.
3504 3509
3505 3510 2004-12-13 *** Released version 0.6.6
3506 3511
3507 3512 2004-12-12 Fernando Perez <fperez@colorado.edu>
3508 3513
3509 3514 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
3510 3515 generated by pygtk upon initialization if it was built without
3511 3516 threads (for matplotlib users). After a crash reported by
3512 3517 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
3513 3518
3514 3519 * IPython/ipmaker.py (make_IPython): fix small bug in the
3515 3520 import_some parameter for multiple imports.
3516 3521
3517 3522 * IPython/iplib.py (ipmagic): simplified the interface of
3518 3523 ipmagic() to take a single string argument, just as it would be
3519 3524 typed at the IPython cmd line.
3520 3525 (ipalias): Added new ipalias() with an interface identical to
3521 3526 ipmagic(). This completes exposing a pure python interface to the
3522 3527 alias and magic system, which can be used in loops or more complex
3523 3528 code where IPython's automatic line mangling is not active.
3524 3529
3525 3530 * IPython/genutils.py (timing): changed interface of timing to
3526 3531 simply run code once, which is the most common case. timings()
3527 3532 remains unchanged, for the cases where you want multiple runs.
3528 3533
3529 3534 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
3530 3535 bug where Python2.2 crashes with exec'ing code which does not end
3531 3536 in a single newline. Python 2.3 is OK, so I hadn't noticed this
3532 3537 before.
3533 3538
3534 3539 2004-12-10 Fernando Perez <fperez@colorado.edu>
3535 3540
3536 3541 * IPython/Magic.py (Magic.magic_prun): changed name of option from
3537 3542 -t to -T, to accomodate the new -t flag in %run (the %run and
3538 3543 %prun options are kind of intermixed, and it's not easy to change
3539 3544 this with the limitations of python's getopt).
3540 3545
3541 3546 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
3542 3547 the execution of scripts. It's not as fine-tuned as timeit.py,
3543 3548 but it works from inside ipython (and under 2.2, which lacks
3544 3549 timeit.py). Optionally a number of runs > 1 can be given for
3545 3550 timing very short-running code.
3546 3551
3547 3552 * IPython/genutils.py (uniq_stable): new routine which returns a
3548 3553 list of unique elements in any iterable, but in stable order of
3549 3554 appearance. I needed this for the ultraTB fixes, and it's a handy
3550 3555 utility.
3551 3556
3552 3557 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
3553 3558 dotted names in Verbose exceptions. This had been broken since
3554 3559 the very start, now x.y will properly be printed in a Verbose
3555 3560 traceback, instead of x being shown and y appearing always as an
3556 3561 'undefined global'. Getting this to work was a bit tricky,
3557 3562 because by default python tokenizers are stateless. Saved by
3558 3563 python's ability to easily add a bit of state to an arbitrary
3559 3564 function (without needing to build a full-blown callable object).
3560 3565
3561 3566 Also big cleanup of this code, which had horrendous runtime
3562 3567 lookups of zillions of attributes for colorization. Moved all
3563 3568 this code into a few templates, which make it cleaner and quicker.
3564 3569
3565 3570 Printout quality was also improved for Verbose exceptions: one
3566 3571 variable per line, and memory addresses are printed (this can be
3567 3572 quite handy in nasty debugging situations, which is what Verbose
3568 3573 is for).
3569 3574
3570 3575 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
3571 3576 the command line as scripts to be loaded by embedded instances.
3572 3577 Doing so has the potential for an infinite recursion if there are
3573 3578 exceptions thrown in the process. This fixes a strange crash
3574 3579 reported by Philippe MULLER <muller-AT-irit.fr>.
3575 3580
3576 3581 2004-12-09 Fernando Perez <fperez@colorado.edu>
3577 3582
3578 3583 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
3579 3584 to reflect new names in matplotlib, which now expose the
3580 3585 matlab-compatible interface via a pylab module instead of the
3581 3586 'matlab' name. The new code is backwards compatible, so users of
3582 3587 all matplotlib versions are OK. Patch by J. Hunter.
3583 3588
3584 3589 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
3585 3590 of __init__ docstrings for instances (class docstrings are already
3586 3591 automatically printed). Instances with customized docstrings
3587 3592 (indep. of the class) are also recognized and all 3 separate
3588 3593 docstrings are printed (instance, class, constructor). After some
3589 3594 comments/suggestions by J. Hunter.
3590 3595
3591 3596 2004-12-05 Fernando Perez <fperez@colorado.edu>
3592 3597
3593 3598 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
3594 3599 warnings when tab-completion fails and triggers an exception.
3595 3600
3596 3601 2004-12-03 Fernando Perez <fperez@colorado.edu>
3597 3602
3598 3603 * IPython/Magic.py (magic_prun): Fix bug where an exception would
3599 3604 be triggered when using 'run -p'. An incorrect option flag was
3600 3605 being set ('d' instead of 'D').
3601 3606 (manpage): fix missing escaped \- sign.
3602 3607
3603 3608 2004-11-30 *** Released version 0.6.5
3604 3609
3605 3610 2004-11-30 Fernando Perez <fperez@colorado.edu>
3606 3611
3607 3612 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
3608 3613 setting with -d option.
3609 3614
3610 3615 * setup.py (docfiles): Fix problem where the doc glob I was using
3611 3616 was COMPLETELY BROKEN. It was giving the right files by pure
3612 3617 accident, but failed once I tried to include ipython.el. Note:
3613 3618 glob() does NOT allow you to do exclusion on multiple endings!
3614 3619
3615 3620 2004-11-29 Fernando Perez <fperez@colorado.edu>
3616 3621
3617 3622 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
3618 3623 the manpage as the source. Better formatting & consistency.
3619 3624
3620 3625 * IPython/Magic.py (magic_run): Added new -d option, to run
3621 3626 scripts under the control of the python pdb debugger. Note that
3622 3627 this required changing the %prun option -d to -D, to avoid a clash
3623 3628 (since %run must pass options to %prun, and getopt is too dumb to
3624 3629 handle options with string values with embedded spaces). Thanks
3625 3630 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
3626 3631 (magic_who_ls): added type matching to %who and %whos, so that one
3627 3632 can filter their output to only include variables of certain
3628 3633 types. Another suggestion by Matthew.
3629 3634 (magic_whos): Added memory summaries in kb and Mb for arrays.
3630 3635 (magic_who): Improve formatting (break lines every 9 vars).
3631 3636
3632 3637 2004-11-28 Fernando Perez <fperez@colorado.edu>
3633 3638
3634 3639 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
3635 3640 cache when empty lines were present.
3636 3641
3637 3642 2004-11-24 Fernando Perez <fperez@colorado.edu>
3638 3643
3639 3644 * IPython/usage.py (__doc__): document the re-activated threading
3640 3645 options for WX and GTK.
3641 3646
3642 3647 2004-11-23 Fernando Perez <fperez@colorado.edu>
3643 3648
3644 3649 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
3645 3650 the -wthread and -gthread options, along with a new -tk one to try
3646 3651 and coordinate Tk threading with wx/gtk. The tk support is very
3647 3652 platform dependent, since it seems to require Tcl and Tk to be
3648 3653 built with threads (Fedora1/2 appears NOT to have it, but in
3649 3654 Prabhu's Debian boxes it works OK). But even with some Tk
3650 3655 limitations, this is a great improvement.
3651 3656
3652 3657 * IPython/Prompts.py (prompt_specials_color): Added \t for time
3653 3658 info in user prompts. Patch by Prabhu.
3654 3659
3655 3660 2004-11-18 Fernando Perez <fperez@colorado.edu>
3656 3661
3657 3662 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
3658 3663 EOFErrors and bail, to avoid infinite loops if a non-terminating
3659 3664 file is fed into ipython. Patch submitted in issue 19 by user,
3660 3665 many thanks.
3661 3666
3662 3667 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
3663 3668 autoquote/parens in continuation prompts, which can cause lots of
3664 3669 problems. Closes roundup issue 20.
3665 3670
3666 3671 2004-11-17 Fernando Perez <fperez@colorado.edu>
3667 3672
3668 3673 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
3669 3674 reported as debian bug #280505. I'm not sure my local changelog
3670 3675 entry has the proper debian format (Jack?).
3671 3676
3672 3677 2004-11-08 *** Released version 0.6.4
3673 3678
3674 3679 2004-11-08 Fernando Perez <fperez@colorado.edu>
3675 3680
3676 3681 * IPython/iplib.py (init_readline): Fix exit message for Windows
3677 3682 when readline is active. Thanks to a report by Eric Jones
3678 3683 <eric-AT-enthought.com>.
3679 3684
3680 3685 2004-11-07 Fernando Perez <fperez@colorado.edu>
3681 3686
3682 3687 * IPython/genutils.py (page): Add a trap for OSError exceptions,
3683 3688 sometimes seen by win2k/cygwin users.
3684 3689
3685 3690 2004-11-06 Fernando Perez <fperez@colorado.edu>
3686 3691
3687 3692 * IPython/iplib.py (interact): Change the handling of %Exit from
3688 3693 trying to propagate a SystemExit to an internal ipython flag.
3689 3694 This is less elegant than using Python's exception mechanism, but
3690 3695 I can't get that to work reliably with threads, so under -pylab
3691 3696 %Exit was hanging IPython. Cross-thread exception handling is
3692 3697 really a bitch. Thaks to a bug report by Stephen Walton
3693 3698 <stephen.walton-AT-csun.edu>.
3694 3699
3695 3700 2004-11-04 Fernando Perez <fperez@colorado.edu>
3696 3701
3697 3702 * IPython/iplib.py (raw_input_original): store a pointer to the
3698 3703 true raw_input to harden against code which can modify it
3699 3704 (wx.py.PyShell does this and would otherwise crash ipython).
3700 3705 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
3701 3706
3702 3707 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
3703 3708 Ctrl-C problem, which does not mess up the input line.
3704 3709
3705 3710 2004-11-03 Fernando Perez <fperez@colorado.edu>
3706 3711
3707 3712 * IPython/Release.py: Changed licensing to BSD, in all files.
3708 3713 (name): lowercase name for tarball/RPM release.
3709 3714
3710 3715 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
3711 3716 use throughout ipython.
3712 3717
3713 3718 * IPython/Magic.py (Magic._ofind): Switch to using the new
3714 3719 OInspect.getdoc() function.
3715 3720
3716 3721 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
3717 3722 of the line currently being canceled via Ctrl-C. It's extremely
3718 3723 ugly, but I don't know how to do it better (the problem is one of
3719 3724 handling cross-thread exceptions).
3720 3725
3721 3726 2004-10-28 Fernando Perez <fperez@colorado.edu>
3722 3727
3723 3728 * IPython/Shell.py (signal_handler): add signal handlers to trap
3724 3729 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
3725 3730 report by Francesc Alted.
3726 3731
3727 3732 2004-10-21 Fernando Perez <fperez@colorado.edu>
3728 3733
3729 3734 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
3730 3735 to % for pysh syntax extensions.
3731 3736
3732 3737 2004-10-09 Fernando Perez <fperez@colorado.edu>
3733 3738
3734 3739 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
3735 3740 arrays to print a more useful summary, without calling str(arr).
3736 3741 This avoids the problem of extremely lengthy computations which
3737 3742 occur if arr is large, and appear to the user as a system lockup
3738 3743 with 100% cpu activity. After a suggestion by Kristian Sandberg
3739 3744 <Kristian.Sandberg@colorado.edu>.
3740 3745 (Magic.__init__): fix bug in global magic escapes not being
3741 3746 correctly set.
3742 3747
3743 3748 2004-10-08 Fernando Perez <fperez@colorado.edu>
3744 3749
3745 3750 * IPython/Magic.py (__license__): change to absolute imports of
3746 3751 ipython's own internal packages, to start adapting to the absolute
3747 3752 import requirement of PEP-328.
3748 3753
3749 3754 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
3750 3755 files, and standardize author/license marks through the Release
3751 3756 module instead of having per/file stuff (except for files with
3752 3757 particular licenses, like the MIT/PSF-licensed codes).
3753 3758
3754 3759 * IPython/Debugger.py: remove dead code for python 2.1
3755 3760
3756 3761 2004-10-04 Fernando Perez <fperez@colorado.edu>
3757 3762
3758 3763 * IPython/iplib.py (ipmagic): New function for accessing magics
3759 3764 via a normal python function call.
3760 3765
3761 3766 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
3762 3767 from '@' to '%', to accomodate the new @decorator syntax of python
3763 3768 2.4.
3764 3769
3765 3770 2004-09-29 Fernando Perez <fperez@colorado.edu>
3766 3771
3767 3772 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
3768 3773 matplotlib.use to prevent running scripts which try to switch
3769 3774 interactive backends from within ipython. This will just crash
3770 3775 the python interpreter, so we can't allow it (but a detailed error
3771 3776 is given to the user).
3772 3777
3773 3778 2004-09-28 Fernando Perez <fperez@colorado.edu>
3774 3779
3775 3780 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
3776 3781 matplotlib-related fixes so that using @run with non-matplotlib
3777 3782 scripts doesn't pop up spurious plot windows. This requires
3778 3783 matplotlib >= 0.63, where I had to make some changes as well.
3779 3784
3780 3785 * IPython/ipmaker.py (make_IPython): update version requirement to
3781 3786 python 2.2.
3782 3787
3783 3788 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
3784 3789 banner arg for embedded customization.
3785 3790
3786 3791 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
3787 3792 explicit uses of __IP as the IPython's instance name. Now things
3788 3793 are properly handled via the shell.name value. The actual code
3789 3794 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
3790 3795 is much better than before. I'll clean things completely when the
3791 3796 magic stuff gets a real overhaul.
3792 3797
3793 3798 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
3794 3799 minor changes to debian dir.
3795 3800
3796 3801 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
3797 3802 pointer to the shell itself in the interactive namespace even when
3798 3803 a user-supplied dict is provided. This is needed for embedding
3799 3804 purposes (found by tests with Michel Sanner).
3800 3805
3801 3806 2004-09-27 Fernando Perez <fperez@colorado.edu>
3802 3807
3803 3808 * IPython/UserConfig/ipythonrc: remove []{} from
3804 3809 readline_remove_delims, so that things like [modname.<TAB> do
3805 3810 proper completion. This disables [].TAB, but that's a less common
3806 3811 case than module names in list comprehensions, for example.
3807 3812 Thanks to a report by Andrea Riciputi.
3808 3813
3809 3814 2004-09-09 Fernando Perez <fperez@colorado.edu>
3810 3815
3811 3816 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
3812 3817 blocking problems in win32 and osx. Fix by John.
3813 3818
3814 3819 2004-09-08 Fernando Perez <fperez@colorado.edu>
3815 3820
3816 3821 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
3817 3822 for Win32 and OSX. Fix by John Hunter.
3818 3823
3819 3824 2004-08-30 *** Released version 0.6.3
3820 3825
3821 3826 2004-08-30 Fernando Perez <fperez@colorado.edu>
3822 3827
3823 3828 * setup.py (isfile): Add manpages to list of dependent files to be
3824 3829 updated.
3825 3830
3826 3831 2004-08-27 Fernando Perez <fperez@colorado.edu>
3827 3832
3828 3833 * IPython/Shell.py (start): I've disabled -wthread and -gthread
3829 3834 for now. They don't really work with standalone WX/GTK code
3830 3835 (though matplotlib IS working fine with both of those backends).
3831 3836 This will neeed much more testing. I disabled most things with
3832 3837 comments, so turning it back on later should be pretty easy.
3833 3838
3834 3839 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
3835 3840 autocalling of expressions like r'foo', by modifying the line
3836 3841 split regexp. Closes
3837 3842 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
3838 3843 Riley <ipythonbugs-AT-sabi.net>.
3839 3844 (InteractiveShell.mainloop): honor --nobanner with banner
3840 3845 extensions.
3841 3846
3842 3847 * IPython/Shell.py: Significant refactoring of all classes, so
3843 3848 that we can really support ALL matplotlib backends and threading
3844 3849 models (John spotted a bug with Tk which required this). Now we
3845 3850 should support single-threaded, WX-threads and GTK-threads, both
3846 3851 for generic code and for matplotlib.
3847 3852
3848 3853 * IPython/ipmaker.py (__call__): Changed -mpthread option to
3849 3854 -pylab, to simplify things for users. Will also remove the pylab
3850 3855 profile, since now all of matplotlib configuration is directly
3851 3856 handled here. This also reduces startup time.
3852 3857
3853 3858 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
3854 3859 shell wasn't being correctly called. Also in IPShellWX.
3855 3860
3856 3861 * IPython/iplib.py (InteractiveShell.__init__): Added option to
3857 3862 fine-tune banner.
3858 3863
3859 3864 * IPython/numutils.py (spike): Deprecate these spike functions,
3860 3865 delete (long deprecated) gnuplot_exec handler.
3861 3866
3862 3867 2004-08-26 Fernando Perez <fperez@colorado.edu>
3863 3868
3864 3869 * ipython.1: Update for threading options, plus some others which
3865 3870 were missing.
3866 3871
3867 3872 * IPython/ipmaker.py (__call__): Added -wthread option for
3868 3873 wxpython thread handling. Make sure threading options are only
3869 3874 valid at the command line.
3870 3875
3871 3876 * scripts/ipython: moved shell selection into a factory function
3872 3877 in Shell.py, to keep the starter script to a minimum.
3873 3878
3874 3879 2004-08-25 Fernando Perez <fperez@colorado.edu>
3875 3880
3876 3881 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
3877 3882 John. Along with some recent changes he made to matplotlib, the
3878 3883 next versions of both systems should work very well together.
3879 3884
3880 3885 2004-08-24 Fernando Perez <fperez@colorado.edu>
3881 3886
3882 3887 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
3883 3888 tried to switch the profiling to using hotshot, but I'm getting
3884 3889 strange errors from prof.runctx() there. I may be misreading the
3885 3890 docs, but it looks weird. For now the profiling code will
3886 3891 continue to use the standard profiler.
3887 3892
3888 3893 2004-08-23 Fernando Perez <fperez@colorado.edu>
3889 3894
3890 3895 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
3891 3896 threaded shell, by John Hunter. It's not quite ready yet, but
3892 3897 close.
3893 3898
3894 3899 2004-08-22 Fernando Perez <fperez@colorado.edu>
3895 3900
3896 3901 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
3897 3902 in Magic and ultraTB.
3898 3903
3899 3904 * ipython.1: document threading options in manpage.
3900 3905
3901 3906 * scripts/ipython: Changed name of -thread option to -gthread,
3902 3907 since this is GTK specific. I want to leave the door open for a
3903 3908 -wthread option for WX, which will most likely be necessary. This
3904 3909 change affects usage and ipmaker as well.
3905 3910
3906 3911 * IPython/Shell.py (matplotlib_shell): Add a factory function to
3907 3912 handle the matplotlib shell issues. Code by John Hunter
3908 3913 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3909 3914 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
3910 3915 broken (and disabled for end users) for now, but it puts the
3911 3916 infrastructure in place.
3912 3917
3913 3918 2004-08-21 Fernando Perez <fperez@colorado.edu>
3914 3919
3915 3920 * ipythonrc-pylab: Add matplotlib support.
3916 3921
3917 3922 * matplotlib_config.py: new files for matplotlib support, part of
3918 3923 the pylab profile.
3919 3924
3920 3925 * IPython/usage.py (__doc__): documented the threading options.
3921 3926
3922 3927 2004-08-20 Fernando Perez <fperez@colorado.edu>
3923 3928
3924 3929 * ipython: Modified the main calling routine to handle the -thread
3925 3930 and -mpthread options. This needs to be done as a top-level hack,
3926 3931 because it determines which class to instantiate for IPython
3927 3932 itself.
3928 3933
3929 3934 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
3930 3935 classes to support multithreaded GTK operation without blocking,
3931 3936 and matplotlib with all backends. This is a lot of still very
3932 3937 experimental code, and threads are tricky. So it may still have a
3933 3938 few rough edges... This code owes a lot to
3934 3939 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
3935 3940 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
3936 3941 to John Hunter for all the matplotlib work.
3937 3942
3938 3943 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
3939 3944 options for gtk thread and matplotlib support.
3940 3945
3941 3946 2004-08-16 Fernando Perez <fperez@colorado.edu>
3942 3947
3943 3948 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
3944 3949 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
3945 3950 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
3946 3951
3947 3952 2004-08-11 Fernando Perez <fperez@colorado.edu>
3948 3953
3949 3954 * setup.py (isfile): Fix build so documentation gets updated for
3950 3955 rpms (it was only done for .tgz builds).
3951 3956
3952 3957 2004-08-10 Fernando Perez <fperez@colorado.edu>
3953 3958
3954 3959 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
3955 3960
3956 3961 * iplib.py : Silence syntax error exceptions in tab-completion.
3957 3962
3958 3963 2004-08-05 Fernando Perez <fperez@colorado.edu>
3959 3964
3960 3965 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
3961 3966 'color off' mark for continuation prompts. This was causing long
3962 3967 continuation lines to mis-wrap.
3963 3968
3964 3969 2004-08-01 Fernando Perez <fperez@colorado.edu>
3965 3970
3966 3971 * IPython/ipmaker.py (make_IPython): Allow the shell class used
3967 3972 for building ipython to be a parameter. All this is necessary
3968 3973 right now to have a multithreaded version, but this insane
3969 3974 non-design will be cleaned up soon. For now, it's a hack that
3970 3975 works.
3971 3976
3972 3977 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
3973 3978 args in various places. No bugs so far, but it's a dangerous
3974 3979 practice.
3975 3980
3976 3981 2004-07-31 Fernando Perez <fperez@colorado.edu>
3977 3982
3978 3983 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
3979 3984 fix completion of files with dots in their names under most
3980 3985 profiles (pysh was OK because the completion order is different).
3981 3986
3982 3987 2004-07-27 Fernando Perez <fperez@colorado.edu>
3983 3988
3984 3989 * IPython/iplib.py (InteractiveShell.__init__): build dict of
3985 3990 keywords manually, b/c the one in keyword.py was removed in python
3986 3991 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
3987 3992 This is NOT a bug under python 2.3 and earlier.
3988 3993
3989 3994 2004-07-26 Fernando Perez <fperez@colorado.edu>
3990 3995
3991 3996 * IPython/ultraTB.py (VerboseTB.text): Add another
3992 3997 linecache.checkcache() call to try to prevent inspect.py from
3993 3998 crashing under python 2.3. I think this fixes
3994 3999 http://www.scipy.net/roundup/ipython/issue17.
3995 4000
3996 4001 2004-07-26 *** Released version 0.6.2
3997 4002
3998 4003 2004-07-26 Fernando Perez <fperez@colorado.edu>
3999 4004
4000 4005 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
4001 4006 fail for any number.
4002 4007 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
4003 4008 empty bookmarks.
4004 4009
4005 4010 2004-07-26 *** Released version 0.6.1
4006 4011
4007 4012 2004-07-26 Fernando Perez <fperez@colorado.edu>
4008 4013
4009 4014 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
4010 4015
4011 4016 * IPython/iplib.py (protect_filename): Applied Ville's patch for
4012 4017 escaping '()[]{}' in filenames.
4013 4018
4014 4019 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
4015 4020 Python 2.2 users who lack a proper shlex.split.
4016 4021
4017 4022 2004-07-19 Fernando Perez <fperez@colorado.edu>
4018 4023
4019 4024 * IPython/iplib.py (InteractiveShell.init_readline): Add support
4020 4025 for reading readline's init file. I follow the normal chain:
4021 4026 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
4022 4027 report by Mike Heeter. This closes
4023 4028 http://www.scipy.net/roundup/ipython/issue16.
4024 4029
4025 4030 2004-07-18 Fernando Perez <fperez@colorado.edu>
4026 4031
4027 4032 * IPython/iplib.py (__init__): Add better handling of '\' under
4028 4033 Win32 for filenames. After a patch by Ville.
4029 4034
4030 4035 2004-07-17 Fernando Perez <fperez@colorado.edu>
4031 4036
4032 4037 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4033 4038 autocalling would be triggered for 'foo is bar' if foo is
4034 4039 callable. I also cleaned up the autocall detection code to use a
4035 4040 regexp, which is faster. Bug reported by Alexander Schmolck.
4036 4041
4037 4042 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
4038 4043 '?' in them would confuse the help system. Reported by Alex
4039 4044 Schmolck.
4040 4045
4041 4046 2004-07-16 Fernando Perez <fperez@colorado.edu>
4042 4047
4043 4048 * IPython/GnuplotInteractive.py (__all__): added plot2.
4044 4049
4045 4050 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
4046 4051 plotting dictionaries, lists or tuples of 1d arrays.
4047 4052
4048 4053 * IPython/Magic.py (Magic.magic_hist): small clenaups and
4049 4054 optimizations.
4050 4055
4051 4056 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
4052 4057 the information which was there from Janko's original IPP code:
4053 4058
4054 4059 03.05.99 20:53 porto.ifm.uni-kiel.de
4055 4060 --Started changelog.
4056 4061 --make clear do what it say it does
4057 4062 --added pretty output of lines from inputcache
4058 4063 --Made Logger a mixin class, simplifies handling of switches
4059 4064 --Added own completer class. .string<TAB> expands to last history
4060 4065 line which starts with string. The new expansion is also present
4061 4066 with Ctrl-r from the readline library. But this shows, who this
4062 4067 can be done for other cases.
4063 4068 --Added convention that all shell functions should accept a
4064 4069 parameter_string This opens the door for different behaviour for
4065 4070 each function. @cd is a good example of this.
4066 4071
4067 4072 04.05.99 12:12 porto.ifm.uni-kiel.de
4068 4073 --added logfile rotation
4069 4074 --added new mainloop method which freezes first the namespace
4070 4075
4071 4076 07.05.99 21:24 porto.ifm.uni-kiel.de
4072 4077 --added the docreader classes. Now there is a help system.
4073 4078 -This is only a first try. Currently it's not easy to put new
4074 4079 stuff in the indices. But this is the way to go. Info would be
4075 4080 better, but HTML is every where and not everybody has an info
4076 4081 system installed and it's not so easy to change html-docs to info.
4077 4082 --added global logfile option
4078 4083 --there is now a hook for object inspection method pinfo needs to
4079 4084 be provided for this. Can be reached by two '??'.
4080 4085
4081 4086 08.05.99 20:51 porto.ifm.uni-kiel.de
4082 4087 --added a README
4083 4088 --bug in rc file. Something has changed so functions in the rc
4084 4089 file need to reference the shell and not self. Not clear if it's a
4085 4090 bug or feature.
4086 4091 --changed rc file for new behavior
4087 4092
4088 4093 2004-07-15 Fernando Perez <fperez@colorado.edu>
4089 4094
4090 4095 * IPython/Logger.py (Logger.log): fixed recent bug where the input
4091 4096 cache was falling out of sync in bizarre manners when multi-line
4092 4097 input was present. Minor optimizations and cleanup.
4093 4098
4094 4099 (Logger): Remove old Changelog info for cleanup. This is the
4095 4100 information which was there from Janko's original code:
4096 4101
4097 4102 Changes to Logger: - made the default log filename a parameter
4098 4103
4099 4104 - put a check for lines beginning with !@? in log(). Needed
4100 4105 (even if the handlers properly log their lines) for mid-session
4101 4106 logging activation to work properly. Without this, lines logged
4102 4107 in mid session, which get read from the cache, would end up
4103 4108 'bare' (with !@? in the open) in the log. Now they are caught
4104 4109 and prepended with a #.
4105 4110
4106 4111 * IPython/iplib.py (InteractiveShell.init_readline): added check
4107 4112 in case MagicCompleter fails to be defined, so we don't crash.
4108 4113
4109 4114 2004-07-13 Fernando Perez <fperez@colorado.edu>
4110 4115
4111 4116 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
4112 4117 of EPS if the requested filename ends in '.eps'.
4113 4118
4114 4119 2004-07-04 Fernando Perez <fperez@colorado.edu>
4115 4120
4116 4121 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
4117 4122 escaping of quotes when calling the shell.
4118 4123
4119 4124 2004-07-02 Fernando Perez <fperez@colorado.edu>
4120 4125
4121 4126 * IPython/Prompts.py (CachedOutput.update): Fix problem with
4122 4127 gettext not working because we were clobbering '_'. Fixes
4123 4128 http://www.scipy.net/roundup/ipython/issue6.
4124 4129
4125 4130 2004-07-01 Fernando Perez <fperez@colorado.edu>
4126 4131
4127 4132 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
4128 4133 into @cd. Patch by Ville.
4129 4134
4130 4135 * IPython/iplib.py (InteractiveShell.post_config_initialization):
4131 4136 new function to store things after ipmaker runs. Patch by Ville.
4132 4137 Eventually this will go away once ipmaker is removed and the class
4133 4138 gets cleaned up, but for now it's ok. Key functionality here is
4134 4139 the addition of the persistent storage mechanism, a dict for
4135 4140 keeping data across sessions (for now just bookmarks, but more can
4136 4141 be implemented later).
4137 4142
4138 4143 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
4139 4144 persistent across sections. Patch by Ville, I modified it
4140 4145 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
4141 4146 added a '-l' option to list all bookmarks.
4142 4147
4143 4148 * IPython/iplib.py (InteractiveShell.atexit_operations): new
4144 4149 center for cleanup. Registered with atexit.register(). I moved
4145 4150 here the old exit_cleanup(). After a patch by Ville.
4146 4151
4147 4152 * IPython/Magic.py (get_py_filename): added '~' to the accepted
4148 4153 characters in the hacked shlex_split for python 2.2.
4149 4154
4150 4155 * IPython/iplib.py (file_matches): more fixes to filenames with
4151 4156 whitespace in them. It's not perfect, but limitations in python's
4152 4157 readline make it impossible to go further.
4153 4158
4154 4159 2004-06-29 Fernando Perez <fperez@colorado.edu>
4155 4160
4156 4161 * IPython/iplib.py (file_matches): escape whitespace correctly in
4157 4162 filename completions. Bug reported by Ville.
4158 4163
4159 4164 2004-06-28 Fernando Perez <fperez@colorado.edu>
4160 4165
4161 4166 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
4162 4167 the history file will be called 'history-PROFNAME' (or just
4163 4168 'history' if no profile is loaded). I was getting annoyed at
4164 4169 getting my Numerical work history clobbered by pysh sessions.
4165 4170
4166 4171 * IPython/iplib.py (InteractiveShell.__init__): Internal
4167 4172 getoutputerror() function so that we can honor the system_verbose
4168 4173 flag for _all_ system calls. I also added escaping of #
4169 4174 characters here to avoid confusing Itpl.
4170 4175
4171 4176 * IPython/Magic.py (shlex_split): removed call to shell in
4172 4177 parse_options and replaced it with shlex.split(). The annoying
4173 4178 part was that in Python 2.2, shlex.split() doesn't exist, so I had
4174 4179 to backport it from 2.3, with several frail hacks (the shlex
4175 4180 module is rather limited in 2.2). Thanks to a suggestion by Ville
4176 4181 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
4177 4182 problem.
4178 4183
4179 4184 (Magic.magic_system_verbose): new toggle to print the actual
4180 4185 system calls made by ipython. Mainly for debugging purposes.
4181 4186
4182 4187 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
4183 4188 doesn't support persistence. Reported (and fix suggested) by
4184 4189 Travis Caldwell <travis_caldwell2000@yahoo.com>.
4185 4190
4186 4191 2004-06-26 Fernando Perez <fperez@colorado.edu>
4187 4192
4188 4193 * IPython/Logger.py (Logger.log): fix to handle correctly empty
4189 4194 continue prompts.
4190 4195
4191 4196 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
4192 4197 function (basically a big docstring) and a few more things here to
4193 4198 speedup startup. pysh.py is now very lightweight. We want because
4194 4199 it gets execfile'd, while InterpreterExec gets imported, so
4195 4200 byte-compilation saves time.
4196 4201
4197 4202 2004-06-25 Fernando Perez <fperez@colorado.edu>
4198 4203
4199 4204 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
4200 4205 -NUM', which was recently broken.
4201 4206
4202 4207 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
4203 4208 in multi-line input (but not !!, which doesn't make sense there).
4204 4209
4205 4210 * IPython/UserConfig/ipythonrc: made autoindent on by default.
4206 4211 It's just too useful, and people can turn it off in the less
4207 4212 common cases where it's a problem.
4208 4213
4209 4214 2004-06-24 Fernando Perez <fperez@colorado.edu>
4210 4215
4211 4216 * IPython/iplib.py (InteractiveShell._prefilter): big change -
4212 4217 special syntaxes (like alias calling) is now allied in multi-line
4213 4218 input. This is still _very_ experimental, but it's necessary for
4214 4219 efficient shell usage combining python looping syntax with system
4215 4220 calls. For now it's restricted to aliases, I don't think it
4216 4221 really even makes sense to have this for magics.
4217 4222
4218 4223 2004-06-23 Fernando Perez <fperez@colorado.edu>
4219 4224
4220 4225 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
4221 4226 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
4222 4227
4223 4228 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
4224 4229 extensions under Windows (after code sent by Gary Bishop). The
4225 4230 extensions considered 'executable' are stored in IPython's rc
4226 4231 structure as win_exec_ext.
4227 4232
4228 4233 * IPython/genutils.py (shell): new function, like system() but
4229 4234 without return value. Very useful for interactive shell work.
4230 4235
4231 4236 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
4232 4237 delete aliases.
4233 4238
4234 4239 * IPython/iplib.py (InteractiveShell.alias_table_update): make
4235 4240 sure that the alias table doesn't contain python keywords.
4236 4241
4237 4242 2004-06-21 Fernando Perez <fperez@colorado.edu>
4238 4243
4239 4244 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
4240 4245 non-existent items are found in $PATH. Reported by Thorsten.
4241 4246
4242 4247 2004-06-20 Fernando Perez <fperez@colorado.edu>
4243 4248
4244 4249 * IPython/iplib.py (complete): modified the completer so that the
4245 4250 order of priorities can be easily changed at runtime.
4246 4251
4247 4252 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
4248 4253 Modified to auto-execute all lines beginning with '~', '/' or '.'.
4249 4254
4250 4255 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
4251 4256 expand Python variables prepended with $ in all system calls. The
4252 4257 same was done to InteractiveShell.handle_shell_escape. Now all
4253 4258 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
4254 4259 expansion of python variables and expressions according to the
4255 4260 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
4256 4261
4257 4262 Though PEP-215 has been rejected, a similar (but simpler) one
4258 4263 seems like it will go into Python 2.4, PEP-292 -
4259 4264 http://www.python.org/peps/pep-0292.html.
4260 4265
4261 4266 I'll keep the full syntax of PEP-215, since IPython has since the
4262 4267 start used Ka-Ping Yee's reference implementation discussed there
4263 4268 (Itpl), and I actually like the powerful semantics it offers.
4264 4269
4265 4270 In order to access normal shell variables, the $ has to be escaped
4266 4271 via an extra $. For example:
4267 4272
4268 4273 In [7]: PATH='a python variable'
4269 4274
4270 4275 In [8]: !echo $PATH
4271 4276 a python variable
4272 4277
4273 4278 In [9]: !echo $$PATH
4274 4279 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
4275 4280
4276 4281 (Magic.parse_options): escape $ so the shell doesn't evaluate
4277 4282 things prematurely.
4278 4283
4279 4284 * IPython/iplib.py (InteractiveShell.call_alias): added the
4280 4285 ability for aliases to expand python variables via $.
4281 4286
4282 4287 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
4283 4288 system, now there's a @rehash/@rehashx pair of magics. These work
4284 4289 like the csh rehash command, and can be invoked at any time. They
4285 4290 build a table of aliases to everything in the user's $PATH
4286 4291 (@rehash uses everything, @rehashx is slower but only adds
4287 4292 executable files). With this, the pysh.py-based shell profile can
4288 4293 now simply call rehash upon startup, and full access to all
4289 4294 programs in the user's path is obtained.
4290 4295
4291 4296 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
4292 4297 functionality is now fully in place. I removed the old dynamic
4293 4298 code generation based approach, in favor of a much lighter one
4294 4299 based on a simple dict. The advantage is that this allows me to
4295 4300 now have thousands of aliases with negligible cost (unthinkable
4296 4301 with the old system).
4297 4302
4298 4303 2004-06-19 Fernando Perez <fperez@colorado.edu>
4299 4304
4300 4305 * IPython/iplib.py (__init__): extended MagicCompleter class to
4301 4306 also complete (last in priority) on user aliases.
4302 4307
4303 4308 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
4304 4309 call to eval.
4305 4310 (ItplNS.__init__): Added a new class which functions like Itpl,
4306 4311 but allows configuring the namespace for the evaluation to occur
4307 4312 in.
4308 4313
4309 4314 2004-06-18 Fernando Perez <fperez@colorado.edu>
4310 4315
4311 4316 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
4312 4317 better message when 'exit' or 'quit' are typed (a common newbie
4313 4318 confusion).
4314 4319
4315 4320 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
4316 4321 check for Windows users.
4317 4322
4318 4323 * IPython/iplib.py (InteractiveShell.user_setup): removed
4319 4324 disabling of colors for Windows. I'll test at runtime and issue a
4320 4325 warning if Gary's readline isn't found, as to nudge users to
4321 4326 download it.
4322 4327
4323 4328 2004-06-16 Fernando Perez <fperez@colorado.edu>
4324 4329
4325 4330 * IPython/genutils.py (Stream.__init__): changed to print errors
4326 4331 to sys.stderr. I had a circular dependency here. Now it's
4327 4332 possible to run ipython as IDLE's shell (consider this pre-alpha,
4328 4333 since true stdout things end up in the starting terminal instead
4329 4334 of IDLE's out).
4330 4335
4331 4336 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
4332 4337 users who haven't # updated their prompt_in2 definitions. Remove
4333 4338 eventually.
4334 4339 (multiple_replace): added credit to original ASPN recipe.
4335 4340
4336 4341 2004-06-15 Fernando Perez <fperez@colorado.edu>
4337 4342
4338 4343 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
4339 4344 list of auto-defined aliases.
4340 4345
4341 4346 2004-06-13 Fernando Perez <fperez@colorado.edu>
4342 4347
4343 4348 * setup.py (scriptfiles): Don't trigger win_post_install unless an
4344 4349 install was really requested (so setup.py can be used for other
4345 4350 things under Windows).
4346 4351
4347 4352 2004-06-10 Fernando Perez <fperez@colorado.edu>
4348 4353
4349 4354 * IPython/Logger.py (Logger.create_log): Manually remove any old
4350 4355 backup, since os.remove may fail under Windows. Fixes bug
4351 4356 reported by Thorsten.
4352 4357
4353 4358 2004-06-09 Fernando Perez <fperez@colorado.edu>
4354 4359
4355 4360 * examples/example-embed.py: fixed all references to %n (replaced
4356 4361 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
4357 4362 for all examples and the manual as well.
4358 4363
4359 4364 2004-06-08 Fernando Perez <fperez@colorado.edu>
4360 4365
4361 4366 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
4362 4367 alignment and color management. All 3 prompt subsystems now
4363 4368 inherit from BasePrompt.
4364 4369
4365 4370 * tools/release: updates for windows installer build and tag rpms
4366 4371 with python version (since paths are fixed).
4367 4372
4368 4373 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
4369 4374 which will become eventually obsolete. Also fixed the default
4370 4375 prompt_in2 to use \D, so at least new users start with the correct
4371 4376 defaults.
4372 4377 WARNING: Users with existing ipythonrc files will need to apply
4373 4378 this fix manually!
4374 4379
4375 4380 * setup.py: make windows installer (.exe). This is finally the
4376 4381 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
4377 4382 which I hadn't included because it required Python 2.3 (or recent
4378 4383 distutils).
4379 4384
4380 4385 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
4381 4386 usage of new '\D' escape.
4382 4387
4383 4388 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
4384 4389 lacks os.getuid())
4385 4390 (CachedOutput.set_colors): Added the ability to turn coloring
4386 4391 on/off with @colors even for manually defined prompt colors. It
4387 4392 uses a nasty global, but it works safely and via the generic color
4388 4393 handling mechanism.
4389 4394 (Prompt2.__init__): Introduced new escape '\D' for continuation
4390 4395 prompts. It represents the counter ('\#') as dots.
4391 4396 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
4392 4397 need to update their ipythonrc files and replace '%n' with '\D' in
4393 4398 their prompt_in2 settings everywhere. Sorry, but there's
4394 4399 otherwise no clean way to get all prompts to properly align. The
4395 4400 ipythonrc shipped with IPython has been updated.
4396 4401
4397 4402 2004-06-07 Fernando Perez <fperez@colorado.edu>
4398 4403
4399 4404 * setup.py (isfile): Pass local_icons option to latex2html, so the
4400 4405 resulting HTML file is self-contained. Thanks to
4401 4406 dryice-AT-liu.com.cn for the tip.
4402 4407
4403 4408 * pysh.py: I created a new profile 'shell', which implements a
4404 4409 _rudimentary_ IPython-based shell. This is in NO WAY a realy
4405 4410 system shell, nor will it become one anytime soon. It's mainly
4406 4411 meant to illustrate the use of the new flexible bash-like prompts.
4407 4412 I guess it could be used by hardy souls for true shell management,
4408 4413 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
4409 4414 profile. This uses the InterpreterExec extension provided by
4410 4415 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
4411 4416
4412 4417 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
4413 4418 auto-align itself with the length of the previous input prompt
4414 4419 (taking into account the invisible color escapes).
4415 4420 (CachedOutput.__init__): Large restructuring of this class. Now
4416 4421 all three prompts (primary1, primary2, output) are proper objects,
4417 4422 managed by the 'parent' CachedOutput class. The code is still a
4418 4423 bit hackish (all prompts share state via a pointer to the cache),
4419 4424 but it's overall far cleaner than before.
4420 4425
4421 4426 * IPython/genutils.py (getoutputerror): modified to add verbose,
4422 4427 debug and header options. This makes the interface of all getout*
4423 4428 functions uniform.
4424 4429 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
4425 4430
4426 4431 * IPython/Magic.py (Magic.default_option): added a function to
4427 4432 allow registering default options for any magic command. This
4428 4433 makes it easy to have profiles which customize the magics globally
4429 4434 for a certain use. The values set through this function are
4430 4435 picked up by the parse_options() method, which all magics should
4431 4436 use to parse their options.
4432 4437
4433 4438 * IPython/genutils.py (warn): modified the warnings framework to
4434 4439 use the Term I/O class. I'm trying to slowly unify all of
4435 4440 IPython's I/O operations to pass through Term.
4436 4441
4437 4442 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
4438 4443 the secondary prompt to correctly match the length of the primary
4439 4444 one for any prompt. Now multi-line code will properly line up
4440 4445 even for path dependent prompts, such as the new ones available
4441 4446 via the prompt_specials.
4442 4447
4443 4448 2004-06-06 Fernando Perez <fperez@colorado.edu>
4444 4449
4445 4450 * IPython/Prompts.py (prompt_specials): Added the ability to have
4446 4451 bash-like special sequences in the prompts, which get
4447 4452 automatically expanded. Things like hostname, current working
4448 4453 directory and username are implemented already, but it's easy to
4449 4454 add more in the future. Thanks to a patch by W.J. van der Laan
4450 4455 <gnufnork-AT-hetdigitalegat.nl>
4451 4456 (prompt_specials): Added color support for prompt strings, so
4452 4457 users can define arbitrary color setups for their prompts.
4453 4458
4454 4459 2004-06-05 Fernando Perez <fperez@colorado.edu>
4455 4460
4456 4461 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
4457 4462 code to load Gary Bishop's readline and configure it
4458 4463 automatically. Thanks to Gary for help on this.
4459 4464
4460 4465 2004-06-01 Fernando Perez <fperez@colorado.edu>
4461 4466
4462 4467 * IPython/Logger.py (Logger.create_log): fix bug for logging
4463 4468 with no filename (previous fix was incomplete).
4464 4469
4465 4470 2004-05-25 Fernando Perez <fperez@colorado.edu>
4466 4471
4467 4472 * IPython/Magic.py (Magic.parse_options): fix bug where naked
4468 4473 parens would get passed to the shell.
4469 4474
4470 4475 2004-05-20 Fernando Perez <fperez@colorado.edu>
4471 4476
4472 4477 * IPython/Magic.py (Magic.magic_prun): changed default profile
4473 4478 sort order to 'time' (the more common profiling need).
4474 4479
4475 4480 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
4476 4481 so that source code shown is guaranteed in sync with the file on
4477 4482 disk (also changed in psource). Similar fix to the one for
4478 4483 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
4479 4484 <yann.ledu-AT-noos.fr>.
4480 4485
4481 4486 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
4482 4487 with a single option would not be correctly parsed. Closes
4483 4488 http://www.scipy.net/roundup/ipython/issue14. This bug had been
4484 4489 introduced in 0.6.0 (on 2004-05-06).
4485 4490
4486 4491 2004-05-13 *** Released version 0.6.0
4487 4492
4488 4493 2004-05-13 Fernando Perez <fperez@colorado.edu>
4489 4494
4490 4495 * debian/: Added debian/ directory to CVS, so that debian support
4491 4496 is publicly accessible. The debian package is maintained by Jack
4492 4497 Moffit <jack-AT-xiph.org>.
4493 4498
4494 4499 * Documentation: included the notes about an ipython-based system
4495 4500 shell (the hypothetical 'pysh') into the new_design.pdf document,
4496 4501 so that these ideas get distributed to users along with the
4497 4502 official documentation.
4498 4503
4499 4504 2004-05-10 Fernando Perez <fperez@colorado.edu>
4500 4505
4501 4506 * IPython/Logger.py (Logger.create_log): fix recently introduced
4502 4507 bug (misindented line) where logstart would fail when not given an
4503 4508 explicit filename.
4504 4509
4505 4510 2004-05-09 Fernando Perez <fperez@colorado.edu>
4506 4511
4507 4512 * IPython/Magic.py (Magic.parse_options): skip system call when
4508 4513 there are no options to look for. Faster, cleaner for the common
4509 4514 case.
4510 4515
4511 4516 * Documentation: many updates to the manual: describing Windows
4512 4517 support better, Gnuplot updates, credits, misc small stuff. Also
4513 4518 updated the new_design doc a bit.
4514 4519
4515 4520 2004-05-06 *** Released version 0.6.0.rc1
4516 4521
4517 4522 2004-05-06 Fernando Perez <fperez@colorado.edu>
4518 4523
4519 4524 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
4520 4525 operations to use the vastly more efficient list/''.join() method.
4521 4526 (FormattedTB.text): Fix
4522 4527 http://www.scipy.net/roundup/ipython/issue12 - exception source
4523 4528 extract not updated after reload. Thanks to Mike Salib
4524 4529 <msalib-AT-mit.edu> for pinning the source of the problem.
4525 4530 Fortunately, the solution works inside ipython and doesn't require
4526 4531 any changes to python proper.
4527 4532
4528 4533 * IPython/Magic.py (Magic.parse_options): Improved to process the
4529 4534 argument list as a true shell would (by actually using the
4530 4535 underlying system shell). This way, all @magics automatically get
4531 4536 shell expansion for variables. Thanks to a comment by Alex
4532 4537 Schmolck.
4533 4538
4534 4539 2004-04-04 Fernando Perez <fperez@colorado.edu>
4535 4540
4536 4541 * IPython/iplib.py (InteractiveShell.interact): Added a special
4537 4542 trap for a debugger quit exception, which is basically impossible
4538 4543 to handle by normal mechanisms, given what pdb does to the stack.
4539 4544 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
4540 4545
4541 4546 2004-04-03 Fernando Perez <fperez@colorado.edu>
4542 4547
4543 4548 * IPython/genutils.py (Term): Standardized the names of the Term
4544 4549 class streams to cin/cout/cerr, following C++ naming conventions
4545 4550 (I can't use in/out/err because 'in' is not a valid attribute
4546 4551 name).
4547 4552
4548 4553 * IPython/iplib.py (InteractiveShell.interact): don't increment
4549 4554 the prompt if there's no user input. By Daniel 'Dang' Griffith
4550 4555 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
4551 4556 Francois Pinard.
4552 4557
4553 4558 2004-04-02 Fernando Perez <fperez@colorado.edu>
4554 4559
4555 4560 * IPython/genutils.py (Stream.__init__): Modified to survive at
4556 4561 least importing in contexts where stdin/out/err aren't true file
4557 4562 objects, such as PyCrust (they lack fileno() and mode). However,
4558 4563 the recovery facilities which rely on these things existing will
4559 4564 not work.
4560 4565
4561 4566 2004-04-01 Fernando Perez <fperez@colorado.edu>
4562 4567
4563 4568 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
4564 4569 use the new getoutputerror() function, so it properly
4565 4570 distinguishes stdout/err.
4566 4571
4567 4572 * IPython/genutils.py (getoutputerror): added a function to
4568 4573 capture separately the standard output and error of a command.
4569 4574 After a comment from dang on the mailing lists. This code is
4570 4575 basically a modified version of commands.getstatusoutput(), from
4571 4576 the standard library.
4572 4577
4573 4578 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
4574 4579 '!!' as a special syntax (shorthand) to access @sx.
4575 4580
4576 4581 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
4577 4582 command and return its output as a list split on '\n'.
4578 4583
4579 4584 2004-03-31 Fernando Perez <fperez@colorado.edu>
4580 4585
4581 4586 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
4582 4587 method to dictionaries used as FakeModule instances if they lack
4583 4588 it. At least pydoc in python2.3 breaks for runtime-defined
4584 4589 functions without this hack. At some point I need to _really_
4585 4590 understand what FakeModule is doing, because it's a gross hack.
4586 4591 But it solves Arnd's problem for now...
4587 4592
4588 4593 2004-02-27 Fernando Perez <fperez@colorado.edu>
4589 4594
4590 4595 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
4591 4596 mode would behave erratically. Also increased the number of
4592 4597 possible logs in rotate mod to 999. Thanks to Rod Holland
4593 4598 <rhh@StructureLABS.com> for the report and fixes.
4594 4599
4595 4600 2004-02-26 Fernando Perez <fperez@colorado.edu>
4596 4601
4597 4602 * IPython/genutils.py (page): Check that the curses module really
4598 4603 has the initscr attribute before trying to use it. For some
4599 4604 reason, the Solaris curses module is missing this. I think this
4600 4605 should be considered a Solaris python bug, but I'm not sure.
4601 4606
4602 4607 2004-01-17 Fernando Perez <fperez@colorado.edu>
4603 4608
4604 4609 * IPython/genutils.py (Stream.__init__): Changes to try to make
4605 4610 ipython robust against stdin/out/err being closed by the user.
4606 4611 This is 'user error' (and blocks a normal python session, at least
4607 4612 the stdout case). However, Ipython should be able to survive such
4608 4613 instances of abuse as gracefully as possible. To simplify the
4609 4614 coding and maintain compatibility with Gary Bishop's Term
4610 4615 contributions, I've made use of classmethods for this. I think
4611 4616 this introduces a dependency on python 2.2.
4612 4617
4613 4618 2004-01-13 Fernando Perez <fperez@colorado.edu>
4614 4619
4615 4620 * IPython/numutils.py (exp_safe): simplified the code a bit and
4616 4621 removed the need for importing the kinds module altogether.
4617 4622
4618 4623 2004-01-06 Fernando Perez <fperez@colorado.edu>
4619 4624
4620 4625 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
4621 4626 a magic function instead, after some community feedback. No
4622 4627 special syntax will exist for it, but its name is deliberately
4623 4628 very short.
4624 4629
4625 4630 2003-12-20 Fernando Perez <fperez@colorado.edu>
4626 4631
4627 4632 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
4628 4633 new functionality, to automagically assign the result of a shell
4629 4634 command to a variable. I'll solicit some community feedback on
4630 4635 this before making it permanent.
4631 4636
4632 4637 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
4633 4638 requested about callables for which inspect couldn't obtain a
4634 4639 proper argspec. Thanks to a crash report sent by Etienne
4635 4640 Posthumus <etienne-AT-apple01.cs.vu.nl>.
4636 4641
4637 4642 2003-12-09 Fernando Perez <fperez@colorado.edu>
4638 4643
4639 4644 * IPython/genutils.py (page): patch for the pager to work across
4640 4645 various versions of Windows. By Gary Bishop.
4641 4646
4642 4647 2003-12-04 Fernando Perez <fperez@colorado.edu>
4643 4648
4644 4649 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
4645 4650 Gnuplot.py version 1.7, whose internal names changed quite a bit.
4646 4651 While I tested this and it looks ok, there may still be corner
4647 4652 cases I've missed.
4648 4653
4649 4654 2003-12-01 Fernando Perez <fperez@colorado.edu>
4650 4655
4651 4656 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
4652 4657 where a line like 'p,q=1,2' would fail because the automagic
4653 4658 system would be triggered for @p.
4654 4659
4655 4660 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
4656 4661 cleanups, code unmodified.
4657 4662
4658 4663 * IPython/genutils.py (Term): added a class for IPython to handle
4659 4664 output. In most cases it will just be a proxy for stdout/err, but
4660 4665 having this allows modifications to be made for some platforms,
4661 4666 such as handling color escapes under Windows. All of this code
4662 4667 was contributed by Gary Bishop, with minor modifications by me.
4663 4668 The actual changes affect many files.
4664 4669
4665 4670 2003-11-30 Fernando Perez <fperez@colorado.edu>
4666 4671
4667 4672 * IPython/iplib.py (file_matches): new completion code, courtesy
4668 4673 of Jeff Collins. This enables filename completion again under
4669 4674 python 2.3, which disabled it at the C level.
4670 4675
4671 4676 2003-11-11 Fernando Perez <fperez@colorado.edu>
4672 4677
4673 4678 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
4674 4679 for Numeric.array(map(...)), but often convenient.
4675 4680
4676 4681 2003-11-05 Fernando Perez <fperez@colorado.edu>
4677 4682
4678 4683 * IPython/numutils.py (frange): Changed a call from int() to
4679 4684 int(round()) to prevent a problem reported with arange() in the
4680 4685 numpy list.
4681 4686
4682 4687 2003-10-06 Fernando Perez <fperez@colorado.edu>
4683 4688
4684 4689 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
4685 4690 prevent crashes if sys lacks an argv attribute (it happens with
4686 4691 embedded interpreters which build a bare-bones sys module).
4687 4692 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
4688 4693
4689 4694 2003-09-24 Fernando Perez <fperez@colorado.edu>
4690 4695
4691 4696 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
4692 4697 to protect against poorly written user objects where __getattr__
4693 4698 raises exceptions other than AttributeError. Thanks to a bug
4694 4699 report by Oliver Sander <osander-AT-gmx.de>.
4695 4700
4696 4701 * IPython/FakeModule.py (FakeModule.__repr__): this method was
4697 4702 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
4698 4703
4699 4704 2003-09-09 Fernando Perez <fperez@colorado.edu>
4700 4705
4701 4706 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4702 4707 unpacking a list whith a callable as first element would
4703 4708 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
4704 4709 Collins.
4705 4710
4706 4711 2003-08-25 *** Released version 0.5.0
4707 4712
4708 4713 2003-08-22 Fernando Perez <fperez@colorado.edu>
4709 4714
4710 4715 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
4711 4716 improperly defined user exceptions. Thanks to feedback from Mark
4712 4717 Russell <mrussell-AT-verio.net>.
4713 4718
4714 4719 2003-08-20 Fernando Perez <fperez@colorado.edu>
4715 4720
4716 4721 * IPython/OInspect.py (Inspector.pinfo): changed String Form
4717 4722 printing so that it would print multi-line string forms starting
4718 4723 with a new line. This way the formatting is better respected for
4719 4724 objects which work hard to make nice string forms.
4720 4725
4721 4726 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
4722 4727 autocall would overtake data access for objects with both
4723 4728 __getitem__ and __call__.
4724 4729
4725 4730 2003-08-19 *** Released version 0.5.0-rc1
4726 4731
4727 4732 2003-08-19 Fernando Perez <fperez@colorado.edu>
4728 4733
4729 4734 * IPython/deep_reload.py (load_tail): single tiny change here
4730 4735 seems to fix the long-standing bug of dreload() failing to work
4731 4736 for dotted names. But this module is pretty tricky, so I may have
4732 4737 missed some subtlety. Needs more testing!.
4733 4738
4734 4739 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
4735 4740 exceptions which have badly implemented __str__ methods.
4736 4741 (VerboseTB.text): harden against inspect.getinnerframes crashing,
4737 4742 which I've been getting reports about from Python 2.3 users. I
4738 4743 wish I had a simple test case to reproduce the problem, so I could
4739 4744 either write a cleaner workaround or file a bug report if
4740 4745 necessary.
4741 4746
4742 4747 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
4743 4748 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
4744 4749 a bug report by Tjabo Kloppenburg.
4745 4750
4746 4751 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
4747 4752 crashes. Wrapped the pdb call in a blanket try/except, since pdb
4748 4753 seems rather unstable. Thanks to a bug report by Tjabo
4749 4754 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
4750 4755
4751 4756 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
4752 4757 this out soon because of the critical fixes in the inner loop for
4753 4758 generators.
4754 4759
4755 4760 * IPython/Magic.py (Magic.getargspec): removed. This (and
4756 4761 _get_def) have been obsoleted by OInspect for a long time, I
4757 4762 hadn't noticed that they were dead code.
4758 4763 (Magic._ofind): restored _ofind functionality for a few literals
4759 4764 (those in ["''",'""','[]','{}','()']). But it won't work anymore
4760 4765 for things like "hello".capitalize?, since that would require a
4761 4766 potentially dangerous eval() again.
4762 4767
4763 4768 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
4764 4769 logic a bit more to clean up the escapes handling and minimize the
4765 4770 use of _ofind to only necessary cases. The interactive 'feel' of
4766 4771 IPython should have improved quite a bit with the changes in
4767 4772 _prefilter and _ofind (besides being far safer than before).
4768 4773
4769 4774 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
4770 4775 obscure, never reported). Edit would fail to find the object to
4771 4776 edit under some circumstances.
4772 4777 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
4773 4778 which were causing double-calling of generators. Those eval calls
4774 4779 were _very_ dangerous, since code with side effects could be
4775 4780 triggered. As they say, 'eval is evil'... These were the
4776 4781 nastiest evals in IPython. Besides, _ofind is now far simpler,
4777 4782 and it should also be quite a bit faster. Its use of inspect is
4778 4783 also safer, so perhaps some of the inspect-related crashes I've
4779 4784 seen lately with Python 2.3 might be taken care of. That will
4780 4785 need more testing.
4781 4786
4782 4787 2003-08-17 Fernando Perez <fperez@colorado.edu>
4783 4788
4784 4789 * IPython/iplib.py (InteractiveShell._prefilter): significant
4785 4790 simplifications to the logic for handling user escapes. Faster
4786 4791 and simpler code.
4787 4792
4788 4793 2003-08-14 Fernando Perez <fperez@colorado.edu>
4789 4794
4790 4795 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
4791 4796 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
4792 4797 but it should be quite a bit faster. And the recursive version
4793 4798 generated O(log N) intermediate storage for all rank>1 arrays,
4794 4799 even if they were contiguous.
4795 4800 (l1norm): Added this function.
4796 4801 (norm): Added this function for arbitrary norms (including
4797 4802 l-infinity). l1 and l2 are still special cases for convenience
4798 4803 and speed.
4799 4804
4800 4805 2003-08-03 Fernando Perez <fperez@colorado.edu>
4801 4806
4802 4807 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
4803 4808 exceptions, which now raise PendingDeprecationWarnings in Python
4804 4809 2.3. There were some in Magic and some in Gnuplot2.
4805 4810
4806 4811 2003-06-30 Fernando Perez <fperez@colorado.edu>
4807 4812
4808 4813 * IPython/genutils.py (page): modified to call curses only for
4809 4814 terminals where TERM=='xterm'. After problems under many other
4810 4815 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
4811 4816
4812 4817 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
4813 4818 would be triggered when readline was absent. This was just an old
4814 4819 debugging statement I'd forgotten to take out.
4815 4820
4816 4821 2003-06-20 Fernando Perez <fperez@colorado.edu>
4817 4822
4818 4823 * IPython/genutils.py (clock): modified to return only user time
4819 4824 (not counting system time), after a discussion on scipy. While
4820 4825 system time may be a useful quantity occasionally, it may much
4821 4826 more easily be skewed by occasional swapping or other similar
4822 4827 activity.
4823 4828
4824 4829 2003-06-05 Fernando Perez <fperez@colorado.edu>
4825 4830
4826 4831 * IPython/numutils.py (identity): new function, for building
4827 4832 arbitrary rank Kronecker deltas (mostly backwards compatible with
4828 4833 Numeric.identity)
4829 4834
4830 4835 2003-06-03 Fernando Perez <fperez@colorado.edu>
4831 4836
4832 4837 * IPython/iplib.py (InteractiveShell.handle_magic): protect
4833 4838 arguments passed to magics with spaces, to allow trailing '\' to
4834 4839 work normally (mainly for Windows users).
4835 4840
4836 4841 2003-05-29 Fernando Perez <fperez@colorado.edu>
4837 4842
4838 4843 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
4839 4844 instead of pydoc.help. This fixes a bizarre behavior where
4840 4845 printing '%s' % locals() would trigger the help system. Now
4841 4846 ipython behaves like normal python does.
4842 4847
4843 4848 Note that if one does 'from pydoc import help', the bizarre
4844 4849 behavior returns, but this will also happen in normal python, so
4845 4850 it's not an ipython bug anymore (it has to do with how pydoc.help
4846 4851 is implemented).
4847 4852
4848 4853 2003-05-22 Fernando Perez <fperez@colorado.edu>
4849 4854
4850 4855 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
4851 4856 return [] instead of None when nothing matches, also match to end
4852 4857 of line. Patch by Gary Bishop.
4853 4858
4854 4859 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
4855 4860 protection as before, for files passed on the command line. This
4856 4861 prevents the CrashHandler from kicking in if user files call into
4857 4862 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
4858 4863 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
4859 4864
4860 4865 2003-05-20 *** Released version 0.4.0
4861 4866
4862 4867 2003-05-20 Fernando Perez <fperez@colorado.edu>
4863 4868
4864 4869 * setup.py: added support for manpages. It's a bit hackish b/c of
4865 4870 a bug in the way the bdist_rpm distutils target handles gzipped
4866 4871 manpages, but it works. After a patch by Jack.
4867 4872
4868 4873 2003-05-19 Fernando Perez <fperez@colorado.edu>
4869 4874
4870 4875 * IPython/numutils.py: added a mockup of the kinds module, since
4871 4876 it was recently removed from Numeric. This way, numutils will
4872 4877 work for all users even if they are missing kinds.
4873 4878
4874 4879 * IPython/Magic.py (Magic._ofind): Harden against an inspect
4875 4880 failure, which can occur with SWIG-wrapped extensions. After a
4876 4881 crash report from Prabhu.
4877 4882
4878 4883 2003-05-16 Fernando Perez <fperez@colorado.edu>
4879 4884
4880 4885 * IPython/iplib.py (InteractiveShell.excepthook): New method to
4881 4886 protect ipython from user code which may call directly
4882 4887 sys.excepthook (this looks like an ipython crash to the user, even
4883 4888 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4884 4889 This is especially important to help users of WxWindows, but may
4885 4890 also be useful in other cases.
4886 4891
4887 4892 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
4888 4893 an optional tb_offset to be specified, and to preserve exception
4889 4894 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4890 4895
4891 4896 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
4892 4897
4893 4898 2003-05-15 Fernando Perez <fperez@colorado.edu>
4894 4899
4895 4900 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
4896 4901 installing for a new user under Windows.
4897 4902
4898 4903 2003-05-12 Fernando Perez <fperez@colorado.edu>
4899 4904
4900 4905 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
4901 4906 handler for Emacs comint-based lines. Currently it doesn't do
4902 4907 much (but importantly, it doesn't update the history cache). In
4903 4908 the future it may be expanded if Alex needs more functionality
4904 4909 there.
4905 4910
4906 4911 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
4907 4912 info to crash reports.
4908 4913
4909 4914 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
4910 4915 just like Python's -c. Also fixed crash with invalid -color
4911 4916 option value at startup. Thanks to Will French
4912 4917 <wfrench-AT-bestweb.net> for the bug report.
4913 4918
4914 4919 2003-05-09 Fernando Perez <fperez@colorado.edu>
4915 4920
4916 4921 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
4917 4922 to EvalDict (it's a mapping, after all) and simplified its code
4918 4923 quite a bit, after a nice discussion on c.l.py where Gustavo
4919 4924 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
4920 4925
4921 4926 2003-04-30 Fernando Perez <fperez@colorado.edu>
4922 4927
4923 4928 * IPython/genutils.py (timings_out): modified it to reduce its
4924 4929 overhead in the common reps==1 case.
4925 4930
4926 4931 2003-04-29 Fernando Perez <fperez@colorado.edu>
4927 4932
4928 4933 * IPython/genutils.py (timings_out): Modified to use the resource
4929 4934 module, which avoids the wraparound problems of time.clock().
4930 4935
4931 4936 2003-04-17 *** Released version 0.2.15pre4
4932 4937
4933 4938 2003-04-17 Fernando Perez <fperez@colorado.edu>
4934 4939
4935 4940 * setup.py (scriptfiles): Split windows-specific stuff over to a
4936 4941 separate file, in an attempt to have a Windows GUI installer.
4937 4942 That didn't work, but part of the groundwork is done.
4938 4943
4939 4944 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
4940 4945 indent/unindent with 4 spaces. Particularly useful in combination
4941 4946 with the new auto-indent option.
4942 4947
4943 4948 2003-04-16 Fernando Perez <fperez@colorado.edu>
4944 4949
4945 4950 * IPython/Magic.py: various replacements of self.rc for
4946 4951 self.shell.rc. A lot more remains to be done to fully disentangle
4947 4952 this class from the main Shell class.
4948 4953
4949 4954 * IPython/GnuplotRuntime.py: added checks for mouse support so
4950 4955 that we don't try to enable it if the current gnuplot doesn't
4951 4956 really support it. Also added checks so that we don't try to
4952 4957 enable persist under Windows (where Gnuplot doesn't recognize the
4953 4958 option).
4954 4959
4955 4960 * IPython/iplib.py (InteractiveShell.interact): Added optional
4956 4961 auto-indenting code, after a patch by King C. Shu
4957 4962 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
4958 4963 get along well with pasting indented code. If I ever figure out
4959 4964 how to make that part go well, it will become on by default.
4960 4965
4961 4966 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
4962 4967 crash ipython if there was an unmatched '%' in the user's prompt
4963 4968 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4964 4969
4965 4970 * IPython/iplib.py (InteractiveShell.interact): removed the
4966 4971 ability to ask the user whether he wants to crash or not at the
4967 4972 'last line' exception handler. Calling functions at that point
4968 4973 changes the stack, and the error reports would have incorrect
4969 4974 tracebacks.
4970 4975
4971 4976 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
4972 4977 pass through a peger a pretty-printed form of any object. After a
4973 4978 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
4974 4979
4975 4980 2003-04-14 Fernando Perez <fperez@colorado.edu>
4976 4981
4977 4982 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
4978 4983 all files in ~ would be modified at first install (instead of
4979 4984 ~/.ipython). This could be potentially disastrous, as the
4980 4985 modification (make line-endings native) could damage binary files.
4981 4986
4982 4987 2003-04-10 Fernando Perez <fperez@colorado.edu>
4983 4988
4984 4989 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
4985 4990 handle only lines which are invalid python. This now means that
4986 4991 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
4987 4992 for the bug report.
4988 4993
4989 4994 2003-04-01 Fernando Perez <fperez@colorado.edu>
4990 4995
4991 4996 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
4992 4997 where failing to set sys.last_traceback would crash pdb.pm().
4993 4998 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
4994 4999 report.
4995 5000
4996 5001 2003-03-25 Fernando Perez <fperez@colorado.edu>
4997 5002
4998 5003 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
4999 5004 before printing it (it had a lot of spurious blank lines at the
5000 5005 end).
5001 5006
5002 5007 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
5003 5008 output would be sent 21 times! Obviously people don't use this
5004 5009 too often, or I would have heard about it.
5005 5010
5006 5011 2003-03-24 Fernando Perez <fperez@colorado.edu>
5007 5012
5008 5013 * setup.py (scriptfiles): renamed the data_files parameter from
5009 5014 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
5010 5015 for the patch.
5011 5016
5012 5017 2003-03-20 Fernando Perez <fperez@colorado.edu>
5013 5018
5014 5019 * IPython/genutils.py (error): added error() and fatal()
5015 5020 functions.
5016 5021
5017 5022 2003-03-18 *** Released version 0.2.15pre3
5018 5023
5019 5024 2003-03-18 Fernando Perez <fperez@colorado.edu>
5020 5025
5021 5026 * setupext/install_data_ext.py
5022 5027 (install_data_ext.initialize_options): Class contributed by Jack
5023 5028 Moffit for fixing the old distutils hack. He is sending this to
5024 5029 the distutils folks so in the future we may not need it as a
5025 5030 private fix.
5026 5031
5027 5032 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
5028 5033 changes for Debian packaging. See his patch for full details.
5029 5034 The old distutils hack of making the ipythonrc* files carry a
5030 5035 bogus .py extension is gone, at last. Examples were moved to a
5031 5036 separate subdir under doc/, and the separate executable scripts
5032 5037 now live in their own directory. Overall a great cleanup. The
5033 5038 manual was updated to use the new files, and setup.py has been
5034 5039 fixed for this setup.
5035 5040
5036 5041 * IPython/PyColorize.py (Parser.usage): made non-executable and
5037 5042 created a pycolor wrapper around it to be included as a script.
5038 5043
5039 5044 2003-03-12 *** Released version 0.2.15pre2
5040 5045
5041 5046 2003-03-12 Fernando Perez <fperez@colorado.edu>
5042 5047
5043 5048 * IPython/ColorANSI.py (make_color_table): Finally fixed the
5044 5049 long-standing problem with garbage characters in some terminals.
5045 5050 The issue was really that the \001 and \002 escapes must _only_ be
5046 5051 passed to input prompts (which call readline), but _never_ to
5047 5052 normal text to be printed on screen. I changed ColorANSI to have
5048 5053 two classes: TermColors and InputTermColors, each with the
5049 5054 appropriate escapes for input prompts or normal text. The code in
5050 5055 Prompts.py got slightly more complicated, but this very old and
5051 5056 annoying bug is finally fixed.
5052 5057
5053 5058 All the credit for nailing down the real origin of this problem
5054 5059 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
5055 5060 *Many* thanks to him for spending quite a bit of effort on this.
5056 5061
5057 5062 2003-03-05 *** Released version 0.2.15pre1
5058 5063
5059 5064 2003-03-03 Fernando Perez <fperez@colorado.edu>
5060 5065
5061 5066 * IPython/FakeModule.py: Moved the former _FakeModule to a
5062 5067 separate file, because it's also needed by Magic (to fix a similar
5063 5068 pickle-related issue in @run).
5064 5069
5065 5070 2003-03-02 Fernando Perez <fperez@colorado.edu>
5066 5071
5067 5072 * IPython/Magic.py (Magic.magic_autocall): new magic to control
5068 5073 the autocall option at runtime.
5069 5074 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
5070 5075 across Magic.py to start separating Magic from InteractiveShell.
5071 5076 (Magic._ofind): Fixed to return proper namespace for dotted
5072 5077 names. Before, a dotted name would always return 'not currently
5073 5078 defined', because it would find the 'parent'. s.x would be found,
5074 5079 but since 'x' isn't defined by itself, it would get confused.
5075 5080 (Magic.magic_run): Fixed pickling problems reported by Ralf
5076 5081 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
5077 5082 that I'd used when Mike Heeter reported similar issues at the
5078 5083 top-level, but now for @run. It boils down to injecting the
5079 5084 namespace where code is being executed with something that looks
5080 5085 enough like a module to fool pickle.dump(). Since a pickle stores
5081 5086 a named reference to the importing module, we need this for
5082 5087 pickles to save something sensible.
5083 5088
5084 5089 * IPython/ipmaker.py (make_IPython): added an autocall option.
5085 5090
5086 5091 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
5087 5092 the auto-eval code. Now autocalling is an option, and the code is
5088 5093 also vastly safer. There is no more eval() involved at all.
5089 5094
5090 5095 2003-03-01 Fernando Perez <fperez@colorado.edu>
5091 5096
5092 5097 * IPython/Magic.py (Magic._ofind): Changed interface to return a
5093 5098 dict with named keys instead of a tuple.
5094 5099
5095 5100 * IPython: Started using CVS for IPython as of 0.2.15pre1.
5096 5101
5097 5102 * setup.py (make_shortcut): Fixed message about directories
5098 5103 created during Windows installation (the directories were ok, just
5099 5104 the printed message was misleading). Thanks to Chris Liechti
5100 5105 <cliechti-AT-gmx.net> for the heads up.
5101 5106
5102 5107 2003-02-21 Fernando Perez <fperez@colorado.edu>
5103 5108
5104 5109 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
5105 5110 of ValueError exception when checking for auto-execution. This
5106 5111 one is raised by things like Numeric arrays arr.flat when the
5107 5112 array is non-contiguous.
5108 5113
5109 5114 2003-01-31 Fernando Perez <fperez@colorado.edu>
5110 5115
5111 5116 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
5112 5117 not return any value at all (even though the command would get
5113 5118 executed).
5114 5119 (xsys): Flush stdout right after printing the command to ensure
5115 5120 proper ordering of commands and command output in the total
5116 5121 output.
5117 5122 (SystemExec/xsys/bq): Switched the names of xsys/bq and
5118 5123 system/getoutput as defaults. The old ones are kept for
5119 5124 compatibility reasons, so no code which uses this library needs
5120 5125 changing.
5121 5126
5122 5127 2003-01-27 *** Released version 0.2.14
5123 5128
5124 5129 2003-01-25 Fernando Perez <fperez@colorado.edu>
5125 5130
5126 5131 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
5127 5132 functions defined in previous edit sessions could not be re-edited
5128 5133 (because the temp files were immediately removed). Now temp files
5129 5134 are removed only at IPython's exit.
5130 5135 (Magic.magic_run): Improved @run to perform shell-like expansions
5131 5136 on its arguments (~users and $VARS). With this, @run becomes more
5132 5137 like a normal command-line.
5133 5138
5134 5139 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
5135 5140 bugs related to embedding and cleaned up that code. A fairly
5136 5141 important one was the impossibility to access the global namespace
5137 5142 through the embedded IPython (only local variables were visible).
5138 5143
5139 5144 2003-01-14 Fernando Perez <fperez@colorado.edu>
5140 5145
5141 5146 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
5142 5147 auto-calling to be a bit more conservative. Now it doesn't get
5143 5148 triggered if any of '!=()<>' are in the rest of the input line, to
5144 5149 allow comparing callables. Thanks to Alex for the heads up.
5145 5150
5146 5151 2003-01-07 Fernando Perez <fperez@colorado.edu>
5147 5152
5148 5153 * IPython/genutils.py (page): fixed estimation of the number of
5149 5154 lines in a string to be paged to simply count newlines. This
5150 5155 prevents over-guessing due to embedded escape sequences. A better
5151 5156 long-term solution would involve stripping out the control chars
5152 5157 for the count, but it's potentially so expensive I just don't
5153 5158 think it's worth doing.
5154 5159
5155 5160 2002-12-19 *** Released version 0.2.14pre50
5156 5161
5157 5162 2002-12-19 Fernando Perez <fperez@colorado.edu>
5158 5163
5159 5164 * tools/release (version): Changed release scripts to inform
5160 5165 Andrea and build a NEWS file with a list of recent changes.
5161 5166
5162 5167 * IPython/ColorANSI.py (__all__): changed terminal detection
5163 5168 code. Seems to work better for xterms without breaking
5164 5169 konsole. Will need more testing to determine if WinXP and Mac OSX
5165 5170 also work ok.
5166 5171
5167 5172 2002-12-18 *** Released version 0.2.14pre49
5168 5173
5169 5174 2002-12-18 Fernando Perez <fperez@colorado.edu>
5170 5175
5171 5176 * Docs: added new info about Mac OSX, from Andrea.
5172 5177
5173 5178 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
5174 5179 allow direct plotting of python strings whose format is the same
5175 5180 of gnuplot data files.
5176 5181
5177 5182 2002-12-16 Fernando Perez <fperez@colorado.edu>
5178 5183
5179 5184 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
5180 5185 value of exit question to be acknowledged.
5181 5186
5182 5187 2002-12-03 Fernando Perez <fperez@colorado.edu>
5183 5188
5184 5189 * IPython/ipmaker.py: removed generators, which had been added
5185 5190 by mistake in an earlier debugging run. This was causing trouble
5186 5191 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
5187 5192 for pointing this out.
5188 5193
5189 5194 2002-11-17 Fernando Perez <fperez@colorado.edu>
5190 5195
5191 5196 * Manual: updated the Gnuplot section.
5192 5197
5193 5198 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
5194 5199 a much better split of what goes in Runtime and what goes in
5195 5200 Interactive.
5196 5201
5197 5202 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
5198 5203 being imported from iplib.
5199 5204
5200 5205 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
5201 5206 for command-passing. Now the global Gnuplot instance is called
5202 5207 'gp' instead of 'g', which was really a far too fragile and
5203 5208 common name.
5204 5209
5205 5210 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
5206 5211 bounding boxes generated by Gnuplot for square plots.
5207 5212
5208 5213 * IPython/genutils.py (popkey): new function added. I should
5209 5214 suggest this on c.l.py as a dict method, it seems useful.
5210 5215
5211 5216 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
5212 5217 to transparently handle PostScript generation. MUCH better than
5213 5218 the previous plot_eps/replot_eps (which I removed now). The code
5214 5219 is also fairly clean and well documented now (including
5215 5220 docstrings).
5216 5221
5217 5222 2002-11-13 Fernando Perez <fperez@colorado.edu>
5218 5223
5219 5224 * IPython/Magic.py (Magic.magic_edit): fixed docstring
5220 5225 (inconsistent with options).
5221 5226
5222 5227 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
5223 5228 manually disabled, I don't know why. Fixed it.
5224 5229 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
5225 5230 eps output.
5226 5231
5227 5232 2002-11-12 Fernando Perez <fperez@colorado.edu>
5228 5233
5229 5234 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
5230 5235 don't propagate up to caller. Fixes crash reported by François
5231 5236 Pinard.
5232 5237
5233 5238 2002-11-09 Fernando Perez <fperez@colorado.edu>
5234 5239
5235 5240 * IPython/ipmaker.py (make_IPython): fixed problem with writing
5236 5241 history file for new users.
5237 5242 (make_IPython): fixed bug where initial install would leave the
5238 5243 user running in the .ipython dir.
5239 5244 (make_IPython): fixed bug where config dir .ipython would be
5240 5245 created regardless of the given -ipythondir option. Thanks to Cory
5241 5246 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
5242 5247
5243 5248 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
5244 5249 type confirmations. Will need to use it in all of IPython's code
5245 5250 consistently.
5246 5251
5247 5252 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
5248 5253 context to print 31 lines instead of the default 5. This will make
5249 5254 the crash reports extremely detailed in case the problem is in
5250 5255 libraries I don't have access to.
5251 5256
5252 5257 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
5253 5258 line of defense' code to still crash, but giving users fair
5254 5259 warning. I don't want internal errors to go unreported: if there's
5255 5260 an internal problem, IPython should crash and generate a full
5256 5261 report.
5257 5262
5258 5263 2002-11-08 Fernando Perez <fperez@colorado.edu>
5259 5264
5260 5265 * IPython/iplib.py (InteractiveShell.interact): added code to trap
5261 5266 otherwise uncaught exceptions which can appear if people set
5262 5267 sys.stdout to something badly broken. Thanks to a crash report
5263 5268 from henni-AT-mail.brainbot.com.
5264 5269
5265 5270 2002-11-04 Fernando Perez <fperez@colorado.edu>
5266 5271
5267 5272 * IPython/iplib.py (InteractiveShell.interact): added
5268 5273 __IPYTHON__active to the builtins. It's a flag which goes on when
5269 5274 the interaction starts and goes off again when it stops. This
5270 5275 allows embedding code to detect being inside IPython. Before this
5271 5276 was done via __IPYTHON__, but that only shows that an IPython
5272 5277 instance has been created.
5273 5278
5274 5279 * IPython/Magic.py (Magic.magic_env): I realized that in a
5275 5280 UserDict, instance.data holds the data as a normal dict. So I
5276 5281 modified @env to return os.environ.data instead of rebuilding a
5277 5282 dict by hand.
5278 5283
5279 5284 2002-11-02 Fernando Perez <fperez@colorado.edu>
5280 5285
5281 5286 * IPython/genutils.py (warn): changed so that level 1 prints no
5282 5287 header. Level 2 is now the default (with 'WARNING' header, as
5283 5288 before). I think I tracked all places where changes were needed in
5284 5289 IPython, but outside code using the old level numbering may have
5285 5290 broken.
5286 5291
5287 5292 * IPython/iplib.py (InteractiveShell.runcode): added this to
5288 5293 handle the tracebacks in SystemExit traps correctly. The previous
5289 5294 code (through interact) was printing more of the stack than
5290 5295 necessary, showing IPython internal code to the user.
5291 5296
5292 5297 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
5293 5298 default. Now that the default at the confirmation prompt is yes,
5294 5299 it's not so intrusive. François' argument that ipython sessions
5295 5300 tend to be complex enough not to lose them from an accidental C-d,
5296 5301 is a valid one.
5297 5302
5298 5303 * IPython/iplib.py (InteractiveShell.interact): added a
5299 5304 showtraceback() call to the SystemExit trap, and modified the exit
5300 5305 confirmation to have yes as the default.
5301 5306
5302 5307 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
5303 5308 this file. It's been gone from the code for a long time, this was
5304 5309 simply leftover junk.
5305 5310
5306 5311 2002-11-01 Fernando Perez <fperez@colorado.edu>
5307 5312
5308 5313 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
5309 5314 added. If set, IPython now traps EOF and asks for
5310 5315 confirmation. After a request by François Pinard.
5311 5316
5312 5317 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
5313 5318 of @abort, and with a new (better) mechanism for handling the
5314 5319 exceptions.
5315 5320
5316 5321 2002-10-27 Fernando Perez <fperez@colorado.edu>
5317 5322
5318 5323 * IPython/usage.py (__doc__): updated the --help information and
5319 5324 the ipythonrc file to indicate that -log generates
5320 5325 ./ipython.log. Also fixed the corresponding info in @logstart.
5321 5326 This and several other fixes in the manuals thanks to reports by
5322 5327 François Pinard <pinard-AT-iro.umontreal.ca>.
5323 5328
5324 5329 * IPython/Logger.py (Logger.switch_log): Fixed error message to
5325 5330 refer to @logstart (instead of @log, which doesn't exist).
5326 5331
5327 5332 * IPython/iplib.py (InteractiveShell._prefilter): fixed
5328 5333 AttributeError crash. Thanks to Christopher Armstrong
5329 5334 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
5330 5335 introduced recently (in 0.2.14pre37) with the fix to the eval
5331 5336 problem mentioned below.
5332 5337
5333 5338 2002-10-17 Fernando Perez <fperez@colorado.edu>
5334 5339
5335 5340 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
5336 5341 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
5337 5342
5338 5343 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
5339 5344 this function to fix a problem reported by Alex Schmolck. He saw
5340 5345 it with list comprehensions and generators, which were getting
5341 5346 called twice. The real problem was an 'eval' call in testing for
5342 5347 automagic which was evaluating the input line silently.
5343 5348
5344 5349 This is a potentially very nasty bug, if the input has side
5345 5350 effects which must not be repeated. The code is much cleaner now,
5346 5351 without any blanket 'except' left and with a regexp test for
5347 5352 actual function names.
5348 5353
5349 5354 But an eval remains, which I'm not fully comfortable with. I just
5350 5355 don't know how to find out if an expression could be a callable in
5351 5356 the user's namespace without doing an eval on the string. However
5352 5357 that string is now much more strictly checked so that no code
5353 5358 slips by, so the eval should only happen for things that can
5354 5359 really be only function/method names.
5355 5360
5356 5361 2002-10-15 Fernando Perez <fperez@colorado.edu>
5357 5362
5358 5363 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
5359 5364 OSX information to main manual, removed README_Mac_OSX file from
5360 5365 distribution. Also updated credits for recent additions.
5361 5366
5362 5367 2002-10-10 Fernando Perez <fperez@colorado.edu>
5363 5368
5364 5369 * README_Mac_OSX: Added a README for Mac OSX users for fixing
5365 5370 terminal-related issues. Many thanks to Andrea Riciputi
5366 5371 <andrea.riciputi-AT-libero.it> for writing it.
5367 5372
5368 5373 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
5369 5374 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5370 5375
5371 5376 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
5372 5377 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
5373 5378 <syver-en-AT-online.no> who both submitted patches for this problem.
5374 5379
5375 5380 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
5376 5381 global embedding to make sure that things don't overwrite user
5377 5382 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
5378 5383
5379 5384 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
5380 5385 compatibility. Thanks to Hayden Callow
5381 5386 <h.callow-AT-elec.canterbury.ac.nz>
5382 5387
5383 5388 2002-10-04 Fernando Perez <fperez@colorado.edu>
5384 5389
5385 5390 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
5386 5391 Gnuplot.File objects.
5387 5392
5388 5393 2002-07-23 Fernando Perez <fperez@colorado.edu>
5389 5394
5390 5395 * IPython/genutils.py (timing): Added timings() and timing() for
5391 5396 quick access to the most commonly needed data, the execution
5392 5397 times. Old timing() renamed to timings_out().
5393 5398
5394 5399 2002-07-18 Fernando Perez <fperez@colorado.edu>
5395 5400
5396 5401 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
5397 5402 bug with nested instances disrupting the parent's tab completion.
5398 5403
5399 5404 * IPython/iplib.py (all_completions): Added Alex Schmolck's
5400 5405 all_completions code to begin the emacs integration.
5401 5406
5402 5407 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
5403 5408 argument to allow titling individual arrays when plotting.
5404 5409
5405 5410 2002-07-15 Fernando Perez <fperez@colorado.edu>
5406 5411
5407 5412 * setup.py (make_shortcut): changed to retrieve the value of
5408 5413 'Program Files' directory from the registry (this value changes in
5409 5414 non-english versions of Windows). Thanks to Thomas Fanslau
5410 5415 <tfanslau-AT-gmx.de> for the report.
5411 5416
5412 5417 2002-07-10 Fernando Perez <fperez@colorado.edu>
5413 5418
5414 5419 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
5415 5420 a bug in pdb, which crashes if a line with only whitespace is
5416 5421 entered. Bug report submitted to sourceforge.
5417 5422
5418 5423 2002-07-09 Fernando Perez <fperez@colorado.edu>
5419 5424
5420 5425 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
5421 5426 reporting exceptions (it's a bug in inspect.py, I just set a
5422 5427 workaround).
5423 5428
5424 5429 2002-07-08 Fernando Perez <fperez@colorado.edu>
5425 5430
5426 5431 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
5427 5432 __IPYTHON__ in __builtins__ to show up in user_ns.
5428 5433
5429 5434 2002-07-03 Fernando Perez <fperez@colorado.edu>
5430 5435
5431 5436 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
5432 5437 name from @gp_set_instance to @gp_set_default.
5433 5438
5434 5439 * IPython/ipmaker.py (make_IPython): default editor value set to
5435 5440 '0' (a string), to match the rc file. Otherwise will crash when
5436 5441 .strip() is called on it.
5437 5442
5438 5443
5439 5444 2002-06-28 Fernando Perez <fperez@colorado.edu>
5440 5445
5441 5446 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
5442 5447 of files in current directory when a file is executed via
5443 5448 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
5444 5449
5445 5450 * setup.py (manfiles): fix for rpm builds, submitted by RA
5446 5451 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
5447 5452
5448 5453 * IPython/ipmaker.py (make_IPython): fixed lookup of default
5449 5454 editor when set to '0'. Problem was, '0' evaluates to True (it's a
5450 5455 string!). A. Schmolck caught this one.
5451 5456
5452 5457 2002-06-27 Fernando Perez <fperez@colorado.edu>
5453 5458
5454 5459 * IPython/ipmaker.py (make_IPython): fixed bug when running user
5455 5460 defined files at the cmd line. __name__ wasn't being set to
5456 5461 __main__.
5457 5462
5458 5463 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
5459 5464 regular lists and tuples besides Numeric arrays.
5460 5465
5461 5466 * IPython/Prompts.py (CachedOutput.__call__): Added output
5462 5467 supression for input ending with ';'. Similar to Mathematica and
5463 5468 Matlab. The _* vars and Out[] list are still updated, just like
5464 5469 Mathematica behaves.
5465 5470
5466 5471 2002-06-25 Fernando Perez <fperez@colorado.edu>
5467 5472
5468 5473 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
5469 5474 .ini extensions for profiels under Windows.
5470 5475
5471 5476 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
5472 5477 string form. Fix contributed by Alexander Schmolck
5473 5478 <a.schmolck-AT-gmx.net>
5474 5479
5475 5480 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
5476 5481 pre-configured Gnuplot instance.
5477 5482
5478 5483 2002-06-21 Fernando Perez <fperez@colorado.edu>
5479 5484
5480 5485 * IPython/numutils.py (exp_safe): new function, works around the
5481 5486 underflow problems in Numeric.
5482 5487 (log2): New fn. Safe log in base 2: returns exact integer answer
5483 5488 for exact integer powers of 2.
5484 5489
5485 5490 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
5486 5491 properly.
5487 5492
5488 5493 2002-06-20 Fernando Perez <fperez@colorado.edu>
5489 5494
5490 5495 * IPython/genutils.py (timing): new function like
5491 5496 Mathematica's. Similar to time_test, but returns more info.
5492 5497
5493 5498 2002-06-18 Fernando Perez <fperez@colorado.edu>
5494 5499
5495 5500 * IPython/Magic.py (Magic.magic_save): modified @save and @r
5496 5501 according to Mike Heeter's suggestions.
5497 5502
5498 5503 2002-06-16 Fernando Perez <fperez@colorado.edu>
5499 5504
5500 5505 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
5501 5506 system. GnuplotMagic is gone as a user-directory option. New files
5502 5507 make it easier to use all the gnuplot stuff both from external
5503 5508 programs as well as from IPython. Had to rewrite part of
5504 5509 hardcopy() b/c of a strange bug: often the ps files simply don't
5505 5510 get created, and require a repeat of the command (often several
5506 5511 times).
5507 5512
5508 5513 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
5509 5514 resolve output channel at call time, so that if sys.stderr has
5510 5515 been redirected by user this gets honored.
5511 5516
5512 5517 2002-06-13 Fernando Perez <fperez@colorado.edu>
5513 5518
5514 5519 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
5515 5520 IPShell. Kept a copy with the old names to avoid breaking people's
5516 5521 embedded code.
5517 5522
5518 5523 * IPython/ipython: simplified it to the bare minimum after
5519 5524 Holger's suggestions. Added info about how to use it in
5520 5525 PYTHONSTARTUP.
5521 5526
5522 5527 * IPython/Shell.py (IPythonShell): changed the options passing
5523 5528 from a string with funky %s replacements to a straight list. Maybe
5524 5529 a bit more typing, but it follows sys.argv conventions, so there's
5525 5530 less special-casing to remember.
5526 5531
5527 5532 2002-06-12 Fernando Perez <fperez@colorado.edu>
5528 5533
5529 5534 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
5530 5535 command. Thanks to a suggestion by Mike Heeter.
5531 5536 (Magic.magic_pfile): added behavior to look at filenames if given
5532 5537 arg is not a defined object.
5533 5538 (Magic.magic_save): New @save function to save code snippets. Also
5534 5539 a Mike Heeter idea.
5535 5540
5536 5541 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
5537 5542 plot() and replot(). Much more convenient now, especially for
5538 5543 interactive use.
5539 5544
5540 5545 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
5541 5546 filenames.
5542 5547
5543 5548 2002-06-02 Fernando Perez <fperez@colorado.edu>
5544 5549
5545 5550 * IPython/Struct.py (Struct.__init__): modified to admit
5546 5551 initialization via another struct.
5547 5552
5548 5553 * IPython/genutils.py (SystemExec.__init__): New stateful
5549 5554 interface to xsys and bq. Useful for writing system scripts.
5550 5555
5551 5556 2002-05-30 Fernando Perez <fperez@colorado.edu>
5552 5557
5553 5558 * MANIFEST.in: Changed docfile selection to exclude all the lyx
5554 5559 documents. This will make the user download smaller (it's getting
5555 5560 too big).
5556 5561
5557 5562 2002-05-29 Fernando Perez <fperez@colorado.edu>
5558 5563
5559 5564 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
5560 5565 fix problems with shelve and pickle. Seems to work, but I don't
5561 5566 know if corner cases break it. Thanks to Mike Heeter
5562 5567 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
5563 5568
5564 5569 2002-05-24 Fernando Perez <fperez@colorado.edu>
5565 5570
5566 5571 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
5567 5572 macros having broken.
5568 5573
5569 5574 2002-05-21 Fernando Perez <fperez@colorado.edu>
5570 5575
5571 5576 * IPython/Magic.py (Magic.magic_logstart): fixed recently
5572 5577 introduced logging bug: all history before logging started was
5573 5578 being written one character per line! This came from the redesign
5574 5579 of the input history as a special list which slices to strings,
5575 5580 not to lists.
5576 5581
5577 5582 2002-05-20 Fernando Perez <fperez@colorado.edu>
5578 5583
5579 5584 * IPython/Prompts.py (CachedOutput.__init__): made the color table
5580 5585 be an attribute of all classes in this module. The design of these
5581 5586 classes needs some serious overhauling.
5582 5587
5583 5588 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
5584 5589 which was ignoring '_' in option names.
5585 5590
5586 5591 * IPython/ultraTB.py (FormattedTB.__init__): Changed
5587 5592 'Verbose_novars' to 'Context' and made it the new default. It's a
5588 5593 bit more readable and also safer than verbose.
5589 5594
5590 5595 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
5591 5596 triple-quoted strings.
5592 5597
5593 5598 * IPython/OInspect.py (__all__): new module exposing the object
5594 5599 introspection facilities. Now the corresponding magics are dummy
5595 5600 wrappers around this. Having this module will make it much easier
5596 5601 to put these functions into our modified pdb.
5597 5602 This new object inspector system uses the new colorizing module,
5598 5603 so source code and other things are nicely syntax highlighted.
5599 5604
5600 5605 2002-05-18 Fernando Perez <fperez@colorado.edu>
5601 5606
5602 5607 * IPython/ColorANSI.py: Split the coloring tools into a separate
5603 5608 module so I can use them in other code easier (they were part of
5604 5609 ultraTB).
5605 5610
5606 5611 2002-05-17 Fernando Perez <fperez@colorado.edu>
5607 5612
5608 5613 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5609 5614 fixed it to set the global 'g' also to the called instance, as
5610 5615 long as 'g' was still a gnuplot instance (so it doesn't overwrite
5611 5616 user's 'g' variables).
5612 5617
5613 5618 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
5614 5619 global variables (aliases to _ih,_oh) so that users which expect
5615 5620 In[5] or Out[7] to work aren't unpleasantly surprised.
5616 5621 (InputList.__getslice__): new class to allow executing slices of
5617 5622 input history directly. Very simple class, complements the use of
5618 5623 macros.
5619 5624
5620 5625 2002-05-16 Fernando Perez <fperez@colorado.edu>
5621 5626
5622 5627 * setup.py (docdirbase): make doc directory be just doc/IPython
5623 5628 without version numbers, it will reduce clutter for users.
5624 5629
5625 5630 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
5626 5631 execfile call to prevent possible memory leak. See for details:
5627 5632 http://mail.python.org/pipermail/python-list/2002-February/088476.html
5628 5633
5629 5634 2002-05-15 Fernando Perez <fperez@colorado.edu>
5630 5635
5631 5636 * IPython/Magic.py (Magic.magic_psource): made the object
5632 5637 introspection names be more standard: pdoc, pdef, pfile and
5633 5638 psource. They all print/page their output, and it makes
5634 5639 remembering them easier. Kept old names for compatibility as
5635 5640 aliases.
5636 5641
5637 5642 2002-05-14 Fernando Perez <fperez@colorado.edu>
5638 5643
5639 5644 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
5640 5645 what the mouse problem was. The trick is to use gnuplot with temp
5641 5646 files and NOT with pipes (for data communication), because having
5642 5647 both pipes and the mouse on is bad news.
5643 5648
5644 5649 2002-05-13 Fernando Perez <fperez@colorado.edu>
5645 5650
5646 5651 * IPython/Magic.py (Magic._ofind): fixed namespace order search
5647 5652 bug. Information would be reported about builtins even when
5648 5653 user-defined functions overrode them.
5649 5654
5650 5655 2002-05-11 Fernando Perez <fperez@colorado.edu>
5651 5656
5652 5657 * IPython/__init__.py (__all__): removed FlexCompleter from
5653 5658 __all__ so that things don't fail in platforms without readline.
5654 5659
5655 5660 2002-05-10 Fernando Perez <fperez@colorado.edu>
5656 5661
5657 5662 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
5658 5663 it requires Numeric, effectively making Numeric a dependency for
5659 5664 IPython.
5660 5665
5661 5666 * Released 0.2.13
5662 5667
5663 5668 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
5664 5669 profiler interface. Now all the major options from the profiler
5665 5670 module are directly supported in IPython, both for single
5666 5671 expressions (@prun) and for full programs (@run -p).
5667 5672
5668 5673 2002-05-09 Fernando Perez <fperez@colorado.edu>
5669 5674
5670 5675 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
5671 5676 magic properly formatted for screen.
5672 5677
5673 5678 * setup.py (make_shortcut): Changed things to put pdf version in
5674 5679 doc/ instead of doc/manual (had to change lyxport a bit).
5675 5680
5676 5681 * IPython/Magic.py (Profile.string_stats): made profile runs go
5677 5682 through pager (they are long and a pager allows searching, saving,
5678 5683 etc.)
5679 5684
5680 5685 2002-05-08 Fernando Perez <fperez@colorado.edu>
5681 5686
5682 5687 * Released 0.2.12
5683 5688
5684 5689 2002-05-06 Fernando Perez <fperez@colorado.edu>
5685 5690
5686 5691 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
5687 5692 introduced); 'hist n1 n2' was broken.
5688 5693 (Magic.magic_pdb): added optional on/off arguments to @pdb
5689 5694 (Magic.magic_run): added option -i to @run, which executes code in
5690 5695 the IPython namespace instead of a clean one. Also added @irun as
5691 5696 an alias to @run -i.
5692 5697
5693 5698 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5694 5699 fixed (it didn't really do anything, the namespaces were wrong).
5695 5700
5696 5701 * IPython/Debugger.py (__init__): Added workaround for python 2.1
5697 5702
5698 5703 * IPython/__init__.py (__all__): Fixed package namespace, now
5699 5704 'import IPython' does give access to IPython.<all> as
5700 5705 expected. Also renamed __release__ to Release.
5701 5706
5702 5707 * IPython/Debugger.py (__license__): created new Pdb class which
5703 5708 functions like a drop-in for the normal pdb.Pdb but does NOT
5704 5709 import readline by default. This way it doesn't muck up IPython's
5705 5710 readline handling, and now tab-completion finally works in the
5706 5711 debugger -- sort of. It completes things globally visible, but the
5707 5712 completer doesn't track the stack as pdb walks it. That's a bit
5708 5713 tricky, and I'll have to implement it later.
5709 5714
5710 5715 2002-05-05 Fernando Perez <fperez@colorado.edu>
5711 5716
5712 5717 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
5713 5718 magic docstrings when printed via ? (explicit \'s were being
5714 5719 printed).
5715 5720
5716 5721 * IPython/ipmaker.py (make_IPython): fixed namespace
5717 5722 identification bug. Now variables loaded via logs or command-line
5718 5723 files are recognized in the interactive namespace by @who.
5719 5724
5720 5725 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
5721 5726 log replay system stemming from the string form of Structs.
5722 5727
5723 5728 * IPython/Magic.py (Macro.__init__): improved macros to properly
5724 5729 handle magic commands in them.
5725 5730 (Magic.magic_logstart): usernames are now expanded so 'logstart
5726 5731 ~/mylog' now works.
5727 5732
5728 5733 * IPython/iplib.py (complete): fixed bug where paths starting with
5729 5734 '/' would be completed as magic names.
5730 5735
5731 5736 2002-05-04 Fernando Perez <fperez@colorado.edu>
5732 5737
5733 5738 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
5734 5739 allow running full programs under the profiler's control.
5735 5740
5736 5741 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
5737 5742 mode to report exceptions verbosely but without formatting
5738 5743 variables. This addresses the issue of ipython 'freezing' (it's
5739 5744 not frozen, but caught in an expensive formatting loop) when huge
5740 5745 variables are in the context of an exception.
5741 5746 (VerboseTB.text): Added '--->' markers at line where exception was
5742 5747 triggered. Much clearer to read, especially in NoColor modes.
5743 5748
5744 5749 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
5745 5750 implemented in reverse when changing to the new parse_options().
5746 5751
5747 5752 2002-05-03 Fernando Perez <fperez@colorado.edu>
5748 5753
5749 5754 * IPython/Magic.py (Magic.parse_options): new function so that
5750 5755 magics can parse options easier.
5751 5756 (Magic.magic_prun): new function similar to profile.run(),
5752 5757 suggested by Chris Hart.
5753 5758 (Magic.magic_cd): fixed behavior so that it only changes if
5754 5759 directory actually is in history.
5755 5760
5756 5761 * IPython/usage.py (__doc__): added information about potential
5757 5762 slowness of Verbose exception mode when there are huge data
5758 5763 structures to be formatted (thanks to Archie Paulson).
5759 5764
5760 5765 * IPython/ipmaker.py (make_IPython): Changed default logging
5761 5766 (when simply called with -log) to use curr_dir/ipython.log in
5762 5767 rotate mode. Fixed crash which was occuring with -log before
5763 5768 (thanks to Jim Boyle).
5764 5769
5765 5770 2002-05-01 Fernando Perez <fperez@colorado.edu>
5766 5771
5767 5772 * Released 0.2.11 for these fixes (mainly the ultraTB one which
5768 5773 was nasty -- though somewhat of a corner case).
5769 5774
5770 5775 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
5771 5776 text (was a bug).
5772 5777
5773 5778 2002-04-30 Fernando Perez <fperez@colorado.edu>
5774 5779
5775 5780 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
5776 5781 a print after ^D or ^C from the user so that the In[] prompt
5777 5782 doesn't over-run the gnuplot one.
5778 5783
5779 5784 2002-04-29 Fernando Perez <fperez@colorado.edu>
5780 5785
5781 5786 * Released 0.2.10
5782 5787
5783 5788 * IPython/__release__.py (version): get date dynamically.
5784 5789
5785 5790 * Misc. documentation updates thanks to Arnd's comments. Also ran
5786 5791 a full spellcheck on the manual (hadn't been done in a while).
5787 5792
5788 5793 2002-04-27 Fernando Perez <fperez@colorado.edu>
5789 5794
5790 5795 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
5791 5796 starting a log in mid-session would reset the input history list.
5792 5797
5793 5798 2002-04-26 Fernando Perez <fperez@colorado.edu>
5794 5799
5795 5800 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
5796 5801 all files were being included in an update. Now anything in
5797 5802 UserConfig that matches [A-Za-z]*.py will go (this excludes
5798 5803 __init__.py)
5799 5804
5800 5805 2002-04-25 Fernando Perez <fperez@colorado.edu>
5801 5806
5802 5807 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
5803 5808 to __builtins__ so that any form of embedded or imported code can
5804 5809 test for being inside IPython.
5805 5810
5806 5811 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
5807 5812 changed to GnuplotMagic because it's now an importable module,
5808 5813 this makes the name follow that of the standard Gnuplot module.
5809 5814 GnuplotMagic can now be loaded at any time in mid-session.
5810 5815
5811 5816 2002-04-24 Fernando Perez <fperez@colorado.edu>
5812 5817
5813 5818 * IPython/numutils.py: removed SIUnits. It doesn't properly set
5814 5819 the globals (IPython has its own namespace) and the
5815 5820 PhysicalQuantity stuff is much better anyway.
5816 5821
5817 5822 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
5818 5823 embedding example to standard user directory for
5819 5824 distribution. Also put it in the manual.
5820 5825
5821 5826 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
5822 5827 instance as first argument (so it doesn't rely on some obscure
5823 5828 hidden global).
5824 5829
5825 5830 * IPython/UserConfig/ipythonrc.py: put () back in accepted
5826 5831 delimiters. While it prevents ().TAB from working, it allows
5827 5832 completions in open (... expressions. This is by far a more common
5828 5833 case.
5829 5834
5830 5835 2002-04-23 Fernando Perez <fperez@colorado.edu>
5831 5836
5832 5837 * IPython/Extensions/InterpreterPasteInput.py: new
5833 5838 syntax-processing module for pasting lines with >>> or ... at the
5834 5839 start.
5835 5840
5836 5841 * IPython/Extensions/PhysicalQ_Interactive.py
5837 5842 (PhysicalQuantityInteractive.__int__): fixed to work with either
5838 5843 Numeric or math.
5839 5844
5840 5845 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
5841 5846 provided profiles. Now we have:
5842 5847 -math -> math module as * and cmath with its own namespace.
5843 5848 -numeric -> Numeric as *, plus gnuplot & grace
5844 5849 -physics -> same as before
5845 5850
5846 5851 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
5847 5852 user-defined magics wouldn't be found by @magic if they were
5848 5853 defined as class methods. Also cleaned up the namespace search
5849 5854 logic and the string building (to use %s instead of many repeated
5850 5855 string adds).
5851 5856
5852 5857 * IPython/UserConfig/example-magic.py (magic_foo): updated example
5853 5858 of user-defined magics to operate with class methods (cleaner, in
5854 5859 line with the gnuplot code).
5855 5860
5856 5861 2002-04-22 Fernando Perez <fperez@colorado.edu>
5857 5862
5858 5863 * setup.py: updated dependency list so that manual is updated when
5859 5864 all included files change.
5860 5865
5861 5866 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
5862 5867 the delimiter removal option (the fix is ugly right now).
5863 5868
5864 5869 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
5865 5870 all of the math profile (quicker loading, no conflict between
5866 5871 g-9.8 and g-gnuplot).
5867 5872
5868 5873 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
5869 5874 name of post-mortem files to IPython_crash_report.txt.
5870 5875
5871 5876 * Cleanup/update of the docs. Added all the new readline info and
5872 5877 formatted all lists as 'real lists'.
5873 5878
5874 5879 * IPython/ipmaker.py (make_IPython): removed now-obsolete
5875 5880 tab-completion options, since the full readline parse_and_bind is
5876 5881 now accessible.
5877 5882
5878 5883 * IPython/iplib.py (InteractiveShell.init_readline): Changed
5879 5884 handling of readline options. Now users can specify any string to
5880 5885 be passed to parse_and_bind(), as well as the delimiters to be
5881 5886 removed.
5882 5887 (InteractiveShell.__init__): Added __name__ to the global
5883 5888 namespace so that things like Itpl which rely on its existence
5884 5889 don't crash.
5885 5890 (InteractiveShell._prefilter): Defined the default with a _ so
5886 5891 that prefilter() is easier to override, while the default one
5887 5892 remains available.
5888 5893
5889 5894 2002-04-18 Fernando Perez <fperez@colorado.edu>
5890 5895
5891 5896 * Added information about pdb in the docs.
5892 5897
5893 5898 2002-04-17 Fernando Perez <fperez@colorado.edu>
5894 5899
5895 5900 * IPython/ipmaker.py (make_IPython): added rc_override option to
5896 5901 allow passing config options at creation time which may override
5897 5902 anything set in the config files or command line. This is
5898 5903 particularly useful for configuring embedded instances.
5899 5904
5900 5905 2002-04-15 Fernando Perez <fperez@colorado.edu>
5901 5906
5902 5907 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
5903 5908 crash embedded instances because of the input cache falling out of
5904 5909 sync with the output counter.
5905 5910
5906 5911 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
5907 5912 mode which calls pdb after an uncaught exception in IPython itself.
5908 5913
5909 5914 2002-04-14 Fernando Perez <fperez@colorado.edu>
5910 5915
5911 5916 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
5912 5917 readline, fix it back after each call.
5913 5918
5914 5919 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
5915 5920 method to force all access via __call__(), which guarantees that
5916 5921 traceback references are properly deleted.
5917 5922
5918 5923 * IPython/Prompts.py (CachedOutput._display): minor fixes to
5919 5924 improve printing when pprint is in use.
5920 5925
5921 5926 2002-04-13 Fernando Perez <fperez@colorado.edu>
5922 5927
5923 5928 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
5924 5929 exceptions aren't caught anymore. If the user triggers one, he
5925 5930 should know why he's doing it and it should go all the way up,
5926 5931 just like any other exception. So now @abort will fully kill the
5927 5932 embedded interpreter and the embedding code (unless that happens
5928 5933 to catch SystemExit).
5929 5934
5930 5935 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
5931 5936 and a debugger() method to invoke the interactive pdb debugger
5932 5937 after printing exception information. Also added the corresponding
5933 5938 -pdb option and @pdb magic to control this feature, and updated
5934 5939 the docs. After a suggestion from Christopher Hart
5935 5940 (hart-AT-caltech.edu).
5936 5941
5937 5942 2002-04-12 Fernando Perez <fperez@colorado.edu>
5938 5943
5939 5944 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
5940 5945 the exception handlers defined by the user (not the CrashHandler)
5941 5946 so that user exceptions don't trigger an ipython bug report.
5942 5947
5943 5948 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
5944 5949 configurable (it should have always been so).
5945 5950
5946 5951 2002-03-26 Fernando Perez <fperez@colorado.edu>
5947 5952
5948 5953 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
5949 5954 and there to fix embedding namespace issues. This should all be
5950 5955 done in a more elegant way.
5951 5956
5952 5957 2002-03-25 Fernando Perez <fperez@colorado.edu>
5953 5958
5954 5959 * IPython/genutils.py (get_home_dir): Try to make it work under
5955 5960 win9x also.
5956 5961
5957 5962 2002-03-20 Fernando Perez <fperez@colorado.edu>
5958 5963
5959 5964 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
5960 5965 sys.displayhook untouched upon __init__.
5961 5966
5962 5967 2002-03-19 Fernando Perez <fperez@colorado.edu>
5963 5968
5964 5969 * Released 0.2.9 (for embedding bug, basically).
5965 5970
5966 5971 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
5967 5972 exceptions so that enclosing shell's state can be restored.
5968 5973
5969 5974 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
5970 5975 naming conventions in the .ipython/ dir.
5971 5976
5972 5977 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
5973 5978 from delimiters list so filenames with - in them get expanded.
5974 5979
5975 5980 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
5976 5981 sys.displayhook not being properly restored after an embedded call.
5977 5982
5978 5983 2002-03-18 Fernando Perez <fperez@colorado.edu>
5979 5984
5980 5985 * Released 0.2.8
5981 5986
5982 5987 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
5983 5988 some files weren't being included in a -upgrade.
5984 5989 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
5985 5990 on' so that the first tab completes.
5986 5991 (InteractiveShell.handle_magic): fixed bug with spaces around
5987 5992 quotes breaking many magic commands.
5988 5993
5989 5994 * setup.py: added note about ignoring the syntax error messages at
5990 5995 installation.
5991 5996
5992 5997 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
5993 5998 streamlining the gnuplot interface, now there's only one magic @gp.
5994 5999
5995 6000 2002-03-17 Fernando Perez <fperez@colorado.edu>
5996 6001
5997 6002 * IPython/UserConfig/magic_gnuplot.py: new name for the
5998 6003 example-magic_pm.py file. Much enhanced system, now with a shell
5999 6004 for communicating directly with gnuplot, one command at a time.
6000 6005
6001 6006 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
6002 6007 setting __name__=='__main__'.
6003 6008
6004 6009 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
6005 6010 mini-shell for accessing gnuplot from inside ipython. Should
6006 6011 extend it later for grace access too. Inspired by Arnd's
6007 6012 suggestion.
6008 6013
6009 6014 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
6010 6015 calling magic functions with () in their arguments. Thanks to Arnd
6011 6016 Baecker for pointing this to me.
6012 6017
6013 6018 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
6014 6019 infinitely for integer or complex arrays (only worked with floats).
6015 6020
6016 6021 2002-03-16 Fernando Perez <fperez@colorado.edu>
6017 6022
6018 6023 * setup.py: Merged setup and setup_windows into a single script
6019 6024 which properly handles things for windows users.
6020 6025
6021 6026 2002-03-15 Fernando Perez <fperez@colorado.edu>
6022 6027
6023 6028 * Big change to the manual: now the magics are all automatically
6024 6029 documented. This information is generated from their docstrings
6025 6030 and put in a latex file included by the manual lyx file. This way
6026 6031 we get always up to date information for the magics. The manual
6027 6032 now also has proper version information, also auto-synced.
6028 6033
6029 6034 For this to work, an undocumented --magic_docstrings option was added.
6030 6035
6031 6036 2002-03-13 Fernando Perez <fperez@colorado.edu>
6032 6037
6033 6038 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
6034 6039 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
6035 6040
6036 6041 2002-03-12 Fernando Perez <fperez@colorado.edu>
6037 6042
6038 6043 * IPython/ultraTB.py (TermColors): changed color escapes again to
6039 6044 fix the (old, reintroduced) line-wrapping bug. Basically, if
6040 6045 \001..\002 aren't given in the color escapes, lines get wrapped
6041 6046 weirdly. But giving those screws up old xterms and emacs terms. So
6042 6047 I added some logic for emacs terms to be ok, but I can't identify old
6043 6048 xterms separately ($TERM=='xterm' for many terminals, like konsole).
6044 6049
6045 6050 2002-03-10 Fernando Perez <fperez@colorado.edu>
6046 6051
6047 6052 * IPython/usage.py (__doc__): Various documentation cleanups and
6048 6053 updates, both in usage docstrings and in the manual.
6049 6054
6050 6055 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
6051 6056 handling of caching. Set minimum acceptabe value for having a
6052 6057 cache at 20 values.
6053 6058
6054 6059 * IPython/iplib.py (InteractiveShell.user_setup): moved the
6055 6060 install_first_time function to a method, renamed it and added an
6056 6061 'upgrade' mode. Now people can update their config directory with
6057 6062 a simple command line switch (-upgrade, also new).
6058 6063
6059 6064 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
6060 6065 @file (convenient for automagic users under Python >= 2.2).
6061 6066 Removed @files (it seemed more like a plural than an abbrev. of
6062 6067 'file show').
6063 6068
6064 6069 * IPython/iplib.py (install_first_time): Fixed crash if there were
6065 6070 backup files ('~') in .ipython/ install directory.
6066 6071
6067 6072 * IPython/ipmaker.py (make_IPython): fixes for new prompt
6068 6073 system. Things look fine, but these changes are fairly
6069 6074 intrusive. Test them for a few days.
6070 6075
6071 6076 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
6072 6077 the prompts system. Now all in/out prompt strings are user
6073 6078 controllable. This is particularly useful for embedding, as one
6074 6079 can tag embedded instances with particular prompts.
6075 6080
6076 6081 Also removed global use of sys.ps1/2, which now allows nested
6077 6082 embeddings without any problems. Added command-line options for
6078 6083 the prompt strings.
6079 6084
6080 6085 2002-03-08 Fernando Perez <fperez@colorado.edu>
6081 6086
6082 6087 * IPython/UserConfig/example-embed-short.py (ipshell): added
6083 6088 example file with the bare minimum code for embedding.
6084 6089
6085 6090 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
6086 6091 functionality for the embeddable shell to be activated/deactivated
6087 6092 either globally or at each call.
6088 6093
6089 6094 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
6090 6095 rewriting the prompt with '--->' for auto-inputs with proper
6091 6096 coloring. Now the previous UGLY hack in handle_auto() is gone, and
6092 6097 this is handled by the prompts class itself, as it should.
6093 6098
6094 6099 2002-03-05 Fernando Perez <fperez@colorado.edu>
6095 6100
6096 6101 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
6097 6102 @logstart to avoid name clashes with the math log function.
6098 6103
6099 6104 * Big updates to X/Emacs section of the manual.
6100 6105
6101 6106 * Removed ipython_emacs. Milan explained to me how to pass
6102 6107 arguments to ipython through Emacs. Some day I'm going to end up
6103 6108 learning some lisp...
6104 6109
6105 6110 2002-03-04 Fernando Perez <fperez@colorado.edu>
6106 6111
6107 6112 * IPython/ipython_emacs: Created script to be used as the
6108 6113 py-python-command Emacs variable so we can pass IPython
6109 6114 parameters. I can't figure out how to tell Emacs directly to pass
6110 6115 parameters to IPython, so a dummy shell script will do it.
6111 6116
6112 6117 Other enhancements made for things to work better under Emacs'
6113 6118 various types of terminals. Many thanks to Milan Zamazal
6114 6119 <pdm-AT-zamazal.org> for all the suggestions and pointers.
6115 6120
6116 6121 2002-03-01 Fernando Perez <fperez@colorado.edu>
6117 6122
6118 6123 * IPython/ipmaker.py (make_IPython): added a --readline! option so
6119 6124 that loading of readline is now optional. This gives better
6120 6125 control to emacs users.
6121 6126
6122 6127 * IPython/ultraTB.py (__date__): Modified color escape sequences
6123 6128 and now things work fine under xterm and in Emacs' term buffers
6124 6129 (though not shell ones). Well, in emacs you get colors, but all
6125 6130 seem to be 'light' colors (no difference between dark and light
6126 6131 ones). But the garbage chars are gone, and also in xterms. It
6127 6132 seems that now I'm using 'cleaner' ansi sequences.
6128 6133
6129 6134 2002-02-21 Fernando Perez <fperez@colorado.edu>
6130 6135
6131 6136 * Released 0.2.7 (mainly to publish the scoping fix).
6132 6137
6133 6138 * IPython/Logger.py (Logger.logstate): added. A corresponding
6134 6139 @logstate magic was created.
6135 6140
6136 6141 * IPython/Magic.py: fixed nested scoping problem under Python
6137 6142 2.1.x (automagic wasn't working).
6138 6143
6139 6144 2002-02-20 Fernando Perez <fperez@colorado.edu>
6140 6145
6141 6146 * Released 0.2.6.
6142 6147
6143 6148 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
6144 6149 option so that logs can come out without any headers at all.
6145 6150
6146 6151 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
6147 6152 SciPy.
6148 6153
6149 6154 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
6150 6155 that embedded IPython calls don't require vars() to be explicitly
6151 6156 passed. Now they are extracted from the caller's frame (code
6152 6157 snatched from Eric Jones' weave). Added better documentation to
6153 6158 the section on embedding and the example file.
6154 6159
6155 6160 * IPython/genutils.py (page): Changed so that under emacs, it just
6156 6161 prints the string. You can then page up and down in the emacs
6157 6162 buffer itself. This is how the builtin help() works.
6158 6163
6159 6164 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
6160 6165 macro scoping: macros need to be executed in the user's namespace
6161 6166 to work as if they had been typed by the user.
6162 6167
6163 6168 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
6164 6169 execute automatically (no need to type 'exec...'). They then
6165 6170 behave like 'true macros'. The printing system was also modified
6166 6171 for this to work.
6167 6172
6168 6173 2002-02-19 Fernando Perez <fperez@colorado.edu>
6169 6174
6170 6175 * IPython/genutils.py (page_file): new function for paging files
6171 6176 in an OS-independent way. Also necessary for file viewing to work
6172 6177 well inside Emacs buffers.
6173 6178 (page): Added checks for being in an emacs buffer.
6174 6179 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
6175 6180 same bug in iplib.
6176 6181
6177 6182 2002-02-18 Fernando Perez <fperez@colorado.edu>
6178 6183
6179 6184 * IPython/iplib.py (InteractiveShell.init_readline): modified use
6180 6185 of readline so that IPython can work inside an Emacs buffer.
6181 6186
6182 6187 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
6183 6188 method signatures (they weren't really bugs, but it looks cleaner
6184 6189 and keeps PyChecker happy).
6185 6190
6186 6191 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
6187 6192 for implementing various user-defined hooks. Currently only
6188 6193 display is done.
6189 6194
6190 6195 * IPython/Prompts.py (CachedOutput._display): changed display
6191 6196 functions so that they can be dynamically changed by users easily.
6192 6197
6193 6198 * IPython/Extensions/numeric_formats.py (num_display): added an
6194 6199 extension for printing NumPy arrays in flexible manners. It
6195 6200 doesn't do anything yet, but all the structure is in
6196 6201 place. Ultimately the plan is to implement output format control
6197 6202 like in Octave.
6198 6203
6199 6204 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
6200 6205 methods are found at run-time by all the automatic machinery.
6201 6206
6202 6207 2002-02-17 Fernando Perez <fperez@colorado.edu>
6203 6208
6204 6209 * setup_Windows.py (make_shortcut): documented. Cleaned up the
6205 6210 whole file a little.
6206 6211
6207 6212 * ToDo: closed this document. Now there's a new_design.lyx
6208 6213 document for all new ideas. Added making a pdf of it for the
6209 6214 end-user distro.
6210 6215
6211 6216 * IPython/Logger.py (Logger.switch_log): Created this to replace
6212 6217 logon() and logoff(). It also fixes a nasty crash reported by
6213 6218 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
6214 6219
6215 6220 * IPython/iplib.py (complete): got auto-completion to work with
6216 6221 automagic (I had wanted this for a long time).
6217 6222
6218 6223 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
6219 6224 to @file, since file() is now a builtin and clashes with automagic
6220 6225 for @file.
6221 6226
6222 6227 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
6223 6228 of this was previously in iplib, which had grown to more than 2000
6224 6229 lines, way too long. No new functionality, but it makes managing
6225 6230 the code a bit easier.
6226 6231
6227 6232 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
6228 6233 information to crash reports.
6229 6234
6230 6235 2002-02-12 Fernando Perez <fperez@colorado.edu>
6231 6236
6232 6237 * Released 0.2.5.
6233 6238
6234 6239 2002-02-11 Fernando Perez <fperez@colorado.edu>
6235 6240
6236 6241 * Wrote a relatively complete Windows installer. It puts
6237 6242 everything in place, creates Start Menu entries and fixes the
6238 6243 color issues. Nothing fancy, but it works.
6239 6244
6240 6245 2002-02-10 Fernando Perez <fperez@colorado.edu>
6241 6246
6242 6247 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
6243 6248 os.path.expanduser() call so that we can type @run ~/myfile.py and
6244 6249 have thigs work as expected.
6245 6250
6246 6251 * IPython/genutils.py (page): fixed exception handling so things
6247 6252 work both in Unix and Windows correctly. Quitting a pager triggers
6248 6253 an IOError/broken pipe in Unix, and in windows not finding a pager
6249 6254 is also an IOError, so I had to actually look at the return value
6250 6255 of the exception, not just the exception itself. Should be ok now.
6251 6256
6252 6257 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
6253 6258 modified to allow case-insensitive color scheme changes.
6254 6259
6255 6260 2002-02-09 Fernando Perez <fperez@colorado.edu>
6256 6261
6257 6262 * IPython/genutils.py (native_line_ends): new function to leave
6258 6263 user config files with os-native line-endings.
6259 6264
6260 6265 * README and manual updates.
6261 6266
6262 6267 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
6263 6268 instead of StringType to catch Unicode strings.
6264 6269
6265 6270 * IPython/genutils.py (filefind): fixed bug for paths with
6266 6271 embedded spaces (very common in Windows).
6267 6272
6268 6273 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
6269 6274 files under Windows, so that they get automatically associated
6270 6275 with a text editor. Windows makes it a pain to handle
6271 6276 extension-less files.
6272 6277
6273 6278 * IPython/iplib.py (InteractiveShell.init_readline): Made the
6274 6279 warning about readline only occur for Posix. In Windows there's no
6275 6280 way to get readline, so why bother with the warning.
6276 6281
6277 6282 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
6278 6283 for __str__ instead of dir(self), since dir() changed in 2.2.
6279 6284
6280 6285 * Ported to Windows! Tested on XP, I suspect it should work fine
6281 6286 on NT/2000, but I don't think it will work on 98 et al. That
6282 6287 series of Windows is such a piece of junk anyway that I won't try
6283 6288 porting it there. The XP port was straightforward, showed a few
6284 6289 bugs here and there (fixed all), in particular some string
6285 6290 handling stuff which required considering Unicode strings (which
6286 6291 Windows uses). This is good, but hasn't been too tested :) No
6287 6292 fancy installer yet, I'll put a note in the manual so people at
6288 6293 least make manually a shortcut.
6289 6294
6290 6295 * IPython/iplib.py (Magic.magic_colors): Unified the color options
6291 6296 into a single one, "colors". This now controls both prompt and
6292 6297 exception color schemes, and can be changed both at startup
6293 6298 (either via command-line switches or via ipythonrc files) and at
6294 6299 runtime, with @colors.
6295 6300 (Magic.magic_run): renamed @prun to @run and removed the old
6296 6301 @run. The two were too similar to warrant keeping both.
6297 6302
6298 6303 2002-02-03 Fernando Perez <fperez@colorado.edu>
6299 6304
6300 6305 * IPython/iplib.py (install_first_time): Added comment on how to
6301 6306 configure the color options for first-time users. Put a <return>
6302 6307 request at the end so that small-terminal users get a chance to
6303 6308 read the startup info.
6304 6309
6305 6310 2002-01-23 Fernando Perez <fperez@colorado.edu>
6306 6311
6307 6312 * IPython/iplib.py (CachedOutput.update): Changed output memory
6308 6313 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
6309 6314 input history we still use _i. Did this b/c these variable are
6310 6315 very commonly used in interactive work, so the less we need to
6311 6316 type the better off we are.
6312 6317 (Magic.magic_prun): updated @prun to better handle the namespaces
6313 6318 the file will run in, including a fix for __name__ not being set
6314 6319 before.
6315 6320
6316 6321 2002-01-20 Fernando Perez <fperez@colorado.edu>
6317 6322
6318 6323 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
6319 6324 extra garbage for Python 2.2. Need to look more carefully into
6320 6325 this later.
6321 6326
6322 6327 2002-01-19 Fernando Perez <fperez@colorado.edu>
6323 6328
6324 6329 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
6325 6330 display SyntaxError exceptions properly formatted when they occur
6326 6331 (they can be triggered by imported code).
6327 6332
6328 6333 2002-01-18 Fernando Perez <fperez@colorado.edu>
6329 6334
6330 6335 * IPython/iplib.py (InteractiveShell.safe_execfile): now
6331 6336 SyntaxError exceptions are reported nicely formatted, instead of
6332 6337 spitting out only offset information as before.
6333 6338 (Magic.magic_prun): Added the @prun function for executing
6334 6339 programs with command line args inside IPython.
6335 6340
6336 6341 2002-01-16 Fernando Perez <fperez@colorado.edu>
6337 6342
6338 6343 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
6339 6344 to *not* include the last item given in a range. This brings their
6340 6345 behavior in line with Python's slicing:
6341 6346 a[n1:n2] -> a[n1]...a[n2-1]
6342 6347 It may be a bit less convenient, but I prefer to stick to Python's
6343 6348 conventions *everywhere*, so users never have to wonder.
6344 6349 (Magic.magic_macro): Added @macro function to ease the creation of
6345 6350 macros.
6346 6351
6347 6352 2002-01-05 Fernando Perez <fperez@colorado.edu>
6348 6353
6349 6354 * Released 0.2.4.
6350 6355
6351 6356 * IPython/iplib.py (Magic.magic_pdef):
6352 6357 (InteractiveShell.safe_execfile): report magic lines and error
6353 6358 lines without line numbers so one can easily copy/paste them for
6354 6359 re-execution.
6355 6360
6356 6361 * Updated manual with recent changes.
6357 6362
6358 6363 * IPython/iplib.py (Magic.magic_oinfo): added constructor
6359 6364 docstring printing when class? is called. Very handy for knowing
6360 6365 how to create class instances (as long as __init__ is well
6361 6366 documented, of course :)
6362 6367 (Magic.magic_doc): print both class and constructor docstrings.
6363 6368 (Magic.magic_pdef): give constructor info if passed a class and
6364 6369 __call__ info for callable object instances.
6365 6370
6366 6371 2002-01-04 Fernando Perez <fperez@colorado.edu>
6367 6372
6368 6373 * Made deep_reload() off by default. It doesn't always work
6369 6374 exactly as intended, so it's probably safer to have it off. It's
6370 6375 still available as dreload() anyway, so nothing is lost.
6371 6376
6372 6377 2002-01-02 Fernando Perez <fperez@colorado.edu>
6373 6378
6374 6379 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
6375 6380 so I wanted an updated release).
6376 6381
6377 6382 2001-12-27 Fernando Perez <fperez@colorado.edu>
6378 6383
6379 6384 * IPython/iplib.py (InteractiveShell.interact): Added the original
6380 6385 code from 'code.py' for this module in order to change the
6381 6386 handling of a KeyboardInterrupt. This was necessary b/c otherwise
6382 6387 the history cache would break when the user hit Ctrl-C, and
6383 6388 interact() offers no way to add any hooks to it.
6384 6389
6385 6390 2001-12-23 Fernando Perez <fperez@colorado.edu>
6386 6391
6387 6392 * setup.py: added check for 'MANIFEST' before trying to remove
6388 6393 it. Thanks to Sean Reifschneider.
6389 6394
6390 6395 2001-12-22 Fernando Perez <fperez@colorado.edu>
6391 6396
6392 6397 * Released 0.2.2.
6393 6398
6394 6399 * Finished (reasonably) writing the manual. Later will add the
6395 6400 python-standard navigation stylesheets, but for the time being
6396 6401 it's fairly complete. Distribution will include html and pdf
6397 6402 versions.
6398 6403
6399 6404 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
6400 6405 (MayaVi author).
6401 6406
6402 6407 2001-12-21 Fernando Perez <fperez@colorado.edu>
6403 6408
6404 6409 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
6405 6410 good public release, I think (with the manual and the distutils
6406 6411 installer). The manual can use some work, but that can go
6407 6412 slowly. Otherwise I think it's quite nice for end users. Next
6408 6413 summer, rewrite the guts of it...
6409 6414
6410 6415 * Changed format of ipythonrc files to use whitespace as the
6411 6416 separator instead of an explicit '='. Cleaner.
6412 6417
6413 6418 2001-12-20 Fernando Perez <fperez@colorado.edu>
6414 6419
6415 6420 * Started a manual in LyX. For now it's just a quick merge of the
6416 6421 various internal docstrings and READMEs. Later it may grow into a
6417 6422 nice, full-blown manual.
6418 6423
6419 6424 * Set up a distutils based installer. Installation should now be
6420 6425 trivially simple for end-users.
6421 6426
6422 6427 2001-12-11 Fernando Perez <fperez@colorado.edu>
6423 6428
6424 6429 * Released 0.2.0. First public release, announced it at
6425 6430 comp.lang.python. From now on, just bugfixes...
6426 6431
6427 6432 * Went through all the files, set copyright/license notices and
6428 6433 cleaned up things. Ready for release.
6429 6434
6430 6435 2001-12-10 Fernando Perez <fperez@colorado.edu>
6431 6436
6432 6437 * Changed the first-time installer not to use tarfiles. It's more
6433 6438 robust now and less unix-dependent. Also makes it easier for
6434 6439 people to later upgrade versions.
6435 6440
6436 6441 * Changed @exit to @abort to reflect the fact that it's pretty
6437 6442 brutal (a sys.exit()). The difference between @abort and Ctrl-D
6438 6443 becomes significant only when IPyhton is embedded: in that case,
6439 6444 C-D closes IPython only, but @abort kills the enclosing program
6440 6445 too (unless it had called IPython inside a try catching
6441 6446 SystemExit).
6442 6447
6443 6448 * Created Shell module which exposes the actuall IPython Shell
6444 6449 classes, currently the normal and the embeddable one. This at
6445 6450 least offers a stable interface we won't need to change when
6446 6451 (later) the internals are rewritten. That rewrite will be confined
6447 6452 to iplib and ipmaker, but the Shell interface should remain as is.
6448 6453
6449 6454 * Added embed module which offers an embeddable IPShell object,
6450 6455 useful to fire up IPython *inside* a running program. Great for
6451 6456 debugging or dynamical data analysis.
6452 6457
6453 6458 2001-12-08 Fernando Perez <fperez@colorado.edu>
6454 6459
6455 6460 * Fixed small bug preventing seeing info from methods of defined
6456 6461 objects (incorrect namespace in _ofind()).
6457 6462
6458 6463 * Documentation cleanup. Moved the main usage docstrings to a
6459 6464 separate file, usage.py (cleaner to maintain, and hopefully in the
6460 6465 future some perlpod-like way of producing interactive, man and
6461 6466 html docs out of it will be found).
6462 6467
6463 6468 * Added @profile to see your profile at any time.
6464 6469
6465 6470 * Added @p as an alias for 'print'. It's especially convenient if
6466 6471 using automagic ('p x' prints x).
6467 6472
6468 6473 * Small cleanups and fixes after a pychecker run.
6469 6474
6470 6475 * Changed the @cd command to handle @cd - and @cd -<n> for
6471 6476 visiting any directory in _dh.
6472 6477
6473 6478 * Introduced _dh, a history of visited directories. @dhist prints
6474 6479 it out with numbers.
6475 6480
6476 6481 2001-12-07 Fernando Perez <fperez@colorado.edu>
6477 6482
6478 6483 * Released 0.1.22
6479 6484
6480 6485 * Made initialization a bit more robust against invalid color
6481 6486 options in user input (exit, not traceback-crash).
6482 6487
6483 6488 * Changed the bug crash reporter to write the report only in the
6484 6489 user's .ipython directory. That way IPython won't litter people's
6485 6490 hard disks with crash files all over the place. Also print on
6486 6491 screen the necessary mail command.
6487 6492
6488 6493 * With the new ultraTB, implemented LightBG color scheme for light
6489 6494 background terminals. A lot of people like white backgrounds, so I
6490 6495 guess we should at least give them something readable.
6491 6496
6492 6497 2001-12-06 Fernando Perez <fperez@colorado.edu>
6493 6498
6494 6499 * Modified the structure of ultraTB. Now there's a proper class
6495 6500 for tables of color schemes which allow adding schemes easily and
6496 6501 switching the active scheme without creating a new instance every
6497 6502 time (which was ridiculous). The syntax for creating new schemes
6498 6503 is also cleaner. I think ultraTB is finally done, with a clean
6499 6504 class structure. Names are also much cleaner (now there's proper
6500 6505 color tables, no need for every variable to also have 'color' in
6501 6506 its name).
6502 6507
6503 6508 * Broke down genutils into separate files. Now genutils only
6504 6509 contains utility functions, and classes have been moved to their
6505 6510 own files (they had enough independent functionality to warrant
6506 6511 it): ConfigLoader, OutputTrap, Struct.
6507 6512
6508 6513 2001-12-05 Fernando Perez <fperez@colorado.edu>
6509 6514
6510 6515 * IPython turns 21! Released version 0.1.21, as a candidate for
6511 6516 public consumption. If all goes well, release in a few days.
6512 6517
6513 6518 * Fixed path bug (files in Extensions/ directory wouldn't be found
6514 6519 unless IPython/ was explicitly in sys.path).
6515 6520
6516 6521 * Extended the FlexCompleter class as MagicCompleter to allow
6517 6522 completion of @-starting lines.
6518 6523
6519 6524 * Created __release__.py file as a central repository for release
6520 6525 info that other files can read from.
6521 6526
6522 6527 * Fixed small bug in logging: when logging was turned on in
6523 6528 mid-session, old lines with special meanings (!@?) were being
6524 6529 logged without the prepended comment, which is necessary since
6525 6530 they are not truly valid python syntax. This should make session
6526 6531 restores produce less errors.
6527 6532
6528 6533 * The namespace cleanup forced me to make a FlexCompleter class
6529 6534 which is nothing but a ripoff of rlcompleter, but with selectable
6530 6535 namespace (rlcompleter only works in __main__.__dict__). I'll try
6531 6536 to submit a note to the authors to see if this change can be
6532 6537 incorporated in future rlcompleter releases (Dec.6: done)
6533 6538
6534 6539 * More fixes to namespace handling. It was a mess! Now all
6535 6540 explicit references to __main__.__dict__ are gone (except when
6536 6541 really needed) and everything is handled through the namespace
6537 6542 dicts in the IPython instance. We seem to be getting somewhere
6538 6543 with this, finally...
6539 6544
6540 6545 * Small documentation updates.
6541 6546
6542 6547 * Created the Extensions directory under IPython (with an
6543 6548 __init__.py). Put the PhysicalQ stuff there. This directory should
6544 6549 be used for all special-purpose extensions.
6545 6550
6546 6551 * File renaming:
6547 6552 ipythonlib --> ipmaker
6548 6553 ipplib --> iplib
6549 6554 This makes a bit more sense in terms of what these files actually do.
6550 6555
6551 6556 * Moved all the classes and functions in ipythonlib to ipplib, so
6552 6557 now ipythonlib only has make_IPython(). This will ease up its
6553 6558 splitting in smaller functional chunks later.
6554 6559
6555 6560 * Cleaned up (done, I think) output of @whos. Better column
6556 6561 formatting, and now shows str(var) for as much as it can, which is
6557 6562 typically what one gets with a 'print var'.
6558 6563
6559 6564 2001-12-04 Fernando Perez <fperez@colorado.edu>
6560 6565
6561 6566 * Fixed namespace problems. Now builtin/IPyhton/user names get
6562 6567 properly reported in their namespace. Internal namespace handling
6563 6568 is finally getting decent (not perfect yet, but much better than
6564 6569 the ad-hoc mess we had).
6565 6570
6566 6571 * Removed -exit option. If people just want to run a python
6567 6572 script, that's what the normal interpreter is for. Less
6568 6573 unnecessary options, less chances for bugs.
6569 6574
6570 6575 * Added a crash handler which generates a complete post-mortem if
6571 6576 IPython crashes. This will help a lot in tracking bugs down the
6572 6577 road.
6573 6578
6574 6579 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
6575 6580 which were boud to functions being reassigned would bypass the
6576 6581 logger, breaking the sync of _il with the prompt counter. This
6577 6582 would then crash IPython later when a new line was logged.
6578 6583
6579 6584 2001-12-02 Fernando Perez <fperez@colorado.edu>
6580 6585
6581 6586 * Made IPython a package. This means people don't have to clutter
6582 6587 their sys.path with yet another directory. Changed the INSTALL
6583 6588 file accordingly.
6584 6589
6585 6590 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
6586 6591 sorts its output (so @who shows it sorted) and @whos formats the
6587 6592 table according to the width of the first column. Nicer, easier to
6588 6593 read. Todo: write a generic table_format() which takes a list of
6589 6594 lists and prints it nicely formatted, with optional row/column
6590 6595 separators and proper padding and justification.
6591 6596
6592 6597 * Released 0.1.20
6593 6598
6594 6599 * Fixed bug in @log which would reverse the inputcache list (a
6595 6600 copy operation was missing).
6596 6601
6597 6602 * Code cleanup. @config was changed to use page(). Better, since
6598 6603 its output is always quite long.
6599 6604
6600 6605 * Itpl is back as a dependency. I was having too many problems
6601 6606 getting the parametric aliases to work reliably, and it's just
6602 6607 easier to code weird string operations with it than playing %()s
6603 6608 games. It's only ~6k, so I don't think it's too big a deal.
6604 6609
6605 6610 * Found (and fixed) a very nasty bug with history. !lines weren't
6606 6611 getting cached, and the out of sync caches would crash
6607 6612 IPython. Fixed it by reorganizing the prefilter/handlers/logger
6608 6613 division of labor a bit better. Bug fixed, cleaner structure.
6609 6614
6610 6615 2001-12-01 Fernando Perez <fperez@colorado.edu>
6611 6616
6612 6617 * Released 0.1.19
6613 6618
6614 6619 * Added option -n to @hist to prevent line number printing. Much
6615 6620 easier to copy/paste code this way.
6616 6621
6617 6622 * Created global _il to hold the input list. Allows easy
6618 6623 re-execution of blocks of code by slicing it (inspired by Janko's
6619 6624 comment on 'macros').
6620 6625
6621 6626 * Small fixes and doc updates.
6622 6627
6623 6628 * Rewrote @history function (was @h). Renamed it to @hist, @h is
6624 6629 much too fragile with automagic. Handles properly multi-line
6625 6630 statements and takes parameters.
6626 6631
6627 6632 2001-11-30 Fernando Perez <fperez@colorado.edu>
6628 6633
6629 6634 * Version 0.1.18 released.
6630 6635
6631 6636 * Fixed nasty namespace bug in initial module imports.
6632 6637
6633 6638 * Added copyright/license notes to all code files (except
6634 6639 DPyGetOpt). For the time being, LGPL. That could change.
6635 6640
6636 6641 * Rewrote a much nicer README, updated INSTALL, cleaned up
6637 6642 ipythonrc-* samples.
6638 6643
6639 6644 * Overall code/documentation cleanup. Basically ready for
6640 6645 release. Only remaining thing: licence decision (LGPL?).
6641 6646
6642 6647 * Converted load_config to a class, ConfigLoader. Now recursion
6643 6648 control is better organized. Doesn't include the same file twice.
6644 6649
6645 6650 2001-11-29 Fernando Perez <fperez@colorado.edu>
6646 6651
6647 6652 * Got input history working. Changed output history variables from
6648 6653 _p to _o so that _i is for input and _o for output. Just cleaner
6649 6654 convention.
6650 6655
6651 6656 * Implemented parametric aliases. This pretty much allows the
6652 6657 alias system to offer full-blown shell convenience, I think.
6653 6658
6654 6659 * Version 0.1.17 released, 0.1.18 opened.
6655 6660
6656 6661 * dot_ipython/ipythonrc (alias): added documentation.
6657 6662 (xcolor): Fixed small bug (xcolors -> xcolor)
6658 6663
6659 6664 * Changed the alias system. Now alias is a magic command to define
6660 6665 aliases just like the shell. Rationale: the builtin magics should
6661 6666 be there for things deeply connected to IPython's
6662 6667 architecture. And this is a much lighter system for what I think
6663 6668 is the really important feature: allowing users to define quickly
6664 6669 magics that will do shell things for them, so they can customize
6665 6670 IPython easily to match their work habits. If someone is really
6666 6671 desperate to have another name for a builtin alias, they can
6667 6672 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
6668 6673 works.
6669 6674
6670 6675 2001-11-28 Fernando Perez <fperez@colorado.edu>
6671 6676
6672 6677 * Changed @file so that it opens the source file at the proper
6673 6678 line. Since it uses less, if your EDITOR environment is
6674 6679 configured, typing v will immediately open your editor of choice
6675 6680 right at the line where the object is defined. Not as quick as
6676 6681 having a direct @edit command, but for all intents and purposes it
6677 6682 works. And I don't have to worry about writing @edit to deal with
6678 6683 all the editors, less does that.
6679 6684
6680 6685 * Version 0.1.16 released, 0.1.17 opened.
6681 6686
6682 6687 * Fixed some nasty bugs in the page/page_dumb combo that could
6683 6688 crash IPython.
6684 6689
6685 6690 2001-11-27 Fernando Perez <fperez@colorado.edu>
6686 6691
6687 6692 * Version 0.1.15 released, 0.1.16 opened.
6688 6693
6689 6694 * Finally got ? and ?? to work for undefined things: now it's
6690 6695 possible to type {}.get? and get information about the get method
6691 6696 of dicts, or os.path? even if only os is defined (so technically
6692 6697 os.path isn't). Works at any level. For example, after import os,
6693 6698 os?, os.path?, os.path.abspath? all work. This is great, took some
6694 6699 work in _ofind.
6695 6700
6696 6701 * Fixed more bugs with logging. The sanest way to do it was to add
6697 6702 to @log a 'mode' parameter. Killed two in one shot (this mode
6698 6703 option was a request of Janko's). I think it's finally clean
6699 6704 (famous last words).
6700 6705
6701 6706 * Added a page_dumb() pager which does a decent job of paging on
6702 6707 screen, if better things (like less) aren't available. One less
6703 6708 unix dependency (someday maybe somebody will port this to
6704 6709 windows).
6705 6710
6706 6711 * Fixed problem in magic_log: would lock of logging out if log
6707 6712 creation failed (because it would still think it had succeeded).
6708 6713
6709 6714 * Improved the page() function using curses to auto-detect screen
6710 6715 size. Now it can make a much better decision on whether to print
6711 6716 or page a string. Option screen_length was modified: a value 0
6712 6717 means auto-detect, and that's the default now.
6713 6718
6714 6719 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
6715 6720 go out. I'll test it for a few days, then talk to Janko about
6716 6721 licences and announce it.
6717 6722
6718 6723 * Fixed the length of the auto-generated ---> prompt which appears
6719 6724 for auto-parens and auto-quotes. Getting this right isn't trivial,
6720 6725 with all the color escapes, different prompt types and optional
6721 6726 separators. But it seems to be working in all the combinations.
6722 6727
6723 6728 2001-11-26 Fernando Perez <fperez@colorado.edu>
6724 6729
6725 6730 * Wrote a regexp filter to get option types from the option names
6726 6731 string. This eliminates the need to manually keep two duplicate
6727 6732 lists.
6728 6733
6729 6734 * Removed the unneeded check_option_names. Now options are handled
6730 6735 in a much saner manner and it's easy to visually check that things
6731 6736 are ok.
6732 6737
6733 6738 * Updated version numbers on all files I modified to carry a
6734 6739 notice so Janko and Nathan have clear version markers.
6735 6740
6736 6741 * Updated docstring for ultraTB with my changes. I should send
6737 6742 this to Nathan.
6738 6743
6739 6744 * Lots of small fixes. Ran everything through pychecker again.
6740 6745
6741 6746 * Made loading of deep_reload an cmd line option. If it's not too
6742 6747 kosher, now people can just disable it. With -nodeep_reload it's
6743 6748 still available as dreload(), it just won't overwrite reload().
6744 6749
6745 6750 * Moved many options to the no| form (-opt and -noopt
6746 6751 accepted). Cleaner.
6747 6752
6748 6753 * Changed magic_log so that if called with no parameters, it uses
6749 6754 'rotate' mode. That way auto-generated logs aren't automatically
6750 6755 over-written. For normal logs, now a backup is made if it exists
6751 6756 (only 1 level of backups). A new 'backup' mode was added to the
6752 6757 Logger class to support this. This was a request by Janko.
6753 6758
6754 6759 * Added @logoff/@logon to stop/restart an active log.
6755 6760
6756 6761 * Fixed a lot of bugs in log saving/replay. It was pretty
6757 6762 broken. Now special lines (!@,/) appear properly in the command
6758 6763 history after a log replay.
6759 6764
6760 6765 * Tried and failed to implement full session saving via pickle. My
6761 6766 idea was to pickle __main__.__dict__, but modules can't be
6762 6767 pickled. This would be a better alternative to replaying logs, but
6763 6768 seems quite tricky to get to work. Changed -session to be called
6764 6769 -logplay, which more accurately reflects what it does. And if we
6765 6770 ever get real session saving working, -session is now available.
6766 6771
6767 6772 * Implemented color schemes for prompts also. As for tracebacks,
6768 6773 currently only NoColor and Linux are supported. But now the
6769 6774 infrastructure is in place, based on a generic ColorScheme
6770 6775 class. So writing and activating new schemes both for the prompts
6771 6776 and the tracebacks should be straightforward.
6772 6777
6773 6778 * Version 0.1.13 released, 0.1.14 opened.
6774 6779
6775 6780 * Changed handling of options for output cache. Now counter is
6776 6781 hardwired starting at 1 and one specifies the maximum number of
6777 6782 entries *in the outcache* (not the max prompt counter). This is
6778 6783 much better, since many statements won't increase the cache
6779 6784 count. It also eliminated some confusing options, now there's only
6780 6785 one: cache_size.
6781 6786
6782 6787 * Added 'alias' magic function and magic_alias option in the
6783 6788 ipythonrc file. Now the user can easily define whatever names he
6784 6789 wants for the magic functions without having to play weird
6785 6790 namespace games. This gives IPython a real shell-like feel.
6786 6791
6787 6792 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
6788 6793 @ or not).
6789 6794
6790 6795 This was one of the last remaining 'visible' bugs (that I know
6791 6796 of). I think if I can clean up the session loading so it works
6792 6797 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
6793 6798 about licensing).
6794 6799
6795 6800 2001-11-25 Fernando Perez <fperez@colorado.edu>
6796 6801
6797 6802 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
6798 6803 there's a cleaner distinction between what ? and ?? show.
6799 6804
6800 6805 * Added screen_length option. Now the user can define his own
6801 6806 screen size for page() operations.
6802 6807
6803 6808 * Implemented magic shell-like functions with automatic code
6804 6809 generation. Now adding another function is just a matter of adding
6805 6810 an entry to a dict, and the function is dynamically generated at
6806 6811 run-time. Python has some really cool features!
6807 6812
6808 6813 * Renamed many options to cleanup conventions a little. Now all
6809 6814 are lowercase, and only underscores where needed. Also in the code
6810 6815 option name tables are clearer.
6811 6816
6812 6817 * Changed prompts a little. Now input is 'In [n]:' instead of
6813 6818 'In[n]:='. This allows it the numbers to be aligned with the
6814 6819 Out[n] numbers, and removes usage of ':=' which doesn't exist in
6815 6820 Python (it was a Mathematica thing). The '...' continuation prompt
6816 6821 was also changed a little to align better.
6817 6822
6818 6823 * Fixed bug when flushing output cache. Not all _p<n> variables
6819 6824 exist, so their deletion needs to be wrapped in a try:
6820 6825
6821 6826 * Figured out how to properly use inspect.formatargspec() (it
6822 6827 requires the args preceded by *). So I removed all the code from
6823 6828 _get_pdef in Magic, which was just replicating that.
6824 6829
6825 6830 * Added test to prefilter to allow redefining magic function names
6826 6831 as variables. This is ok, since the @ form is always available,
6827 6832 but whe should allow the user to define a variable called 'ls' if
6828 6833 he needs it.
6829 6834
6830 6835 * Moved the ToDo information from README into a separate ToDo.
6831 6836
6832 6837 * General code cleanup and small bugfixes. I think it's close to a
6833 6838 state where it can be released, obviously with a big 'beta'
6834 6839 warning on it.
6835 6840
6836 6841 * Got the magic function split to work. Now all magics are defined
6837 6842 in a separate class. It just organizes things a bit, and now
6838 6843 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
6839 6844 was too long).
6840 6845
6841 6846 * Changed @clear to @reset to avoid potential confusions with
6842 6847 the shell command clear. Also renamed @cl to @clear, which does
6843 6848 exactly what people expect it to from their shell experience.
6844 6849
6845 6850 Added a check to the @reset command (since it's so
6846 6851 destructive, it's probably a good idea to ask for confirmation).
6847 6852 But now reset only works for full namespace resetting. Since the
6848 6853 del keyword is already there for deleting a few specific
6849 6854 variables, I don't see the point of having a redundant magic
6850 6855 function for the same task.
6851 6856
6852 6857 2001-11-24 Fernando Perez <fperez@colorado.edu>
6853 6858
6854 6859 * Updated the builtin docs (esp. the ? ones).
6855 6860
6856 6861 * Ran all the code through pychecker. Not terribly impressed with
6857 6862 it: lots of spurious warnings and didn't really find anything of
6858 6863 substance (just a few modules being imported and not used).
6859 6864
6860 6865 * Implemented the new ultraTB functionality into IPython. New
6861 6866 option: xcolors. This chooses color scheme. xmode now only selects
6862 6867 between Plain and Verbose. Better orthogonality.
6863 6868
6864 6869 * Large rewrite of ultraTB. Much cleaner now, with a separation of
6865 6870 mode and color scheme for the exception handlers. Now it's
6866 6871 possible to have the verbose traceback with no coloring.
6867 6872
6868 6873 2001-11-23 Fernando Perez <fperez@colorado.edu>
6869 6874
6870 6875 * Version 0.1.12 released, 0.1.13 opened.
6871 6876
6872 6877 * Removed option to set auto-quote and auto-paren escapes by
6873 6878 user. The chances of breaking valid syntax are just too high. If
6874 6879 someone *really* wants, they can always dig into the code.
6875 6880
6876 6881 * Made prompt separators configurable.
6877 6882
6878 6883 2001-11-22 Fernando Perez <fperez@colorado.edu>
6879 6884
6880 6885 * Small bugfixes in many places.
6881 6886
6882 6887 * Removed the MyCompleter class from ipplib. It seemed redundant
6883 6888 with the C-p,C-n history search functionality. Less code to
6884 6889 maintain.
6885 6890
6886 6891 * Moved all the original ipython.py code into ipythonlib.py. Right
6887 6892 now it's just one big dump into a function called make_IPython, so
6888 6893 no real modularity has been gained. But at least it makes the
6889 6894 wrapper script tiny, and since ipythonlib is a module, it gets
6890 6895 compiled and startup is much faster.
6891 6896
6892 6897 This is a reasobably 'deep' change, so we should test it for a
6893 6898 while without messing too much more with the code.
6894 6899
6895 6900 2001-11-21 Fernando Perez <fperez@colorado.edu>
6896 6901
6897 6902 * Version 0.1.11 released, 0.1.12 opened for further work.
6898 6903
6899 6904 * Removed dependency on Itpl. It was only needed in one place. It
6900 6905 would be nice if this became part of python, though. It makes life
6901 6906 *a lot* easier in some cases.
6902 6907
6903 6908 * Simplified the prefilter code a bit. Now all handlers are
6904 6909 expected to explicitly return a value (at least a blank string).
6905 6910
6906 6911 * Heavy edits in ipplib. Removed the help system altogether. Now
6907 6912 obj?/?? is used for inspecting objects, a magic @doc prints
6908 6913 docstrings, and full-blown Python help is accessed via the 'help'
6909 6914 keyword. This cleans up a lot of code (less to maintain) and does
6910 6915 the job. Since 'help' is now a standard Python component, might as
6911 6916 well use it and remove duplicate functionality.
6912 6917
6913 6918 Also removed the option to use ipplib as a standalone program. By
6914 6919 now it's too dependent on other parts of IPython to function alone.
6915 6920
6916 6921 * Fixed bug in genutils.pager. It would crash if the pager was
6917 6922 exited immediately after opening (broken pipe).
6918 6923
6919 6924 * Trimmed down the VerboseTB reporting a little. The header is
6920 6925 much shorter now and the repeated exception arguments at the end
6921 6926 have been removed. For interactive use the old header seemed a bit
6922 6927 excessive.
6923 6928
6924 6929 * Fixed small bug in output of @whos for variables with multi-word
6925 6930 types (only first word was displayed).
6926 6931
6927 6932 2001-11-17 Fernando Perez <fperez@colorado.edu>
6928 6933
6929 6934 * Version 0.1.10 released, 0.1.11 opened for further work.
6930 6935
6931 6936 * Modified dirs and friends. dirs now *returns* the stack (not
6932 6937 prints), so one can manipulate it as a variable. Convenient to
6933 6938 travel along many directories.
6934 6939
6935 6940 * Fixed bug in magic_pdef: would only work with functions with
6936 6941 arguments with default values.
6937 6942
6938 6943 2001-11-14 Fernando Perez <fperez@colorado.edu>
6939 6944
6940 6945 * Added the PhysicsInput stuff to dot_ipython so it ships as an
6941 6946 example with IPython. Various other minor fixes and cleanups.
6942 6947
6943 6948 * Version 0.1.9 released, 0.1.10 opened for further work.
6944 6949
6945 6950 * Added sys.path to the list of directories searched in the
6946 6951 execfile= option. It used to be the current directory and the
6947 6952 user's IPYTHONDIR only.
6948 6953
6949 6954 2001-11-13 Fernando Perez <fperez@colorado.edu>
6950 6955
6951 6956 * Reinstated the raw_input/prefilter separation that Janko had
6952 6957 initially. This gives a more convenient setup for extending the
6953 6958 pre-processor from the outside: raw_input always gets a string,
6954 6959 and prefilter has to process it. We can then redefine prefilter
6955 6960 from the outside and implement extensions for special
6956 6961 purposes.
6957 6962
6958 6963 Today I got one for inputting PhysicalQuantity objects
6959 6964 (from Scientific) without needing any function calls at
6960 6965 all. Extremely convenient, and it's all done as a user-level
6961 6966 extension (no IPython code was touched). Now instead of:
6962 6967 a = PhysicalQuantity(4.2,'m/s**2')
6963 6968 one can simply say
6964 6969 a = 4.2 m/s**2
6965 6970 or even
6966 6971 a = 4.2 m/s^2
6967 6972
6968 6973 I use this, but it's also a proof of concept: IPython really is
6969 6974 fully user-extensible, even at the level of the parsing of the
6970 6975 command line. It's not trivial, but it's perfectly doable.
6971 6976
6972 6977 * Added 'add_flip' method to inclusion conflict resolver. Fixes
6973 6978 the problem of modules being loaded in the inverse order in which
6974 6979 they were defined in
6975 6980
6976 6981 * Version 0.1.8 released, 0.1.9 opened for further work.
6977 6982
6978 6983 * Added magics pdef, source and file. They respectively show the
6979 6984 definition line ('prototype' in C), source code and full python
6980 6985 file for any callable object. The object inspector oinfo uses
6981 6986 these to show the same information.
6982 6987
6983 6988 * Version 0.1.7 released, 0.1.8 opened for further work.
6984 6989
6985 6990 * Separated all the magic functions into a class called Magic. The
6986 6991 InteractiveShell class was becoming too big for Xemacs to handle
6987 6992 (de-indenting a line would lock it up for 10 seconds while it
6988 6993 backtracked on the whole class!)
6989 6994
6990 6995 FIXME: didn't work. It can be done, but right now namespaces are
6991 6996 all messed up. Do it later (reverted it for now, so at least
6992 6997 everything works as before).
6993 6998
6994 6999 * Got the object introspection system (magic_oinfo) working! I
6995 7000 think this is pretty much ready for release to Janko, so he can
6996 7001 test it for a while and then announce it. Pretty much 100% of what
6997 7002 I wanted for the 'phase 1' release is ready. Happy, tired.
6998 7003
6999 7004 2001-11-12 Fernando Perez <fperez@colorado.edu>
7000 7005
7001 7006 * Version 0.1.6 released, 0.1.7 opened for further work.
7002 7007
7003 7008 * Fixed bug in printing: it used to test for truth before
7004 7009 printing, so 0 wouldn't print. Now checks for None.
7005 7010
7006 7011 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
7007 7012 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
7008 7013 reaches by hand into the outputcache. Think of a better way to do
7009 7014 this later.
7010 7015
7011 7016 * Various small fixes thanks to Nathan's comments.
7012 7017
7013 7018 * Changed magic_pprint to magic_Pprint. This way it doesn't
7014 7019 collide with pprint() and the name is consistent with the command
7015 7020 line option.
7016 7021
7017 7022 * Changed prompt counter behavior to be fully like
7018 7023 Mathematica's. That is, even input that doesn't return a result
7019 7024 raises the prompt counter. The old behavior was kind of confusing
7020 7025 (getting the same prompt number several times if the operation
7021 7026 didn't return a result).
7022 7027
7023 7028 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
7024 7029
7025 7030 * Fixed -Classic mode (wasn't working anymore).
7026 7031
7027 7032 * Added colored prompts using Nathan's new code. Colors are
7028 7033 currently hardwired, they can be user-configurable. For
7029 7034 developers, they can be chosen in file ipythonlib.py, at the
7030 7035 beginning of the CachedOutput class def.
7031 7036
7032 7037 2001-11-11 Fernando Perez <fperez@colorado.edu>
7033 7038
7034 7039 * Version 0.1.5 released, 0.1.6 opened for further work.
7035 7040
7036 7041 * Changed magic_env to *return* the environment as a dict (not to
7037 7042 print it). This way it prints, but it can also be processed.
7038 7043
7039 7044 * Added Verbose exception reporting to interactive
7040 7045 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
7041 7046 traceback. Had to make some changes to the ultraTB file. This is
7042 7047 probably the last 'big' thing in my mental todo list. This ties
7043 7048 in with the next entry:
7044 7049
7045 7050 * Changed -Xi and -Xf to a single -xmode option. Now all the user
7046 7051 has to specify is Plain, Color or Verbose for all exception
7047 7052 handling.
7048 7053
7049 7054 * Removed ShellServices option. All this can really be done via
7050 7055 the magic system. It's easier to extend, cleaner and has automatic
7051 7056 namespace protection and documentation.
7052 7057
7053 7058 2001-11-09 Fernando Perez <fperez@colorado.edu>
7054 7059
7055 7060 * Fixed bug in output cache flushing (missing parameter to
7056 7061 __init__). Other small bugs fixed (found using pychecker).
7057 7062
7058 7063 * Version 0.1.4 opened for bugfixing.
7059 7064
7060 7065 2001-11-07 Fernando Perez <fperez@colorado.edu>
7061 7066
7062 7067 * Version 0.1.3 released, mainly because of the raw_input bug.
7063 7068
7064 7069 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
7065 7070 and when testing for whether things were callable, a call could
7066 7071 actually be made to certain functions. They would get called again
7067 7072 once 'really' executed, with a resulting double call. A disaster
7068 7073 in many cases (list.reverse() would never work!).
7069 7074
7070 7075 * Removed prefilter() function, moved its code to raw_input (which
7071 7076 after all was just a near-empty caller for prefilter). This saves
7072 7077 a function call on every prompt, and simplifies the class a tiny bit.
7073 7078
7074 7079 * Fix _ip to __ip name in magic example file.
7075 7080
7076 7081 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
7077 7082 work with non-gnu versions of tar.
7078 7083
7079 7084 2001-11-06 Fernando Perez <fperez@colorado.edu>
7080 7085
7081 7086 * Version 0.1.2. Just to keep track of the recent changes.
7082 7087
7083 7088 * Fixed nasty bug in output prompt routine. It used to check 'if
7084 7089 arg != None...'. Problem is, this fails if arg implements a
7085 7090 special comparison (__cmp__) which disallows comparing to
7086 7091 None. Found it when trying to use the PhysicalQuantity module from
7087 7092 ScientificPython.
7088 7093
7089 7094 2001-11-05 Fernando Perez <fperez@colorado.edu>
7090 7095
7091 7096 * Also added dirs. Now the pushd/popd/dirs family functions
7092 7097 basically like the shell, with the added convenience of going home
7093 7098 when called with no args.
7094 7099
7095 7100 * pushd/popd slightly modified to mimic shell behavior more
7096 7101 closely.
7097 7102
7098 7103 * Added env,pushd,popd from ShellServices as magic functions. I
7099 7104 think the cleanest will be to port all desired functions from
7100 7105 ShellServices as magics and remove ShellServices altogether. This
7101 7106 will provide a single, clean way of adding functionality
7102 7107 (shell-type or otherwise) to IP.
7103 7108
7104 7109 2001-11-04 Fernando Perez <fperez@colorado.edu>
7105 7110
7106 7111 * Added .ipython/ directory to sys.path. This way users can keep
7107 7112 customizations there and access them via import.
7108 7113
7109 7114 2001-11-03 Fernando Perez <fperez@colorado.edu>
7110 7115
7111 7116 * Opened version 0.1.1 for new changes.
7112 7117
7113 7118 * Changed version number to 0.1.0: first 'public' release, sent to
7114 7119 Nathan and Janko.
7115 7120
7116 7121 * Lots of small fixes and tweaks.
7117 7122
7118 7123 * Minor changes to whos format. Now strings are shown, snipped if
7119 7124 too long.
7120 7125
7121 7126 * Changed ShellServices to work on __main__ so they show up in @who
7122 7127
7123 7128 * Help also works with ? at the end of a line:
7124 7129 ?sin and sin?
7125 7130 both produce the same effect. This is nice, as often I use the
7126 7131 tab-complete to find the name of a method, but I used to then have
7127 7132 to go to the beginning of the line to put a ? if I wanted more
7128 7133 info. Now I can just add the ? and hit return. Convenient.
7129 7134
7130 7135 2001-11-02 Fernando Perez <fperez@colorado.edu>
7131 7136
7132 7137 * Python version check (>=2.1) added.
7133 7138
7134 7139 * Added LazyPython documentation. At this point the docs are quite
7135 7140 a mess. A cleanup is in order.
7136 7141
7137 7142 * Auto-installer created. For some bizarre reason, the zipfiles
7138 7143 module isn't working on my system. So I made a tar version
7139 7144 (hopefully the command line options in various systems won't kill
7140 7145 me).
7141 7146
7142 7147 * Fixes to Struct in genutils. Now all dictionary-like methods are
7143 7148 protected (reasonably).
7144 7149
7145 7150 * Added pager function to genutils and changed ? to print usage
7146 7151 note through it (it was too long).
7147 7152
7148 7153 * Added the LazyPython functionality. Works great! I changed the
7149 7154 auto-quote escape to ';', it's on home row and next to '. But
7150 7155 both auto-quote and auto-paren (still /) escapes are command-line
7151 7156 parameters.
7152 7157
7153 7158
7154 7159 2001-11-01 Fernando Perez <fperez@colorado.edu>
7155 7160
7156 7161 * Version changed to 0.0.7. Fairly large change: configuration now
7157 7162 is all stored in a directory, by default .ipython. There, all
7158 7163 config files have normal looking names (not .names)
7159 7164
7160 7165 * Version 0.0.6 Released first to Lucas and Archie as a test
7161 7166 run. Since it's the first 'semi-public' release, change version to
7162 7167 > 0.0.6 for any changes now.
7163 7168
7164 7169 * Stuff I had put in the ipplib.py changelog:
7165 7170
7166 7171 Changes to InteractiveShell:
7167 7172
7168 7173 - Made the usage message a parameter.
7169 7174
7170 7175 - Require the name of the shell variable to be given. It's a bit
7171 7176 of a hack, but allows the name 'shell' not to be hardwired in the
7172 7177 magic (@) handler, which is problematic b/c it requires
7173 7178 polluting the global namespace with 'shell'. This in turn is
7174 7179 fragile: if a user redefines a variable called shell, things
7175 7180 break.
7176 7181
7177 7182 - magic @: all functions available through @ need to be defined
7178 7183 as magic_<name>, even though they can be called simply as
7179 7184 @<name>. This allows the special command @magic to gather
7180 7185 information automatically about all existing magic functions,
7181 7186 even if they are run-time user extensions, by parsing the shell
7182 7187 instance __dict__ looking for special magic_ names.
7183 7188
7184 7189 - mainloop: added *two* local namespace parameters. This allows
7185 7190 the class to differentiate between parameters which were there
7186 7191 before and after command line initialization was processed. This
7187 7192 way, later @who can show things loaded at startup by the
7188 7193 user. This trick was necessary to make session saving/reloading
7189 7194 really work: ideally after saving/exiting/reloading a session,
7190 7195 *everything* should look the same, including the output of @who. I
7191 7196 was only able to make this work with this double namespace
7192 7197 trick.
7193 7198
7194 7199 - added a header to the logfile which allows (almost) full
7195 7200 session restoring.
7196 7201
7197 7202 - prepend lines beginning with @ or !, with a and log
7198 7203 them. Why? !lines: may be useful to know what you did @lines:
7199 7204 they may affect session state. So when restoring a session, at
7200 7205 least inform the user of their presence. I couldn't quite get
7201 7206 them to properly re-execute, but at least the user is warned.
7202 7207
7203 7208 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now