##// END OF EJS Templates
Restore sys.last_traceback and friends, for the benefit of pdb.pm(). Let's hope it doesn't cause problems with threaded shells (tested, OK so far). Other exception-related cleanups.
fperez -
Show More
@@ -1,2268 +1,2278 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 1140 2006-02-10 17:07:11Z vivainio $
9 $Id: iplib.py 1202 2006-03-12 06:37:52Z fperez $
10 10 """
11 11
12 12 #*****************************************************************************
13 13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
14 14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
15 15 #
16 16 # Distributed under the terms of the BSD License. The full license is in
17 17 # the file COPYING, distributed as part of this software.
18 18 #
19 19 # Note: this code originally subclassed code.InteractiveConsole from the
20 20 # Python standard library. Over time, all of that class has been copied
21 21 # verbatim here for modifications which could not be accomplished by
22 22 # subclassing. At this point, there are no dependencies at all on the code
23 23 # module anymore (it is not even imported). The Python License (sec. 2)
24 24 # allows for this, but it's always nice to acknowledge credit where credit is
25 25 # due.
26 26 #*****************************************************************************
27 27
28 28 #****************************************************************************
29 29 # Modules and globals
30 30
31 31 from __future__ import generators # for 2.2 backwards-compatibility
32 32
33 33 from IPython import Release
34 34 __author__ = '%s <%s>\n%s <%s>' % \
35 35 ( Release.authors['Janko'] + Release.authors['Fernando'] )
36 36 __license__ = Release.license
37 37 __version__ = Release.version
38 38
39 39 # Python standard modules
40 40 import __main__
41 41 import __builtin__
42 42 import StringIO
43 43 import bdb
44 44 import cPickle as pickle
45 45 import codeop
46 46 import exceptions
47 47 import glob
48 48 import inspect
49 49 import keyword
50 50 import new
51 51 import os
52 52 import pdb
53 53 import pydoc
54 54 import re
55 55 import shutil
56 56 import string
57 57 import sys
58 58 import tempfile
59 59 import traceback
60 60 import types
61 61 import pickleshare
62 62
63 63 from pprint import pprint, pformat
64 64
65 65 # IPython's own modules
66 66 import IPython
67 67 from IPython import OInspect,PyColorize,ultraTB
68 68 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
69 69 from IPython.FakeModule import FakeModule
70 70 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
71 71 from IPython.Logger import Logger
72 72 from IPython.Magic import Magic
73 73 from IPython.Prompts import CachedOutput
74 74 from IPython.ipstruct import Struct
75 75 from IPython.background_jobs import BackgroundJobManager
76 76 from IPython.usage import cmd_line_usage,interactive_usage
77 77 from IPython.genutils import *
78 78 import IPython.ipapi
79 79
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 InputList(list):
132 132 """Class to store user input.
133 133
134 134 It's basically a list, but slices return a string instead of a list, thus
135 135 allowing things like (assuming 'In' is an instance):
136 136
137 137 exec In[4:7]
138 138
139 139 or
140 140
141 141 exec In[5:9] + In[14] + In[21:25]"""
142 142
143 143 def __getslice__(self,i,j):
144 144 return ''.join(list.__getslice__(self,i,j))
145 145
146 146 class SyntaxTB(ultraTB.ListTB):
147 147 """Extension which holds some state: the last exception value"""
148 148
149 149 def __init__(self,color_scheme = 'NoColor'):
150 150 ultraTB.ListTB.__init__(self,color_scheme)
151 151 self.last_syntax_error = None
152 152
153 153 def __call__(self, etype, value, elist):
154 154 self.last_syntax_error = value
155 155 ultraTB.ListTB.__call__(self,etype,value,elist)
156 156
157 157 def clear_err_state(self):
158 158 """Return the current error state and clear it"""
159 159 e = self.last_syntax_error
160 160 self.last_syntax_error = None
161 161 return e
162 162
163 163 #****************************************************************************
164 164 # Main IPython class
165 165
166 166 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
167 167 # until a full rewrite is made. I've cleaned all cross-class uses of
168 168 # attributes and methods, but too much user code out there relies on the
169 169 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
170 170 #
171 171 # But at least now, all the pieces have been separated and we could, in
172 172 # principle, stop using the mixin. This will ease the transition to the
173 173 # chainsaw branch.
174 174
175 175 # For reference, the following is the list of 'self.foo' uses in the Magic
176 176 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
177 177 # class, to prevent clashes.
178 178
179 179 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
180 180 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
181 181 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
182 182 # 'self.value']
183 183
184 184 class InteractiveShell(object,Magic):
185 185 """An enhanced console for Python."""
186 186
187 187 # class attribute to indicate whether the class supports threads or not.
188 188 # Subclasses with thread support should override this as needed.
189 189 isthreaded = False
190 190
191 191 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
192 192 user_ns = None,user_global_ns=None,banner2='',
193 193 custom_exceptions=((),None),embedded=False):
194 194
195 195
196 196 # log system
197 197 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
198 198
199 199 # Produce a public API instance
200 200
201 201 self.api = IPython.ipapi.IPApi(self)
202 202
203 203 # some minimal strict typechecks. For some core data structures, I
204 204 # want actual basic python types, not just anything that looks like
205 205 # one. This is especially true for namespaces.
206 206 for ns in (user_ns,user_global_ns):
207 207 if ns is not None and type(ns) != types.DictType:
208 208 raise TypeError,'namespace must be a dictionary'
209 209
210 210 # Job manager (for jobs run as background threads)
211 211 self.jobs = BackgroundJobManager()
212 212
213 213 # track which builtins we add, so we can clean up later
214 214 self.builtins_added = {}
215 215 # This method will add the necessary builtins for operation, but
216 216 # tracking what it did via the builtins_added dict.
217 217 self.add_builtins()
218 218
219 219 # Do the intuitively correct thing for quit/exit: we remove the
220 220 # builtins if they exist, and our own magics will deal with this
221 221 try:
222 222 del __builtin__.exit, __builtin__.quit
223 223 except AttributeError:
224 224 pass
225 225
226 226 # Store the actual shell's name
227 227 self.name = name
228 228
229 229 # We need to know whether the instance is meant for embedding, since
230 230 # global/local namespaces need to be handled differently in that case
231 231 self.embedded = embedded
232 232
233 233 # command compiler
234 234 self.compile = codeop.CommandCompiler()
235 235
236 236 # User input buffer
237 237 self.buffer = []
238 238
239 239 # Default name given in compilation of code
240 240 self.filename = '<ipython console>'
241 241
242 242 # Make an empty namespace, which extension writers can rely on both
243 243 # existing and NEVER being used by ipython itself. This gives them a
244 244 # convenient location for storing additional information and state
245 245 # their extensions may require, without fear of collisions with other
246 246 # ipython names that may develop later.
247 247 self.meta = Struct()
248 248
249 249 # Create the namespace where the user will operate. user_ns is
250 250 # normally the only one used, and it is passed to the exec calls as
251 251 # the locals argument. But we do carry a user_global_ns namespace
252 252 # given as the exec 'globals' argument, This is useful in embedding
253 253 # situations where the ipython shell opens in a context where the
254 254 # distinction between locals and globals is meaningful.
255 255
256 256 # FIXME. For some strange reason, __builtins__ is showing up at user
257 257 # level as a dict instead of a module. This is a manual fix, but I
258 258 # should really track down where the problem is coming from. Alex
259 259 # Schmolck reported this problem first.
260 260
261 261 # A useful post by Alex Martelli on this topic:
262 262 # Re: inconsistent value from __builtins__
263 263 # Von: Alex Martelli <aleaxit@yahoo.com>
264 264 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
265 265 # Gruppen: comp.lang.python
266 266
267 267 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
268 268 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
269 269 # > <type 'dict'>
270 270 # > >>> print type(__builtins__)
271 271 # > <type 'module'>
272 272 # > Is this difference in return value intentional?
273 273
274 274 # Well, it's documented that '__builtins__' can be either a dictionary
275 275 # or a module, and it's been that way for a long time. Whether it's
276 276 # intentional (or sensible), I don't know. In any case, the idea is
277 277 # that if you need to access the built-in namespace directly, you
278 278 # should start with "import __builtin__" (note, no 's') which will
279 279 # definitely give you a module. Yeah, it's somewhat confusing:-(.
280 280
281 281 if user_ns is None:
282 282 # Set __name__ to __main__ to better match the behavior of the
283 283 # normal interpreter.
284 284 user_ns = {'__name__' :'__main__',
285 285 '__builtins__' : __builtin__,
286 286 }
287 287
288 288 if user_global_ns is None:
289 289 user_global_ns = {}
290 290
291 291 # Assign namespaces
292 292 # This is the namespace where all normal user variables live
293 293 self.user_ns = user_ns
294 294 # Embedded instances require a separate namespace for globals.
295 295 # Normally this one is unused by non-embedded instances.
296 296 self.user_global_ns = user_global_ns
297 297 # A namespace to keep track of internal data structures to prevent
298 298 # them from cluttering user-visible stuff. Will be updated later
299 299 self.internal_ns = {}
300 300
301 301 # Namespace of system aliases. Each entry in the alias
302 302 # table must be a 2-tuple of the form (N,name), where N is the number
303 303 # of positional arguments of the alias.
304 304 self.alias_table = {}
305 305
306 306 # A table holding all the namespaces IPython deals with, so that
307 307 # introspection facilities can search easily.
308 308 self.ns_table = {'user':user_ns,
309 309 'user_global':user_global_ns,
310 310 'alias':self.alias_table,
311 311 'internal':self.internal_ns,
312 312 'builtin':__builtin__.__dict__
313 313 }
314 314
315 315 # The user namespace MUST have a pointer to the shell itself.
316 316 self.user_ns[name] = self
317 317
318 318 # We need to insert into sys.modules something that looks like a
319 319 # module but which accesses the IPython namespace, for shelve and
320 320 # pickle to work interactively. Normally they rely on getting
321 321 # everything out of __main__, but for embedding purposes each IPython
322 322 # instance has its own private namespace, so we can't go shoving
323 323 # everything into __main__.
324 324
325 325 # note, however, that we should only do this for non-embedded
326 326 # ipythons, which really mimic the __main__.__dict__ with their own
327 327 # namespace. Embedded instances, on the other hand, should not do
328 328 # this because they need to manage the user local/global namespaces
329 329 # only, but they live within a 'normal' __main__ (meaning, they
330 330 # shouldn't overtake the execution environment of the script they're
331 331 # embedded in).
332 332
333 333 if not embedded:
334 334 try:
335 335 main_name = self.user_ns['__name__']
336 336 except KeyError:
337 337 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
338 338 else:
339 339 #print "pickle hack in place" # dbg
340 340 #print 'main_name:',main_name # dbg
341 341 sys.modules[main_name] = FakeModule(self.user_ns)
342 342
343 343 # List of input with multi-line handling.
344 344 # Fill its zero entry, user counter starts at 1
345 345 self.input_hist = InputList(['\n'])
346 346 # This one will hold the 'raw' input history, without any
347 347 # pre-processing. This will allow users to retrieve the input just as
348 348 # it was exactly typed in by the user, with %hist -r.
349 349 self.input_hist_raw = InputList(['\n'])
350 350
351 351 # list of visited directories
352 352 try:
353 353 self.dir_hist = [os.getcwd()]
354 354 except IOError, e:
355 355 self.dir_hist = []
356 356
357 357 # dict of output history
358 358 self.output_hist = {}
359 359
360 360 # dict of things NOT to alias (keywords, builtins and some magics)
361 361 no_alias = {}
362 362 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
363 363 for key in keyword.kwlist + no_alias_magics:
364 364 no_alias[key] = 1
365 365 no_alias.update(__builtin__.__dict__)
366 366 self.no_alias = no_alias
367 367
368 368 # make global variables for user access to these
369 369 self.user_ns['_ih'] = self.input_hist
370 370 self.user_ns['_oh'] = self.output_hist
371 371 self.user_ns['_dh'] = self.dir_hist
372 372
373 373 # user aliases to input and output histories
374 374 self.user_ns['In'] = self.input_hist
375 375 self.user_ns['Out'] = self.output_hist
376 376
377 377 # Object variable to store code object waiting execution. This is
378 378 # used mainly by the multithreaded shells, but it can come in handy in
379 379 # other situations. No need to use a Queue here, since it's a single
380 380 # item which gets cleared once run.
381 381 self.code_to_run = None
382 382
383 383 # escapes for automatic behavior on the command line
384 384 self.ESC_SHELL = '!'
385 385 self.ESC_HELP = '?'
386 386 self.ESC_MAGIC = '%'
387 387 self.ESC_QUOTE = ','
388 388 self.ESC_QUOTE2 = ';'
389 389 self.ESC_PAREN = '/'
390 390
391 391 # And their associated handlers
392 392 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
393 393 self.ESC_QUOTE : self.handle_auto,
394 394 self.ESC_QUOTE2 : self.handle_auto,
395 395 self.ESC_MAGIC : self.handle_magic,
396 396 self.ESC_HELP : self.handle_help,
397 397 self.ESC_SHELL : self.handle_shell_escape,
398 398 }
399 399
400 400 # class initializations
401 401 Magic.__init__(self,self)
402 402
403 403 # Python source parser/formatter for syntax highlighting
404 404 pyformat = PyColorize.Parser().format
405 405 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
406 406
407 407 # hooks holds pointers used for user-side customizations
408 408 self.hooks = Struct()
409 409
410 410 # Set all default hooks, defined in the IPython.hooks module.
411 411 hooks = IPython.hooks
412 412 for hook_name in hooks.__all__:
413 413 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
414 414 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
415 415 #print "bound hook",hook_name
416 416
417 417 # Flag to mark unconditional exit
418 418 self.exit_now = False
419 419
420 420 self.usage_min = """\
421 421 An enhanced console for Python.
422 422 Some of its features are:
423 423 - Readline support if the readline library is present.
424 424 - Tab completion in the local namespace.
425 425 - Logging of input, see command-line options.
426 426 - System shell escape via ! , eg !ls.
427 427 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
428 428 - Keeps track of locally defined variables via %who, %whos.
429 429 - Show object information with a ? eg ?x or x? (use ?? for more info).
430 430 """
431 431 if usage: self.usage = usage
432 432 else: self.usage = self.usage_min
433 433
434 434 # Storage
435 435 self.rc = rc # This will hold all configuration information
436 436 self.pager = 'less'
437 437 # temporary files used for various purposes. Deleted at exit.
438 438 self.tempfiles = []
439 439
440 440 # Keep track of readline usage (later set by init_readline)
441 441 self.has_readline = False
442 442
443 443 # template for logfile headers. It gets resolved at runtime by the
444 444 # logstart method.
445 445 self.loghead_tpl = \
446 446 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
447 447 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
448 448 #log# opts = %s
449 449 #log# args = %s
450 450 #log# It is safe to make manual edits below here.
451 451 #log#-----------------------------------------------------------------------
452 452 """
453 453 # for pushd/popd management
454 454 try:
455 455 self.home_dir = get_home_dir()
456 456 except HomeDirError,msg:
457 457 fatal(msg)
458 458
459 459 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
460 460
461 461 # Functions to call the underlying shell.
462 462
463 463 # utility to expand user variables via Itpl
464 464 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
465 465 self.user_ns))
466 466 # The first is similar to os.system, but it doesn't return a value,
467 467 # and it allows interpolation of variables in the user's namespace.
468 468 self.system = lambda cmd: shell(self.var_expand(cmd),
469 469 header='IPython system call: ',
470 470 verbose=self.rc.system_verbose)
471 471 # These are for getoutput and getoutputerror:
472 472 self.getoutput = lambda cmd: \
473 473 getoutput(self.var_expand(cmd),
474 474 header='IPython system call: ',
475 475 verbose=self.rc.system_verbose)
476 476 self.getoutputerror = lambda cmd: \
477 477 getoutputerror(str(ItplNS(cmd.replace('#','\#'),
478 478 self.user_ns)),
479 479 header='IPython system call: ',
480 480 verbose=self.rc.system_verbose)
481 481
482 482 # RegExp for splitting line contents into pre-char//first
483 483 # word-method//rest. For clarity, each group in on one line.
484 484
485 485 # WARNING: update the regexp if the above escapes are changed, as they
486 486 # are hardwired in.
487 487
488 488 # Don't get carried away with trying to make the autocalling catch too
489 489 # much: it's better to be conservative rather than to trigger hidden
490 490 # evals() somewhere and end up causing side effects.
491 491
492 492 self.line_split = re.compile(r'^([\s*,;/])'
493 493 r'([\?\w\.]+\w*\s*)'
494 494 r'(\(?.*$)')
495 495
496 496 # Original re, keep around for a while in case changes break something
497 497 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
498 498 # r'(\s*[\?\w\.]+\w*\s*)'
499 499 # r'(\(?.*$)')
500 500
501 501 # RegExp to identify potential function names
502 502 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
503 503
504 504 # RegExp to exclude strings with this start from autocalling. In
505 505 # particular, all binary operators should be excluded, so that if foo
506 506 # is callable, foo OP bar doesn't become foo(OP bar), which is
507 507 # invalid. The characters '!=()' don't need to be checked for, as the
508 508 # _prefilter routine explicitely does so, to catch direct calls and
509 509 # rebindings of existing names.
510 510
511 511 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
512 512 # it affects the rest of the group in square brackets.
513 513 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
514 514 '|^is |^not |^in |^and |^or ')
515 515
516 516 # try to catch also methods for stuff in lists/tuples/dicts: off
517 517 # (experimental). For this to work, the line_split regexp would need
518 518 # to be modified so it wouldn't break things at '['. That line is
519 519 # nasty enough that I shouldn't change it until I can test it _well_.
520 520 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
521 521
522 522 # keep track of where we started running (mainly for crash post-mortem)
523 523 self.starting_dir = os.getcwd()
524 524
525 525 # Various switches which can be set
526 526 self.CACHELENGTH = 5000 # this is cheap, it's just text
527 527 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
528 528 self.banner2 = banner2
529 529
530 530 # TraceBack handlers:
531 531
532 532 # Syntax error handler.
533 533 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
534 534
535 535 # The interactive one is initialized with an offset, meaning we always
536 536 # want to remove the topmost item in the traceback, which is our own
537 537 # internal code. Valid modes: ['Plain','Context','Verbose']
538 538 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
539 539 color_scheme='NoColor',
540 540 tb_offset = 1)
541 541
542 542 # IPython itself shouldn't crash. This will produce a detailed
543 543 # post-mortem if it does. But we only install the crash handler for
544 544 # non-threaded shells, the threaded ones use a normal verbose reporter
545 545 # and lose the crash handler. This is because exceptions in the main
546 546 # thread (such as in GUI code) propagate directly to sys.excepthook,
547 547 # and there's no point in printing crash dumps for every user exception.
548 548 if self.isthreaded:
549 549 sys.excepthook = ultraTB.FormattedTB()
550 550 else:
551 551 from IPython import CrashHandler
552 552 sys.excepthook = CrashHandler.CrashHandler(self)
553 553
554 554 # The instance will store a pointer to this, so that runtime code
555 555 # (such as magics) can access it. This is because during the
556 556 # read-eval loop, it gets temporarily overwritten (to deal with GUI
557 557 # frameworks).
558 558 self.sys_excepthook = sys.excepthook
559 559
560 560 # and add any custom exception handlers the user may have specified
561 561 self.set_custom_exc(*custom_exceptions)
562 562
563 563 # Object inspector
564 564 self.inspector = OInspect.Inspector(OInspect.InspectColors,
565 565 PyColorize.ANSICodeColors,
566 566 'NoColor')
567 567 # indentation management
568 568 self.autoindent = False
569 569 self.indent_current_nsp = 0
570 570
571 571 # Make some aliases automatically
572 572 # Prepare list of shell aliases to auto-define
573 573 if os.name == 'posix':
574 574 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
575 575 'mv mv -i','rm rm -i','cp cp -i',
576 576 'cat cat','less less','clear clear',
577 577 # a better ls
578 578 'ls ls -F',
579 579 # long ls
580 580 'll ls -lF',
581 581 # color ls
582 582 'lc ls -F -o --color',
583 583 # ls normal files only
584 584 'lf ls -F -o --color %l | grep ^-',
585 585 # ls symbolic links
586 586 'lk ls -F -o --color %l | grep ^l',
587 587 # directories or links to directories,
588 588 'ldir ls -F -o --color %l | grep /$',
589 589 # things which are executable
590 590 'lx ls -F -o --color %l | grep ^-..x',
591 591 )
592 592 elif os.name in ['nt','dos']:
593 593 auto_alias = ('dir dir /on', 'ls dir /on',
594 594 'ddir dir /ad /on', 'ldir dir /ad /on',
595 595 'mkdir mkdir','rmdir rmdir','echo echo',
596 596 'ren ren','cls cls','copy copy')
597 597 else:
598 598 auto_alias = ()
599 599 self.auto_alias = map(lambda s:s.split(None,1),auto_alias)
600 600 # Call the actual (public) initializer
601 601 self.init_auto_alias()
602 602 # end __init__
603 603
604 604 def pre_config_initialization(self):
605 605 """Pre-configuration init method
606 606
607 607 This is called before the configuration files are processed to
608 608 prepare the services the config files might need.
609 609
610 610 self.rc already has reasonable default values at this point.
611 611 """
612 612 rc = self.rc
613 613
614 614 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
615 615
616 616
617 617 def post_config_initialization(self):
618 618 """Post configuration init method
619 619
620 620 This is called after the configuration files have been processed to
621 621 'finalize' the initialization."""
622 622
623 623 rc = self.rc
624 624
625 625 # Load readline proper
626 626 if rc.readline:
627 627 self.init_readline()
628 628
629 629 # local shortcut, this is used a LOT
630 630 self.log = self.logger.log
631 631
632 632 # Initialize cache, set in/out prompts and printing system
633 633 self.outputcache = CachedOutput(self,
634 634 rc.cache_size,
635 635 rc.pprint,
636 636 input_sep = rc.separate_in,
637 637 output_sep = rc.separate_out,
638 638 output_sep2 = rc.separate_out2,
639 639 ps1 = rc.prompt_in1,
640 640 ps2 = rc.prompt_in2,
641 641 ps_out = rc.prompt_out,
642 642 pad_left = rc.prompts_pad_left)
643 643
644 644 # user may have over-ridden the default print hook:
645 645 try:
646 646 self.outputcache.__class__.display = self.hooks.display
647 647 except AttributeError:
648 648 pass
649 649
650 650 # I don't like assigning globally to sys, because it means when embedding
651 651 # instances, each embedded instance overrides the previous choice. But
652 652 # sys.displayhook seems to be called internally by exec, so I don't see a
653 653 # way around it.
654 654 sys.displayhook = self.outputcache
655 655
656 656 # Set user colors (don't do it in the constructor above so that it
657 657 # doesn't crash if colors option is invalid)
658 658 self.magic_colors(rc.colors)
659 659
660 660 # Set calling of pdb on exceptions
661 661 self.call_pdb = rc.pdb
662 662
663 663 # Load user aliases
664 664 for alias in rc.alias:
665 665 self.magic_alias(alias)
666 666 self.hooks.late_startup_hook()
667 667
668 668
669 669 def add_builtins(self):
670 670 """Store ipython references into the builtin namespace.
671 671
672 672 Some parts of ipython operate via builtins injected here, which hold a
673 673 reference to IPython itself."""
674 674
675 675 # TODO: deprecate all except _ip; 'jobs' should be installed
676 676 # by an extension and the rest are under _ip, ipalias is redundant
677 677 builtins_new = dict(__IPYTHON__ = self,
678 678 ip_set_hook = self.set_hook,
679 679 jobs = self.jobs,
680 680 ipmagic = self.ipmagic,
681 681 ipalias = self.ipalias,
682 682 ipsystem = self.ipsystem,
683 683 _ip = self.api
684 684 )
685 685 for biname,bival in builtins_new.items():
686 686 try:
687 687 # store the orignal value so we can restore it
688 688 self.builtins_added[biname] = __builtin__.__dict__[biname]
689 689 except KeyError:
690 690 # or mark that it wasn't defined, and we'll just delete it at
691 691 # cleanup
692 692 self.builtins_added[biname] = Undefined
693 693 __builtin__.__dict__[biname] = bival
694 694
695 695 # Keep in the builtins a flag for when IPython is active. We set it
696 696 # with setdefault so that multiple nested IPythons don't clobber one
697 697 # another. Each will increase its value by one upon being activated,
698 698 # which also gives us a way to determine the nesting level.
699 699 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
700 700
701 701 def clean_builtins(self):
702 702 """Remove any builtins which might have been added by add_builtins, or
703 703 restore overwritten ones to their previous values."""
704 704 for biname,bival in self.builtins_added.items():
705 705 if bival is Undefined:
706 706 del __builtin__.__dict__[biname]
707 707 else:
708 708 __builtin__.__dict__[biname] = bival
709 709 self.builtins_added.clear()
710 710
711 711 def set_hook(self,name,hook, priority = 50):
712 712 """set_hook(name,hook) -> sets an internal IPython hook.
713 713
714 714 IPython exposes some of its internal API as user-modifiable hooks. By
715 715 adding your function to one of these hooks, you can modify IPython's
716 716 behavior to call at runtime your own routines."""
717 717
718 718 # At some point in the future, this should validate the hook before it
719 719 # accepts it. Probably at least check that the hook takes the number
720 720 # of args it's supposed to.
721 721 dp = getattr(self.hooks, name, None)
722 722 if name not in IPython.hooks.__all__:
723 723 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
724 724 if not dp:
725 725 dp = IPython.hooks.CommandChainDispatcher()
726 726
727 727 f = new.instancemethod(hook,self,self.__class__)
728 728 try:
729 729 dp.add(f,priority)
730 730 except AttributeError:
731 731 # it was not commandchain, plain old func - replace
732 732 dp = f
733 733
734 734 setattr(self.hooks,name, dp)
735 735
736 736
737 737 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
738 738
739 739 def set_custom_exc(self,exc_tuple,handler):
740 740 """set_custom_exc(exc_tuple,handler)
741 741
742 742 Set a custom exception handler, which will be called if any of the
743 743 exceptions in exc_tuple occur in the mainloop (specifically, in the
744 744 runcode() method.
745 745
746 746 Inputs:
747 747
748 748 - exc_tuple: a *tuple* of valid exceptions to call the defined
749 749 handler for. It is very important that you use a tuple, and NOT A
750 750 LIST here, because of the way Python's except statement works. If
751 751 you only want to trap a single exception, use a singleton tuple:
752 752
753 753 exc_tuple == (MyCustomException,)
754 754
755 755 - handler: this must be defined as a function with the following
756 756 basic interface: def my_handler(self,etype,value,tb).
757 757
758 758 This will be made into an instance method (via new.instancemethod)
759 759 of IPython itself, and it will be called if any of the exceptions
760 760 listed in the exc_tuple are caught. If the handler is None, an
761 761 internal basic one is used, which just prints basic info.
762 762
763 763 WARNING: by putting in your own exception handler into IPython's main
764 764 execution loop, you run a very good chance of nasty crashes. This
765 765 facility should only be used if you really know what you are doing."""
766 766
767 767 assert type(exc_tuple)==type(()) , \
768 768 "The custom exceptions must be given AS A TUPLE."
769 769
770 770 def dummy_handler(self,etype,value,tb):
771 771 print '*** Simple custom exception handler ***'
772 772 print 'Exception type :',etype
773 773 print 'Exception value:',value
774 774 print 'Traceback :',tb
775 775 print 'Source code :','\n'.join(self.buffer)
776 776
777 777 if handler is None: handler = dummy_handler
778 778
779 779 self.CustomTB = new.instancemethod(handler,self,self.__class__)
780 780 self.custom_exceptions = exc_tuple
781 781
782 782 def set_custom_completer(self,completer,pos=0):
783 783 """set_custom_completer(completer,pos=0)
784 784
785 785 Adds a new custom completer function.
786 786
787 787 The position argument (defaults to 0) is the index in the completers
788 788 list where you want the completer to be inserted."""
789 789
790 790 newcomp = new.instancemethod(completer,self.Completer,
791 791 self.Completer.__class__)
792 792 self.Completer.matchers.insert(pos,newcomp)
793 793
794 794 def _get_call_pdb(self):
795 795 return self._call_pdb
796 796
797 797 def _set_call_pdb(self,val):
798 798
799 799 if val not in (0,1,False,True):
800 800 raise ValueError,'new call_pdb value must be boolean'
801 801
802 802 # store value in instance
803 803 self._call_pdb = val
804 804
805 805 # notify the actual exception handlers
806 806 self.InteractiveTB.call_pdb = val
807 807 if self.isthreaded:
808 808 try:
809 809 self.sys_excepthook.call_pdb = val
810 810 except:
811 811 warn('Failed to activate pdb for threaded exception handler')
812 812
813 813 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
814 814 'Control auto-activation of pdb at exceptions')
815 815
816 816
817 817 # These special functions get installed in the builtin namespace, to
818 818 # provide programmatic (pure python) access to magics, aliases and system
819 819 # calls. This is important for logging, user scripting, and more.
820 820
821 821 # We are basically exposing, via normal python functions, the three
822 822 # mechanisms in which ipython offers special call modes (magics for
823 823 # internal control, aliases for direct system access via pre-selected
824 824 # names, and !cmd for calling arbitrary system commands).
825 825
826 826 def ipmagic(self,arg_s):
827 827 """Call a magic function by name.
828 828
829 829 Input: a string containing the name of the magic function to call and any
830 830 additional arguments to be passed to the magic.
831 831
832 832 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
833 833 prompt:
834 834
835 835 In[1]: %name -opt foo bar
836 836
837 837 To call a magic without arguments, simply use ipmagic('name').
838 838
839 839 This provides a proper Python function to call IPython's magics in any
840 840 valid Python code you can type at the interpreter, including loops and
841 841 compound statements. It is added by IPython to the Python builtin
842 842 namespace upon initialization."""
843 843
844 844 args = arg_s.split(' ',1)
845 845 magic_name = args[0]
846 846 magic_name = magic_name.lstrip(self.ESC_MAGIC)
847 847
848 848 try:
849 849 magic_args = args[1]
850 850 except IndexError:
851 851 magic_args = ''
852 852 fn = getattr(self,'magic_'+magic_name,None)
853 853 if fn is None:
854 854 error("Magic function `%s` not found." % magic_name)
855 855 else:
856 856 magic_args = self.var_expand(magic_args)
857 857 return fn(magic_args)
858 858
859 859 def ipalias(self,arg_s):
860 860 """Call an alias by name.
861 861
862 862 Input: a string containing the name of the alias to call and any
863 863 additional arguments to be passed to the magic.
864 864
865 865 ipalias('name -opt foo bar') is equivalent to typing at the ipython
866 866 prompt:
867 867
868 868 In[1]: name -opt foo bar
869 869
870 870 To call an alias without arguments, simply use ipalias('name').
871 871
872 872 This provides a proper Python function to call IPython's aliases in any
873 873 valid Python code you can type at the interpreter, including loops and
874 874 compound statements. It is added by IPython to the Python builtin
875 875 namespace upon initialization."""
876 876
877 877 args = arg_s.split(' ',1)
878 878 alias_name = args[0]
879 879 try:
880 880 alias_args = args[1]
881 881 except IndexError:
882 882 alias_args = ''
883 883 if alias_name in self.alias_table:
884 884 self.call_alias(alias_name,alias_args)
885 885 else:
886 886 error("Alias `%s` not found." % alias_name)
887 887
888 888 def ipsystem(self,arg_s):
889 889 """Make a system call, using IPython."""
890 890
891 891 self.system(arg_s)
892 892
893 893 def complete(self,text):
894 894 """Return a sorted list of all possible completions on text.
895 895
896 896 Inputs:
897 897
898 898 - text: a string of text to be completed on.
899 899
900 900 This is a wrapper around the completion mechanism, similar to what
901 901 readline does at the command line when the TAB key is hit. By
902 902 exposing it as a method, it can be used by other non-readline
903 903 environments (such as GUIs) for text completion.
904 904
905 905 Simple usage example:
906 906
907 907 In [1]: x = 'hello'
908 908
909 909 In [2]: __IP.complete('x.l')
910 910 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
911 911
912 912 complete = self.Completer.complete
913 913 state = 0
914 914 # use a dict so we get unique keys, since ipyhton's multiple
915 915 # completers can return duplicates.
916 916 comps = {}
917 917 while True:
918 918 newcomp = complete(text,state)
919 919 if newcomp is None:
920 920 break
921 921 comps[newcomp] = 1
922 922 state += 1
923 923 outcomps = comps.keys()
924 924 outcomps.sort()
925 925 return outcomps
926 926
927 927 def set_completer_frame(self, frame=None):
928 928 if frame:
929 929 self.Completer.namespace = frame.f_locals
930 930 self.Completer.global_namespace = frame.f_globals
931 931 else:
932 932 self.Completer.namespace = self.user_ns
933 933 self.Completer.global_namespace = self.user_global_ns
934 934
935 935 def init_auto_alias(self):
936 936 """Define some aliases automatically.
937 937
938 938 These are ALL parameter-less aliases"""
939 939
940 940 for alias,cmd in self.auto_alias:
941 941 self.alias_table[alias] = (0,cmd)
942 942
943 943 def alias_table_validate(self,verbose=0):
944 944 """Update information about the alias table.
945 945
946 946 In particular, make sure no Python keywords/builtins are in it."""
947 947
948 948 no_alias = self.no_alias
949 949 for k in self.alias_table.keys():
950 950 if k in no_alias:
951 951 del self.alias_table[k]
952 952 if verbose:
953 953 print ("Deleting alias <%s>, it's a Python "
954 954 "keyword or builtin." % k)
955 955
956 956 def set_autoindent(self,value=None):
957 957 """Set the autoindent flag, checking for readline support.
958 958
959 959 If called with no arguments, it acts as a toggle."""
960 960
961 961 if not self.has_readline:
962 962 if os.name == 'posix':
963 963 warn("The auto-indent feature requires the readline library")
964 964 self.autoindent = 0
965 965 return
966 966 if value is None:
967 967 self.autoindent = not self.autoindent
968 968 else:
969 969 self.autoindent = value
970 970
971 971 def rc_set_toggle(self,rc_field,value=None):
972 972 """Set or toggle a field in IPython's rc config. structure.
973 973
974 974 If called with no arguments, it acts as a toggle.
975 975
976 976 If called with a non-existent field, the resulting AttributeError
977 977 exception will propagate out."""
978 978
979 979 rc_val = getattr(self.rc,rc_field)
980 980 if value is None:
981 981 value = not rc_val
982 982 setattr(self.rc,rc_field,value)
983 983
984 984 def user_setup(self,ipythondir,rc_suffix,mode='install'):
985 985 """Install the user configuration directory.
986 986
987 987 Can be called when running for the first time or to upgrade the user's
988 988 .ipython/ directory with the mode parameter. Valid modes are 'install'
989 989 and 'upgrade'."""
990 990
991 991 def wait():
992 992 try:
993 993 raw_input("Please press <RETURN> to start IPython.")
994 994 except EOFError:
995 995 print >> Term.cout
996 996 print '*'*70
997 997
998 998 cwd = os.getcwd() # remember where we started
999 999 glb = glob.glob
1000 1000 print '*'*70
1001 1001 if mode == 'install':
1002 1002 print \
1003 1003 """Welcome to IPython. I will try to create a personal configuration directory
1004 1004 where you can customize many aspects of IPython's functionality in:\n"""
1005 1005 else:
1006 1006 print 'I am going to upgrade your configuration in:'
1007 1007
1008 1008 print ipythondir
1009 1009
1010 1010 rcdirend = os.path.join('IPython','UserConfig')
1011 1011 cfg = lambda d: os.path.join(d,rcdirend)
1012 1012 try:
1013 1013 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1014 1014 except IOError:
1015 1015 warning = """
1016 1016 Installation error. IPython's directory was not found.
1017 1017
1018 1018 Check the following:
1019 1019
1020 1020 The ipython/IPython directory should be in a directory belonging to your
1021 1021 PYTHONPATH environment variable (that is, it should be in a directory
1022 1022 belonging to sys.path). You can copy it explicitly there or just link to it.
1023 1023
1024 1024 IPython will proceed with builtin defaults.
1025 1025 """
1026 1026 warn(warning)
1027 1027 wait()
1028 1028 return
1029 1029
1030 1030 if mode == 'install':
1031 1031 try:
1032 1032 shutil.copytree(rcdir,ipythondir)
1033 1033 os.chdir(ipythondir)
1034 1034 rc_files = glb("ipythonrc*")
1035 1035 for rc_file in rc_files:
1036 1036 os.rename(rc_file,rc_file+rc_suffix)
1037 1037 except:
1038 1038 warning = """
1039 1039
1040 1040 There was a problem with the installation:
1041 1041 %s
1042 1042 Try to correct it or contact the developers if you think it's a bug.
1043 1043 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1044 1044 warn(warning)
1045 1045 wait()
1046 1046 return
1047 1047
1048 1048 elif mode == 'upgrade':
1049 1049 try:
1050 1050 os.chdir(ipythondir)
1051 1051 except:
1052 1052 print """
1053 1053 Can not upgrade: changing to directory %s failed. Details:
1054 1054 %s
1055 1055 """ % (ipythondir,sys.exc_info()[1])
1056 1056 wait()
1057 1057 return
1058 1058 else:
1059 1059 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1060 1060 for new_full_path in sources:
1061 1061 new_filename = os.path.basename(new_full_path)
1062 1062 if new_filename.startswith('ipythonrc'):
1063 1063 new_filename = new_filename + rc_suffix
1064 1064 # The config directory should only contain files, skip any
1065 1065 # directories which may be there (like CVS)
1066 1066 if os.path.isdir(new_full_path):
1067 1067 continue
1068 1068 if os.path.exists(new_filename):
1069 1069 old_file = new_filename+'.old'
1070 1070 if os.path.exists(old_file):
1071 1071 os.remove(old_file)
1072 1072 os.rename(new_filename,old_file)
1073 1073 shutil.copy(new_full_path,new_filename)
1074 1074 else:
1075 1075 raise ValueError,'unrecognized mode for install:',`mode`
1076 1076
1077 1077 # Fix line-endings to those native to each platform in the config
1078 1078 # directory.
1079 1079 try:
1080 1080 os.chdir(ipythondir)
1081 1081 except:
1082 1082 print """
1083 1083 Problem: changing to directory %s failed.
1084 1084 Details:
1085 1085 %s
1086 1086
1087 1087 Some configuration files may have incorrect line endings. This should not
1088 1088 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1089 1089 wait()
1090 1090 else:
1091 1091 for fname in glb('ipythonrc*'):
1092 1092 try:
1093 1093 native_line_ends(fname,backup=0)
1094 1094 except IOError:
1095 1095 pass
1096 1096
1097 1097 if mode == 'install':
1098 1098 print """
1099 1099 Successful installation!
1100 1100
1101 1101 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1102 1102 IPython manual (there are both HTML and PDF versions supplied with the
1103 1103 distribution) to make sure that your system environment is properly configured
1104 1104 to take advantage of IPython's features.
1105 1105
1106 1106 Important note: the configuration system has changed! The old system is
1107 1107 still in place, but its setting may be partly overridden by the settings in
1108 1108 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1109 1109 if some of the new settings bother you.
1110 1110
1111 1111 """
1112 1112 else:
1113 1113 print """
1114 1114 Successful upgrade!
1115 1115
1116 1116 All files in your directory:
1117 1117 %(ipythondir)s
1118 1118 which would have been overwritten by the upgrade were backed up with a .old
1119 1119 extension. If you had made particular customizations in those files you may
1120 1120 want to merge them back into the new files.""" % locals()
1121 1121 wait()
1122 1122 os.chdir(cwd)
1123 1123 # end user_setup()
1124 1124
1125 1125 def atexit_operations(self):
1126 1126 """This will be executed at the time of exit.
1127 1127
1128 1128 Saving of persistent data should be performed here. """
1129 1129
1130 1130 #print '*** IPython exit cleanup ***' # dbg
1131 1131 # input history
1132 1132 self.savehist()
1133 1133
1134 1134 # Cleanup all tempfiles left around
1135 1135 for tfile in self.tempfiles:
1136 1136 try:
1137 1137 os.unlink(tfile)
1138 1138 except OSError:
1139 1139 pass
1140 1140
1141 1141 # save the "persistent data" catch-all dictionary
1142 1142 self.hooks.shutdown_hook()
1143 1143
1144 1144 def savehist(self):
1145 1145 """Save input history to a file (via readline library)."""
1146 1146 try:
1147 1147 self.readline.write_history_file(self.histfile)
1148 1148 except:
1149 1149 print 'Unable to save IPython command history to file: ' + \
1150 1150 `self.histfile`
1151 1151
1152 1152 def pre_readline(self):
1153 1153 """readline hook to be used at the start of each line.
1154 1154
1155 1155 Currently it handles auto-indent only."""
1156 1156
1157 1157 #debugx('self.indent_current_nsp','pre_readline:')
1158 1158 self.readline.insert_text(self.indent_current_str())
1159 1159
1160 1160 def init_readline(self):
1161 1161 """Command history completion/saving/reloading."""
1162 1162
1163 1163 import IPython.rlineimpl as readline
1164 1164 if not readline.have_readline:
1165 1165 self.has_readline = 0
1166 1166 self.readline = None
1167 1167 # no point in bugging windows users with this every time:
1168 1168 warn('Readline services not available on this platform.')
1169 1169 else:
1170 1170 sys.modules['readline'] = readline
1171 1171 import atexit
1172 1172 from IPython.completer import IPCompleter
1173 1173 self.Completer = IPCompleter(self,
1174 1174 self.user_ns,
1175 1175 self.user_global_ns,
1176 1176 self.rc.readline_omit__names,
1177 1177 self.alias_table)
1178 1178
1179 1179 # Platform-specific configuration
1180 1180 if os.name == 'nt':
1181 1181 self.readline_startup_hook = readline.set_pre_input_hook
1182 1182 else:
1183 1183 self.readline_startup_hook = readline.set_startup_hook
1184 1184
1185 1185 # Load user's initrc file (readline config)
1186 1186 inputrc_name = os.environ.get('INPUTRC')
1187 1187 if inputrc_name is None:
1188 1188 home_dir = get_home_dir()
1189 1189 if home_dir is not None:
1190 1190 inputrc_name = os.path.join(home_dir,'.inputrc')
1191 1191 if os.path.isfile(inputrc_name):
1192 1192 try:
1193 1193 readline.read_init_file(inputrc_name)
1194 1194 except:
1195 1195 warn('Problems reading readline initialization file <%s>'
1196 1196 % inputrc_name)
1197 1197
1198 1198 self.has_readline = 1
1199 1199 self.readline = readline
1200 1200 # save this in sys so embedded copies can restore it properly
1201 1201 sys.ipcompleter = self.Completer.complete
1202 1202 readline.set_completer(self.Completer.complete)
1203 1203
1204 1204 # Configure readline according to user's prefs
1205 1205 for rlcommand in self.rc.readline_parse_and_bind:
1206 1206 readline.parse_and_bind(rlcommand)
1207 1207
1208 1208 # remove some chars from the delimiters list
1209 1209 delims = readline.get_completer_delims()
1210 1210 delims = delims.translate(string._idmap,
1211 1211 self.rc.readline_remove_delims)
1212 1212 readline.set_completer_delims(delims)
1213 1213 # otherwise we end up with a monster history after a while:
1214 1214 readline.set_history_length(1000)
1215 1215 try:
1216 1216 #print '*** Reading readline history' # dbg
1217 1217 readline.read_history_file(self.histfile)
1218 1218 except IOError:
1219 1219 pass # It doesn't exist yet.
1220 1220
1221 1221 atexit.register(self.atexit_operations)
1222 1222 del atexit
1223 1223
1224 1224 # Configure auto-indent for all platforms
1225 1225 self.set_autoindent(self.rc.autoindent)
1226 1226
1227 1227 def _should_recompile(self,e):
1228 1228 """Utility routine for edit_syntax_error"""
1229 1229
1230 1230 if e.filename in ('<ipython console>','<input>','<string>',
1231 1231 '<console>',None):
1232 1232
1233 1233 return False
1234 1234 try:
1235 1235 if (self.rc.autoedit_syntax and
1236 1236 not ask_yes_no('Return to editor to correct syntax error? '
1237 1237 '[Y/n] ','y')):
1238 1238 return False
1239 1239 except EOFError:
1240 1240 return False
1241 1241
1242 1242 def int0(x):
1243 1243 try:
1244 1244 return int(x)
1245 1245 except TypeError:
1246 1246 return 0
1247 1247 # always pass integer line and offset values to editor hook
1248 1248 self.hooks.fix_error_editor(e.filename,
1249 1249 int0(e.lineno),int0(e.offset),e.msg)
1250 1250 return True
1251 1251
1252 1252 def edit_syntax_error(self):
1253 1253 """The bottom half of the syntax error handler called in the main loop.
1254 1254
1255 1255 Loop until syntax error is fixed or user cancels.
1256 1256 """
1257 1257
1258 1258 while self.SyntaxTB.last_syntax_error:
1259 1259 # copy and clear last_syntax_error
1260 1260 err = self.SyntaxTB.clear_err_state()
1261 1261 if not self._should_recompile(err):
1262 1262 return
1263 1263 try:
1264 1264 # may set last_syntax_error again if a SyntaxError is raised
1265 1265 self.safe_execfile(err.filename,self.shell.user_ns)
1266 1266 except:
1267 1267 self.showtraceback()
1268 1268 else:
1269 1269 f = file(err.filename)
1270 1270 try:
1271 1271 sys.displayhook(f.read())
1272 1272 finally:
1273 1273 f.close()
1274 1274
1275 1275 def showsyntaxerror(self, filename=None):
1276 1276 """Display the syntax error that just occurred.
1277 1277
1278 1278 This doesn't display a stack trace because there isn't one.
1279 1279
1280 1280 If a filename is given, it is stuffed in the exception instead
1281 1281 of what was there before (because Python's parser always uses
1282 1282 "<string>" when reading from a string).
1283 1283 """
1284 1284 etype, value, last_traceback = sys.exc_info()
1285
1286 # See note about these variables in showtraceback() below
1287 sys.last_type = etype
1288 sys.last_value = value
1289 sys.last_traceback = last_traceback
1290
1285 1291 if filename and etype is SyntaxError:
1286 1292 # Work hard to stuff the correct filename in the exception
1287 1293 try:
1288 1294 msg, (dummy_filename, lineno, offset, line) = value
1289 1295 except:
1290 1296 # Not the format we expect; leave it alone
1291 1297 pass
1292 1298 else:
1293 1299 # Stuff in the right filename
1294 1300 try:
1295 1301 # Assume SyntaxError is a class exception
1296 1302 value = SyntaxError(msg, (filename, lineno, offset, line))
1297 1303 except:
1298 1304 # If that failed, assume SyntaxError is a string
1299 1305 value = msg, (filename, lineno, offset, line)
1300 1306 self.SyntaxTB(etype,value,[])
1301 1307
1302 1308 def debugger(self):
1303 1309 """Call the pdb debugger."""
1304 1310
1305 1311 if not self.rc.pdb:
1306 1312 return
1307 1313 pdb.pm()
1308 1314
1309 def showtraceback(self,exc_tuple = None,filename=None):
1315 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1310 1316 """Display the exception that just occurred."""
1311 1317
1312 1318 # Though this won't be called by syntax errors in the input line,
1313 1319 # there may be SyntaxError cases whith imported code.
1314 1320 if exc_tuple is None:
1315 type, value, tb = sys.exc_info()
1321 etype, value, tb = sys.exc_info()
1316 1322 else:
1317 type, value, tb = exc_tuple
1318 if type is SyntaxError:
1323 etype, value, tb = exc_tuple
1324 if etype is SyntaxError:
1319 1325 self.showsyntaxerror(filename)
1320 1326 else:
1321 self.InteractiveTB()
1327 # WARNING: these variables are somewhat deprecated and not
1328 # necessarily safe to use in a threaded environment, but tools
1329 # like pdb depend on their existence, so let's set them. If we
1330 # find problems in the field, we'll need to revisit their use.
1331 sys.last_type = etype
1332 sys.last_value = value
1333 sys.last_traceback = tb
1334
1335 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1322 1336 if self.InteractiveTB.call_pdb and self.has_readline:
1323 1337 # pdb mucks up readline, fix it back
1324 1338 self.readline.set_completer(self.Completer.complete)
1325 1339
1326 1340 def mainloop(self,banner=None):
1327 1341 """Creates the local namespace and starts the mainloop.
1328 1342
1329 1343 If an optional banner argument is given, it will override the
1330 1344 internally created default banner."""
1331 1345
1332 1346 if self.rc.c: # Emulate Python's -c option
1333 1347 self.exec_init_cmd()
1334 1348 if banner is None:
1335 1349 if not self.rc.banner:
1336 1350 banner = ''
1337 1351 # banner is string? Use it directly!
1338 1352 elif isinstance(self.rc.banner,basestring):
1339 1353 banner = self.rc.banner
1340 1354 else:
1341 1355 banner = self.BANNER+self.banner2
1342 1356
1343 1357 self.interact(banner)
1344 1358
1345 1359 def exec_init_cmd(self):
1346 1360 """Execute a command given at the command line.
1347 1361
1348 1362 This emulates Python's -c option."""
1349 1363
1350 1364 #sys.argv = ['-c']
1351 1365 self.push(self.rc.c)
1352 1366
1353 1367 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1354 1368 """Embeds IPython into a running python program.
1355 1369
1356 1370 Input:
1357 1371
1358 1372 - header: An optional header message can be specified.
1359 1373
1360 1374 - local_ns, global_ns: working namespaces. If given as None, the
1361 1375 IPython-initialized one is updated with __main__.__dict__, so that
1362 1376 program variables become visible but user-specific configuration
1363 1377 remains possible.
1364 1378
1365 1379 - stack_depth: specifies how many levels in the stack to go to
1366 1380 looking for namespaces (when local_ns and global_ns are None). This
1367 1381 allows an intermediate caller to make sure that this function gets
1368 1382 the namespace from the intended level in the stack. By default (0)
1369 1383 it will get its locals and globals from the immediate caller.
1370 1384
1371 1385 Warning: it's possible to use this in a program which is being run by
1372 1386 IPython itself (via %run), but some funny things will happen (a few
1373 1387 globals get overwritten). In the future this will be cleaned up, as
1374 1388 there is no fundamental reason why it can't work perfectly."""
1375 1389
1376 1390 # Get locals and globals from caller
1377 1391 if local_ns is None or global_ns is None:
1378 1392 call_frame = sys._getframe(stack_depth).f_back
1379 1393
1380 1394 if local_ns is None:
1381 1395 local_ns = call_frame.f_locals
1382 1396 if global_ns is None:
1383 1397 global_ns = call_frame.f_globals
1384 1398
1385 1399 # Update namespaces and fire up interpreter
1386 1400
1387 1401 # The global one is easy, we can just throw it in
1388 1402 self.user_global_ns = global_ns
1389 1403
1390 1404 # but the user/local one is tricky: ipython needs it to store internal
1391 1405 # data, but we also need the locals. We'll copy locals in the user
1392 1406 # one, but will track what got copied so we can delete them at exit.
1393 1407 # This is so that a later embedded call doesn't see locals from a
1394 1408 # previous call (which most likely existed in a separate scope).
1395 1409 local_varnames = local_ns.keys()
1396 1410 self.user_ns.update(local_ns)
1397 1411
1398 1412 # Patch for global embedding to make sure that things don't overwrite
1399 1413 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1400 1414 # FIXME. Test this a bit more carefully (the if.. is new)
1401 1415 if local_ns is None and global_ns is None:
1402 1416 self.user_global_ns.update(__main__.__dict__)
1403 1417
1404 1418 # make sure the tab-completer has the correct frame information, so it
1405 1419 # actually completes using the frame's locals/globals
1406 1420 self.set_completer_frame()
1407 1421
1408 1422 # before activating the interactive mode, we need to make sure that
1409 1423 # all names in the builtin namespace needed by ipython point to
1410 1424 # ourselves, and not to other instances.
1411 1425 self.add_builtins()
1412 1426
1413 1427 self.interact(header)
1414 1428
1415 1429 # now, purge out the user namespace from anything we might have added
1416 1430 # from the caller's local namespace
1417 1431 delvar = self.user_ns.pop
1418 1432 for var in local_varnames:
1419 1433 delvar(var,None)
1420 1434 # and clean builtins we may have overridden
1421 1435 self.clean_builtins()
1422 1436
1423 1437 def interact(self, banner=None):
1424 1438 """Closely emulate the interactive Python console.
1425 1439
1426 1440 The optional banner argument specify the banner to print
1427 1441 before the first interaction; by default it prints a banner
1428 1442 similar to the one printed by the real Python interpreter,
1429 1443 followed by the current class name in parentheses (so as not
1430 1444 to confuse this with the real interpreter -- since it's so
1431 1445 close!).
1432 1446
1433 1447 """
1434 1448 cprt = 'Type "copyright", "credits" or "license" for more information.'
1435 1449 if banner is None:
1436 1450 self.write("Python %s on %s\n%s\n(%s)\n" %
1437 1451 (sys.version, sys.platform, cprt,
1438 1452 self.__class__.__name__))
1439 1453 else:
1440 1454 self.write(banner)
1441 1455
1442 1456 more = 0
1443 1457
1444 1458 # Mark activity in the builtins
1445 1459 __builtin__.__dict__['__IPYTHON__active'] += 1
1446 1460
1447 1461 # exit_now is set by a call to %Exit or %Quit
1448 1462 self.exit_now = False
1449 1463 while not self.exit_now:
1450 1464 if more:
1451 1465 prompt = self.outputcache.prompt2
1452 1466 if self.autoindent:
1453 1467 self.readline_startup_hook(self.pre_readline)
1454 1468 else:
1455 1469 prompt = self.outputcache.prompt1
1456 1470 try:
1457 1471 line = self.raw_input(prompt,more)
1458 1472 if self.autoindent:
1459 1473 self.readline_startup_hook(None)
1460 1474 except KeyboardInterrupt:
1461 1475 self.write('\nKeyboardInterrupt\n')
1462 1476 self.resetbuffer()
1463 1477 # keep cache in sync with the prompt counter:
1464 1478 self.outputcache.prompt_count -= 1
1465 1479
1466 1480 if self.autoindent:
1467 1481 self.indent_current_nsp = 0
1468 1482 more = 0
1469 1483 except EOFError:
1470 1484 if self.autoindent:
1471 1485 self.readline_startup_hook(None)
1472 1486 self.write('\n')
1473 1487 self.exit()
1474 1488 except bdb.BdbQuit:
1475 1489 warn('The Python debugger has exited with a BdbQuit exception.\n'
1476 1490 'Because of how pdb handles the stack, it is impossible\n'
1477 1491 'for IPython to properly format this particular exception.\n'
1478 1492 'IPython will resume normal operation.')
1479 1493 except:
1480 1494 # exceptions here are VERY RARE, but they can be triggered
1481 1495 # asynchronously by signal handlers, for example.
1482 1496 self.showtraceback()
1483 1497 else:
1484 1498 more = self.push(line)
1485 1499 if (self.SyntaxTB.last_syntax_error and
1486 1500 self.rc.autoedit_syntax):
1487 1501 self.edit_syntax_error()
1488 1502
1489 1503 # We are off again...
1490 1504 __builtin__.__dict__['__IPYTHON__active'] -= 1
1491 1505
1492 def excepthook(self, type, value, tb):
1506 def excepthook(self, etype, value, tb):
1493 1507 """One more defense for GUI apps that call sys.excepthook.
1494 1508
1495 1509 GUI frameworks like wxPython trap exceptions and call
1496 1510 sys.excepthook themselves. I guess this is a feature that
1497 1511 enables them to keep running after exceptions that would
1498 1512 otherwise kill their mainloop. This is a bother for IPython
1499 1513 which excepts to catch all of the program exceptions with a try:
1500 1514 except: statement.
1501 1515
1502 1516 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1503 1517 any app directly invokes sys.excepthook, it will look to the user like
1504 1518 IPython crashed. In order to work around this, we can disable the
1505 1519 CrashHandler and replace it with this excepthook instead, which prints a
1506 1520 regular traceback using our InteractiveTB. In this fashion, apps which
1507 1521 call sys.excepthook will generate a regular-looking exception from
1508 1522 IPython, and the CrashHandler will only be triggered by real IPython
1509 1523 crashes.
1510 1524
1511 1525 This hook should be used sparingly, only in places which are not likely
1512 1526 to be true IPython errors.
1513 1527 """
1514
1515 self.InteractiveTB(type, value, tb, tb_offset=0)
1516 if self.InteractiveTB.call_pdb and self.has_readline:
1517 self.readline.set_completer(self.Completer.complete)
1528 self.showtraceback((etype,value,tb),tb_offset=0)
1518 1529
1519 1530 def transform_alias(self, alias,rest=''):
1520 1531 """ Transform alias to system command string
1521 1532
1522 1533 """
1523 1534 nargs,cmd = self.alias_table[alias]
1524 1535 # Expand the %l special to be the user's input line
1525 1536 if cmd.find('%l') >= 0:
1526 1537 cmd = cmd.replace('%l',rest)
1527 1538 rest = ''
1528 1539 if nargs==0:
1529 1540 # Simple, argument-less aliases
1530 1541 cmd = '%s %s' % (cmd,rest)
1531 1542 else:
1532 1543 # Handle aliases with positional arguments
1533 1544 args = rest.split(None,nargs)
1534 1545 if len(args)< nargs:
1535 1546 error('Alias <%s> requires %s arguments, %s given.' %
1536 1547 (alias,nargs,len(args)))
1537 1548 return None
1538 1549 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1539 1550 # Now call the macro, evaluating in the user's namespace
1540 1551
1541 1552 return cmd
1542 1553
1543 1554 def call_alias(self,alias,rest=''):
1544 1555 """Call an alias given its name and the rest of the line.
1545 1556
1546 1557 This is only used to provide backwards compatibility for users of
1547 1558 ipalias(), use of which is not recommended for anymore."""
1548 1559
1549 1560 # Now call the macro, evaluating in the user's namespace
1550 1561 cmd = self.transform_alias(alias, rest)
1551 1562 try:
1552 1563 self.system(cmd)
1553 1564 except:
1554 1565 self.showtraceback()
1555 1566
1556 1567 def indent_current_str(self):
1557 1568 """return the current level of indentation as a string"""
1558 1569 return self.indent_current_nsp * ' '
1559 1570
1560 1571 def autoindent_update(self,line):
1561 1572 """Keep track of the indent level."""
1562 1573
1563 1574 #debugx('line')
1564 1575 #debugx('self.indent_current_nsp')
1565 1576 if self.autoindent:
1566 1577 if line:
1567 1578 inisp = num_ini_spaces(line)
1568 1579 if inisp < self.indent_current_nsp:
1569 1580 self.indent_current_nsp = inisp
1570 1581
1571 1582 if line[-1] == ':':
1572 1583 self.indent_current_nsp += 4
1573 1584 elif dedent_re.match(line):
1574 1585 self.indent_current_nsp -= 4
1575 1586 else:
1576 1587 self.indent_current_nsp = 0
1577 1588
1578 1589 def runlines(self,lines):
1579 1590 """Run a string of one or more lines of source.
1580 1591
1581 1592 This method is capable of running a string containing multiple source
1582 1593 lines, as if they had been entered at the IPython prompt. Since it
1583 1594 exposes IPython's processing machinery, the given strings can contain
1584 1595 magic calls (%magic), special shell access (!cmd), etc."""
1585 1596
1586 1597 # We must start with a clean buffer, in case this is run from an
1587 1598 # interactive IPython session (via a magic, for example).
1588 1599 self.resetbuffer()
1589 1600 lines = lines.split('\n')
1590 1601 more = 0
1591 1602 for line in lines:
1592 1603 # skip blank lines so we don't mess up the prompt counter, but do
1593 1604 # NOT skip even a blank line if we are in a code block (more is
1594 1605 # true)
1595 1606 if line or more:
1596 1607 more = self.push(self.prefilter(line,more))
1597 1608 # IPython's runsource returns None if there was an error
1598 1609 # compiling the code. This allows us to stop processing right
1599 1610 # away, so the user gets the error message at the right place.
1600 1611 if more is None:
1601 1612 break
1602 1613 # final newline in case the input didn't have it, so that the code
1603 1614 # actually does get executed
1604 1615 if more:
1605 1616 self.push('\n')
1606 1617
1607 1618 def runsource(self, source, filename='<input>', symbol='single'):
1608 1619 """Compile and run some source in the interpreter.
1609 1620
1610 1621 Arguments are as for compile_command().
1611 1622
1612 1623 One several things can happen:
1613 1624
1614 1625 1) The input is incorrect; compile_command() raised an
1615 1626 exception (SyntaxError or OverflowError). A syntax traceback
1616 1627 will be printed by calling the showsyntaxerror() method.
1617 1628
1618 1629 2) The input is incomplete, and more input is required;
1619 1630 compile_command() returned None. Nothing happens.
1620 1631
1621 1632 3) The input is complete; compile_command() returned a code
1622 1633 object. The code is executed by calling self.runcode() (which
1623 1634 also handles run-time exceptions, except for SystemExit).
1624 1635
1625 1636 The return value is:
1626 1637
1627 1638 - True in case 2
1628 1639
1629 1640 - False in the other cases, unless an exception is raised, where
1630 1641 None is returned instead. This can be used by external callers to
1631 1642 know whether to continue feeding input or not.
1632 1643
1633 1644 The return value can be used to decide whether to use sys.ps1 or
1634 1645 sys.ps2 to prompt the next line."""
1635 1646
1636 1647 try:
1637 1648 code = self.compile(source,filename,symbol)
1638 1649 except (OverflowError, SyntaxError, ValueError):
1639 1650 # Case 1
1640 1651 self.showsyntaxerror(filename)
1641 1652 return None
1642 1653
1643 1654 if code is None:
1644 1655 # Case 2
1645 1656 return True
1646 1657
1647 1658 # Case 3
1648 1659 # We store the code object so that threaded shells and
1649 1660 # custom exception handlers can access all this info if needed.
1650 1661 # The source corresponding to this can be obtained from the
1651 1662 # buffer attribute as '\n'.join(self.buffer).
1652 1663 self.code_to_run = code
1653 1664 # now actually execute the code object
1654 1665 if self.runcode(code) == 0:
1655 1666 return False
1656 1667 else:
1657 1668 return None
1658 1669
1659 1670 def runcode(self,code_obj):
1660 1671 """Execute a code object.
1661 1672
1662 1673 When an exception occurs, self.showtraceback() is called to display a
1663 1674 traceback.
1664 1675
1665 1676 Return value: a flag indicating whether the code to be run completed
1666 1677 successfully:
1667 1678
1668 1679 - 0: successful execution.
1669 1680 - 1: an error occurred.
1670 1681 """
1671 1682
1672 1683 # Set our own excepthook in case the user code tries to call it
1673 1684 # directly, so that the IPython crash handler doesn't get triggered
1674 1685 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1675 1686
1676 1687 # we save the original sys.excepthook in the instance, in case config
1677 1688 # code (such as magics) needs access to it.
1678 1689 self.sys_excepthook = old_excepthook
1679 1690 outflag = 1 # happens in more places, so it's easier as default
1680 1691 try:
1681 1692 try:
1682 1693 # Embedded instances require separate global/local namespaces
1683 1694 # so they can see both the surrounding (local) namespace and
1684 1695 # the module-level globals when called inside another function.
1685 1696 if self.embedded:
1686 1697 exec code_obj in self.user_global_ns, self.user_ns
1687 1698 # Normal (non-embedded) instances should only have a single
1688 1699 # namespace for user code execution, otherwise functions won't
1689 1700 # see interactive top-level globals.
1690 1701 else:
1691 1702 exec code_obj in self.user_ns
1692 1703 finally:
1693 1704 # Reset our crash handler in place
1694 1705 sys.excepthook = old_excepthook
1695 1706 except SystemExit:
1696 1707 self.resetbuffer()
1697 1708 self.showtraceback()
1698 1709 warn("Type exit or quit to exit IPython "
1699 1710 "(%Exit or %Quit do so unconditionally).",level=1)
1700 1711 except self.custom_exceptions:
1701 1712 etype,value,tb = sys.exc_info()
1702 1713 self.CustomTB(etype,value,tb)
1703 1714 except:
1704 1715 self.showtraceback()
1705 1716 else:
1706 1717 outflag = 0
1707 1718 if softspace(sys.stdout, 0):
1708 1719 print
1709 1720 # Flush out code object which has been run (and source)
1710 1721 self.code_to_run = None
1711 1722 return outflag
1712 1723
1713 1724 def push(self, line):
1714 1725 """Push a line to the interpreter.
1715 1726
1716 1727 The line should not have a trailing newline; it may have
1717 1728 internal newlines. The line is appended to a buffer and the
1718 1729 interpreter's runsource() method is called with the
1719 1730 concatenated contents of the buffer as source. If this
1720 1731 indicates that the command was executed or invalid, the buffer
1721 1732 is reset; otherwise, the command is incomplete, and the buffer
1722 1733 is left as it was after the line was appended. The return
1723 1734 value is 1 if more input is required, 0 if the line was dealt
1724 1735 with in some way (this is the same as runsource()).
1725 1736 """
1726 1737
1727 1738 # autoindent management should be done here, and not in the
1728 1739 # interactive loop, since that one is only seen by keyboard input. We
1729 1740 # need this done correctly even for code run via runlines (which uses
1730 1741 # push).
1731 1742
1732 1743 #print 'push line: <%s>' % line # dbg
1733 1744 self.autoindent_update(line)
1734 1745
1735 1746 self.buffer.append(line)
1736 1747 more = self.runsource('\n'.join(self.buffer), self.filename)
1737 1748 if not more:
1738 1749 self.resetbuffer()
1739 1750 return more
1740 1751
1741 1752 def resetbuffer(self):
1742 1753 """Reset the input buffer."""
1743 1754 self.buffer[:] = []
1744 1755
1745 1756 def raw_input(self,prompt='',continue_prompt=False):
1746 1757 """Write a prompt and read a line.
1747 1758
1748 1759 The returned line does not include the trailing newline.
1749 1760 When the user enters the EOF key sequence, EOFError is raised.
1750 1761
1751 1762 Optional inputs:
1752 1763
1753 1764 - prompt(''): a string to be printed to prompt the user.
1754 1765
1755 1766 - continue_prompt(False): whether this line is the first one or a
1756 1767 continuation in a sequence of inputs.
1757 1768 """
1758 1769
1759 1770 line = raw_input_original(prompt)
1760 1771
1761 1772 # Try to be reasonably smart about not re-indenting pasted input more
1762 1773 # than necessary. We do this by trimming out the auto-indent initial
1763 1774 # spaces, if the user's actual input started itself with whitespace.
1764 1775 #debugx('self.buffer[-1]')
1765 1776
1766 1777 if self.autoindent:
1767 1778 if num_ini_spaces(line) > self.indent_current_nsp:
1768 1779 line = line[self.indent_current_nsp:]
1769 1780 self.indent_current_nsp = 0
1770 1781
1771 1782 # store the unfiltered input before the user has any chance to modify
1772 1783 # it.
1773 1784 if line.strip():
1774 1785 if continue_prompt:
1775 1786 self.input_hist_raw[-1] += '%s\n' % line
1776 1787 else:
1777 1788 self.input_hist_raw.append('%s\n' % line)
1778 1789
1779 1790 lineout = self.prefilter(line,continue_prompt)
1780 1791 return lineout
1781 1792
1782 1793 def split_user_input(self,line):
1783 1794 """Split user input into pre-char, function part and rest."""
1784 1795
1785 1796 lsplit = self.line_split.match(line)
1786 1797 if lsplit is None: # no regexp match returns None
1787 1798 try:
1788 1799 iFun,theRest = line.split(None,1)
1789 1800 except ValueError:
1790 1801 iFun,theRest = line,''
1791 1802 pre = re.match('^(\s*)(.*)',line).groups()[0]
1792 1803 else:
1793 1804 pre,iFun,theRest = lsplit.groups()
1794 1805
1795 1806 #print 'line:<%s>' % line # dbg
1796 1807 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1797 1808 return pre,iFun.strip(),theRest
1798 1809
1799 1810 def _prefilter(self, line, continue_prompt):
1800 1811 """Calls different preprocessors, depending on the form of line."""
1801 1812
1802 1813 # All handlers *must* return a value, even if it's blank ('').
1803 1814
1804 1815 # Lines are NOT logged here. Handlers should process the line as
1805 1816 # needed, update the cache AND log it (so that the input cache array
1806 1817 # stays synced).
1807 1818
1808 1819 # This function is _very_ delicate, and since it's also the one which
1809 1820 # determines IPython's response to user input, it must be as efficient
1810 1821 # as possible. For this reason it has _many_ returns in it, trying
1811 1822 # always to exit as quickly as it can figure out what it needs to do.
1812 1823
1813 1824 # This function is the main responsible for maintaining IPython's
1814 1825 # behavior respectful of Python's semantics. So be _very_ careful if
1815 1826 # making changes to anything here.
1816 1827
1817 1828 #.....................................................................
1818 1829 # Code begins
1819 1830
1820 1831 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1821 1832
1822 1833 # save the line away in case we crash, so the post-mortem handler can
1823 1834 # record it
1824 1835 self._last_input_line = line
1825 1836
1826 1837 #print '***line: <%s>' % line # dbg
1827 1838
1828 1839 # the input history needs to track even empty lines
1829 1840 stripped = line.strip()
1830 1841
1831 1842 if not stripped:
1832 1843 if not continue_prompt:
1833 1844 self.outputcache.prompt_count -= 1
1834 1845 return self.handle_normal(line,continue_prompt)
1835 1846 #return self.handle_normal('',continue_prompt)
1836 1847
1837 1848 # print '***cont',continue_prompt # dbg
1838 1849 # special handlers are only allowed for single line statements
1839 1850 if continue_prompt and not self.rc.multi_line_specials:
1840 1851 return self.handle_normal(line,continue_prompt)
1841 1852
1842 1853
1843 1854 # For the rest, we need the structure of the input
1844 1855 pre,iFun,theRest = self.split_user_input(line)
1845 1856
1846 1857 # See whether any pre-existing handler can take care of it
1847 1858
1848 1859 rewritten = self.hooks.input_prefilter(stripped)
1849 1860 if rewritten != stripped: # ok, some prefilter did something
1850 1861 rewritten = pre + rewritten # add indentation
1851 1862 return self.handle_normal(rewritten)
1852 1863
1853 1864
1854 1865
1855 1866
1856 1867 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1857 1868
1858 1869 # First check for explicit escapes in the last/first character
1859 1870 handler = None
1860 1871 if line[-1] == self.ESC_HELP:
1861 1872 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
1862 1873 if handler is None:
1863 1874 # look at the first character of iFun, NOT of line, so we skip
1864 1875 # leading whitespace in multiline input
1865 1876 handler = self.esc_handlers.get(iFun[0:1])
1866 1877 if handler is not None:
1867 1878 return handler(line,continue_prompt,pre,iFun,theRest)
1868 1879 # Emacs ipython-mode tags certain input lines
1869 1880 if line.endswith('# PYTHON-MODE'):
1870 1881 return self.handle_emacs(line,continue_prompt)
1871 1882
1872 1883 # Next, check if we can automatically execute this thing
1873 1884
1874 1885 # Allow ! in multi-line statements if multi_line_specials is on:
1875 1886 if continue_prompt and self.rc.multi_line_specials and \
1876 1887 iFun.startswith(self.ESC_SHELL):
1877 1888 return self.handle_shell_escape(line,continue_prompt,
1878 1889 pre=pre,iFun=iFun,
1879 1890 theRest=theRest)
1880 1891
1881 1892 # Let's try to find if the input line is a magic fn
1882 1893 oinfo = None
1883 1894 if hasattr(self,'magic_'+iFun):
1884 1895 # WARNING: _ofind uses getattr(), so it can consume generators and
1885 1896 # cause other side effects.
1886 1897 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1887 1898 if oinfo['ismagic']:
1888 1899 # Be careful not to call magics when a variable assignment is
1889 1900 # being made (ls='hi', for example)
1890 1901 if self.rc.automagic and \
1891 1902 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
1892 1903 (self.rc.multi_line_specials or not continue_prompt):
1893 1904 return self.handle_magic(line,continue_prompt,
1894 1905 pre,iFun,theRest)
1895 1906 else:
1896 1907 return self.handle_normal(line,continue_prompt)
1897 1908
1898 1909 # If the rest of the line begins with an (in)equality, assginment or
1899 1910 # function call, we should not call _ofind but simply execute it.
1900 1911 # This avoids spurious geattr() accesses on objects upon assignment.
1901 1912 #
1902 1913 # It also allows users to assign to either alias or magic names true
1903 1914 # python variables (the magic/alias systems always take second seat to
1904 1915 # true python code).
1905 1916 if theRest and theRest[0] in '!=()':
1906 1917 return self.handle_normal(line,continue_prompt)
1907 1918
1908 1919 if oinfo is None:
1909 1920 # let's try to ensure that _oinfo is ONLY called when autocall is
1910 1921 # on. Since it has inevitable potential side effects, at least
1911 1922 # having autocall off should be a guarantee to the user that no
1912 1923 # weird things will happen.
1913 1924
1914 1925 if self.rc.autocall:
1915 1926 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1916 1927 else:
1917 1928 # in this case, all that's left is either an alias or
1918 1929 # processing the line normally.
1919 1930 if iFun in self.alias_table:
1920 1931 return self.handle_alias(line,continue_prompt,
1921 1932 pre,iFun,theRest)
1922 1933
1923 1934 else:
1924 1935 return self.handle_normal(line,continue_prompt)
1925 1936
1926 1937 if not oinfo['found']:
1927 1938 return self.handle_normal(line,continue_prompt)
1928 1939 else:
1929 1940 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1930 1941 if oinfo['isalias']:
1931 1942 return self.handle_alias(line,continue_prompt,
1932 1943 pre,iFun,theRest)
1933 1944
1934 1945 if (self.rc.autocall
1935 1946 and
1936 1947 (
1937 1948 #only consider exclusion re if not "," or ";" autoquoting
1938 1949 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
1939 1950 or pre == self.ESC_PAREN) or
1940 1951 (not self.re_exclude_auto.match(theRest)))
1941 1952 and
1942 1953 self.re_fun_name.match(iFun) and
1943 1954 callable(oinfo['obj'])) :
1944 1955 #print 'going auto' # dbg
1945 1956 return self.handle_auto(line,continue_prompt,
1946 1957 pre,iFun,theRest,oinfo['obj'])
1947 1958 else:
1948 1959 #print 'was callable?', callable(oinfo['obj']) # dbg
1949 1960 return self.handle_normal(line,continue_prompt)
1950 1961
1951 1962 # If we get here, we have a normal Python line. Log and return.
1952 1963 return self.handle_normal(line,continue_prompt)
1953 1964
1954 1965 def _prefilter_dumb(self, line, continue_prompt):
1955 1966 """simple prefilter function, for debugging"""
1956 1967 return self.handle_normal(line,continue_prompt)
1957 1968
1958 1969 # Set the default prefilter() function (this can be user-overridden)
1959 1970 prefilter = _prefilter
1960 1971
1961 1972 def handle_normal(self,line,continue_prompt=None,
1962 1973 pre=None,iFun=None,theRest=None):
1963 1974 """Handle normal input lines. Use as a template for handlers."""
1964 1975
1965 1976 # With autoindent on, we need some way to exit the input loop, and I
1966 1977 # don't want to force the user to have to backspace all the way to
1967 1978 # clear the line. The rule will be in this case, that either two
1968 1979 # lines of pure whitespace in a row, or a line of pure whitespace but
1969 1980 # of a size different to the indent level, will exit the input loop.
1970 1981
1971 1982 if (continue_prompt and self.autoindent and line.isspace() and
1972 1983 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
1973 1984 (self.buffer[-1]).isspace() )):
1974 1985 line = ''
1975 1986
1976 1987 self.log(line,continue_prompt)
1977 1988 return line
1978 1989
1979 1990 def handle_alias(self,line,continue_prompt=None,
1980 1991 pre=None,iFun=None,theRest=None):
1981 1992 """Handle alias input lines. """
1982 1993
1983 1994 # pre is needed, because it carries the leading whitespace. Otherwise
1984 1995 # aliases won't work in indented sections.
1985 1996 transformed = self.transform_alias(iFun, theRest)
1986 1997 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
1987 1998 self.log(line_out,continue_prompt)
1988 1999 return line_out
1989 2000
1990 2001 def handle_shell_escape(self, line, continue_prompt=None,
1991 2002 pre=None,iFun=None,theRest=None):
1992 2003 """Execute the line in a shell, empty return value"""
1993 2004
1994 2005 #print 'line in :', `line` # dbg
1995 2006 # Example of a special handler. Others follow a similar pattern.
1996 2007 if line.lstrip().startswith('!!'):
1997 2008 # rewrite iFun/theRest to properly hold the call to %sx and
1998 2009 # the actual command to be executed, so handle_magic can work
1999 2010 # correctly
2000 2011 theRest = '%s %s' % (iFun[2:],theRest)
2001 2012 iFun = 'sx'
2002 2013 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2003 2014 line.lstrip()[2:]),
2004 2015 continue_prompt,pre,iFun,theRest)
2005 2016 else:
2006 2017 cmd=line.lstrip().lstrip('!')
2007 2018 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2008 2019 # update cache/log and return
2009 2020 self.log(line_out,continue_prompt)
2010 2021 return line_out
2011 2022
2012 2023 def handle_magic(self, line, continue_prompt=None,
2013 2024 pre=None,iFun=None,theRest=None):
2014 2025 """Execute magic functions."""
2015 2026
2016 2027
2017 2028 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2018 2029 self.log(cmd,continue_prompt)
2019 2030 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2020 2031 return cmd
2021 2032
2022 2033 def handle_auto(self, line, continue_prompt=None,
2023 2034 pre=None,iFun=None,theRest=None,obj=None):
2024 2035 """Hande lines which can be auto-executed, quoting if requested."""
2025 2036
2026 2037 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2027 2038
2028 2039 # This should only be active for single-line input!
2029 2040 if continue_prompt:
2030 2041 self.log(line,continue_prompt)
2031 2042 return line
2032 2043
2033 2044 auto_rewrite = True
2034 2045
2035 2046 if pre == self.ESC_QUOTE:
2036 2047 # Auto-quote splitting on whitespace
2037 2048 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2038 2049 elif pre == self.ESC_QUOTE2:
2039 2050 # Auto-quote whole string
2040 2051 newcmd = '%s("%s")' % (iFun,theRest)
2041 2052 elif pre == self.ESC_PAREN:
2042 2053 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2043 2054 else:
2044 2055 # Auto-paren.
2045 2056 # We only apply it to argument-less calls if the autocall
2046 2057 # parameter is set to 2. We only need to check that autocall is <
2047 2058 # 2, since this function isn't called unless it's at least 1.
2048 2059 if not theRest and (self.rc.autocall < 2):
2049 2060 newcmd = '%s %s' % (iFun,theRest)
2050 2061 auto_rewrite = False
2051 2062 else:
2052 2063 if theRest.startswith('['):
2053 2064 if hasattr(obj,'__getitem__'):
2054 2065 # Don't autocall in this case: item access for an object
2055 2066 # which is BOTH callable and implements __getitem__.
2056 2067 newcmd = '%s %s' % (iFun,theRest)
2057 2068 auto_rewrite = False
2058 2069 else:
2059 2070 # if the object doesn't support [] access, go ahead and
2060 2071 # autocall
2061 2072 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2062 2073 elif theRest.endswith(';'):
2063 2074 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2064 2075 else:
2065 2076 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2066 2077
2067 2078 if auto_rewrite:
2068 2079 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2069 2080 # log what is now valid Python, not the actual user input (without the
2070 2081 # final newline)
2071 2082 self.log(newcmd,continue_prompt)
2072 2083 return newcmd
2073 2084
2074 2085 def handle_help(self, line, continue_prompt=None,
2075 2086 pre=None,iFun=None,theRest=None):
2076 2087 """Try to get some help for the object.
2077 2088
2078 2089 obj? or ?obj -> basic information.
2079 2090 obj?? or ??obj -> more details.
2080 2091 """
2081 2092
2082 2093 # We need to make sure that we don't process lines which would be
2083 2094 # otherwise valid python, such as "x=1 # what?"
2084 2095 try:
2085 2096 codeop.compile_command(line)
2086 2097 except SyntaxError:
2087 2098 # We should only handle as help stuff which is NOT valid syntax
2088 2099 if line[0]==self.ESC_HELP:
2089 2100 line = line[1:]
2090 2101 elif line[-1]==self.ESC_HELP:
2091 2102 line = line[:-1]
2092 2103 self.log('#?'+line)
2093 2104 if line:
2094 2105 self.magic_pinfo(line)
2095 2106 else:
2096 2107 page(self.usage,screen_lines=self.rc.screen_length)
2097 2108 return '' # Empty string is needed here!
2098 2109 except:
2099 2110 # Pass any other exceptions through to the normal handler
2100 2111 return self.handle_normal(line,continue_prompt)
2101 2112 else:
2102 2113 # If the code compiles ok, we should handle it normally
2103 2114 return self.handle_normal(line,continue_prompt)
2104 2115
2105 2116 def getapi(self):
2106 2117 """ Get an IPApi object for this shell instance
2107 2118
2108 2119 Getting an IPApi object is always preferable to accessing the shell
2109 2120 directly, but this holds true especially for extensions.
2110 2121
2111 2122 It should always be possible to implement an extension with IPApi
2112 2123 alone. If not, contact maintainer to request an addition.
2113 2124
2114 2125 """
2115 2126 return self.api
2116 2127
2117 2128 def handle_emacs(self,line,continue_prompt=None,
2118 2129 pre=None,iFun=None,theRest=None):
2119 2130 """Handle input lines marked by python-mode."""
2120 2131
2121 2132 # Currently, nothing is done. Later more functionality can be added
2122 2133 # here if needed.
2123 2134
2124 2135 # The input cache shouldn't be updated
2125 2136
2126 2137 return line
2127 2138
2128 2139 def mktempfile(self,data=None):
2129 2140 """Make a new tempfile and return its filename.
2130 2141
2131 2142 This makes a call to tempfile.mktemp, but it registers the created
2132 2143 filename internally so ipython cleans it up at exit time.
2133 2144
2134 2145 Optional inputs:
2135 2146
2136 2147 - data(None): if data is given, it gets written out to the temp file
2137 2148 immediately, and the file is closed again."""
2138 2149
2139 2150 filename = tempfile.mktemp('.py','ipython_edit_')
2140 2151 self.tempfiles.append(filename)
2141 2152
2142 2153 if data:
2143 2154 tmp_file = open(filename,'w')
2144 2155 tmp_file.write(data)
2145 2156 tmp_file.close()
2146 2157 return filename
2147 2158
2148 2159 def write(self,data):
2149 2160 """Write a string to the default output"""
2150 2161 Term.cout.write(data)
2151 2162
2152 2163 def write_err(self,data):
2153 2164 """Write a string to the default error output"""
2154 2165 Term.cerr.write(data)
2155 2166
2156 2167 def exit(self):
2157 2168 """Handle interactive exit.
2158 2169
2159 2170 This method sets the exit_now attribute."""
2160 2171
2161 2172 if self.rc.confirm_exit:
2162 2173 if ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2163 2174 self.exit_now = True
2164 2175 else:
2165 2176 self.exit_now = True
2166 2177 return self.exit_now
2167 2178
2168 2179 def safe_execfile(self,fname,*where,**kw):
2169 2180 fname = os.path.expanduser(fname)
2170 2181
2171 2182 # find things also in current directory
2172 2183 dname = os.path.dirname(fname)
2173 2184 if not sys.path.count(dname):
2174 2185 sys.path.append(dname)
2175 2186
2176 2187 try:
2177 2188 xfile = open(fname)
2178 2189 except:
2179 2190 print >> Term.cerr, \
2180 2191 'Could not open file <%s> for safe execution.' % fname
2181 2192 return None
2182 2193
2183 2194 kw.setdefault('islog',0)
2184 2195 kw.setdefault('quiet',1)
2185 2196 kw.setdefault('exit_ignore',0)
2186 2197 first = xfile.readline()
2187 2198 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2188 2199 xfile.close()
2189 2200 # line by line execution
2190 2201 if first.startswith(loghead) or kw['islog']:
2191 2202 print 'Loading log file <%s> one line at a time...' % fname
2192 2203 if kw['quiet']:
2193 2204 stdout_save = sys.stdout
2194 2205 sys.stdout = StringIO.StringIO()
2195 2206 try:
2196 2207 globs,locs = where[0:2]
2197 2208 except:
2198 2209 try:
2199 2210 globs = locs = where[0]
2200 2211 except:
2201 2212 globs = locs = globals()
2202 2213 badblocks = []
2203 2214
2204 2215 # we also need to identify indented blocks of code when replaying
2205 2216 # logs and put them together before passing them to an exec
2206 2217 # statement. This takes a bit of regexp and look-ahead work in the
2207 2218 # file. It's easiest if we swallow the whole thing in memory
2208 2219 # first, and manually walk through the lines list moving the
2209 2220 # counter ourselves.
2210 2221 indent_re = re.compile('\s+\S')
2211 2222 xfile = open(fname)
2212 2223 filelines = xfile.readlines()
2213 2224 xfile.close()
2214 2225 nlines = len(filelines)
2215 2226 lnum = 0
2216 2227 while lnum < nlines:
2217 2228 line = filelines[lnum]
2218 2229 lnum += 1
2219 2230 # don't re-insert logger status info into cache
2220 2231 if line.startswith('#log#'):
2221 2232 continue
2222 2233 else:
2223 2234 # build a block of code (maybe a single line) for execution
2224 2235 block = line
2225 2236 try:
2226 2237 next = filelines[lnum] # lnum has already incremented
2227 2238 except:
2228 2239 next = None
2229 2240 while next and indent_re.match(next):
2230 2241 block += next
2231 2242 lnum += 1
2232 2243 try:
2233 2244 next = filelines[lnum]
2234 2245 except:
2235 2246 next = None
2236 2247 # now execute the block of one or more lines
2237 2248 try:
2238 2249 exec block in globs,locs
2239 2250 except SystemExit:
2240 2251 pass
2241 2252 except:
2242 2253 badblocks.append(block.rstrip())
2243 2254 if kw['quiet']: # restore stdout
2244 2255 sys.stdout.close()
2245 2256 sys.stdout = stdout_save
2246 2257 print 'Finished replaying log file <%s>' % fname
2247 2258 if badblocks:
2248 2259 print >> sys.stderr, ('\nThe following lines/blocks in file '
2249 2260 '<%s> reported errors:' % fname)
2250 2261
2251 2262 for badline in badblocks:
2252 2263 print >> sys.stderr, badline
2253 2264 else: # regular file execution
2254 2265 try:
2255 2266 execfile(fname,*where)
2256 2267 except SyntaxError:
2257 etype,evalue = sys.exc_info()[:2]
2258 self.SyntaxTB(etype,evalue,[])
2268 self.showsyntaxerror()
2259 2269 warn('Failure executing file: <%s>' % fname)
2260 2270 except SystemExit,status:
2261 2271 if not kw['exit_ignore']:
2262 self.InteractiveTB()
2272 self.showtraceback()
2263 2273 warn('Failure executing file: <%s>' % fname)
2264 2274 except:
2265 self.InteractiveTB()
2275 self.showtraceback()
2266 2276 warn('Failure executing file: <%s>' % fname)
2267 2277
2268 2278 #************************* end of file <iplib.py> *****************************
@@ -1,5235 +1,5249 b''
1 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/iplib.py (showtraceback): add back sys.last_traceback
4 and friends, after a discussion with Zach Pincus on ipython-user.
5 I'm not 100% sure, but after thinking aobut it quite a bit, it may
6 be OK. Testing with the multithreaded shells didn't reveal any
7 problems, but let's keep an eye out.
8
9 In the process, I fixed a few things which were calling
10 self.InteractiveTB() directly (like safe_execfile), which is a
11 mistake: ALL exception reporting should be done by calling
12 self.showtraceback(), which handles state and tab-completion and
13 more.
14
1 15 2006-03-01 Ville Vainio <vivainio@gmail.com>
2 16
3 17 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
4 18 To use, do "from ipipe import *".
5 19
6 20 2006-02-24 Ville Vainio <vivainio@gmail.com>
7 21
8 22 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
9 23 "cleanly" and safely than the older upgrade mechanism.
10 24
11 25 2006-02-21 Ville Vainio <vivainio@gmail.com>
12 26
13 27 * Magic.py: %save works again.
14 28
15 29 2006-02-15 Ville Vainio <vivainio@gmail.com>
16 30
17 31 * Magic.py: %Pprint works again
18 32
19 33 * Extensions/ipy_sane_defaults.py: Provide everything provided
20 34 in default ipythonrc, to make it possible to have a completely empty
21 35 ipythonrc (and thus completely rc-file free configuration)
22 36
23 37
24 38 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
25 39
26 40 * IPython/hooks.py (editor): quote the call to the editor command,
27 41 to allow commands with spaces in them. Problem noted by watching
28 42 Ian Oswald's video about textpad under win32 at
29 43 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
30 44
31 45 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
32 46 describing magics (we haven't used @ for a loong time).
33 47
34 48 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
35 49 contributed by marienz to close
36 50 http://www.scipy.net/roundup/ipython/issue53.
37 51
38 52 2006-02-10 Ville Vainio <vivainio@gmail.com>
39 53
40 54 * genutils.py: getoutput now works in win32 too
41 55
42 56 * completer.py: alias and magic completion only invoked
43 57 at the first "item" in the line, to avoid "cd %store"
44 58 nonsense.
45 59
46 60 2006-02-09 Ville Vainio <vivainio@gmail.com>
47 61
48 62 * test/*: Added a unit testing framework (finally).
49 63 '%run runtests.py' to run test_*.
50 64
51 65 * ipapi.py: Exposed runlines and set_custom_exc
52 66
53 67 2006-02-07 Ville Vainio <vivainio@gmail.com>
54 68
55 69 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
56 70 instead use "f(1 2)" as before.
57 71
58 72 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
59 73
60 74 * IPython/demo.py (IPythonDemo): Add new classes to the demo
61 75 facilities, for demos processed by the IPython input filter
62 76 (IPythonDemo), and for running a script one-line-at-a-time as a
63 77 demo, both for pure Python (LineDemo) and for IPython-processed
64 78 input (IPythonLineDemo). After a request by Dave Kohel, from the
65 79 SAGE team.
66 80 (Demo.edit): added and edit() method to the demo objects, to edit
67 81 the in-memory copy of the last executed block.
68 82
69 83 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
70 84 processing to %edit, %macro and %save. These commands can now be
71 85 invoked on the unprocessed input as it was typed by the user
72 86 (without any prefilters applied). After requests by the SAGE team
73 87 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
74 88
75 89 2006-02-01 Ville Vainio <vivainio@gmail.com>
76 90
77 91 * setup.py, eggsetup.py: easy_install ipython==dev works
78 92 correctly now (on Linux)
79 93
80 94 * ipy_user_conf,ipmaker: user config changes, removed spurious
81 95 warnings
82 96
83 97 * iplib: if rc.banner is string, use it as is.
84 98
85 99 * Magic: %pycat accepts a string argument and pages it's contents.
86 100
87 101
88 102 2006-01-30 Ville Vainio <vivainio@gmail.com>
89 103
90 104 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
91 105 Now %store and bookmarks work through PickleShare, meaning that
92 106 concurrent access is possible and all ipython sessions see the
93 107 same database situation all the time, instead of snapshot of
94 108 the situation when the session was started. Hence, %bookmark
95 109 results are immediately accessible from othes sessions. The database
96 110 is also available for use by user extensions. See:
97 111 http://www.python.org/pypi/pickleshare
98 112
99 113 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
100 114
101 115 * aliases can now be %store'd
102 116
103 117 * path.py move to Extensions so that pickleshare does not need
104 118 IPython-specific import. Extensions added to pythonpath right
105 119 at __init__.
106 120
107 121 * iplib.py: ipalias deprecated/redundant; aliases are converted and
108 122 called with _ip.system and the pre-transformed command string.
109 123
110 124 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
111 125
112 126 * IPython/iplib.py (interact): Fix that we were not catching
113 127 KeyboardInterrupt exceptions properly. I'm not quite sure why the
114 128 logic here had to change, but it's fixed now.
115 129
116 130 2006-01-29 Ville Vainio <vivainio@gmail.com>
117 131
118 132 * iplib.py: Try to import pyreadline on Windows.
119 133
120 134 2006-01-27 Ville Vainio <vivainio@gmail.com>
121 135
122 136 * iplib.py: Expose ipapi as _ip in builtin namespace.
123 137 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
124 138 and ip_set_hook (-> _ip.set_hook) redundant. % and !
125 139 syntax now produce _ip.* variant of the commands.
126 140
127 141 * "_ip.options().autoedit_syntax = 2" automatically throws
128 142 user to editor for syntax error correction without prompting.
129 143
130 144 2006-01-27 Ville Vainio <vivainio@gmail.com>
131 145
132 146 * ipmaker.py: Give "realistic" sys.argv for scripts (without
133 147 'ipython' at argv[0]) executed through command line.
134 148 NOTE: this DEPRECATES calling ipython with multiple scripts
135 149 ("ipython a.py b.py c.py")
136 150
137 151 * iplib.py, hooks.py: Added configurable input prefilter,
138 152 named 'input_prefilter'. See ext_rescapture.py for example
139 153 usage.
140 154
141 155 * ext_rescapture.py, Magic.py: Better system command output capture
142 156 through 'var = !ls' (deprecates user-visible %sc). Same notation
143 157 applies for magics, 'var = %alias' assigns alias list to var.
144 158
145 159 * ipapi.py: added meta() for accessing extension-usable data store.
146 160
147 161 * iplib.py: added InteractiveShell.getapi(). New magics should be
148 162 written doing self.getapi() instead of using the shell directly.
149 163
150 164 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
151 165 %store foo >> ~/myfoo.txt to store variables to files (in clean
152 166 textual form, not a restorable pickle).
153 167
154 168 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
155 169
156 170 * usage.py, Magic.py: added %quickref
157 171
158 172 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
159 173
160 174 * GetoptErrors when invoking magics etc. with wrong args
161 175 are now more helpful:
162 176 GetoptError: option -l not recognized (allowed: "qb" )
163 177
164 178 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
165 179
166 180 * IPython/demo.py (Demo.show): Flush stdout after each block, so
167 181 computationally intensive blocks don't appear to stall the demo.
168 182
169 183 2006-01-24 Ville Vainio <vivainio@gmail.com>
170 184
171 185 * iplib.py, hooks.py: 'result_display' hook can return a non-None
172 186 value to manipulate resulting history entry.
173 187
174 188 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
175 189 to instance methods of IPApi class, to make extending an embedded
176 190 IPython feasible. See ext_rehashdir.py for example usage.
177 191
178 192 * Merged 1071-1076 from banches/0.7.1
179 193
180 194
181 195 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
182 196
183 197 * tools/release (daystamp): Fix build tools to use the new
184 198 eggsetup.py script to build lightweight eggs.
185 199
186 200 * Applied changesets 1062 and 1064 before 0.7.1 release.
187 201
188 202 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
189 203 see the raw input history (without conversions like %ls ->
190 204 ipmagic("ls")). After a request from W. Stein, SAGE
191 205 (http://modular.ucsd.edu/sage) developer. This information is
192 206 stored in the input_hist_raw attribute of the IPython instance, so
193 207 developers can access it if needed (it's an InputList instance).
194 208
195 209 * Versionstring = 0.7.2.svn
196 210
197 211 * eggsetup.py: A separate script for constructing eggs, creates
198 212 proper launch scripts even on Windows (an .exe file in
199 213 \python24\scripts).
200 214
201 215 * ipapi.py: launch_new_instance, launch entry point needed for the
202 216 egg.
203 217
204 218 2006-01-23 Ville Vainio <vivainio@gmail.com>
205 219
206 220 * Added %cpaste magic for pasting python code
207 221
208 222 2006-01-22 Ville Vainio <vivainio@gmail.com>
209 223
210 224 * Merge from branches/0.7.1 into trunk, revs 1052-1057
211 225
212 226 * Versionstring = 0.7.2.svn
213 227
214 228 * eggsetup.py: A separate script for constructing eggs, creates
215 229 proper launch scripts even on Windows (an .exe file in
216 230 \python24\scripts).
217 231
218 232 * ipapi.py: launch_new_instance, launch entry point needed for the
219 233 egg.
220 234
221 235 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
222 236
223 237 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
224 238 %pfile foo would print the file for foo even if it was a binary.
225 239 Now, extensions '.so' and '.dll' are skipped.
226 240
227 241 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
228 242 bug, where macros would fail in all threaded modes. I'm not 100%
229 243 sure, so I'm going to put out an rc instead of making a release
230 244 today, and wait for feedback for at least a few days.
231 245
232 246 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
233 247 it...) the handling of pasting external code with autoindent on.
234 248 To get out of a multiline input, the rule will appear for most
235 249 users unchanged: two blank lines or change the indent level
236 250 proposed by IPython. But there is a twist now: you can
237 251 add/subtract only *one or two spaces*. If you add/subtract three
238 252 or more (unless you completely delete the line), IPython will
239 253 accept that line, and you'll need to enter a second one of pure
240 254 whitespace. I know it sounds complicated, but I can't find a
241 255 different solution that covers all the cases, with the right
242 256 heuristics. Hopefully in actual use, nobody will really notice
243 257 all these strange rules and things will 'just work'.
244 258
245 259 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
246 260
247 261 * IPython/iplib.py (interact): catch exceptions which can be
248 262 triggered asynchronously by signal handlers. Thanks to an
249 263 automatic crash report, submitted by Colin Kingsley
250 264 <tercel-AT-gentoo.org>.
251 265
252 266 2006-01-20 Ville Vainio <vivainio@gmail.com>
253 267
254 268 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
255 269 (%rehashdir, very useful, try it out) of how to extend ipython
256 270 with new magics. Also added Extensions dir to pythonpath to make
257 271 importing extensions easy.
258 272
259 273 * %store now complains when trying to store interactively declared
260 274 classes / instances of those classes.
261 275
262 276 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
263 277 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
264 278 if they exist, and ipy_user_conf.py with some defaults is created for
265 279 the user.
266 280
267 281 * Startup rehashing done by the config file, not InterpreterExec.
268 282 This means system commands are available even without selecting the
269 283 pysh profile. It's the sensible default after all.
270 284
271 285 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
272 286
273 287 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
274 288 multiline code with autoindent on working. But I am really not
275 289 sure, so this needs more testing. Will commit a debug-enabled
276 290 version for now, while I test it some more, so that Ville and
277 291 others may also catch any problems. Also made
278 292 self.indent_current_str() a method, to ensure that there's no
279 293 chance of the indent space count and the corresponding string
280 294 falling out of sync. All code needing the string should just call
281 295 the method.
282 296
283 297 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
284 298
285 299 * IPython/Magic.py (magic_edit): fix check for when users don't
286 300 save their output files, the try/except was in the wrong section.
287 301
288 302 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
289 303
290 304 * IPython/Magic.py (magic_run): fix __file__ global missing from
291 305 script's namespace when executed via %run. After a report by
292 306 Vivian.
293 307
294 308 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
295 309 when using python 2.4. The parent constructor changed in 2.4, and
296 310 we need to track it directly (we can't call it, as it messes up
297 311 readline and tab-completion inside our pdb would stop working).
298 312 After a bug report by R. Bernstein <rocky-AT-panix.com>.
299 313
300 314 2006-01-16 Ville Vainio <vivainio@gmail.com>
301 315
302 316 * Ipython/magic.py:Reverted back to old %edit functionality
303 317 that returns file contents on exit.
304 318
305 319 * IPython/path.py: Added Jason Orendorff's "path" module to
306 320 IPython tree, http://www.jorendorff.com/articles/python/path/.
307 321 You can get path objects conveniently through %sc, and !!, e.g.:
308 322 sc files=ls
309 323 for p in files.paths: # or files.p
310 324 print p,p.mtime
311 325
312 326 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
313 327 now work again without considering the exclusion regexp -
314 328 hence, things like ',foo my/path' turn to 'foo("my/path")'
315 329 instead of syntax error.
316 330
317 331
318 332 2006-01-14 Ville Vainio <vivainio@gmail.com>
319 333
320 334 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
321 335 ipapi decorators for python 2.4 users, options() provides access to rc
322 336 data.
323 337
324 338 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
325 339 as path separators (even on Linux ;-). Space character after
326 340 backslash (as yielded by tab completer) is still space;
327 341 "%cd long\ name" works as expected.
328 342
329 343 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
330 344 as "chain of command", with priority. API stays the same,
331 345 TryNext exception raised by a hook function signals that
332 346 current hook failed and next hook should try handling it, as
333 347 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
334 348 requested configurable display hook, which is now implemented.
335 349
336 350 2006-01-13 Ville Vainio <vivainio@gmail.com>
337 351
338 352 * IPython/platutils*.py: platform specific utility functions,
339 353 so far only set_term_title is implemented (change terminal
340 354 label in windowing systems). %cd now changes the title to
341 355 current dir.
342 356
343 357 * IPython/Release.py: Added myself to "authors" list,
344 358 had to create new files.
345 359
346 360 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
347 361 shell escape; not a known bug but had potential to be one in the
348 362 future.
349 363
350 364 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
351 365 extension API for IPython! See the module for usage example. Fix
352 366 OInspect for docstring-less magic functions.
353 367
354 368
355 369 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
356 370
357 371 * IPython/iplib.py (raw_input): temporarily deactivate all
358 372 attempts at allowing pasting of code with autoindent on. It
359 373 introduced bugs (reported by Prabhu) and I can't seem to find a
360 374 robust combination which works in all cases. Will have to revisit
361 375 later.
362 376
363 377 * IPython/genutils.py: remove isspace() function. We've dropped
364 378 2.2 compatibility, so it's OK to use the string method.
365 379
366 380 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
367 381
368 382 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
369 383 matching what NOT to autocall on, to include all python binary
370 384 operators (including things like 'and', 'or', 'is' and 'in').
371 385 Prompted by a bug report on 'foo & bar', but I realized we had
372 386 many more potential bug cases with other operators. The regexp is
373 387 self.re_exclude_auto, it's fairly commented.
374 388
375 389 2006-01-12 Ville Vainio <vivainio@gmail.com>
376 390
377 391 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
378 392 Prettified and hardened string/backslash quoting with ipsystem(),
379 393 ipalias() and ipmagic(). Now even \ characters are passed to
380 394 %magics, !shell escapes and aliases exactly as they are in the
381 395 ipython command line. Should improve backslash experience,
382 396 particularly in Windows (path delimiter for some commands that
383 397 won't understand '/'), but Unix benefits as well (regexps). %cd
384 398 magic still doesn't support backslash path delimiters, though. Also
385 399 deleted all pretense of supporting multiline command strings in
386 400 !system or %magic commands. Thanks to Jerry McRae for suggestions.
387 401
388 402 * doc/build_doc_instructions.txt added. Documentation on how to
389 403 use doc/update_manual.py, added yesterday. Both files contributed
390 404 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
391 405 doc/*.sh for deprecation at a later date.
392 406
393 407 * /ipython.py Added ipython.py to root directory for
394 408 zero-installation (tar xzvf ipython.tgz; cd ipython; python
395 409 ipython.py) and development convenience (no need to kee doing
396 410 "setup.py install" between changes).
397 411
398 412 * Made ! and !! shell escapes work (again) in multiline expressions:
399 413 if 1:
400 414 !ls
401 415 !!ls
402 416
403 417 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
404 418
405 419 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
406 420 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
407 421 module in case-insensitive installation. Was causing crashes
408 422 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
409 423
410 424 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
411 425 <marienz-AT-gentoo.org>, closes
412 426 http://www.scipy.net/roundup/ipython/issue51.
413 427
414 428 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
415 429
416 430 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the the
417 431 problem of excessive CPU usage under *nix and keyboard lag under
418 432 win32.
419 433
420 434 2006-01-10 *** Released version 0.7.0
421 435
422 436 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
423 437
424 438 * IPython/Release.py (revision): tag version number to 0.7.0,
425 439 ready for release.
426 440
427 441 * IPython/Magic.py (magic_edit): Add print statement to %edit so
428 442 it informs the user of the name of the temp. file used. This can
429 443 help if you decide later to reuse that same file, so you know
430 444 where to copy the info from.
431 445
432 446 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
433 447
434 448 * setup_bdist_egg.py: little script to build an egg. Added
435 449 support in the release tools as well.
436 450
437 451 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
438 452
439 453 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
440 454 version selection (new -wxversion command line and ipythonrc
441 455 parameter). Patch contributed by Arnd Baecker
442 456 <arnd.baecker-AT-web.de>.
443 457
444 458 * IPython/iplib.py (embed_mainloop): fix tab-completion in
445 459 embedded instances, for variables defined at the interactive
446 460 prompt of the embedded ipython. Reported by Arnd.
447 461
448 462 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
449 463 it can be used as a (stateful) toggle, or with a direct parameter.
450 464
451 465 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
452 466 could be triggered in certain cases and cause the traceback
453 467 printer not to work.
454 468
455 469 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
456 470
457 471 * IPython/iplib.py (_should_recompile): Small fix, closes
458 472 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
459 473
460 474 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
461 475
462 476 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
463 477 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
464 478 Moad for help with tracking it down.
465 479
466 480 * IPython/iplib.py (handle_auto): fix autocall handling for
467 481 objects which support BOTH __getitem__ and __call__ (so that f [x]
468 482 is left alone, instead of becoming f([x]) automatically).
469 483
470 484 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
471 485 Ville's patch.
472 486
473 487 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
474 488
475 489 * IPython/iplib.py (handle_auto): changed autocall semantics to
476 490 include 'smart' mode, where the autocall transformation is NOT
477 491 applied if there are no arguments on the line. This allows you to
478 492 just type 'foo' if foo is a callable to see its internal form,
479 493 instead of having it called with no arguments (typically a
480 494 mistake). The old 'full' autocall still exists: for that, you
481 495 need to set the 'autocall' parameter to 2 in your ipythonrc file.
482 496
483 497 * IPython/completer.py (Completer.attr_matches): add
484 498 tab-completion support for Enthoughts' traits. After a report by
485 499 Arnd and a patch by Prabhu.
486 500
487 501 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
488 502
489 503 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
490 504 Schmolck's patch to fix inspect.getinnerframes().
491 505
492 506 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
493 507 for embedded instances, regarding handling of namespaces and items
494 508 added to the __builtin__ one. Multiple embedded instances and
495 509 recursive embeddings should work better now (though I'm not sure
496 510 I've got all the corner cases fixed, that code is a bit of a brain
497 511 twister).
498 512
499 513 * IPython/Magic.py (magic_edit): added support to edit in-memory
500 514 macros (automatically creates the necessary temp files). %edit
501 515 also doesn't return the file contents anymore, it's just noise.
502 516
503 517 * IPython/completer.py (Completer.attr_matches): revert change to
504 518 complete only on attributes listed in __all__. I realized it
505 519 cripples the tab-completion system as a tool for exploring the
506 520 internals of unknown libraries (it renders any non-__all__
507 521 attribute off-limits). I got bit by this when trying to see
508 522 something inside the dis module.
509 523
510 524 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
511 525
512 526 * IPython/iplib.py (InteractiveShell.__init__): add .meta
513 527 namespace for users and extension writers to hold data in. This
514 528 follows the discussion in
515 529 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
516 530
517 531 * IPython/completer.py (IPCompleter.complete): small patch to help
518 532 tab-completion under Emacs, after a suggestion by John Barnard
519 533 <barnarj-AT-ccf.org>.
520 534
521 535 * IPython/Magic.py (Magic.extract_input_slices): added support for
522 536 the slice notation in magics to use N-M to represent numbers N...M
523 537 (closed endpoints). This is used by %macro and %save.
524 538
525 539 * IPython/completer.py (Completer.attr_matches): for modules which
526 540 define __all__, complete only on those. After a patch by Jeffrey
527 541 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
528 542 speed up this routine.
529 543
530 544 * IPython/Logger.py (Logger.log): fix a history handling bug. I
531 545 don't know if this is the end of it, but the behavior now is
532 546 certainly much more correct. Note that coupled with macros,
533 547 slightly surprising (at first) behavior may occur: a macro will in
534 548 general expand to multiple lines of input, so upon exiting, the
535 549 in/out counters will both be bumped by the corresponding amount
536 550 (as if the macro's contents had been typed interactively). Typing
537 551 %hist will reveal the intermediate (silently processed) lines.
538 552
539 553 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
540 554 pickle to fail (%run was overwriting __main__ and not restoring
541 555 it, but pickle relies on __main__ to operate).
542 556
543 557 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
544 558 using properties, but forgot to make the main InteractiveShell
545 559 class a new-style class. Properties fail silently, and
546 560 misteriously, with old-style class (getters work, but
547 561 setters don't do anything).
548 562
549 563 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
550 564
551 565 * IPython/Magic.py (magic_history): fix history reporting bug (I
552 566 know some nasties are still there, I just can't seem to find a
553 567 reproducible test case to track them down; the input history is
554 568 falling out of sync...)
555 569
556 570 * IPython/iplib.py (handle_shell_escape): fix bug where both
557 571 aliases and system accesses where broken for indented code (such
558 572 as loops).
559 573
560 574 * IPython/genutils.py (shell): fix small but critical bug for
561 575 win32 system access.
562 576
563 577 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
564 578
565 579 * IPython/iplib.py (showtraceback): remove use of the
566 580 sys.last_{type/value/traceback} structures, which are non
567 581 thread-safe.
568 582 (_prefilter): change control flow to ensure that we NEVER
569 583 introspect objects when autocall is off. This will guarantee that
570 584 having an input line of the form 'x.y', where access to attribute
571 585 'y' has side effects, doesn't trigger the side effect TWICE. It
572 586 is important to note that, with autocall on, these side effects
573 587 can still happen.
574 588 (ipsystem): new builtin, to complete the ip{magic/alias/system}
575 589 trio. IPython offers these three kinds of special calls which are
576 590 not python code, and it's a good thing to have their call method
577 591 be accessible as pure python functions (not just special syntax at
578 592 the command line). It gives us a better internal implementation
579 593 structure, as well as exposing these for user scripting more
580 594 cleanly.
581 595
582 596 * IPython/macro.py (Macro.__init__): moved macros to a standalone
583 597 file. Now that they'll be more likely to be used with the
584 598 persistance system (%store), I want to make sure their module path
585 599 doesn't change in the future, so that we don't break things for
586 600 users' persisted data.
587 601
588 602 * IPython/iplib.py (autoindent_update): move indentation
589 603 management into the _text_ processing loop, not the keyboard
590 604 interactive one. This is necessary to correctly process non-typed
591 605 multiline input (such as macros).
592 606
593 607 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
594 608 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
595 609 which was producing problems in the resulting manual.
596 610 (magic_whos): improve reporting of instances (show their class,
597 611 instead of simply printing 'instance' which isn't terribly
598 612 informative).
599 613
600 614 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
601 615 (minor mods) to support network shares under win32.
602 616
603 617 * IPython/winconsole.py (get_console_size): add new winconsole
604 618 module and fixes to page_dumb() to improve its behavior under
605 619 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
606 620
607 621 * IPython/Magic.py (Macro): simplified Macro class to just
608 622 subclass list. We've had only 2.2 compatibility for a very long
609 623 time, yet I was still avoiding subclassing the builtin types. No
610 624 more (I'm also starting to use properties, though I won't shift to
611 625 2.3-specific features quite yet).
612 626 (magic_store): added Ville's patch for lightweight variable
613 627 persistence, after a request on the user list by Matt Wilkie
614 628 <maphew-AT-gmail.com>. The new %store magic's docstring has full
615 629 details.
616 630
617 631 * IPython/iplib.py (InteractiveShell.post_config_initialization):
618 632 changed the default logfile name from 'ipython.log' to
619 633 'ipython_log.py'. These logs are real python files, and now that
620 634 we have much better multiline support, people are more likely to
621 635 want to use them as such. Might as well name them correctly.
622 636
623 637 * IPython/Magic.py: substantial cleanup. While we can't stop
624 638 using magics as mixins, due to the existing customizations 'out
625 639 there' which rely on the mixin naming conventions, at least I
626 640 cleaned out all cross-class name usage. So once we are OK with
627 641 breaking compatibility, the two systems can be separated.
628 642
629 643 * IPython/Logger.py: major cleanup. This one is NOT a mixin
630 644 anymore, and the class is a fair bit less hideous as well. New
631 645 features were also introduced: timestamping of input, and logging
632 646 of output results. These are user-visible with the -t and -o
633 647 options to %logstart. Closes
634 648 http://www.scipy.net/roundup/ipython/issue11 and a request by
635 649 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
636 650
637 651 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
638 652
639 653 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
640 654 better hadnle backslashes in paths. See the thread 'More Windows
641 655 questions part 2 - \/ characters revisited' on the iypthon user
642 656 list:
643 657 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
644 658
645 659 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
646 660
647 661 (InteractiveShell.__init__): change threaded shells to not use the
648 662 ipython crash handler. This was causing more problems than not,
649 663 as exceptions in the main thread (GUI code, typically) would
650 664 always show up as a 'crash', when they really weren't.
651 665
652 666 The colors and exception mode commands (%colors/%xmode) have been
653 667 synchronized to also take this into account, so users can get
654 668 verbose exceptions for their threaded code as well. I also added
655 669 support for activating pdb inside this exception handler as well,
656 670 so now GUI authors can use IPython's enhanced pdb at runtime.
657 671
658 672 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
659 673 true by default, and add it to the shipped ipythonrc file. Since
660 674 this asks the user before proceeding, I think it's OK to make it
661 675 true by default.
662 676
663 677 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
664 678 of the previous special-casing of input in the eval loop. I think
665 679 this is cleaner, as they really are commands and shouldn't have
666 680 a special role in the middle of the core code.
667 681
668 682 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
669 683
670 684 * IPython/iplib.py (edit_syntax_error): added support for
671 685 automatically reopening the editor if the file had a syntax error
672 686 in it. Thanks to scottt who provided the patch at:
673 687 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
674 688 version committed).
675 689
676 690 * IPython/iplib.py (handle_normal): add suport for multi-line
677 691 input with emtpy lines. This fixes
678 692 http://www.scipy.net/roundup/ipython/issue43 and a similar
679 693 discussion on the user list.
680 694
681 695 WARNING: a behavior change is necessarily introduced to support
682 696 blank lines: now a single blank line with whitespace does NOT
683 697 break the input loop, which means that when autoindent is on, by
684 698 default hitting return on the next (indented) line does NOT exit.
685 699
686 700 Instead, to exit a multiline input you can either have:
687 701
688 702 - TWO whitespace lines (just hit return again), or
689 703 - a single whitespace line of a different length than provided
690 704 by the autoindent (add or remove a space).
691 705
692 706 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
693 707 module to better organize all readline-related functionality.
694 708 I've deleted FlexCompleter and put all completion clases here.
695 709
696 710 * IPython/iplib.py (raw_input): improve indentation management.
697 711 It is now possible to paste indented code with autoindent on, and
698 712 the code is interpreted correctly (though it still looks bad on
699 713 screen, due to the line-oriented nature of ipython).
700 714 (MagicCompleter.complete): change behavior so that a TAB key on an
701 715 otherwise empty line actually inserts a tab, instead of completing
702 716 on the entire global namespace. This makes it easier to use the
703 717 TAB key for indentation. After a request by Hans Meine
704 718 <hans_meine-AT-gmx.net>
705 719 (_prefilter): add support so that typing plain 'exit' or 'quit'
706 720 does a sensible thing. Originally I tried to deviate as little as
707 721 possible from the default python behavior, but even that one may
708 722 change in this direction (thread on python-dev to that effect).
709 723 Regardless, ipython should do the right thing even if CPython's
710 724 '>>>' prompt doesn't.
711 725 (InteractiveShell): removed subclassing code.InteractiveConsole
712 726 class. By now we'd overridden just about all of its methods: I've
713 727 copied the remaining two over, and now ipython is a standalone
714 728 class. This will provide a clearer picture for the chainsaw
715 729 branch refactoring.
716 730
717 731 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
718 732
719 733 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
720 734 failures for objects which break when dir() is called on them.
721 735
722 736 * IPython/FlexCompleter.py (Completer.__init__): Added support for
723 737 distinct local and global namespaces in the completer API. This
724 738 change allows us top properly handle completion with distinct
725 739 scopes, including in embedded instances (this had never really
726 740 worked correctly).
727 741
728 742 Note: this introduces a change in the constructor for
729 743 MagicCompleter, as a new global_namespace parameter is now the
730 744 second argument (the others were bumped one position).
731 745
732 746 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
733 747
734 748 * IPython/iplib.py (embed_mainloop): fix tab-completion in
735 749 embedded instances (which can be done now thanks to Vivian's
736 750 frame-handling fixes for pdb).
737 751 (InteractiveShell.__init__): Fix namespace handling problem in
738 752 embedded instances. We were overwriting __main__ unconditionally,
739 753 and this should only be done for 'full' (non-embedded) IPython;
740 754 embedded instances must respect the caller's __main__. Thanks to
741 755 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
742 756
743 757 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
744 758
745 759 * setup.py: added download_url to setup(). This registers the
746 760 download address at PyPI, which is not only useful to humans
747 761 browsing the site, but is also picked up by setuptools (the Eggs
748 762 machinery). Thanks to Ville and R. Kern for the info/discussion
749 763 on this.
750 764
751 765 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
752 766
753 767 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
754 768 This brings a lot of nice functionality to the pdb mode, which now
755 769 has tab-completion, syntax highlighting, and better stack handling
756 770 than before. Many thanks to Vivian De Smedt
757 771 <vivian-AT-vdesmedt.com> for the original patches.
758 772
759 773 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
760 774
761 775 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
762 776 sequence to consistently accept the banner argument. The
763 777 inconsistency was tripping SAGE, thanks to Gary Zablackis
764 778 <gzabl-AT-yahoo.com> for the report.
765 779
766 780 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
767 781
768 782 * IPython/iplib.py (InteractiveShell.post_config_initialization):
769 783 Fix bug where a naked 'alias' call in the ipythonrc file would
770 784 cause a crash. Bug reported by Jorgen Stenarson.
771 785
772 786 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
773 787
774 788 * IPython/ipmaker.py (make_IPython): cleanups which should improve
775 789 startup time.
776 790
777 791 * IPython/iplib.py (runcode): my globals 'fix' for embedded
778 792 instances had introduced a bug with globals in normal code. Now
779 793 it's working in all cases.
780 794
781 795 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
782 796 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
783 797 has been introduced to set the default case sensitivity of the
784 798 searches. Users can still select either mode at runtime on a
785 799 per-search basis.
786 800
787 801 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
788 802
789 803 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
790 804 attributes in wildcard searches for subclasses. Modified version
791 805 of a patch by Jorgen.
792 806
793 807 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
794 808
795 809 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
796 810 embedded instances. I added a user_global_ns attribute to the
797 811 InteractiveShell class to handle this.
798 812
799 813 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
800 814
801 815 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
802 816 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
803 817 (reported under win32, but may happen also in other platforms).
804 818 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
805 819
806 820 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
807 821
808 822 * IPython/Magic.py (magic_psearch): new support for wildcard
809 823 patterns. Now, typing ?a*b will list all names which begin with a
810 824 and end in b, for example. The %psearch magic has full
811 825 docstrings. Many thanks to JΓΆrgen Stenarson
812 826 <jorgen.stenarson-AT-bostream.nu>, author of the patches
813 827 implementing this functionality.
814 828
815 829 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
816 830
817 831 * Manual: fixed long-standing annoyance of double-dashes (as in
818 832 --prefix=~, for example) being stripped in the HTML version. This
819 833 is a latex2html bug, but a workaround was provided. Many thanks
820 834 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
821 835 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
822 836 rolling. This seemingly small issue had tripped a number of users
823 837 when first installing, so I'm glad to see it gone.
824 838
825 839 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
826 840
827 841 * IPython/Extensions/numeric_formats.py: fix missing import,
828 842 reported by Stephen Walton.
829 843
830 844 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
831 845
832 846 * IPython/demo.py: finish demo module, fully documented now.
833 847
834 848 * IPython/genutils.py (file_read): simple little utility to read a
835 849 file and ensure it's closed afterwards.
836 850
837 851 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
838 852
839 853 * IPython/demo.py (Demo.__init__): added support for individually
840 854 tagging blocks for automatic execution.
841 855
842 856 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
843 857 syntax-highlighted python sources, requested by John.
844 858
845 859 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
846 860
847 861 * IPython/demo.py (Demo.again): fix bug where again() blocks after
848 862 finishing.
849 863
850 864 * IPython/genutils.py (shlex_split): moved from Magic to here,
851 865 where all 2.2 compatibility stuff lives. I needed it for demo.py.
852 866
853 867 * IPython/demo.py (Demo.__init__): added support for silent
854 868 blocks, improved marks as regexps, docstrings written.
855 869 (Demo.__init__): better docstring, added support for sys.argv.
856 870
857 871 * IPython/genutils.py (marquee): little utility used by the demo
858 872 code, handy in general.
859 873
860 874 * IPython/demo.py (Demo.__init__): new class for interactive
861 875 demos. Not documented yet, I just wrote it in a hurry for
862 876 scipy'05. Will docstring later.
863 877
864 878 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
865 879
866 880 * IPython/Shell.py (sigint_handler): Drastic simplification which
867 881 also seems to make Ctrl-C work correctly across threads! This is
868 882 so simple, that I can't beleive I'd missed it before. Needs more
869 883 testing, though.
870 884 (KBINT): Never mind, revert changes. I'm sure I'd tried something
871 885 like this before...
872 886
873 887 * IPython/genutils.py (get_home_dir): add protection against
874 888 non-dirs in win32 registry.
875 889
876 890 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
877 891 bug where dict was mutated while iterating (pysh crash).
878 892
879 893 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
880 894
881 895 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
882 896 spurious newlines added by this routine. After a report by
883 897 F. Mantegazza.
884 898
885 899 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
886 900
887 901 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
888 902 calls. These were a leftover from the GTK 1.x days, and can cause
889 903 problems in certain cases (after a report by John Hunter).
890 904
891 905 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
892 906 os.getcwd() fails at init time. Thanks to patch from David Remahl
893 907 <chmod007-AT-mac.com>.
894 908 (InteractiveShell.__init__): prevent certain special magics from
895 909 being shadowed by aliases. Closes
896 910 http://www.scipy.net/roundup/ipython/issue41.
897 911
898 912 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
899 913
900 914 * IPython/iplib.py (InteractiveShell.complete): Added new
901 915 top-level completion method to expose the completion mechanism
902 916 beyond readline-based environments.
903 917
904 918 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
905 919
906 920 * tools/ipsvnc (svnversion): fix svnversion capture.
907 921
908 922 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
909 923 attribute to self, which was missing. Before, it was set by a
910 924 routine which in certain cases wasn't being called, so the
911 925 instance could end up missing the attribute. This caused a crash.
912 926 Closes http://www.scipy.net/roundup/ipython/issue40.
913 927
914 928 2005-08-16 Fernando Perez <fperez@colorado.edu>
915 929
916 930 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
917 931 contains non-string attribute. Closes
918 932 http://www.scipy.net/roundup/ipython/issue38.
919 933
920 934 2005-08-14 Fernando Perez <fperez@colorado.edu>
921 935
922 936 * tools/ipsvnc: Minor improvements, to add changeset info.
923 937
924 938 2005-08-12 Fernando Perez <fperez@colorado.edu>
925 939
926 940 * IPython/iplib.py (runsource): remove self.code_to_run_src
927 941 attribute. I realized this is nothing more than
928 942 '\n'.join(self.buffer), and having the same data in two different
929 943 places is just asking for synchronization bugs. This may impact
930 944 people who have custom exception handlers, so I need to warn
931 945 ipython-dev about it (F. Mantegazza may use them).
932 946
933 947 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
934 948
935 949 * IPython/genutils.py: fix 2.2 compatibility (generators)
936 950
937 951 2005-07-18 Fernando Perez <fperez@colorado.edu>
938 952
939 953 * IPython/genutils.py (get_home_dir): fix to help users with
940 954 invalid $HOME under win32.
941 955
942 956 2005-07-17 Fernando Perez <fperez@colorado.edu>
943 957
944 958 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
945 959 some old hacks and clean up a bit other routines; code should be
946 960 simpler and a bit faster.
947 961
948 962 * IPython/iplib.py (interact): removed some last-resort attempts
949 963 to survive broken stdout/stderr. That code was only making it
950 964 harder to abstract out the i/o (necessary for gui integration),
951 965 and the crashes it could prevent were extremely rare in practice
952 966 (besides being fully user-induced in a pretty violent manner).
953 967
954 968 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
955 969 Nothing major yet, but the code is simpler to read; this should
956 970 make it easier to do more serious modifications in the future.
957 971
958 972 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
959 973 which broke in .15 (thanks to a report by Ville).
960 974
961 975 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
962 976 be quite correct, I know next to nothing about unicode). This
963 977 will allow unicode strings to be used in prompts, amongst other
964 978 cases. It also will prevent ipython from crashing when unicode
965 979 shows up unexpectedly in many places. If ascii encoding fails, we
966 980 assume utf_8. Currently the encoding is not a user-visible
967 981 setting, though it could be made so if there is demand for it.
968 982
969 983 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
970 984
971 985 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
972 986
973 987 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
974 988
975 989 * IPython/genutils.py: Add 2.2 compatibility here, so all other
976 990 code can work transparently for 2.2/2.3.
977 991
978 992 2005-07-16 Fernando Perez <fperez@colorado.edu>
979 993
980 994 * IPython/ultraTB.py (ExceptionColors): Make a global variable
981 995 out of the color scheme table used for coloring exception
982 996 tracebacks. This allows user code to add new schemes at runtime.
983 997 This is a minimally modified version of the patch at
984 998 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
985 999 for the contribution.
986 1000
987 1001 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
988 1002 slightly modified version of the patch in
989 1003 http://www.scipy.net/roundup/ipython/issue34, which also allows me
990 1004 to remove the previous try/except solution (which was costlier).
991 1005 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
992 1006
993 1007 2005-06-08 Fernando Perez <fperez@colorado.edu>
994 1008
995 1009 * IPython/iplib.py (write/write_err): Add methods to abstract all
996 1010 I/O a bit more.
997 1011
998 1012 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
999 1013 warning, reported by Aric Hagberg, fix by JD Hunter.
1000 1014
1001 1015 2005-06-02 *** Released version 0.6.15
1002 1016
1003 1017 2005-06-01 Fernando Perez <fperez@colorado.edu>
1004 1018
1005 1019 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1006 1020 tab-completion of filenames within open-quoted strings. Note that
1007 1021 this requires that in ~/.ipython/ipythonrc, users change the
1008 1022 readline delimiters configuration to read:
1009 1023
1010 1024 readline_remove_delims -/~
1011 1025
1012 1026
1013 1027 2005-05-31 *** Released version 0.6.14
1014 1028
1015 1029 2005-05-29 Fernando Perez <fperez@colorado.edu>
1016 1030
1017 1031 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1018 1032 with files not on the filesystem. Reported by Eliyahu Sandler
1019 1033 <eli@gondolin.net>
1020 1034
1021 1035 2005-05-22 Fernando Perez <fperez@colorado.edu>
1022 1036
1023 1037 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1024 1038 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1025 1039
1026 1040 2005-05-19 Fernando Perez <fperez@colorado.edu>
1027 1041
1028 1042 * IPython/iplib.py (safe_execfile): close a file which could be
1029 1043 left open (causing problems in win32, which locks open files).
1030 1044 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1031 1045
1032 1046 2005-05-18 Fernando Perez <fperez@colorado.edu>
1033 1047
1034 1048 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1035 1049 keyword arguments correctly to safe_execfile().
1036 1050
1037 1051 2005-05-13 Fernando Perez <fperez@colorado.edu>
1038 1052
1039 1053 * ipython.1: Added info about Qt to manpage, and threads warning
1040 1054 to usage page (invoked with --help).
1041 1055
1042 1056 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1043 1057 new matcher (it goes at the end of the priority list) to do
1044 1058 tab-completion on named function arguments. Submitted by George
1045 1059 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1046 1060 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1047 1061 for more details.
1048 1062
1049 1063 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1050 1064 SystemExit exceptions in the script being run. Thanks to a report
1051 1065 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1052 1066 producing very annoying behavior when running unit tests.
1053 1067
1054 1068 2005-05-12 Fernando Perez <fperez@colorado.edu>
1055 1069
1056 1070 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1057 1071 which I'd broken (again) due to a changed regexp. In the process,
1058 1072 added ';' as an escape to auto-quote the whole line without
1059 1073 splitting its arguments. Thanks to a report by Jerry McRae
1060 1074 <qrs0xyc02-AT-sneakemail.com>.
1061 1075
1062 1076 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1063 1077 possible crashes caused by a TokenError. Reported by Ed Schofield
1064 1078 <schofield-AT-ftw.at>.
1065 1079
1066 1080 2005-05-06 Fernando Perez <fperez@colorado.edu>
1067 1081
1068 1082 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1069 1083
1070 1084 2005-04-29 Fernando Perez <fperez@colorado.edu>
1071 1085
1072 1086 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1073 1087 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1074 1088 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1075 1089 which provides support for Qt interactive usage (similar to the
1076 1090 existing one for WX and GTK). This had been often requested.
1077 1091
1078 1092 2005-04-14 *** Released version 0.6.13
1079 1093
1080 1094 2005-04-08 Fernando Perez <fperez@colorado.edu>
1081 1095
1082 1096 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1083 1097 from _ofind, which gets called on almost every input line. Now,
1084 1098 we only try to get docstrings if they are actually going to be
1085 1099 used (the overhead of fetching unnecessary docstrings can be
1086 1100 noticeable for certain objects, such as Pyro proxies).
1087 1101
1088 1102 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1089 1103 for completers. For some reason I had been passing them the state
1090 1104 variable, which completers never actually need, and was in
1091 1105 conflict with the rlcompleter API. Custom completers ONLY need to
1092 1106 take the text parameter.
1093 1107
1094 1108 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1095 1109 work correctly in pysh. I've also moved all the logic which used
1096 1110 to be in pysh.py here, which will prevent problems with future
1097 1111 upgrades. However, this time I must warn users to update their
1098 1112 pysh profile to include the line
1099 1113
1100 1114 import_all IPython.Extensions.InterpreterExec
1101 1115
1102 1116 because otherwise things won't work for them. They MUST also
1103 1117 delete pysh.py and the line
1104 1118
1105 1119 execfile pysh.py
1106 1120
1107 1121 from their ipythonrc-pysh.
1108 1122
1109 1123 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1110 1124 robust in the face of objects whose dir() returns non-strings
1111 1125 (which it shouldn't, but some broken libs like ITK do). Thanks to
1112 1126 a patch by John Hunter (implemented differently, though). Also
1113 1127 minor improvements by using .extend instead of + on lists.
1114 1128
1115 1129 * pysh.py:
1116 1130
1117 1131 2005-04-06 Fernando Perez <fperez@colorado.edu>
1118 1132
1119 1133 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1120 1134 by default, so that all users benefit from it. Those who don't
1121 1135 want it can still turn it off.
1122 1136
1123 1137 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1124 1138 config file, I'd forgotten about this, so users were getting it
1125 1139 off by default.
1126 1140
1127 1141 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1128 1142 consistency. Now magics can be called in multiline statements,
1129 1143 and python variables can be expanded in magic calls via $var.
1130 1144 This makes the magic system behave just like aliases or !system
1131 1145 calls.
1132 1146
1133 1147 2005-03-28 Fernando Perez <fperez@colorado.edu>
1134 1148
1135 1149 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1136 1150 expensive string additions for building command. Add support for
1137 1151 trailing ';' when autocall is used.
1138 1152
1139 1153 2005-03-26 Fernando Perez <fperez@colorado.edu>
1140 1154
1141 1155 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1142 1156 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1143 1157 ipython.el robust against prompts with any number of spaces
1144 1158 (including 0) after the ':' character.
1145 1159
1146 1160 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1147 1161 continuation prompt, which misled users to think the line was
1148 1162 already indented. Closes debian Bug#300847, reported to me by
1149 1163 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1150 1164
1151 1165 2005-03-23 Fernando Perez <fperez@colorado.edu>
1152 1166
1153 1167 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1154 1168 properly aligned if they have embedded newlines.
1155 1169
1156 1170 * IPython/iplib.py (runlines): Add a public method to expose
1157 1171 IPython's code execution machinery, so that users can run strings
1158 1172 as if they had been typed at the prompt interactively.
1159 1173 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1160 1174 methods which can call the system shell, but with python variable
1161 1175 expansion. The three such methods are: __IPYTHON__.system,
1162 1176 .getoutput and .getoutputerror. These need to be documented in a
1163 1177 'public API' section (to be written) of the manual.
1164 1178
1165 1179 2005-03-20 Fernando Perez <fperez@colorado.edu>
1166 1180
1167 1181 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1168 1182 for custom exception handling. This is quite powerful, and it
1169 1183 allows for user-installable exception handlers which can trap
1170 1184 custom exceptions at runtime and treat them separately from
1171 1185 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1172 1186 Mantegazza <mantegazza-AT-ill.fr>.
1173 1187 (InteractiveShell.set_custom_completer): public API function to
1174 1188 add new completers at runtime.
1175 1189
1176 1190 2005-03-19 Fernando Perez <fperez@colorado.edu>
1177 1191
1178 1192 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1179 1193 allow objects which provide their docstrings via non-standard
1180 1194 mechanisms (like Pyro proxies) to still be inspected by ipython's
1181 1195 ? system.
1182 1196
1183 1197 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1184 1198 automatic capture system. I tried quite hard to make it work
1185 1199 reliably, and simply failed. I tried many combinations with the
1186 1200 subprocess module, but eventually nothing worked in all needed
1187 1201 cases (not blocking stdin for the child, duplicating stdout
1188 1202 without blocking, etc). The new %sc/%sx still do capture to these
1189 1203 magical list/string objects which make shell use much more
1190 1204 conveninent, so not all is lost.
1191 1205
1192 1206 XXX - FIX MANUAL for the change above!
1193 1207
1194 1208 (runsource): I copied code.py's runsource() into ipython to modify
1195 1209 it a bit. Now the code object and source to be executed are
1196 1210 stored in ipython. This makes this info accessible to third-party
1197 1211 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1198 1212 Mantegazza <mantegazza-AT-ill.fr>.
1199 1213
1200 1214 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1201 1215 history-search via readline (like C-p/C-n). I'd wanted this for a
1202 1216 long time, but only recently found out how to do it. For users
1203 1217 who already have their ipythonrc files made and want this, just
1204 1218 add:
1205 1219
1206 1220 readline_parse_and_bind "\e[A": history-search-backward
1207 1221 readline_parse_and_bind "\e[B": history-search-forward
1208 1222
1209 1223 2005-03-18 Fernando Perez <fperez@colorado.edu>
1210 1224
1211 1225 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1212 1226 LSString and SList classes which allow transparent conversions
1213 1227 between list mode and whitespace-separated string.
1214 1228 (magic_r): Fix recursion problem in %r.
1215 1229
1216 1230 * IPython/genutils.py (LSString): New class to be used for
1217 1231 automatic storage of the results of all alias/system calls in _o
1218 1232 and _e (stdout/err). These provide a .l/.list attribute which
1219 1233 does automatic splitting on newlines. This means that for most
1220 1234 uses, you'll never need to do capturing of output with %sc/%sx
1221 1235 anymore, since ipython keeps this always done for you. Note that
1222 1236 only the LAST results are stored, the _o/e variables are
1223 1237 overwritten on each call. If you need to save their contents
1224 1238 further, simply bind them to any other name.
1225 1239
1226 1240 2005-03-17 Fernando Perez <fperez@colorado.edu>
1227 1241
1228 1242 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1229 1243 prompt namespace handling.
1230 1244
1231 1245 2005-03-16 Fernando Perez <fperez@colorado.edu>
1232 1246
1233 1247 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1234 1248 classic prompts to be '>>> ' (final space was missing, and it
1235 1249 trips the emacs python mode).
1236 1250 (BasePrompt.__str__): Added safe support for dynamic prompt
1237 1251 strings. Now you can set your prompt string to be '$x', and the
1238 1252 value of x will be printed from your interactive namespace. The
1239 1253 interpolation syntax includes the full Itpl support, so
1240 1254 ${foo()+x+bar()} is a valid prompt string now, and the function
1241 1255 calls will be made at runtime.
1242 1256
1243 1257 2005-03-15 Fernando Perez <fperez@colorado.edu>
1244 1258
1245 1259 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1246 1260 avoid name clashes in pylab. %hist still works, it just forwards
1247 1261 the call to %history.
1248 1262
1249 1263 2005-03-02 *** Released version 0.6.12
1250 1264
1251 1265 2005-03-02 Fernando Perez <fperez@colorado.edu>
1252 1266
1253 1267 * IPython/iplib.py (handle_magic): log magic calls properly as
1254 1268 ipmagic() function calls.
1255 1269
1256 1270 * IPython/Magic.py (magic_time): Improved %time to support
1257 1271 statements and provide wall-clock as well as CPU time.
1258 1272
1259 1273 2005-02-27 Fernando Perez <fperez@colorado.edu>
1260 1274
1261 1275 * IPython/hooks.py: New hooks module, to expose user-modifiable
1262 1276 IPython functionality in a clean manner. For now only the editor
1263 1277 hook is actually written, and other thigns which I intend to turn
1264 1278 into proper hooks aren't yet there. The display and prefilter
1265 1279 stuff, for example, should be hooks. But at least now the
1266 1280 framework is in place, and the rest can be moved here with more
1267 1281 time later. IPython had had a .hooks variable for a long time for
1268 1282 this purpose, but I'd never actually used it for anything.
1269 1283
1270 1284 2005-02-26 Fernando Perez <fperez@colorado.edu>
1271 1285
1272 1286 * IPython/ipmaker.py (make_IPython): make the default ipython
1273 1287 directory be called _ipython under win32, to follow more the
1274 1288 naming peculiarities of that platform (where buggy software like
1275 1289 Visual Sourcesafe breaks with .named directories). Reported by
1276 1290 Ville Vainio.
1277 1291
1278 1292 2005-02-23 Fernando Perez <fperez@colorado.edu>
1279 1293
1280 1294 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1281 1295 auto_aliases for win32 which were causing problems. Users can
1282 1296 define the ones they personally like.
1283 1297
1284 1298 2005-02-21 Fernando Perez <fperez@colorado.edu>
1285 1299
1286 1300 * IPython/Magic.py (magic_time): new magic to time execution of
1287 1301 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1288 1302
1289 1303 2005-02-19 Fernando Perez <fperez@colorado.edu>
1290 1304
1291 1305 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1292 1306 into keys (for prompts, for example).
1293 1307
1294 1308 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1295 1309 prompts in case users want them. This introduces a small behavior
1296 1310 change: ipython does not automatically add a space to all prompts
1297 1311 anymore. To get the old prompts with a space, users should add it
1298 1312 manually to their ipythonrc file, so for example prompt_in1 should
1299 1313 now read 'In [\#]: ' instead of 'In [\#]:'.
1300 1314 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1301 1315 file) to control left-padding of secondary prompts.
1302 1316
1303 1317 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1304 1318 the profiler can't be imported. Fix for Debian, which removed
1305 1319 profile.py because of License issues. I applied a slightly
1306 1320 modified version of the original Debian patch at
1307 1321 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1308 1322
1309 1323 2005-02-17 Fernando Perez <fperez@colorado.edu>
1310 1324
1311 1325 * IPython/genutils.py (native_line_ends): Fix bug which would
1312 1326 cause improper line-ends under win32 b/c I was not opening files
1313 1327 in binary mode. Bug report and fix thanks to Ville.
1314 1328
1315 1329 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1316 1330 trying to catch spurious foo[1] autocalls. My fix actually broke
1317 1331 ',/' autoquote/call with explicit escape (bad regexp).
1318 1332
1319 1333 2005-02-15 *** Released version 0.6.11
1320 1334
1321 1335 2005-02-14 Fernando Perez <fperez@colorado.edu>
1322 1336
1323 1337 * IPython/background_jobs.py: New background job management
1324 1338 subsystem. This is implemented via a new set of classes, and
1325 1339 IPython now provides a builtin 'jobs' object for background job
1326 1340 execution. A convenience %bg magic serves as a lightweight
1327 1341 frontend for starting the more common type of calls. This was
1328 1342 inspired by discussions with B. Granger and the BackgroundCommand
1329 1343 class described in the book Python Scripting for Computational
1330 1344 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1331 1345 (although ultimately no code from this text was used, as IPython's
1332 1346 system is a separate implementation).
1333 1347
1334 1348 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1335 1349 to control the completion of single/double underscore names
1336 1350 separately. As documented in the example ipytonrc file, the
1337 1351 readline_omit__names variable can now be set to 2, to omit even
1338 1352 single underscore names. Thanks to a patch by Brian Wong
1339 1353 <BrianWong-AT-AirgoNetworks.Com>.
1340 1354 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1341 1355 be autocalled as foo([1]) if foo were callable. A problem for
1342 1356 things which are both callable and implement __getitem__.
1343 1357 (init_readline): Fix autoindentation for win32. Thanks to a patch
1344 1358 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1345 1359
1346 1360 2005-02-12 Fernando Perez <fperez@colorado.edu>
1347 1361
1348 1362 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1349 1363 which I had written long ago to sort out user error messages which
1350 1364 may occur during startup. This seemed like a good idea initially,
1351 1365 but it has proven a disaster in retrospect. I don't want to
1352 1366 change much code for now, so my fix is to set the internal 'debug'
1353 1367 flag to true everywhere, whose only job was precisely to control
1354 1368 this subsystem. This closes issue 28 (as well as avoiding all
1355 1369 sorts of strange hangups which occur from time to time).
1356 1370
1357 1371 2005-02-07 Fernando Perez <fperez@colorado.edu>
1358 1372
1359 1373 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
1360 1374 previous call produced a syntax error.
1361 1375
1362 1376 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1363 1377 classes without constructor.
1364 1378
1365 1379 2005-02-06 Fernando Perez <fperez@colorado.edu>
1366 1380
1367 1381 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
1368 1382 completions with the results of each matcher, so we return results
1369 1383 to the user from all namespaces. This breaks with ipython
1370 1384 tradition, but I think it's a nicer behavior. Now you get all
1371 1385 possible completions listed, from all possible namespaces (python,
1372 1386 filesystem, magics...) After a request by John Hunter
1373 1387 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1374 1388
1375 1389 2005-02-05 Fernando Perez <fperez@colorado.edu>
1376 1390
1377 1391 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
1378 1392 the call had quote characters in it (the quotes were stripped).
1379 1393
1380 1394 2005-01-31 Fernando Perez <fperez@colorado.edu>
1381 1395
1382 1396 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
1383 1397 Itpl.itpl() to make the code more robust against psyco
1384 1398 optimizations.
1385 1399
1386 1400 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
1387 1401 of causing an exception. Quicker, cleaner.
1388 1402
1389 1403 2005-01-28 Fernando Perez <fperez@colorado.edu>
1390 1404
1391 1405 * scripts/ipython_win_post_install.py (install): hardcode
1392 1406 sys.prefix+'python.exe' as the executable path. It turns out that
1393 1407 during the post-installation run, sys.executable resolves to the
1394 1408 name of the binary installer! I should report this as a distutils
1395 1409 bug, I think. I updated the .10 release with this tiny fix, to
1396 1410 avoid annoying the lists further.
1397 1411
1398 1412 2005-01-27 *** Released version 0.6.10
1399 1413
1400 1414 2005-01-27 Fernando Perez <fperez@colorado.edu>
1401 1415
1402 1416 * IPython/numutils.py (norm): Added 'inf' as optional name for
1403 1417 L-infinity norm, included references to mathworld.com for vector
1404 1418 norm definitions.
1405 1419 (amin/amax): added amin/amax for array min/max. Similar to what
1406 1420 pylab ships with after the recent reorganization of names.
1407 1421 (spike/spike_odd): removed deprecated spike/spike_odd functions.
1408 1422
1409 1423 * ipython.el: committed Alex's recent fixes and improvements.
1410 1424 Tested with python-mode from CVS, and it looks excellent. Since
1411 1425 python-mode hasn't released anything in a while, I'm temporarily
1412 1426 putting a copy of today's CVS (v 4.70) of python-mode in:
1413 1427 http://ipython.scipy.org/tmp/python-mode.el
1414 1428
1415 1429 * scripts/ipython_win_post_install.py (install): Win32 fix to use
1416 1430 sys.executable for the executable name, instead of assuming it's
1417 1431 called 'python.exe' (the post-installer would have produced broken
1418 1432 setups on systems with a differently named python binary).
1419 1433
1420 1434 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
1421 1435 references to os.linesep, to make the code more
1422 1436 platform-independent. This is also part of the win32 coloring
1423 1437 fixes.
1424 1438
1425 1439 * IPython/genutils.py (page_dumb): Remove attempts to chop long
1426 1440 lines, which actually cause coloring bugs because the length of
1427 1441 the line is very difficult to correctly compute with embedded
1428 1442 escapes. This was the source of all the coloring problems under
1429 1443 Win32. I think that _finally_, Win32 users have a properly
1430 1444 working ipython in all respects. This would never have happened
1431 1445 if not for Gary Bishop and Viktor Ransmayr's great help and work.
1432 1446
1433 1447 2005-01-26 *** Released version 0.6.9
1434 1448
1435 1449 2005-01-25 Fernando Perez <fperez@colorado.edu>
1436 1450
1437 1451 * setup.py: finally, we have a true Windows installer, thanks to
1438 1452 the excellent work of Viktor Ransmayr
1439 1453 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
1440 1454 Windows users. The setup routine is quite a bit cleaner thanks to
1441 1455 this, and the post-install script uses the proper functions to
1442 1456 allow a clean de-installation using the standard Windows Control
1443 1457 Panel.
1444 1458
1445 1459 * IPython/genutils.py (get_home_dir): changed to use the $HOME
1446 1460 environment variable under all OSes (including win32) if
1447 1461 available. This will give consistency to win32 users who have set
1448 1462 this variable for any reason. If os.environ['HOME'] fails, the
1449 1463 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
1450 1464
1451 1465 2005-01-24 Fernando Perez <fperez@colorado.edu>
1452 1466
1453 1467 * IPython/numutils.py (empty_like): add empty_like(), similar to
1454 1468 zeros_like() but taking advantage of the new empty() Numeric routine.
1455 1469
1456 1470 2005-01-23 *** Released version 0.6.8
1457 1471
1458 1472 2005-01-22 Fernando Perez <fperez@colorado.edu>
1459 1473
1460 1474 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
1461 1475 automatic show() calls. After discussing things with JDH, it
1462 1476 turns out there are too many corner cases where this can go wrong.
1463 1477 It's best not to try to be 'too smart', and simply have ipython
1464 1478 reproduce as much as possible the default behavior of a normal
1465 1479 python shell.
1466 1480
1467 1481 * IPython/iplib.py (InteractiveShell.__init__): Modified the
1468 1482 line-splitting regexp and _prefilter() to avoid calling getattr()
1469 1483 on assignments. This closes
1470 1484 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
1471 1485 readline uses getattr(), so a simple <TAB> keypress is still
1472 1486 enough to trigger getattr() calls on an object.
1473 1487
1474 1488 2005-01-21 Fernando Perez <fperez@colorado.edu>
1475 1489
1476 1490 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
1477 1491 docstring under pylab so it doesn't mask the original.
1478 1492
1479 1493 2005-01-21 *** Released version 0.6.7
1480 1494
1481 1495 2005-01-21 Fernando Perez <fperez@colorado.edu>
1482 1496
1483 1497 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
1484 1498 signal handling for win32 users in multithreaded mode.
1485 1499
1486 1500 2005-01-17 Fernando Perez <fperez@colorado.edu>
1487 1501
1488 1502 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1489 1503 instances with no __init__. After a crash report by Norbert Nemec
1490 1504 <Norbert-AT-nemec-online.de>.
1491 1505
1492 1506 2005-01-14 Fernando Perez <fperez@colorado.edu>
1493 1507
1494 1508 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
1495 1509 names for verbose exceptions, when multiple dotted names and the
1496 1510 'parent' object were present on the same line.
1497 1511
1498 1512 2005-01-11 Fernando Perez <fperez@colorado.edu>
1499 1513
1500 1514 * IPython/genutils.py (flag_calls): new utility to trap and flag
1501 1515 calls in functions. I need it to clean up matplotlib support.
1502 1516 Also removed some deprecated code in genutils.
1503 1517
1504 1518 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
1505 1519 that matplotlib scripts called with %run, which don't call show()
1506 1520 themselves, still have their plotting windows open.
1507 1521
1508 1522 2005-01-05 Fernando Perez <fperez@colorado.edu>
1509 1523
1510 1524 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
1511 1525 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
1512 1526
1513 1527 2004-12-19 Fernando Perez <fperez@colorado.edu>
1514 1528
1515 1529 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
1516 1530 parent_runcode, which was an eyesore. The same result can be
1517 1531 obtained with Python's regular superclass mechanisms.
1518 1532
1519 1533 2004-12-17 Fernando Perez <fperez@colorado.edu>
1520 1534
1521 1535 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
1522 1536 reported by Prabhu.
1523 1537 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
1524 1538 sys.stderr) instead of explicitly calling sys.stderr. This helps
1525 1539 maintain our I/O abstractions clean, for future GUI embeddings.
1526 1540
1527 1541 * IPython/genutils.py (info): added new utility for sys.stderr
1528 1542 unified info message handling (thin wrapper around warn()).
1529 1543
1530 1544 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
1531 1545 composite (dotted) names on verbose exceptions.
1532 1546 (VerboseTB.nullrepr): harden against another kind of errors which
1533 1547 Python's inspect module can trigger, and which were crashing
1534 1548 IPython. Thanks to a report by Marco Lombardi
1535 1549 <mlombard-AT-ma010192.hq.eso.org>.
1536 1550
1537 1551 2004-12-13 *** Released version 0.6.6
1538 1552
1539 1553 2004-12-12 Fernando Perez <fperez@colorado.edu>
1540 1554
1541 1555 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
1542 1556 generated by pygtk upon initialization if it was built without
1543 1557 threads (for matplotlib users). After a crash reported by
1544 1558 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
1545 1559
1546 1560 * IPython/ipmaker.py (make_IPython): fix small bug in the
1547 1561 import_some parameter for multiple imports.
1548 1562
1549 1563 * IPython/iplib.py (ipmagic): simplified the interface of
1550 1564 ipmagic() to take a single string argument, just as it would be
1551 1565 typed at the IPython cmd line.
1552 1566 (ipalias): Added new ipalias() with an interface identical to
1553 1567 ipmagic(). This completes exposing a pure python interface to the
1554 1568 alias and magic system, which can be used in loops or more complex
1555 1569 code where IPython's automatic line mangling is not active.
1556 1570
1557 1571 * IPython/genutils.py (timing): changed interface of timing to
1558 1572 simply run code once, which is the most common case. timings()
1559 1573 remains unchanged, for the cases where you want multiple runs.
1560 1574
1561 1575 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
1562 1576 bug where Python2.2 crashes with exec'ing code which does not end
1563 1577 in a single newline. Python 2.3 is OK, so I hadn't noticed this
1564 1578 before.
1565 1579
1566 1580 2004-12-10 Fernando Perez <fperez@colorado.edu>
1567 1581
1568 1582 * IPython/Magic.py (Magic.magic_prun): changed name of option from
1569 1583 -t to -T, to accomodate the new -t flag in %run (the %run and
1570 1584 %prun options are kind of intermixed, and it's not easy to change
1571 1585 this with the limitations of python's getopt).
1572 1586
1573 1587 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
1574 1588 the execution of scripts. It's not as fine-tuned as timeit.py,
1575 1589 but it works from inside ipython (and under 2.2, which lacks
1576 1590 timeit.py). Optionally a number of runs > 1 can be given for
1577 1591 timing very short-running code.
1578 1592
1579 1593 * IPython/genutils.py (uniq_stable): new routine which returns a
1580 1594 list of unique elements in any iterable, but in stable order of
1581 1595 appearance. I needed this for the ultraTB fixes, and it's a handy
1582 1596 utility.
1583 1597
1584 1598 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
1585 1599 dotted names in Verbose exceptions. This had been broken since
1586 1600 the very start, now x.y will properly be printed in a Verbose
1587 1601 traceback, instead of x being shown and y appearing always as an
1588 1602 'undefined global'. Getting this to work was a bit tricky,
1589 1603 because by default python tokenizers are stateless. Saved by
1590 1604 python's ability to easily add a bit of state to an arbitrary
1591 1605 function (without needing to build a full-blown callable object).
1592 1606
1593 1607 Also big cleanup of this code, which had horrendous runtime
1594 1608 lookups of zillions of attributes for colorization. Moved all
1595 1609 this code into a few templates, which make it cleaner and quicker.
1596 1610
1597 1611 Printout quality was also improved for Verbose exceptions: one
1598 1612 variable per line, and memory addresses are printed (this can be
1599 1613 quite handy in nasty debugging situations, which is what Verbose
1600 1614 is for).
1601 1615
1602 1616 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1603 1617 the command line as scripts to be loaded by embedded instances.
1604 1618 Doing so has the potential for an infinite recursion if there are
1605 1619 exceptions thrown in the process. This fixes a strange crash
1606 1620 reported by Philippe MULLER <muller-AT-irit.fr>.
1607 1621
1608 1622 2004-12-09 Fernando Perez <fperez@colorado.edu>
1609 1623
1610 1624 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1611 1625 to reflect new names in matplotlib, which now expose the
1612 1626 matlab-compatible interface via a pylab module instead of the
1613 1627 'matlab' name. The new code is backwards compatible, so users of
1614 1628 all matplotlib versions are OK. Patch by J. Hunter.
1615 1629
1616 1630 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1617 1631 of __init__ docstrings for instances (class docstrings are already
1618 1632 automatically printed). Instances with customized docstrings
1619 1633 (indep. of the class) are also recognized and all 3 separate
1620 1634 docstrings are printed (instance, class, constructor). After some
1621 1635 comments/suggestions by J. Hunter.
1622 1636
1623 1637 2004-12-05 Fernando Perez <fperez@colorado.edu>
1624 1638
1625 1639 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1626 1640 warnings when tab-completion fails and triggers an exception.
1627 1641
1628 1642 2004-12-03 Fernando Perez <fperez@colorado.edu>
1629 1643
1630 1644 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1631 1645 be triggered when using 'run -p'. An incorrect option flag was
1632 1646 being set ('d' instead of 'D').
1633 1647 (manpage): fix missing escaped \- sign.
1634 1648
1635 1649 2004-11-30 *** Released version 0.6.5
1636 1650
1637 1651 2004-11-30 Fernando Perez <fperez@colorado.edu>
1638 1652
1639 1653 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1640 1654 setting with -d option.
1641 1655
1642 1656 * setup.py (docfiles): Fix problem where the doc glob I was using
1643 1657 was COMPLETELY BROKEN. It was giving the right files by pure
1644 1658 accident, but failed once I tried to include ipython.el. Note:
1645 1659 glob() does NOT allow you to do exclusion on multiple endings!
1646 1660
1647 1661 2004-11-29 Fernando Perez <fperez@colorado.edu>
1648 1662
1649 1663 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1650 1664 the manpage as the source. Better formatting & consistency.
1651 1665
1652 1666 * IPython/Magic.py (magic_run): Added new -d option, to run
1653 1667 scripts under the control of the python pdb debugger. Note that
1654 1668 this required changing the %prun option -d to -D, to avoid a clash
1655 1669 (since %run must pass options to %prun, and getopt is too dumb to
1656 1670 handle options with string values with embedded spaces). Thanks
1657 1671 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1658 1672 (magic_who_ls): added type matching to %who and %whos, so that one
1659 1673 can filter their output to only include variables of certain
1660 1674 types. Another suggestion by Matthew.
1661 1675 (magic_whos): Added memory summaries in kb and Mb for arrays.
1662 1676 (magic_who): Improve formatting (break lines every 9 vars).
1663 1677
1664 1678 2004-11-28 Fernando Perez <fperez@colorado.edu>
1665 1679
1666 1680 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1667 1681 cache when empty lines were present.
1668 1682
1669 1683 2004-11-24 Fernando Perez <fperez@colorado.edu>
1670 1684
1671 1685 * IPython/usage.py (__doc__): document the re-activated threading
1672 1686 options for WX and GTK.
1673 1687
1674 1688 2004-11-23 Fernando Perez <fperez@colorado.edu>
1675 1689
1676 1690 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1677 1691 the -wthread and -gthread options, along with a new -tk one to try
1678 1692 and coordinate Tk threading with wx/gtk. The tk support is very
1679 1693 platform dependent, since it seems to require Tcl and Tk to be
1680 1694 built with threads (Fedora1/2 appears NOT to have it, but in
1681 1695 Prabhu's Debian boxes it works OK). But even with some Tk
1682 1696 limitations, this is a great improvement.
1683 1697
1684 1698 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1685 1699 info in user prompts. Patch by Prabhu.
1686 1700
1687 1701 2004-11-18 Fernando Perez <fperez@colorado.edu>
1688 1702
1689 1703 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1690 1704 EOFErrors and bail, to avoid infinite loops if a non-terminating
1691 1705 file is fed into ipython. Patch submitted in issue 19 by user,
1692 1706 many thanks.
1693 1707
1694 1708 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1695 1709 autoquote/parens in continuation prompts, which can cause lots of
1696 1710 problems. Closes roundup issue 20.
1697 1711
1698 1712 2004-11-17 Fernando Perez <fperez@colorado.edu>
1699 1713
1700 1714 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1701 1715 reported as debian bug #280505. I'm not sure my local changelog
1702 1716 entry has the proper debian format (Jack?).
1703 1717
1704 1718 2004-11-08 *** Released version 0.6.4
1705 1719
1706 1720 2004-11-08 Fernando Perez <fperez@colorado.edu>
1707 1721
1708 1722 * IPython/iplib.py (init_readline): Fix exit message for Windows
1709 1723 when readline is active. Thanks to a report by Eric Jones
1710 1724 <eric-AT-enthought.com>.
1711 1725
1712 1726 2004-11-07 Fernando Perez <fperez@colorado.edu>
1713 1727
1714 1728 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1715 1729 sometimes seen by win2k/cygwin users.
1716 1730
1717 1731 2004-11-06 Fernando Perez <fperez@colorado.edu>
1718 1732
1719 1733 * IPython/iplib.py (interact): Change the handling of %Exit from
1720 1734 trying to propagate a SystemExit to an internal ipython flag.
1721 1735 This is less elegant than using Python's exception mechanism, but
1722 1736 I can't get that to work reliably with threads, so under -pylab
1723 1737 %Exit was hanging IPython. Cross-thread exception handling is
1724 1738 really a bitch. Thaks to a bug report by Stephen Walton
1725 1739 <stephen.walton-AT-csun.edu>.
1726 1740
1727 1741 2004-11-04 Fernando Perez <fperez@colorado.edu>
1728 1742
1729 1743 * IPython/iplib.py (raw_input_original): store a pointer to the
1730 1744 true raw_input to harden against code which can modify it
1731 1745 (wx.py.PyShell does this and would otherwise crash ipython).
1732 1746 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1733 1747
1734 1748 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1735 1749 Ctrl-C problem, which does not mess up the input line.
1736 1750
1737 1751 2004-11-03 Fernando Perez <fperez@colorado.edu>
1738 1752
1739 1753 * IPython/Release.py: Changed licensing to BSD, in all files.
1740 1754 (name): lowercase name for tarball/RPM release.
1741 1755
1742 1756 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1743 1757 use throughout ipython.
1744 1758
1745 1759 * IPython/Magic.py (Magic._ofind): Switch to using the new
1746 1760 OInspect.getdoc() function.
1747 1761
1748 1762 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1749 1763 of the line currently being canceled via Ctrl-C. It's extremely
1750 1764 ugly, but I don't know how to do it better (the problem is one of
1751 1765 handling cross-thread exceptions).
1752 1766
1753 1767 2004-10-28 Fernando Perez <fperez@colorado.edu>
1754 1768
1755 1769 * IPython/Shell.py (signal_handler): add signal handlers to trap
1756 1770 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1757 1771 report by Francesc Alted.
1758 1772
1759 1773 2004-10-21 Fernando Perez <fperez@colorado.edu>
1760 1774
1761 1775 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1762 1776 to % for pysh syntax extensions.
1763 1777
1764 1778 2004-10-09 Fernando Perez <fperez@colorado.edu>
1765 1779
1766 1780 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1767 1781 arrays to print a more useful summary, without calling str(arr).
1768 1782 This avoids the problem of extremely lengthy computations which
1769 1783 occur if arr is large, and appear to the user as a system lockup
1770 1784 with 100% cpu activity. After a suggestion by Kristian Sandberg
1771 1785 <Kristian.Sandberg@colorado.edu>.
1772 1786 (Magic.__init__): fix bug in global magic escapes not being
1773 1787 correctly set.
1774 1788
1775 1789 2004-10-08 Fernando Perez <fperez@colorado.edu>
1776 1790
1777 1791 * IPython/Magic.py (__license__): change to absolute imports of
1778 1792 ipython's own internal packages, to start adapting to the absolute
1779 1793 import requirement of PEP-328.
1780 1794
1781 1795 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
1782 1796 files, and standardize author/license marks through the Release
1783 1797 module instead of having per/file stuff (except for files with
1784 1798 particular licenses, like the MIT/PSF-licensed codes).
1785 1799
1786 1800 * IPython/Debugger.py: remove dead code for python 2.1
1787 1801
1788 1802 2004-10-04 Fernando Perez <fperez@colorado.edu>
1789 1803
1790 1804 * IPython/iplib.py (ipmagic): New function for accessing magics
1791 1805 via a normal python function call.
1792 1806
1793 1807 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
1794 1808 from '@' to '%', to accomodate the new @decorator syntax of python
1795 1809 2.4.
1796 1810
1797 1811 2004-09-29 Fernando Perez <fperez@colorado.edu>
1798 1812
1799 1813 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
1800 1814 matplotlib.use to prevent running scripts which try to switch
1801 1815 interactive backends from within ipython. This will just crash
1802 1816 the python interpreter, so we can't allow it (but a detailed error
1803 1817 is given to the user).
1804 1818
1805 1819 2004-09-28 Fernando Perez <fperez@colorado.edu>
1806 1820
1807 1821 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1808 1822 matplotlib-related fixes so that using @run with non-matplotlib
1809 1823 scripts doesn't pop up spurious plot windows. This requires
1810 1824 matplotlib >= 0.63, where I had to make some changes as well.
1811 1825
1812 1826 * IPython/ipmaker.py (make_IPython): update version requirement to
1813 1827 python 2.2.
1814 1828
1815 1829 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1816 1830 banner arg for embedded customization.
1817 1831
1818 1832 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1819 1833 explicit uses of __IP as the IPython's instance name. Now things
1820 1834 are properly handled via the shell.name value. The actual code
1821 1835 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1822 1836 is much better than before. I'll clean things completely when the
1823 1837 magic stuff gets a real overhaul.
1824 1838
1825 1839 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1826 1840 minor changes to debian dir.
1827 1841
1828 1842 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1829 1843 pointer to the shell itself in the interactive namespace even when
1830 1844 a user-supplied dict is provided. This is needed for embedding
1831 1845 purposes (found by tests with Michel Sanner).
1832 1846
1833 1847 2004-09-27 Fernando Perez <fperez@colorado.edu>
1834 1848
1835 1849 * IPython/UserConfig/ipythonrc: remove []{} from
1836 1850 readline_remove_delims, so that things like [modname.<TAB> do
1837 1851 proper completion. This disables [].TAB, but that's a less common
1838 1852 case than module names in list comprehensions, for example.
1839 1853 Thanks to a report by Andrea Riciputi.
1840 1854
1841 1855 2004-09-09 Fernando Perez <fperez@colorado.edu>
1842 1856
1843 1857 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1844 1858 blocking problems in win32 and osx. Fix by John.
1845 1859
1846 1860 2004-09-08 Fernando Perez <fperez@colorado.edu>
1847 1861
1848 1862 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1849 1863 for Win32 and OSX. Fix by John Hunter.
1850 1864
1851 1865 2004-08-30 *** Released version 0.6.3
1852 1866
1853 1867 2004-08-30 Fernando Perez <fperez@colorado.edu>
1854 1868
1855 1869 * setup.py (isfile): Add manpages to list of dependent files to be
1856 1870 updated.
1857 1871
1858 1872 2004-08-27 Fernando Perez <fperez@colorado.edu>
1859 1873
1860 1874 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1861 1875 for now. They don't really work with standalone WX/GTK code
1862 1876 (though matplotlib IS working fine with both of those backends).
1863 1877 This will neeed much more testing. I disabled most things with
1864 1878 comments, so turning it back on later should be pretty easy.
1865 1879
1866 1880 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1867 1881 autocalling of expressions like r'foo', by modifying the line
1868 1882 split regexp. Closes
1869 1883 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1870 1884 Riley <ipythonbugs-AT-sabi.net>.
1871 1885 (InteractiveShell.mainloop): honor --nobanner with banner
1872 1886 extensions.
1873 1887
1874 1888 * IPython/Shell.py: Significant refactoring of all classes, so
1875 1889 that we can really support ALL matplotlib backends and threading
1876 1890 models (John spotted a bug with Tk which required this). Now we
1877 1891 should support single-threaded, WX-threads and GTK-threads, both
1878 1892 for generic code and for matplotlib.
1879 1893
1880 1894 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1881 1895 -pylab, to simplify things for users. Will also remove the pylab
1882 1896 profile, since now all of matplotlib configuration is directly
1883 1897 handled here. This also reduces startup time.
1884 1898
1885 1899 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1886 1900 shell wasn't being correctly called. Also in IPShellWX.
1887 1901
1888 1902 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1889 1903 fine-tune banner.
1890 1904
1891 1905 * IPython/numutils.py (spike): Deprecate these spike functions,
1892 1906 delete (long deprecated) gnuplot_exec handler.
1893 1907
1894 1908 2004-08-26 Fernando Perez <fperez@colorado.edu>
1895 1909
1896 1910 * ipython.1: Update for threading options, plus some others which
1897 1911 were missing.
1898 1912
1899 1913 * IPython/ipmaker.py (__call__): Added -wthread option for
1900 1914 wxpython thread handling. Make sure threading options are only
1901 1915 valid at the command line.
1902 1916
1903 1917 * scripts/ipython: moved shell selection into a factory function
1904 1918 in Shell.py, to keep the starter script to a minimum.
1905 1919
1906 1920 2004-08-25 Fernando Perez <fperez@colorado.edu>
1907 1921
1908 1922 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1909 1923 John. Along with some recent changes he made to matplotlib, the
1910 1924 next versions of both systems should work very well together.
1911 1925
1912 1926 2004-08-24 Fernando Perez <fperez@colorado.edu>
1913 1927
1914 1928 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1915 1929 tried to switch the profiling to using hotshot, but I'm getting
1916 1930 strange errors from prof.runctx() there. I may be misreading the
1917 1931 docs, but it looks weird. For now the profiling code will
1918 1932 continue to use the standard profiler.
1919 1933
1920 1934 2004-08-23 Fernando Perez <fperez@colorado.edu>
1921 1935
1922 1936 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1923 1937 threaded shell, by John Hunter. It's not quite ready yet, but
1924 1938 close.
1925 1939
1926 1940 2004-08-22 Fernando Perez <fperez@colorado.edu>
1927 1941
1928 1942 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1929 1943 in Magic and ultraTB.
1930 1944
1931 1945 * ipython.1: document threading options in manpage.
1932 1946
1933 1947 * scripts/ipython: Changed name of -thread option to -gthread,
1934 1948 since this is GTK specific. I want to leave the door open for a
1935 1949 -wthread option for WX, which will most likely be necessary. This
1936 1950 change affects usage and ipmaker as well.
1937 1951
1938 1952 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1939 1953 handle the matplotlib shell issues. Code by John Hunter
1940 1954 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1941 1955 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1942 1956 broken (and disabled for end users) for now, but it puts the
1943 1957 infrastructure in place.
1944 1958
1945 1959 2004-08-21 Fernando Perez <fperez@colorado.edu>
1946 1960
1947 1961 * ipythonrc-pylab: Add matplotlib support.
1948 1962
1949 1963 * matplotlib_config.py: new files for matplotlib support, part of
1950 1964 the pylab profile.
1951 1965
1952 1966 * IPython/usage.py (__doc__): documented the threading options.
1953 1967
1954 1968 2004-08-20 Fernando Perez <fperez@colorado.edu>
1955 1969
1956 1970 * ipython: Modified the main calling routine to handle the -thread
1957 1971 and -mpthread options. This needs to be done as a top-level hack,
1958 1972 because it determines which class to instantiate for IPython
1959 1973 itself.
1960 1974
1961 1975 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1962 1976 classes to support multithreaded GTK operation without blocking,
1963 1977 and matplotlib with all backends. This is a lot of still very
1964 1978 experimental code, and threads are tricky. So it may still have a
1965 1979 few rough edges... This code owes a lot to
1966 1980 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1967 1981 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1968 1982 to John Hunter for all the matplotlib work.
1969 1983
1970 1984 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1971 1985 options for gtk thread and matplotlib support.
1972 1986
1973 1987 2004-08-16 Fernando Perez <fperez@colorado.edu>
1974 1988
1975 1989 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1976 1990 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1977 1991 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1978 1992
1979 1993 2004-08-11 Fernando Perez <fperez@colorado.edu>
1980 1994
1981 1995 * setup.py (isfile): Fix build so documentation gets updated for
1982 1996 rpms (it was only done for .tgz builds).
1983 1997
1984 1998 2004-08-10 Fernando Perez <fperez@colorado.edu>
1985 1999
1986 2000 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1987 2001
1988 2002 * iplib.py : Silence syntax error exceptions in tab-completion.
1989 2003
1990 2004 2004-08-05 Fernando Perez <fperez@colorado.edu>
1991 2005
1992 2006 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1993 2007 'color off' mark for continuation prompts. This was causing long
1994 2008 continuation lines to mis-wrap.
1995 2009
1996 2010 2004-08-01 Fernando Perez <fperez@colorado.edu>
1997 2011
1998 2012 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1999 2013 for building ipython to be a parameter. All this is necessary
2000 2014 right now to have a multithreaded version, but this insane
2001 2015 non-design will be cleaned up soon. For now, it's a hack that
2002 2016 works.
2003 2017
2004 2018 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2005 2019 args in various places. No bugs so far, but it's a dangerous
2006 2020 practice.
2007 2021
2008 2022 2004-07-31 Fernando Perez <fperez@colorado.edu>
2009 2023
2010 2024 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2011 2025 fix completion of files with dots in their names under most
2012 2026 profiles (pysh was OK because the completion order is different).
2013 2027
2014 2028 2004-07-27 Fernando Perez <fperez@colorado.edu>
2015 2029
2016 2030 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2017 2031 keywords manually, b/c the one in keyword.py was removed in python
2018 2032 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2019 2033 This is NOT a bug under python 2.3 and earlier.
2020 2034
2021 2035 2004-07-26 Fernando Perez <fperez@colorado.edu>
2022 2036
2023 2037 * IPython/ultraTB.py (VerboseTB.text): Add another
2024 2038 linecache.checkcache() call to try to prevent inspect.py from
2025 2039 crashing under python 2.3. I think this fixes
2026 2040 http://www.scipy.net/roundup/ipython/issue17.
2027 2041
2028 2042 2004-07-26 *** Released version 0.6.2
2029 2043
2030 2044 2004-07-26 Fernando Perez <fperez@colorado.edu>
2031 2045
2032 2046 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2033 2047 fail for any number.
2034 2048 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2035 2049 empty bookmarks.
2036 2050
2037 2051 2004-07-26 *** Released version 0.6.1
2038 2052
2039 2053 2004-07-26 Fernando Perez <fperez@colorado.edu>
2040 2054
2041 2055 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2042 2056
2043 2057 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2044 2058 escaping '()[]{}' in filenames.
2045 2059
2046 2060 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2047 2061 Python 2.2 users who lack a proper shlex.split.
2048 2062
2049 2063 2004-07-19 Fernando Perez <fperez@colorado.edu>
2050 2064
2051 2065 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2052 2066 for reading readline's init file. I follow the normal chain:
2053 2067 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2054 2068 report by Mike Heeter. This closes
2055 2069 http://www.scipy.net/roundup/ipython/issue16.
2056 2070
2057 2071 2004-07-18 Fernando Perez <fperez@colorado.edu>
2058 2072
2059 2073 * IPython/iplib.py (__init__): Add better handling of '\' under
2060 2074 Win32 for filenames. After a patch by Ville.
2061 2075
2062 2076 2004-07-17 Fernando Perez <fperez@colorado.edu>
2063 2077
2064 2078 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2065 2079 autocalling would be triggered for 'foo is bar' if foo is
2066 2080 callable. I also cleaned up the autocall detection code to use a
2067 2081 regexp, which is faster. Bug reported by Alexander Schmolck.
2068 2082
2069 2083 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2070 2084 '?' in them would confuse the help system. Reported by Alex
2071 2085 Schmolck.
2072 2086
2073 2087 2004-07-16 Fernando Perez <fperez@colorado.edu>
2074 2088
2075 2089 * IPython/GnuplotInteractive.py (__all__): added plot2.
2076 2090
2077 2091 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2078 2092 plotting dictionaries, lists or tuples of 1d arrays.
2079 2093
2080 2094 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2081 2095 optimizations.
2082 2096
2083 2097 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2084 2098 the information which was there from Janko's original IPP code:
2085 2099
2086 2100 03.05.99 20:53 porto.ifm.uni-kiel.de
2087 2101 --Started changelog.
2088 2102 --make clear do what it say it does
2089 2103 --added pretty output of lines from inputcache
2090 2104 --Made Logger a mixin class, simplifies handling of switches
2091 2105 --Added own completer class. .string<TAB> expands to last history
2092 2106 line which starts with string. The new expansion is also present
2093 2107 with Ctrl-r from the readline library. But this shows, who this
2094 2108 can be done for other cases.
2095 2109 --Added convention that all shell functions should accept a
2096 2110 parameter_string This opens the door for different behaviour for
2097 2111 each function. @cd is a good example of this.
2098 2112
2099 2113 04.05.99 12:12 porto.ifm.uni-kiel.de
2100 2114 --added logfile rotation
2101 2115 --added new mainloop method which freezes first the namespace
2102 2116
2103 2117 07.05.99 21:24 porto.ifm.uni-kiel.de
2104 2118 --added the docreader classes. Now there is a help system.
2105 2119 -This is only a first try. Currently it's not easy to put new
2106 2120 stuff in the indices. But this is the way to go. Info would be
2107 2121 better, but HTML is every where and not everybody has an info
2108 2122 system installed and it's not so easy to change html-docs to info.
2109 2123 --added global logfile option
2110 2124 --there is now a hook for object inspection method pinfo needs to
2111 2125 be provided for this. Can be reached by two '??'.
2112 2126
2113 2127 08.05.99 20:51 porto.ifm.uni-kiel.de
2114 2128 --added a README
2115 2129 --bug in rc file. Something has changed so functions in the rc
2116 2130 file need to reference the shell and not self. Not clear if it's a
2117 2131 bug or feature.
2118 2132 --changed rc file for new behavior
2119 2133
2120 2134 2004-07-15 Fernando Perez <fperez@colorado.edu>
2121 2135
2122 2136 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2123 2137 cache was falling out of sync in bizarre manners when multi-line
2124 2138 input was present. Minor optimizations and cleanup.
2125 2139
2126 2140 (Logger): Remove old Changelog info for cleanup. This is the
2127 2141 information which was there from Janko's original code:
2128 2142
2129 2143 Changes to Logger: - made the default log filename a parameter
2130 2144
2131 2145 - put a check for lines beginning with !@? in log(). Needed
2132 2146 (even if the handlers properly log their lines) for mid-session
2133 2147 logging activation to work properly. Without this, lines logged
2134 2148 in mid session, which get read from the cache, would end up
2135 2149 'bare' (with !@? in the open) in the log. Now they are caught
2136 2150 and prepended with a #.
2137 2151
2138 2152 * IPython/iplib.py (InteractiveShell.init_readline): added check
2139 2153 in case MagicCompleter fails to be defined, so we don't crash.
2140 2154
2141 2155 2004-07-13 Fernando Perez <fperez@colorado.edu>
2142 2156
2143 2157 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2144 2158 of EPS if the requested filename ends in '.eps'.
2145 2159
2146 2160 2004-07-04 Fernando Perez <fperez@colorado.edu>
2147 2161
2148 2162 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2149 2163 escaping of quotes when calling the shell.
2150 2164
2151 2165 2004-07-02 Fernando Perez <fperez@colorado.edu>
2152 2166
2153 2167 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2154 2168 gettext not working because we were clobbering '_'. Fixes
2155 2169 http://www.scipy.net/roundup/ipython/issue6.
2156 2170
2157 2171 2004-07-01 Fernando Perez <fperez@colorado.edu>
2158 2172
2159 2173 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2160 2174 into @cd. Patch by Ville.
2161 2175
2162 2176 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2163 2177 new function to store things after ipmaker runs. Patch by Ville.
2164 2178 Eventually this will go away once ipmaker is removed and the class
2165 2179 gets cleaned up, but for now it's ok. Key functionality here is
2166 2180 the addition of the persistent storage mechanism, a dict for
2167 2181 keeping data across sessions (for now just bookmarks, but more can
2168 2182 be implemented later).
2169 2183
2170 2184 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2171 2185 persistent across sections. Patch by Ville, I modified it
2172 2186 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2173 2187 added a '-l' option to list all bookmarks.
2174 2188
2175 2189 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2176 2190 center for cleanup. Registered with atexit.register(). I moved
2177 2191 here the old exit_cleanup(). After a patch by Ville.
2178 2192
2179 2193 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2180 2194 characters in the hacked shlex_split for python 2.2.
2181 2195
2182 2196 * IPython/iplib.py (file_matches): more fixes to filenames with
2183 2197 whitespace in them. It's not perfect, but limitations in python's
2184 2198 readline make it impossible to go further.
2185 2199
2186 2200 2004-06-29 Fernando Perez <fperez@colorado.edu>
2187 2201
2188 2202 * IPython/iplib.py (file_matches): escape whitespace correctly in
2189 2203 filename completions. Bug reported by Ville.
2190 2204
2191 2205 2004-06-28 Fernando Perez <fperez@colorado.edu>
2192 2206
2193 2207 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2194 2208 the history file will be called 'history-PROFNAME' (or just
2195 2209 'history' if no profile is loaded). I was getting annoyed at
2196 2210 getting my Numerical work history clobbered by pysh sessions.
2197 2211
2198 2212 * IPython/iplib.py (InteractiveShell.__init__): Internal
2199 2213 getoutputerror() function so that we can honor the system_verbose
2200 2214 flag for _all_ system calls. I also added escaping of #
2201 2215 characters here to avoid confusing Itpl.
2202 2216
2203 2217 * IPython/Magic.py (shlex_split): removed call to shell in
2204 2218 parse_options and replaced it with shlex.split(). The annoying
2205 2219 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2206 2220 to backport it from 2.3, with several frail hacks (the shlex
2207 2221 module is rather limited in 2.2). Thanks to a suggestion by Ville
2208 2222 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2209 2223 problem.
2210 2224
2211 2225 (Magic.magic_system_verbose): new toggle to print the actual
2212 2226 system calls made by ipython. Mainly for debugging purposes.
2213 2227
2214 2228 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2215 2229 doesn't support persistence. Reported (and fix suggested) by
2216 2230 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2217 2231
2218 2232 2004-06-26 Fernando Perez <fperez@colorado.edu>
2219 2233
2220 2234 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2221 2235 continue prompts.
2222 2236
2223 2237 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2224 2238 function (basically a big docstring) and a few more things here to
2225 2239 speedup startup. pysh.py is now very lightweight. We want because
2226 2240 it gets execfile'd, while InterpreterExec gets imported, so
2227 2241 byte-compilation saves time.
2228 2242
2229 2243 2004-06-25 Fernando Perez <fperez@colorado.edu>
2230 2244
2231 2245 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2232 2246 -NUM', which was recently broken.
2233 2247
2234 2248 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2235 2249 in multi-line input (but not !!, which doesn't make sense there).
2236 2250
2237 2251 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2238 2252 It's just too useful, and people can turn it off in the less
2239 2253 common cases where it's a problem.
2240 2254
2241 2255 2004-06-24 Fernando Perez <fperez@colorado.edu>
2242 2256
2243 2257 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2244 2258 special syntaxes (like alias calling) is now allied in multi-line
2245 2259 input. This is still _very_ experimental, but it's necessary for
2246 2260 efficient shell usage combining python looping syntax with system
2247 2261 calls. For now it's restricted to aliases, I don't think it
2248 2262 really even makes sense to have this for magics.
2249 2263
2250 2264 2004-06-23 Fernando Perez <fperez@colorado.edu>
2251 2265
2252 2266 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2253 2267 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2254 2268
2255 2269 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2256 2270 extensions under Windows (after code sent by Gary Bishop). The
2257 2271 extensions considered 'executable' are stored in IPython's rc
2258 2272 structure as win_exec_ext.
2259 2273
2260 2274 * IPython/genutils.py (shell): new function, like system() but
2261 2275 without return value. Very useful for interactive shell work.
2262 2276
2263 2277 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2264 2278 delete aliases.
2265 2279
2266 2280 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2267 2281 sure that the alias table doesn't contain python keywords.
2268 2282
2269 2283 2004-06-21 Fernando Perez <fperez@colorado.edu>
2270 2284
2271 2285 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2272 2286 non-existent items are found in $PATH. Reported by Thorsten.
2273 2287
2274 2288 2004-06-20 Fernando Perez <fperez@colorado.edu>
2275 2289
2276 2290 * IPython/iplib.py (complete): modified the completer so that the
2277 2291 order of priorities can be easily changed at runtime.
2278 2292
2279 2293 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2280 2294 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2281 2295
2282 2296 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2283 2297 expand Python variables prepended with $ in all system calls. The
2284 2298 same was done to InteractiveShell.handle_shell_escape. Now all
2285 2299 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2286 2300 expansion of python variables and expressions according to the
2287 2301 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2288 2302
2289 2303 Though PEP-215 has been rejected, a similar (but simpler) one
2290 2304 seems like it will go into Python 2.4, PEP-292 -
2291 2305 http://www.python.org/peps/pep-0292.html.
2292 2306
2293 2307 I'll keep the full syntax of PEP-215, since IPython has since the
2294 2308 start used Ka-Ping Yee's reference implementation discussed there
2295 2309 (Itpl), and I actually like the powerful semantics it offers.
2296 2310
2297 2311 In order to access normal shell variables, the $ has to be escaped
2298 2312 via an extra $. For example:
2299 2313
2300 2314 In [7]: PATH='a python variable'
2301 2315
2302 2316 In [8]: !echo $PATH
2303 2317 a python variable
2304 2318
2305 2319 In [9]: !echo $$PATH
2306 2320 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2307 2321
2308 2322 (Magic.parse_options): escape $ so the shell doesn't evaluate
2309 2323 things prematurely.
2310 2324
2311 2325 * IPython/iplib.py (InteractiveShell.call_alias): added the
2312 2326 ability for aliases to expand python variables via $.
2313 2327
2314 2328 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2315 2329 system, now there's a @rehash/@rehashx pair of magics. These work
2316 2330 like the csh rehash command, and can be invoked at any time. They
2317 2331 build a table of aliases to everything in the user's $PATH
2318 2332 (@rehash uses everything, @rehashx is slower but only adds
2319 2333 executable files). With this, the pysh.py-based shell profile can
2320 2334 now simply call rehash upon startup, and full access to all
2321 2335 programs in the user's path is obtained.
2322 2336
2323 2337 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2324 2338 functionality is now fully in place. I removed the old dynamic
2325 2339 code generation based approach, in favor of a much lighter one
2326 2340 based on a simple dict. The advantage is that this allows me to
2327 2341 now have thousands of aliases with negligible cost (unthinkable
2328 2342 with the old system).
2329 2343
2330 2344 2004-06-19 Fernando Perez <fperez@colorado.edu>
2331 2345
2332 2346 * IPython/iplib.py (__init__): extended MagicCompleter class to
2333 2347 also complete (last in priority) on user aliases.
2334 2348
2335 2349 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2336 2350 call to eval.
2337 2351 (ItplNS.__init__): Added a new class which functions like Itpl,
2338 2352 but allows configuring the namespace for the evaluation to occur
2339 2353 in.
2340 2354
2341 2355 2004-06-18 Fernando Perez <fperez@colorado.edu>
2342 2356
2343 2357 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2344 2358 better message when 'exit' or 'quit' are typed (a common newbie
2345 2359 confusion).
2346 2360
2347 2361 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2348 2362 check for Windows users.
2349 2363
2350 2364 * IPython/iplib.py (InteractiveShell.user_setup): removed
2351 2365 disabling of colors for Windows. I'll test at runtime and issue a
2352 2366 warning if Gary's readline isn't found, as to nudge users to
2353 2367 download it.
2354 2368
2355 2369 2004-06-16 Fernando Perez <fperez@colorado.edu>
2356 2370
2357 2371 * IPython/genutils.py (Stream.__init__): changed to print errors
2358 2372 to sys.stderr. I had a circular dependency here. Now it's
2359 2373 possible to run ipython as IDLE's shell (consider this pre-alpha,
2360 2374 since true stdout things end up in the starting terminal instead
2361 2375 of IDLE's out).
2362 2376
2363 2377 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
2364 2378 users who haven't # updated their prompt_in2 definitions. Remove
2365 2379 eventually.
2366 2380 (multiple_replace): added credit to original ASPN recipe.
2367 2381
2368 2382 2004-06-15 Fernando Perez <fperez@colorado.edu>
2369 2383
2370 2384 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
2371 2385 list of auto-defined aliases.
2372 2386
2373 2387 2004-06-13 Fernando Perez <fperez@colorado.edu>
2374 2388
2375 2389 * setup.py (scriptfiles): Don't trigger win_post_install unless an
2376 2390 install was really requested (so setup.py can be used for other
2377 2391 things under Windows).
2378 2392
2379 2393 2004-06-10 Fernando Perez <fperez@colorado.edu>
2380 2394
2381 2395 * IPython/Logger.py (Logger.create_log): Manually remove any old
2382 2396 backup, since os.remove may fail under Windows. Fixes bug
2383 2397 reported by Thorsten.
2384 2398
2385 2399 2004-06-09 Fernando Perez <fperez@colorado.edu>
2386 2400
2387 2401 * examples/example-embed.py: fixed all references to %n (replaced
2388 2402 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
2389 2403 for all examples and the manual as well.
2390 2404
2391 2405 2004-06-08 Fernando Perez <fperez@colorado.edu>
2392 2406
2393 2407 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
2394 2408 alignment and color management. All 3 prompt subsystems now
2395 2409 inherit from BasePrompt.
2396 2410
2397 2411 * tools/release: updates for windows installer build and tag rpms
2398 2412 with python version (since paths are fixed).
2399 2413
2400 2414 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
2401 2415 which will become eventually obsolete. Also fixed the default
2402 2416 prompt_in2 to use \D, so at least new users start with the correct
2403 2417 defaults.
2404 2418 WARNING: Users with existing ipythonrc files will need to apply
2405 2419 this fix manually!
2406 2420
2407 2421 * setup.py: make windows installer (.exe). This is finally the
2408 2422 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
2409 2423 which I hadn't included because it required Python 2.3 (or recent
2410 2424 distutils).
2411 2425
2412 2426 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
2413 2427 usage of new '\D' escape.
2414 2428
2415 2429 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
2416 2430 lacks os.getuid())
2417 2431 (CachedOutput.set_colors): Added the ability to turn coloring
2418 2432 on/off with @colors even for manually defined prompt colors. It
2419 2433 uses a nasty global, but it works safely and via the generic color
2420 2434 handling mechanism.
2421 2435 (Prompt2.__init__): Introduced new escape '\D' for continuation
2422 2436 prompts. It represents the counter ('\#') as dots.
2423 2437 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
2424 2438 need to update their ipythonrc files and replace '%n' with '\D' in
2425 2439 their prompt_in2 settings everywhere. Sorry, but there's
2426 2440 otherwise no clean way to get all prompts to properly align. The
2427 2441 ipythonrc shipped with IPython has been updated.
2428 2442
2429 2443 2004-06-07 Fernando Perez <fperez@colorado.edu>
2430 2444
2431 2445 * setup.py (isfile): Pass local_icons option to latex2html, so the
2432 2446 resulting HTML file is self-contained. Thanks to
2433 2447 dryice-AT-liu.com.cn for the tip.
2434 2448
2435 2449 * pysh.py: I created a new profile 'shell', which implements a
2436 2450 _rudimentary_ IPython-based shell. This is in NO WAY a realy
2437 2451 system shell, nor will it become one anytime soon. It's mainly
2438 2452 meant to illustrate the use of the new flexible bash-like prompts.
2439 2453 I guess it could be used by hardy souls for true shell management,
2440 2454 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
2441 2455 profile. This uses the InterpreterExec extension provided by
2442 2456 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
2443 2457
2444 2458 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
2445 2459 auto-align itself with the length of the previous input prompt
2446 2460 (taking into account the invisible color escapes).
2447 2461 (CachedOutput.__init__): Large restructuring of this class. Now
2448 2462 all three prompts (primary1, primary2, output) are proper objects,
2449 2463 managed by the 'parent' CachedOutput class. The code is still a
2450 2464 bit hackish (all prompts share state via a pointer to the cache),
2451 2465 but it's overall far cleaner than before.
2452 2466
2453 2467 * IPython/genutils.py (getoutputerror): modified to add verbose,
2454 2468 debug and header options. This makes the interface of all getout*
2455 2469 functions uniform.
2456 2470 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
2457 2471
2458 2472 * IPython/Magic.py (Magic.default_option): added a function to
2459 2473 allow registering default options for any magic command. This
2460 2474 makes it easy to have profiles which customize the magics globally
2461 2475 for a certain use. The values set through this function are
2462 2476 picked up by the parse_options() method, which all magics should
2463 2477 use to parse their options.
2464 2478
2465 2479 * IPython/genutils.py (warn): modified the warnings framework to
2466 2480 use the Term I/O class. I'm trying to slowly unify all of
2467 2481 IPython's I/O operations to pass through Term.
2468 2482
2469 2483 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
2470 2484 the secondary prompt to correctly match the length of the primary
2471 2485 one for any prompt. Now multi-line code will properly line up
2472 2486 even for path dependent prompts, such as the new ones available
2473 2487 via the prompt_specials.
2474 2488
2475 2489 2004-06-06 Fernando Perez <fperez@colorado.edu>
2476 2490
2477 2491 * IPython/Prompts.py (prompt_specials): Added the ability to have
2478 2492 bash-like special sequences in the prompts, which get
2479 2493 automatically expanded. Things like hostname, current working
2480 2494 directory and username are implemented already, but it's easy to
2481 2495 add more in the future. Thanks to a patch by W.J. van der Laan
2482 2496 <gnufnork-AT-hetdigitalegat.nl>
2483 2497 (prompt_specials): Added color support for prompt strings, so
2484 2498 users can define arbitrary color setups for their prompts.
2485 2499
2486 2500 2004-06-05 Fernando Perez <fperez@colorado.edu>
2487 2501
2488 2502 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
2489 2503 code to load Gary Bishop's readline and configure it
2490 2504 automatically. Thanks to Gary for help on this.
2491 2505
2492 2506 2004-06-01 Fernando Perez <fperez@colorado.edu>
2493 2507
2494 2508 * IPython/Logger.py (Logger.create_log): fix bug for logging
2495 2509 with no filename (previous fix was incomplete).
2496 2510
2497 2511 2004-05-25 Fernando Perez <fperez@colorado.edu>
2498 2512
2499 2513 * IPython/Magic.py (Magic.parse_options): fix bug where naked
2500 2514 parens would get passed to the shell.
2501 2515
2502 2516 2004-05-20 Fernando Perez <fperez@colorado.edu>
2503 2517
2504 2518 * IPython/Magic.py (Magic.magic_prun): changed default profile
2505 2519 sort order to 'time' (the more common profiling need).
2506 2520
2507 2521 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
2508 2522 so that source code shown is guaranteed in sync with the file on
2509 2523 disk (also changed in psource). Similar fix to the one for
2510 2524 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
2511 2525 <yann.ledu-AT-noos.fr>.
2512 2526
2513 2527 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
2514 2528 with a single option would not be correctly parsed. Closes
2515 2529 http://www.scipy.net/roundup/ipython/issue14. This bug had been
2516 2530 introduced in 0.6.0 (on 2004-05-06).
2517 2531
2518 2532 2004-05-13 *** Released version 0.6.0
2519 2533
2520 2534 2004-05-13 Fernando Perez <fperez@colorado.edu>
2521 2535
2522 2536 * debian/: Added debian/ directory to CVS, so that debian support
2523 2537 is publicly accessible. The debian package is maintained by Jack
2524 2538 Moffit <jack-AT-xiph.org>.
2525 2539
2526 2540 * Documentation: included the notes about an ipython-based system
2527 2541 shell (the hypothetical 'pysh') into the new_design.pdf document,
2528 2542 so that these ideas get distributed to users along with the
2529 2543 official documentation.
2530 2544
2531 2545 2004-05-10 Fernando Perez <fperez@colorado.edu>
2532 2546
2533 2547 * IPython/Logger.py (Logger.create_log): fix recently introduced
2534 2548 bug (misindented line) where logstart would fail when not given an
2535 2549 explicit filename.
2536 2550
2537 2551 2004-05-09 Fernando Perez <fperez@colorado.edu>
2538 2552
2539 2553 * IPython/Magic.py (Magic.parse_options): skip system call when
2540 2554 there are no options to look for. Faster, cleaner for the common
2541 2555 case.
2542 2556
2543 2557 * Documentation: many updates to the manual: describing Windows
2544 2558 support better, Gnuplot updates, credits, misc small stuff. Also
2545 2559 updated the new_design doc a bit.
2546 2560
2547 2561 2004-05-06 *** Released version 0.6.0.rc1
2548 2562
2549 2563 2004-05-06 Fernando Perez <fperez@colorado.edu>
2550 2564
2551 2565 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
2552 2566 operations to use the vastly more efficient list/''.join() method.
2553 2567 (FormattedTB.text): Fix
2554 2568 http://www.scipy.net/roundup/ipython/issue12 - exception source
2555 2569 extract not updated after reload. Thanks to Mike Salib
2556 2570 <msalib-AT-mit.edu> for pinning the source of the problem.
2557 2571 Fortunately, the solution works inside ipython and doesn't require
2558 2572 any changes to python proper.
2559 2573
2560 2574 * IPython/Magic.py (Magic.parse_options): Improved to process the
2561 2575 argument list as a true shell would (by actually using the
2562 2576 underlying system shell). This way, all @magics automatically get
2563 2577 shell expansion for variables. Thanks to a comment by Alex
2564 2578 Schmolck.
2565 2579
2566 2580 2004-04-04 Fernando Perez <fperez@colorado.edu>
2567 2581
2568 2582 * IPython/iplib.py (InteractiveShell.interact): Added a special
2569 2583 trap for a debugger quit exception, which is basically impossible
2570 2584 to handle by normal mechanisms, given what pdb does to the stack.
2571 2585 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
2572 2586
2573 2587 2004-04-03 Fernando Perez <fperez@colorado.edu>
2574 2588
2575 2589 * IPython/genutils.py (Term): Standardized the names of the Term
2576 2590 class streams to cin/cout/cerr, following C++ naming conventions
2577 2591 (I can't use in/out/err because 'in' is not a valid attribute
2578 2592 name).
2579 2593
2580 2594 * IPython/iplib.py (InteractiveShell.interact): don't increment
2581 2595 the prompt if there's no user input. By Daniel 'Dang' Griffith
2582 2596 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
2583 2597 Francois Pinard.
2584 2598
2585 2599 2004-04-02 Fernando Perez <fperez@colorado.edu>
2586 2600
2587 2601 * IPython/genutils.py (Stream.__init__): Modified to survive at
2588 2602 least importing in contexts where stdin/out/err aren't true file
2589 2603 objects, such as PyCrust (they lack fileno() and mode). However,
2590 2604 the recovery facilities which rely on these things existing will
2591 2605 not work.
2592 2606
2593 2607 2004-04-01 Fernando Perez <fperez@colorado.edu>
2594 2608
2595 2609 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
2596 2610 use the new getoutputerror() function, so it properly
2597 2611 distinguishes stdout/err.
2598 2612
2599 2613 * IPython/genutils.py (getoutputerror): added a function to
2600 2614 capture separately the standard output and error of a command.
2601 2615 After a comment from dang on the mailing lists. This code is
2602 2616 basically a modified version of commands.getstatusoutput(), from
2603 2617 the standard library.
2604 2618
2605 2619 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2606 2620 '!!' as a special syntax (shorthand) to access @sx.
2607 2621
2608 2622 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2609 2623 command and return its output as a list split on '\n'.
2610 2624
2611 2625 2004-03-31 Fernando Perez <fperez@colorado.edu>
2612 2626
2613 2627 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2614 2628 method to dictionaries used as FakeModule instances if they lack
2615 2629 it. At least pydoc in python2.3 breaks for runtime-defined
2616 2630 functions without this hack. At some point I need to _really_
2617 2631 understand what FakeModule is doing, because it's a gross hack.
2618 2632 But it solves Arnd's problem for now...
2619 2633
2620 2634 2004-02-27 Fernando Perez <fperez@colorado.edu>
2621 2635
2622 2636 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2623 2637 mode would behave erratically. Also increased the number of
2624 2638 possible logs in rotate mod to 999. Thanks to Rod Holland
2625 2639 <rhh@StructureLABS.com> for the report and fixes.
2626 2640
2627 2641 2004-02-26 Fernando Perez <fperez@colorado.edu>
2628 2642
2629 2643 * IPython/genutils.py (page): Check that the curses module really
2630 2644 has the initscr attribute before trying to use it. For some
2631 2645 reason, the Solaris curses module is missing this. I think this
2632 2646 should be considered a Solaris python bug, but I'm not sure.
2633 2647
2634 2648 2004-01-17 Fernando Perez <fperez@colorado.edu>
2635 2649
2636 2650 * IPython/genutils.py (Stream.__init__): Changes to try to make
2637 2651 ipython robust against stdin/out/err being closed by the user.
2638 2652 This is 'user error' (and blocks a normal python session, at least
2639 2653 the stdout case). However, Ipython should be able to survive such
2640 2654 instances of abuse as gracefully as possible. To simplify the
2641 2655 coding and maintain compatibility with Gary Bishop's Term
2642 2656 contributions, I've made use of classmethods for this. I think
2643 2657 this introduces a dependency on python 2.2.
2644 2658
2645 2659 2004-01-13 Fernando Perez <fperez@colorado.edu>
2646 2660
2647 2661 * IPython/numutils.py (exp_safe): simplified the code a bit and
2648 2662 removed the need for importing the kinds module altogether.
2649 2663
2650 2664 2004-01-06 Fernando Perez <fperez@colorado.edu>
2651 2665
2652 2666 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2653 2667 a magic function instead, after some community feedback. No
2654 2668 special syntax will exist for it, but its name is deliberately
2655 2669 very short.
2656 2670
2657 2671 2003-12-20 Fernando Perez <fperez@colorado.edu>
2658 2672
2659 2673 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2660 2674 new functionality, to automagically assign the result of a shell
2661 2675 command to a variable. I'll solicit some community feedback on
2662 2676 this before making it permanent.
2663 2677
2664 2678 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2665 2679 requested about callables for which inspect couldn't obtain a
2666 2680 proper argspec. Thanks to a crash report sent by Etienne
2667 2681 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2668 2682
2669 2683 2003-12-09 Fernando Perez <fperez@colorado.edu>
2670 2684
2671 2685 * IPython/genutils.py (page): patch for the pager to work across
2672 2686 various versions of Windows. By Gary Bishop.
2673 2687
2674 2688 2003-12-04 Fernando Perez <fperez@colorado.edu>
2675 2689
2676 2690 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2677 2691 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2678 2692 While I tested this and it looks ok, there may still be corner
2679 2693 cases I've missed.
2680 2694
2681 2695 2003-12-01 Fernando Perez <fperez@colorado.edu>
2682 2696
2683 2697 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2684 2698 where a line like 'p,q=1,2' would fail because the automagic
2685 2699 system would be triggered for @p.
2686 2700
2687 2701 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2688 2702 cleanups, code unmodified.
2689 2703
2690 2704 * IPython/genutils.py (Term): added a class for IPython to handle
2691 2705 output. In most cases it will just be a proxy for stdout/err, but
2692 2706 having this allows modifications to be made for some platforms,
2693 2707 such as handling color escapes under Windows. All of this code
2694 2708 was contributed by Gary Bishop, with minor modifications by me.
2695 2709 The actual changes affect many files.
2696 2710
2697 2711 2003-11-30 Fernando Perez <fperez@colorado.edu>
2698 2712
2699 2713 * IPython/iplib.py (file_matches): new completion code, courtesy
2700 2714 of Jeff Collins. This enables filename completion again under
2701 2715 python 2.3, which disabled it at the C level.
2702 2716
2703 2717 2003-11-11 Fernando Perez <fperez@colorado.edu>
2704 2718
2705 2719 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2706 2720 for Numeric.array(map(...)), but often convenient.
2707 2721
2708 2722 2003-11-05 Fernando Perez <fperez@colorado.edu>
2709 2723
2710 2724 * IPython/numutils.py (frange): Changed a call from int() to
2711 2725 int(round()) to prevent a problem reported with arange() in the
2712 2726 numpy list.
2713 2727
2714 2728 2003-10-06 Fernando Perez <fperez@colorado.edu>
2715 2729
2716 2730 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2717 2731 prevent crashes if sys lacks an argv attribute (it happens with
2718 2732 embedded interpreters which build a bare-bones sys module).
2719 2733 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2720 2734
2721 2735 2003-09-24 Fernando Perez <fperez@colorado.edu>
2722 2736
2723 2737 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2724 2738 to protect against poorly written user objects where __getattr__
2725 2739 raises exceptions other than AttributeError. Thanks to a bug
2726 2740 report by Oliver Sander <osander-AT-gmx.de>.
2727 2741
2728 2742 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2729 2743 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2730 2744
2731 2745 2003-09-09 Fernando Perez <fperez@colorado.edu>
2732 2746
2733 2747 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2734 2748 unpacking a list whith a callable as first element would
2735 2749 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2736 2750 Collins.
2737 2751
2738 2752 2003-08-25 *** Released version 0.5.0
2739 2753
2740 2754 2003-08-22 Fernando Perez <fperez@colorado.edu>
2741 2755
2742 2756 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2743 2757 improperly defined user exceptions. Thanks to feedback from Mark
2744 2758 Russell <mrussell-AT-verio.net>.
2745 2759
2746 2760 2003-08-20 Fernando Perez <fperez@colorado.edu>
2747 2761
2748 2762 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2749 2763 printing so that it would print multi-line string forms starting
2750 2764 with a new line. This way the formatting is better respected for
2751 2765 objects which work hard to make nice string forms.
2752 2766
2753 2767 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2754 2768 autocall would overtake data access for objects with both
2755 2769 __getitem__ and __call__.
2756 2770
2757 2771 2003-08-19 *** Released version 0.5.0-rc1
2758 2772
2759 2773 2003-08-19 Fernando Perez <fperez@colorado.edu>
2760 2774
2761 2775 * IPython/deep_reload.py (load_tail): single tiny change here
2762 2776 seems to fix the long-standing bug of dreload() failing to work
2763 2777 for dotted names. But this module is pretty tricky, so I may have
2764 2778 missed some subtlety. Needs more testing!.
2765 2779
2766 2780 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2767 2781 exceptions which have badly implemented __str__ methods.
2768 2782 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2769 2783 which I've been getting reports about from Python 2.3 users. I
2770 2784 wish I had a simple test case to reproduce the problem, so I could
2771 2785 either write a cleaner workaround or file a bug report if
2772 2786 necessary.
2773 2787
2774 2788 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2775 2789 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2776 2790 a bug report by Tjabo Kloppenburg.
2777 2791
2778 2792 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
2779 2793 crashes. Wrapped the pdb call in a blanket try/except, since pdb
2780 2794 seems rather unstable. Thanks to a bug report by Tjabo
2781 2795 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
2782 2796
2783 2797 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
2784 2798 this out soon because of the critical fixes in the inner loop for
2785 2799 generators.
2786 2800
2787 2801 * IPython/Magic.py (Magic.getargspec): removed. This (and
2788 2802 _get_def) have been obsoleted by OInspect for a long time, I
2789 2803 hadn't noticed that they were dead code.
2790 2804 (Magic._ofind): restored _ofind functionality for a few literals
2791 2805 (those in ["''",'""','[]','{}','()']). But it won't work anymore
2792 2806 for things like "hello".capitalize?, since that would require a
2793 2807 potentially dangerous eval() again.
2794 2808
2795 2809 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
2796 2810 logic a bit more to clean up the escapes handling and minimize the
2797 2811 use of _ofind to only necessary cases. The interactive 'feel' of
2798 2812 IPython should have improved quite a bit with the changes in
2799 2813 _prefilter and _ofind (besides being far safer than before).
2800 2814
2801 2815 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
2802 2816 obscure, never reported). Edit would fail to find the object to
2803 2817 edit under some circumstances.
2804 2818 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
2805 2819 which were causing double-calling of generators. Those eval calls
2806 2820 were _very_ dangerous, since code with side effects could be
2807 2821 triggered. As they say, 'eval is evil'... These were the
2808 2822 nastiest evals in IPython. Besides, _ofind is now far simpler,
2809 2823 and it should also be quite a bit faster. Its use of inspect is
2810 2824 also safer, so perhaps some of the inspect-related crashes I've
2811 2825 seen lately with Python 2.3 might be taken care of. That will
2812 2826 need more testing.
2813 2827
2814 2828 2003-08-17 Fernando Perez <fperez@colorado.edu>
2815 2829
2816 2830 * IPython/iplib.py (InteractiveShell._prefilter): significant
2817 2831 simplifications to the logic for handling user escapes. Faster
2818 2832 and simpler code.
2819 2833
2820 2834 2003-08-14 Fernando Perez <fperez@colorado.edu>
2821 2835
2822 2836 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2823 2837 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2824 2838 but it should be quite a bit faster. And the recursive version
2825 2839 generated O(log N) intermediate storage for all rank>1 arrays,
2826 2840 even if they were contiguous.
2827 2841 (l1norm): Added this function.
2828 2842 (norm): Added this function for arbitrary norms (including
2829 2843 l-infinity). l1 and l2 are still special cases for convenience
2830 2844 and speed.
2831 2845
2832 2846 2003-08-03 Fernando Perez <fperez@colorado.edu>
2833 2847
2834 2848 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2835 2849 exceptions, which now raise PendingDeprecationWarnings in Python
2836 2850 2.3. There were some in Magic and some in Gnuplot2.
2837 2851
2838 2852 2003-06-30 Fernando Perez <fperez@colorado.edu>
2839 2853
2840 2854 * IPython/genutils.py (page): modified to call curses only for
2841 2855 terminals where TERM=='xterm'. After problems under many other
2842 2856 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2843 2857
2844 2858 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2845 2859 would be triggered when readline was absent. This was just an old
2846 2860 debugging statement I'd forgotten to take out.
2847 2861
2848 2862 2003-06-20 Fernando Perez <fperez@colorado.edu>
2849 2863
2850 2864 * IPython/genutils.py (clock): modified to return only user time
2851 2865 (not counting system time), after a discussion on scipy. While
2852 2866 system time may be a useful quantity occasionally, it may much
2853 2867 more easily be skewed by occasional swapping or other similar
2854 2868 activity.
2855 2869
2856 2870 2003-06-05 Fernando Perez <fperez@colorado.edu>
2857 2871
2858 2872 * IPython/numutils.py (identity): new function, for building
2859 2873 arbitrary rank Kronecker deltas (mostly backwards compatible with
2860 2874 Numeric.identity)
2861 2875
2862 2876 2003-06-03 Fernando Perez <fperez@colorado.edu>
2863 2877
2864 2878 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2865 2879 arguments passed to magics with spaces, to allow trailing '\' to
2866 2880 work normally (mainly for Windows users).
2867 2881
2868 2882 2003-05-29 Fernando Perez <fperez@colorado.edu>
2869 2883
2870 2884 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2871 2885 instead of pydoc.help. This fixes a bizarre behavior where
2872 2886 printing '%s' % locals() would trigger the help system. Now
2873 2887 ipython behaves like normal python does.
2874 2888
2875 2889 Note that if one does 'from pydoc import help', the bizarre
2876 2890 behavior returns, but this will also happen in normal python, so
2877 2891 it's not an ipython bug anymore (it has to do with how pydoc.help
2878 2892 is implemented).
2879 2893
2880 2894 2003-05-22 Fernando Perez <fperez@colorado.edu>
2881 2895
2882 2896 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2883 2897 return [] instead of None when nothing matches, also match to end
2884 2898 of line. Patch by Gary Bishop.
2885 2899
2886 2900 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2887 2901 protection as before, for files passed on the command line. This
2888 2902 prevents the CrashHandler from kicking in if user files call into
2889 2903 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2890 2904 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2891 2905
2892 2906 2003-05-20 *** Released version 0.4.0
2893 2907
2894 2908 2003-05-20 Fernando Perez <fperez@colorado.edu>
2895 2909
2896 2910 * setup.py: added support for manpages. It's a bit hackish b/c of
2897 2911 a bug in the way the bdist_rpm distutils target handles gzipped
2898 2912 manpages, but it works. After a patch by Jack.
2899 2913
2900 2914 2003-05-19 Fernando Perez <fperez@colorado.edu>
2901 2915
2902 2916 * IPython/numutils.py: added a mockup of the kinds module, since
2903 2917 it was recently removed from Numeric. This way, numutils will
2904 2918 work for all users even if they are missing kinds.
2905 2919
2906 2920 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2907 2921 failure, which can occur with SWIG-wrapped extensions. After a
2908 2922 crash report from Prabhu.
2909 2923
2910 2924 2003-05-16 Fernando Perez <fperez@colorado.edu>
2911 2925
2912 2926 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2913 2927 protect ipython from user code which may call directly
2914 2928 sys.excepthook (this looks like an ipython crash to the user, even
2915 2929 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2916 2930 This is especially important to help users of WxWindows, but may
2917 2931 also be useful in other cases.
2918 2932
2919 2933 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2920 2934 an optional tb_offset to be specified, and to preserve exception
2921 2935 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2922 2936
2923 2937 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2924 2938
2925 2939 2003-05-15 Fernando Perez <fperez@colorado.edu>
2926 2940
2927 2941 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2928 2942 installing for a new user under Windows.
2929 2943
2930 2944 2003-05-12 Fernando Perez <fperez@colorado.edu>
2931 2945
2932 2946 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2933 2947 handler for Emacs comint-based lines. Currently it doesn't do
2934 2948 much (but importantly, it doesn't update the history cache). In
2935 2949 the future it may be expanded if Alex needs more functionality
2936 2950 there.
2937 2951
2938 2952 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2939 2953 info to crash reports.
2940 2954
2941 2955 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2942 2956 just like Python's -c. Also fixed crash with invalid -color
2943 2957 option value at startup. Thanks to Will French
2944 2958 <wfrench-AT-bestweb.net> for the bug report.
2945 2959
2946 2960 2003-05-09 Fernando Perez <fperez@colorado.edu>
2947 2961
2948 2962 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2949 2963 to EvalDict (it's a mapping, after all) and simplified its code
2950 2964 quite a bit, after a nice discussion on c.l.py where Gustavo
2951 2965 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
2952 2966
2953 2967 2003-04-30 Fernando Perez <fperez@colorado.edu>
2954 2968
2955 2969 * IPython/genutils.py (timings_out): modified it to reduce its
2956 2970 overhead in the common reps==1 case.
2957 2971
2958 2972 2003-04-29 Fernando Perez <fperez@colorado.edu>
2959 2973
2960 2974 * IPython/genutils.py (timings_out): Modified to use the resource
2961 2975 module, which avoids the wraparound problems of time.clock().
2962 2976
2963 2977 2003-04-17 *** Released version 0.2.15pre4
2964 2978
2965 2979 2003-04-17 Fernando Perez <fperez@colorado.edu>
2966 2980
2967 2981 * setup.py (scriptfiles): Split windows-specific stuff over to a
2968 2982 separate file, in an attempt to have a Windows GUI installer.
2969 2983 That didn't work, but part of the groundwork is done.
2970 2984
2971 2985 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2972 2986 indent/unindent with 4 spaces. Particularly useful in combination
2973 2987 with the new auto-indent option.
2974 2988
2975 2989 2003-04-16 Fernando Perez <fperez@colorado.edu>
2976 2990
2977 2991 * IPython/Magic.py: various replacements of self.rc for
2978 2992 self.shell.rc. A lot more remains to be done to fully disentangle
2979 2993 this class from the main Shell class.
2980 2994
2981 2995 * IPython/GnuplotRuntime.py: added checks for mouse support so
2982 2996 that we don't try to enable it if the current gnuplot doesn't
2983 2997 really support it. Also added checks so that we don't try to
2984 2998 enable persist under Windows (where Gnuplot doesn't recognize the
2985 2999 option).
2986 3000
2987 3001 * IPython/iplib.py (InteractiveShell.interact): Added optional
2988 3002 auto-indenting code, after a patch by King C. Shu
2989 3003 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2990 3004 get along well with pasting indented code. If I ever figure out
2991 3005 how to make that part go well, it will become on by default.
2992 3006
2993 3007 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2994 3008 crash ipython if there was an unmatched '%' in the user's prompt
2995 3009 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2996 3010
2997 3011 * IPython/iplib.py (InteractiveShell.interact): removed the
2998 3012 ability to ask the user whether he wants to crash or not at the
2999 3013 'last line' exception handler. Calling functions at that point
3000 3014 changes the stack, and the error reports would have incorrect
3001 3015 tracebacks.
3002 3016
3003 3017 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3004 3018 pass through a peger a pretty-printed form of any object. After a
3005 3019 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3006 3020
3007 3021 2003-04-14 Fernando Perez <fperez@colorado.edu>
3008 3022
3009 3023 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3010 3024 all files in ~ would be modified at first install (instead of
3011 3025 ~/.ipython). This could be potentially disastrous, as the
3012 3026 modification (make line-endings native) could damage binary files.
3013 3027
3014 3028 2003-04-10 Fernando Perez <fperez@colorado.edu>
3015 3029
3016 3030 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3017 3031 handle only lines which are invalid python. This now means that
3018 3032 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3019 3033 for the bug report.
3020 3034
3021 3035 2003-04-01 Fernando Perez <fperez@colorado.edu>
3022 3036
3023 3037 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3024 3038 where failing to set sys.last_traceback would crash pdb.pm().
3025 3039 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3026 3040 report.
3027 3041
3028 3042 2003-03-25 Fernando Perez <fperez@colorado.edu>
3029 3043
3030 3044 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3031 3045 before printing it (it had a lot of spurious blank lines at the
3032 3046 end).
3033 3047
3034 3048 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3035 3049 output would be sent 21 times! Obviously people don't use this
3036 3050 too often, or I would have heard about it.
3037 3051
3038 3052 2003-03-24 Fernando Perez <fperez@colorado.edu>
3039 3053
3040 3054 * setup.py (scriptfiles): renamed the data_files parameter from
3041 3055 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3042 3056 for the patch.
3043 3057
3044 3058 2003-03-20 Fernando Perez <fperez@colorado.edu>
3045 3059
3046 3060 * IPython/genutils.py (error): added error() and fatal()
3047 3061 functions.
3048 3062
3049 3063 2003-03-18 *** Released version 0.2.15pre3
3050 3064
3051 3065 2003-03-18 Fernando Perez <fperez@colorado.edu>
3052 3066
3053 3067 * setupext/install_data_ext.py
3054 3068 (install_data_ext.initialize_options): Class contributed by Jack
3055 3069 Moffit for fixing the old distutils hack. He is sending this to
3056 3070 the distutils folks so in the future we may not need it as a
3057 3071 private fix.
3058 3072
3059 3073 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3060 3074 changes for Debian packaging. See his patch for full details.
3061 3075 The old distutils hack of making the ipythonrc* files carry a
3062 3076 bogus .py extension is gone, at last. Examples were moved to a
3063 3077 separate subdir under doc/, and the separate executable scripts
3064 3078 now live in their own directory. Overall a great cleanup. The
3065 3079 manual was updated to use the new files, and setup.py has been
3066 3080 fixed for this setup.
3067 3081
3068 3082 * IPython/PyColorize.py (Parser.usage): made non-executable and
3069 3083 created a pycolor wrapper around it to be included as a script.
3070 3084
3071 3085 2003-03-12 *** Released version 0.2.15pre2
3072 3086
3073 3087 2003-03-12 Fernando Perez <fperez@colorado.edu>
3074 3088
3075 3089 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3076 3090 long-standing problem with garbage characters in some terminals.
3077 3091 The issue was really that the \001 and \002 escapes must _only_ be
3078 3092 passed to input prompts (which call readline), but _never_ to
3079 3093 normal text to be printed on screen. I changed ColorANSI to have
3080 3094 two classes: TermColors and InputTermColors, each with the
3081 3095 appropriate escapes for input prompts or normal text. The code in
3082 3096 Prompts.py got slightly more complicated, but this very old and
3083 3097 annoying bug is finally fixed.
3084 3098
3085 3099 All the credit for nailing down the real origin of this problem
3086 3100 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3087 3101 *Many* thanks to him for spending quite a bit of effort on this.
3088 3102
3089 3103 2003-03-05 *** Released version 0.2.15pre1
3090 3104
3091 3105 2003-03-03 Fernando Perez <fperez@colorado.edu>
3092 3106
3093 3107 * IPython/FakeModule.py: Moved the former _FakeModule to a
3094 3108 separate file, because it's also needed by Magic (to fix a similar
3095 3109 pickle-related issue in @run).
3096 3110
3097 3111 2003-03-02 Fernando Perez <fperez@colorado.edu>
3098 3112
3099 3113 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3100 3114 the autocall option at runtime.
3101 3115 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3102 3116 across Magic.py to start separating Magic from InteractiveShell.
3103 3117 (Magic._ofind): Fixed to return proper namespace for dotted
3104 3118 names. Before, a dotted name would always return 'not currently
3105 3119 defined', because it would find the 'parent'. s.x would be found,
3106 3120 but since 'x' isn't defined by itself, it would get confused.
3107 3121 (Magic.magic_run): Fixed pickling problems reported by Ralf
3108 3122 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3109 3123 that I'd used when Mike Heeter reported similar issues at the
3110 3124 top-level, but now for @run. It boils down to injecting the
3111 3125 namespace where code is being executed with something that looks
3112 3126 enough like a module to fool pickle.dump(). Since a pickle stores
3113 3127 a named reference to the importing module, we need this for
3114 3128 pickles to save something sensible.
3115 3129
3116 3130 * IPython/ipmaker.py (make_IPython): added an autocall option.
3117 3131
3118 3132 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3119 3133 the auto-eval code. Now autocalling is an option, and the code is
3120 3134 also vastly safer. There is no more eval() involved at all.
3121 3135
3122 3136 2003-03-01 Fernando Perez <fperez@colorado.edu>
3123 3137
3124 3138 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3125 3139 dict with named keys instead of a tuple.
3126 3140
3127 3141 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3128 3142
3129 3143 * setup.py (make_shortcut): Fixed message about directories
3130 3144 created during Windows installation (the directories were ok, just
3131 3145 the printed message was misleading). Thanks to Chris Liechti
3132 3146 <cliechti-AT-gmx.net> for the heads up.
3133 3147
3134 3148 2003-02-21 Fernando Perez <fperez@colorado.edu>
3135 3149
3136 3150 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3137 3151 of ValueError exception when checking for auto-execution. This
3138 3152 one is raised by things like Numeric arrays arr.flat when the
3139 3153 array is non-contiguous.
3140 3154
3141 3155 2003-01-31 Fernando Perez <fperez@colorado.edu>
3142 3156
3143 3157 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3144 3158 not return any value at all (even though the command would get
3145 3159 executed).
3146 3160 (xsys): Flush stdout right after printing the command to ensure
3147 3161 proper ordering of commands and command output in the total
3148 3162 output.
3149 3163 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3150 3164 system/getoutput as defaults. The old ones are kept for
3151 3165 compatibility reasons, so no code which uses this library needs
3152 3166 changing.
3153 3167
3154 3168 2003-01-27 *** Released version 0.2.14
3155 3169
3156 3170 2003-01-25 Fernando Perez <fperez@colorado.edu>
3157 3171
3158 3172 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3159 3173 functions defined in previous edit sessions could not be re-edited
3160 3174 (because the temp files were immediately removed). Now temp files
3161 3175 are removed only at IPython's exit.
3162 3176 (Magic.magic_run): Improved @run to perform shell-like expansions
3163 3177 on its arguments (~users and $VARS). With this, @run becomes more
3164 3178 like a normal command-line.
3165 3179
3166 3180 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3167 3181 bugs related to embedding and cleaned up that code. A fairly
3168 3182 important one was the impossibility to access the global namespace
3169 3183 through the embedded IPython (only local variables were visible).
3170 3184
3171 3185 2003-01-14 Fernando Perez <fperez@colorado.edu>
3172 3186
3173 3187 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3174 3188 auto-calling to be a bit more conservative. Now it doesn't get
3175 3189 triggered if any of '!=()<>' are in the rest of the input line, to
3176 3190 allow comparing callables. Thanks to Alex for the heads up.
3177 3191
3178 3192 2003-01-07 Fernando Perez <fperez@colorado.edu>
3179 3193
3180 3194 * IPython/genutils.py (page): fixed estimation of the number of
3181 3195 lines in a string to be paged to simply count newlines. This
3182 3196 prevents over-guessing due to embedded escape sequences. A better
3183 3197 long-term solution would involve stripping out the control chars
3184 3198 for the count, but it's potentially so expensive I just don't
3185 3199 think it's worth doing.
3186 3200
3187 3201 2002-12-19 *** Released version 0.2.14pre50
3188 3202
3189 3203 2002-12-19 Fernando Perez <fperez@colorado.edu>
3190 3204
3191 3205 * tools/release (version): Changed release scripts to inform
3192 3206 Andrea and build a NEWS file with a list of recent changes.
3193 3207
3194 3208 * IPython/ColorANSI.py (__all__): changed terminal detection
3195 3209 code. Seems to work better for xterms without breaking
3196 3210 konsole. Will need more testing to determine if WinXP and Mac OSX
3197 3211 also work ok.
3198 3212
3199 3213 2002-12-18 *** Released version 0.2.14pre49
3200 3214
3201 3215 2002-12-18 Fernando Perez <fperez@colorado.edu>
3202 3216
3203 3217 * Docs: added new info about Mac OSX, from Andrea.
3204 3218
3205 3219 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3206 3220 allow direct plotting of python strings whose format is the same
3207 3221 of gnuplot data files.
3208 3222
3209 3223 2002-12-16 Fernando Perez <fperez@colorado.edu>
3210 3224
3211 3225 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3212 3226 value of exit question to be acknowledged.
3213 3227
3214 3228 2002-12-03 Fernando Perez <fperez@colorado.edu>
3215 3229
3216 3230 * IPython/ipmaker.py: removed generators, which had been added
3217 3231 by mistake in an earlier debugging run. This was causing trouble
3218 3232 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3219 3233 for pointing this out.
3220 3234
3221 3235 2002-11-17 Fernando Perez <fperez@colorado.edu>
3222 3236
3223 3237 * Manual: updated the Gnuplot section.
3224 3238
3225 3239 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3226 3240 a much better split of what goes in Runtime and what goes in
3227 3241 Interactive.
3228 3242
3229 3243 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3230 3244 being imported from iplib.
3231 3245
3232 3246 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3233 3247 for command-passing. Now the global Gnuplot instance is called
3234 3248 'gp' instead of 'g', which was really a far too fragile and
3235 3249 common name.
3236 3250
3237 3251 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3238 3252 bounding boxes generated by Gnuplot for square plots.
3239 3253
3240 3254 * IPython/genutils.py (popkey): new function added. I should
3241 3255 suggest this on c.l.py as a dict method, it seems useful.
3242 3256
3243 3257 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3244 3258 to transparently handle PostScript generation. MUCH better than
3245 3259 the previous plot_eps/replot_eps (which I removed now). The code
3246 3260 is also fairly clean and well documented now (including
3247 3261 docstrings).
3248 3262
3249 3263 2002-11-13 Fernando Perez <fperez@colorado.edu>
3250 3264
3251 3265 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3252 3266 (inconsistent with options).
3253 3267
3254 3268 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3255 3269 manually disabled, I don't know why. Fixed it.
3256 3270 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3257 3271 eps output.
3258 3272
3259 3273 2002-11-12 Fernando Perez <fperez@colorado.edu>
3260 3274
3261 3275 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3262 3276 don't propagate up to caller. Fixes crash reported by François
3263 3277 Pinard.
3264 3278
3265 3279 2002-11-09 Fernando Perez <fperez@colorado.edu>
3266 3280
3267 3281 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3268 3282 history file for new users.
3269 3283 (make_IPython): fixed bug where initial install would leave the
3270 3284 user running in the .ipython dir.
3271 3285 (make_IPython): fixed bug where config dir .ipython would be
3272 3286 created regardless of the given -ipythondir option. Thanks to Cory
3273 3287 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3274 3288
3275 3289 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3276 3290 type confirmations. Will need to use it in all of IPython's code
3277 3291 consistently.
3278 3292
3279 3293 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3280 3294 context to print 31 lines instead of the default 5. This will make
3281 3295 the crash reports extremely detailed in case the problem is in
3282 3296 libraries I don't have access to.
3283 3297
3284 3298 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3285 3299 line of defense' code to still crash, but giving users fair
3286 3300 warning. I don't want internal errors to go unreported: if there's
3287 3301 an internal problem, IPython should crash and generate a full
3288 3302 report.
3289 3303
3290 3304 2002-11-08 Fernando Perez <fperez@colorado.edu>
3291 3305
3292 3306 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3293 3307 otherwise uncaught exceptions which can appear if people set
3294 3308 sys.stdout to something badly broken. Thanks to a crash report
3295 3309 from henni-AT-mail.brainbot.com.
3296 3310
3297 3311 2002-11-04 Fernando Perez <fperez@colorado.edu>
3298 3312
3299 3313 * IPython/iplib.py (InteractiveShell.interact): added
3300 3314 __IPYTHON__active to the builtins. It's a flag which goes on when
3301 3315 the interaction starts and goes off again when it stops. This
3302 3316 allows embedding code to detect being inside IPython. Before this
3303 3317 was done via __IPYTHON__, but that only shows that an IPython
3304 3318 instance has been created.
3305 3319
3306 3320 * IPython/Magic.py (Magic.magic_env): I realized that in a
3307 3321 UserDict, instance.data holds the data as a normal dict. So I
3308 3322 modified @env to return os.environ.data instead of rebuilding a
3309 3323 dict by hand.
3310 3324
3311 3325 2002-11-02 Fernando Perez <fperez@colorado.edu>
3312 3326
3313 3327 * IPython/genutils.py (warn): changed so that level 1 prints no
3314 3328 header. Level 2 is now the default (with 'WARNING' header, as
3315 3329 before). I think I tracked all places where changes were needed in
3316 3330 IPython, but outside code using the old level numbering may have
3317 3331 broken.
3318 3332
3319 3333 * IPython/iplib.py (InteractiveShell.runcode): added this to
3320 3334 handle the tracebacks in SystemExit traps correctly. The previous
3321 3335 code (through interact) was printing more of the stack than
3322 3336 necessary, showing IPython internal code to the user.
3323 3337
3324 3338 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3325 3339 default. Now that the default at the confirmation prompt is yes,
3326 3340 it's not so intrusive. François' argument that ipython sessions
3327 3341 tend to be complex enough not to lose them from an accidental C-d,
3328 3342 is a valid one.
3329 3343
3330 3344 * IPython/iplib.py (InteractiveShell.interact): added a
3331 3345 showtraceback() call to the SystemExit trap, and modified the exit
3332 3346 confirmation to have yes as the default.
3333 3347
3334 3348 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3335 3349 this file. It's been gone from the code for a long time, this was
3336 3350 simply leftover junk.
3337 3351
3338 3352 2002-11-01 Fernando Perez <fperez@colorado.edu>
3339 3353
3340 3354 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3341 3355 added. If set, IPython now traps EOF and asks for
3342 3356 confirmation. After a request by François Pinard.
3343 3357
3344 3358 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3345 3359 of @abort, and with a new (better) mechanism for handling the
3346 3360 exceptions.
3347 3361
3348 3362 2002-10-27 Fernando Perez <fperez@colorado.edu>
3349 3363
3350 3364 * IPython/usage.py (__doc__): updated the --help information and
3351 3365 the ipythonrc file to indicate that -log generates
3352 3366 ./ipython.log. Also fixed the corresponding info in @logstart.
3353 3367 This and several other fixes in the manuals thanks to reports by
3354 3368 François Pinard <pinard-AT-iro.umontreal.ca>.
3355 3369
3356 3370 * IPython/Logger.py (Logger.switch_log): Fixed error message to
3357 3371 refer to @logstart (instead of @log, which doesn't exist).
3358 3372
3359 3373 * IPython/iplib.py (InteractiveShell._prefilter): fixed
3360 3374 AttributeError crash. Thanks to Christopher Armstrong
3361 3375 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
3362 3376 introduced recently (in 0.2.14pre37) with the fix to the eval
3363 3377 problem mentioned below.
3364 3378
3365 3379 2002-10-17 Fernando Perez <fperez@colorado.edu>
3366 3380
3367 3381 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
3368 3382 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
3369 3383
3370 3384 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
3371 3385 this function to fix a problem reported by Alex Schmolck. He saw
3372 3386 it with list comprehensions and generators, which were getting
3373 3387 called twice. The real problem was an 'eval' call in testing for
3374 3388 automagic which was evaluating the input line silently.
3375 3389
3376 3390 This is a potentially very nasty bug, if the input has side
3377 3391 effects which must not be repeated. The code is much cleaner now,
3378 3392 without any blanket 'except' left and with a regexp test for
3379 3393 actual function names.
3380 3394
3381 3395 But an eval remains, which I'm not fully comfortable with. I just
3382 3396 don't know how to find out if an expression could be a callable in
3383 3397 the user's namespace without doing an eval on the string. However
3384 3398 that string is now much more strictly checked so that no code
3385 3399 slips by, so the eval should only happen for things that can
3386 3400 really be only function/method names.
3387 3401
3388 3402 2002-10-15 Fernando Perez <fperez@colorado.edu>
3389 3403
3390 3404 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
3391 3405 OSX information to main manual, removed README_Mac_OSX file from
3392 3406 distribution. Also updated credits for recent additions.
3393 3407
3394 3408 2002-10-10 Fernando Perez <fperez@colorado.edu>
3395 3409
3396 3410 * README_Mac_OSX: Added a README for Mac OSX users for fixing
3397 3411 terminal-related issues. Many thanks to Andrea Riciputi
3398 3412 <andrea.riciputi-AT-libero.it> for writing it.
3399 3413
3400 3414 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
3401 3415 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3402 3416
3403 3417 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
3404 3418 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
3405 3419 <syver-en-AT-online.no> who both submitted patches for this problem.
3406 3420
3407 3421 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
3408 3422 global embedding to make sure that things don't overwrite user
3409 3423 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
3410 3424
3411 3425 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
3412 3426 compatibility. Thanks to Hayden Callow
3413 3427 <h.callow-AT-elec.canterbury.ac.nz>
3414 3428
3415 3429 2002-10-04 Fernando Perez <fperez@colorado.edu>
3416 3430
3417 3431 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
3418 3432 Gnuplot.File objects.
3419 3433
3420 3434 2002-07-23 Fernando Perez <fperez@colorado.edu>
3421 3435
3422 3436 * IPython/genutils.py (timing): Added timings() and timing() for
3423 3437 quick access to the most commonly needed data, the execution
3424 3438 times. Old timing() renamed to timings_out().
3425 3439
3426 3440 2002-07-18 Fernando Perez <fperez@colorado.edu>
3427 3441
3428 3442 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
3429 3443 bug with nested instances disrupting the parent's tab completion.
3430 3444
3431 3445 * IPython/iplib.py (all_completions): Added Alex Schmolck's
3432 3446 all_completions code to begin the emacs integration.
3433 3447
3434 3448 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
3435 3449 argument to allow titling individual arrays when plotting.
3436 3450
3437 3451 2002-07-15 Fernando Perez <fperez@colorado.edu>
3438 3452
3439 3453 * setup.py (make_shortcut): changed to retrieve the value of
3440 3454 'Program Files' directory from the registry (this value changes in
3441 3455 non-english versions of Windows). Thanks to Thomas Fanslau
3442 3456 <tfanslau-AT-gmx.de> for the report.
3443 3457
3444 3458 2002-07-10 Fernando Perez <fperez@colorado.edu>
3445 3459
3446 3460 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
3447 3461 a bug in pdb, which crashes if a line with only whitespace is
3448 3462 entered. Bug report submitted to sourceforge.
3449 3463
3450 3464 2002-07-09 Fernando Perez <fperez@colorado.edu>
3451 3465
3452 3466 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
3453 3467 reporting exceptions (it's a bug in inspect.py, I just set a
3454 3468 workaround).
3455 3469
3456 3470 2002-07-08 Fernando Perez <fperez@colorado.edu>
3457 3471
3458 3472 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
3459 3473 __IPYTHON__ in __builtins__ to show up in user_ns.
3460 3474
3461 3475 2002-07-03 Fernando Perez <fperez@colorado.edu>
3462 3476
3463 3477 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
3464 3478 name from @gp_set_instance to @gp_set_default.
3465 3479
3466 3480 * IPython/ipmaker.py (make_IPython): default editor value set to
3467 3481 '0' (a string), to match the rc file. Otherwise will crash when
3468 3482 .strip() is called on it.
3469 3483
3470 3484
3471 3485 2002-06-28 Fernando Perez <fperez@colorado.edu>
3472 3486
3473 3487 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
3474 3488 of files in current directory when a file is executed via
3475 3489 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
3476 3490
3477 3491 * setup.py (manfiles): fix for rpm builds, submitted by RA
3478 3492 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
3479 3493
3480 3494 * IPython/ipmaker.py (make_IPython): fixed lookup of default
3481 3495 editor when set to '0'. Problem was, '0' evaluates to True (it's a
3482 3496 string!). A. Schmolck caught this one.
3483 3497
3484 3498 2002-06-27 Fernando Perez <fperez@colorado.edu>
3485 3499
3486 3500 * IPython/ipmaker.py (make_IPython): fixed bug when running user
3487 3501 defined files at the cmd line. __name__ wasn't being set to
3488 3502 __main__.
3489 3503
3490 3504 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
3491 3505 regular lists and tuples besides Numeric arrays.
3492 3506
3493 3507 * IPython/Prompts.py (CachedOutput.__call__): Added output
3494 3508 supression for input ending with ';'. Similar to Mathematica and
3495 3509 Matlab. The _* vars and Out[] list are still updated, just like
3496 3510 Mathematica behaves.
3497 3511
3498 3512 2002-06-25 Fernando Perez <fperez@colorado.edu>
3499 3513
3500 3514 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
3501 3515 .ini extensions for profiels under Windows.
3502 3516
3503 3517 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
3504 3518 string form. Fix contributed by Alexander Schmolck
3505 3519 <a.schmolck-AT-gmx.net>
3506 3520
3507 3521 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
3508 3522 pre-configured Gnuplot instance.
3509 3523
3510 3524 2002-06-21 Fernando Perez <fperez@colorado.edu>
3511 3525
3512 3526 * IPython/numutils.py (exp_safe): new function, works around the
3513 3527 underflow problems in Numeric.
3514 3528 (log2): New fn. Safe log in base 2: returns exact integer answer
3515 3529 for exact integer powers of 2.
3516 3530
3517 3531 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
3518 3532 properly.
3519 3533
3520 3534 2002-06-20 Fernando Perez <fperez@colorado.edu>
3521 3535
3522 3536 * IPython/genutils.py (timing): new function like
3523 3537 Mathematica's. Similar to time_test, but returns more info.
3524 3538
3525 3539 2002-06-18 Fernando Perez <fperez@colorado.edu>
3526 3540
3527 3541 * IPython/Magic.py (Magic.magic_save): modified @save and @r
3528 3542 according to Mike Heeter's suggestions.
3529 3543
3530 3544 2002-06-16 Fernando Perez <fperez@colorado.edu>
3531 3545
3532 3546 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
3533 3547 system. GnuplotMagic is gone as a user-directory option. New files
3534 3548 make it easier to use all the gnuplot stuff both from external
3535 3549 programs as well as from IPython. Had to rewrite part of
3536 3550 hardcopy() b/c of a strange bug: often the ps files simply don't
3537 3551 get created, and require a repeat of the command (often several
3538 3552 times).
3539 3553
3540 3554 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
3541 3555 resolve output channel at call time, so that if sys.stderr has
3542 3556 been redirected by user this gets honored.
3543 3557
3544 3558 2002-06-13 Fernando Perez <fperez@colorado.edu>
3545 3559
3546 3560 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
3547 3561 IPShell. Kept a copy with the old names to avoid breaking people's
3548 3562 embedded code.
3549 3563
3550 3564 * IPython/ipython: simplified it to the bare minimum after
3551 3565 Holger's suggestions. Added info about how to use it in
3552 3566 PYTHONSTARTUP.
3553 3567
3554 3568 * IPython/Shell.py (IPythonShell): changed the options passing
3555 3569 from a string with funky %s replacements to a straight list. Maybe
3556 3570 a bit more typing, but it follows sys.argv conventions, so there's
3557 3571 less special-casing to remember.
3558 3572
3559 3573 2002-06-12 Fernando Perez <fperez@colorado.edu>
3560 3574
3561 3575 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
3562 3576 command. Thanks to a suggestion by Mike Heeter.
3563 3577 (Magic.magic_pfile): added behavior to look at filenames if given
3564 3578 arg is not a defined object.
3565 3579 (Magic.magic_save): New @save function to save code snippets. Also
3566 3580 a Mike Heeter idea.
3567 3581
3568 3582 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
3569 3583 plot() and replot(). Much more convenient now, especially for
3570 3584 interactive use.
3571 3585
3572 3586 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
3573 3587 filenames.
3574 3588
3575 3589 2002-06-02 Fernando Perez <fperez@colorado.edu>
3576 3590
3577 3591 * IPython/Struct.py (Struct.__init__): modified to admit
3578 3592 initialization via another struct.
3579 3593
3580 3594 * IPython/genutils.py (SystemExec.__init__): New stateful
3581 3595 interface to xsys and bq. Useful for writing system scripts.
3582 3596
3583 3597 2002-05-30 Fernando Perez <fperez@colorado.edu>
3584 3598
3585 3599 * MANIFEST.in: Changed docfile selection to exclude all the lyx
3586 3600 documents. This will make the user download smaller (it's getting
3587 3601 too big).
3588 3602
3589 3603 2002-05-29 Fernando Perez <fperez@colorado.edu>
3590 3604
3591 3605 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
3592 3606 fix problems with shelve and pickle. Seems to work, but I don't
3593 3607 know if corner cases break it. Thanks to Mike Heeter
3594 3608 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
3595 3609
3596 3610 2002-05-24 Fernando Perez <fperez@colorado.edu>
3597 3611
3598 3612 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
3599 3613 macros having broken.
3600 3614
3601 3615 2002-05-21 Fernando Perez <fperez@colorado.edu>
3602 3616
3603 3617 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3604 3618 introduced logging bug: all history before logging started was
3605 3619 being written one character per line! This came from the redesign
3606 3620 of the input history as a special list which slices to strings,
3607 3621 not to lists.
3608 3622
3609 3623 2002-05-20 Fernando Perez <fperez@colorado.edu>
3610 3624
3611 3625 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3612 3626 be an attribute of all classes in this module. The design of these
3613 3627 classes needs some serious overhauling.
3614 3628
3615 3629 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3616 3630 which was ignoring '_' in option names.
3617 3631
3618 3632 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3619 3633 'Verbose_novars' to 'Context' and made it the new default. It's a
3620 3634 bit more readable and also safer than verbose.
3621 3635
3622 3636 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3623 3637 triple-quoted strings.
3624 3638
3625 3639 * IPython/OInspect.py (__all__): new module exposing the object
3626 3640 introspection facilities. Now the corresponding magics are dummy
3627 3641 wrappers around this. Having this module will make it much easier
3628 3642 to put these functions into our modified pdb.
3629 3643 This new object inspector system uses the new colorizing module,
3630 3644 so source code and other things are nicely syntax highlighted.
3631 3645
3632 3646 2002-05-18 Fernando Perez <fperez@colorado.edu>
3633 3647
3634 3648 * IPython/ColorANSI.py: Split the coloring tools into a separate
3635 3649 module so I can use them in other code easier (they were part of
3636 3650 ultraTB).
3637 3651
3638 3652 2002-05-17 Fernando Perez <fperez@colorado.edu>
3639 3653
3640 3654 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3641 3655 fixed it to set the global 'g' also to the called instance, as
3642 3656 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3643 3657 user's 'g' variables).
3644 3658
3645 3659 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3646 3660 global variables (aliases to _ih,_oh) so that users which expect
3647 3661 In[5] or Out[7] to work aren't unpleasantly surprised.
3648 3662 (InputList.__getslice__): new class to allow executing slices of
3649 3663 input history directly. Very simple class, complements the use of
3650 3664 macros.
3651 3665
3652 3666 2002-05-16 Fernando Perez <fperez@colorado.edu>
3653 3667
3654 3668 * setup.py (docdirbase): make doc directory be just doc/IPython
3655 3669 without version numbers, it will reduce clutter for users.
3656 3670
3657 3671 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3658 3672 execfile call to prevent possible memory leak. See for details:
3659 3673 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3660 3674
3661 3675 2002-05-15 Fernando Perez <fperez@colorado.edu>
3662 3676
3663 3677 * IPython/Magic.py (Magic.magic_psource): made the object
3664 3678 introspection names be more standard: pdoc, pdef, pfile and
3665 3679 psource. They all print/page their output, and it makes
3666 3680 remembering them easier. Kept old names for compatibility as
3667 3681 aliases.
3668 3682
3669 3683 2002-05-14 Fernando Perez <fperez@colorado.edu>
3670 3684
3671 3685 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3672 3686 what the mouse problem was. The trick is to use gnuplot with temp
3673 3687 files and NOT with pipes (for data communication), because having
3674 3688 both pipes and the mouse on is bad news.
3675 3689
3676 3690 2002-05-13 Fernando Perez <fperez@colorado.edu>
3677 3691
3678 3692 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3679 3693 bug. Information would be reported about builtins even when
3680 3694 user-defined functions overrode them.
3681 3695
3682 3696 2002-05-11 Fernando Perez <fperez@colorado.edu>
3683 3697
3684 3698 * IPython/__init__.py (__all__): removed FlexCompleter from
3685 3699 __all__ so that things don't fail in platforms without readline.
3686 3700
3687 3701 2002-05-10 Fernando Perez <fperez@colorado.edu>
3688 3702
3689 3703 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3690 3704 it requires Numeric, effectively making Numeric a dependency for
3691 3705 IPython.
3692 3706
3693 3707 * Released 0.2.13
3694 3708
3695 3709 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3696 3710 profiler interface. Now all the major options from the profiler
3697 3711 module are directly supported in IPython, both for single
3698 3712 expressions (@prun) and for full programs (@run -p).
3699 3713
3700 3714 2002-05-09 Fernando Perez <fperez@colorado.edu>
3701 3715
3702 3716 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3703 3717 magic properly formatted for screen.
3704 3718
3705 3719 * setup.py (make_shortcut): Changed things to put pdf version in
3706 3720 doc/ instead of doc/manual (had to change lyxport a bit).
3707 3721
3708 3722 * IPython/Magic.py (Profile.string_stats): made profile runs go
3709 3723 through pager (they are long and a pager allows searching, saving,
3710 3724 etc.)
3711 3725
3712 3726 2002-05-08 Fernando Perez <fperez@colorado.edu>
3713 3727
3714 3728 * Released 0.2.12
3715 3729
3716 3730 2002-05-06 Fernando Perez <fperez@colorado.edu>
3717 3731
3718 3732 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3719 3733 introduced); 'hist n1 n2' was broken.
3720 3734 (Magic.magic_pdb): added optional on/off arguments to @pdb
3721 3735 (Magic.magic_run): added option -i to @run, which executes code in
3722 3736 the IPython namespace instead of a clean one. Also added @irun as
3723 3737 an alias to @run -i.
3724 3738
3725 3739 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3726 3740 fixed (it didn't really do anything, the namespaces were wrong).
3727 3741
3728 3742 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3729 3743
3730 3744 * IPython/__init__.py (__all__): Fixed package namespace, now
3731 3745 'import IPython' does give access to IPython.<all> as
3732 3746 expected. Also renamed __release__ to Release.
3733 3747
3734 3748 * IPython/Debugger.py (__license__): created new Pdb class which
3735 3749 functions like a drop-in for the normal pdb.Pdb but does NOT
3736 3750 import readline by default. This way it doesn't muck up IPython's
3737 3751 readline handling, and now tab-completion finally works in the
3738 3752 debugger -- sort of. It completes things globally visible, but the
3739 3753 completer doesn't track the stack as pdb walks it. That's a bit
3740 3754 tricky, and I'll have to implement it later.
3741 3755
3742 3756 2002-05-05 Fernando Perez <fperez@colorado.edu>
3743 3757
3744 3758 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3745 3759 magic docstrings when printed via ? (explicit \'s were being
3746 3760 printed).
3747 3761
3748 3762 * IPython/ipmaker.py (make_IPython): fixed namespace
3749 3763 identification bug. Now variables loaded via logs or command-line
3750 3764 files are recognized in the interactive namespace by @who.
3751 3765
3752 3766 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3753 3767 log replay system stemming from the string form of Structs.
3754 3768
3755 3769 * IPython/Magic.py (Macro.__init__): improved macros to properly
3756 3770 handle magic commands in them.
3757 3771 (Magic.magic_logstart): usernames are now expanded so 'logstart
3758 3772 ~/mylog' now works.
3759 3773
3760 3774 * IPython/iplib.py (complete): fixed bug where paths starting with
3761 3775 '/' would be completed as magic names.
3762 3776
3763 3777 2002-05-04 Fernando Perez <fperez@colorado.edu>
3764 3778
3765 3779 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3766 3780 allow running full programs under the profiler's control.
3767 3781
3768 3782 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3769 3783 mode to report exceptions verbosely but without formatting
3770 3784 variables. This addresses the issue of ipython 'freezing' (it's
3771 3785 not frozen, but caught in an expensive formatting loop) when huge
3772 3786 variables are in the context of an exception.
3773 3787 (VerboseTB.text): Added '--->' markers at line where exception was
3774 3788 triggered. Much clearer to read, especially in NoColor modes.
3775 3789
3776 3790 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3777 3791 implemented in reverse when changing to the new parse_options().
3778 3792
3779 3793 2002-05-03 Fernando Perez <fperez@colorado.edu>
3780 3794
3781 3795 * IPython/Magic.py (Magic.parse_options): new function so that
3782 3796 magics can parse options easier.
3783 3797 (Magic.magic_prun): new function similar to profile.run(),
3784 3798 suggested by Chris Hart.
3785 3799 (Magic.magic_cd): fixed behavior so that it only changes if
3786 3800 directory actually is in history.
3787 3801
3788 3802 * IPython/usage.py (__doc__): added information about potential
3789 3803 slowness of Verbose exception mode when there are huge data
3790 3804 structures to be formatted (thanks to Archie Paulson).
3791 3805
3792 3806 * IPython/ipmaker.py (make_IPython): Changed default logging
3793 3807 (when simply called with -log) to use curr_dir/ipython.log in
3794 3808 rotate mode. Fixed crash which was occuring with -log before
3795 3809 (thanks to Jim Boyle).
3796 3810
3797 3811 2002-05-01 Fernando Perez <fperez@colorado.edu>
3798 3812
3799 3813 * Released 0.2.11 for these fixes (mainly the ultraTB one which
3800 3814 was nasty -- though somewhat of a corner case).
3801 3815
3802 3816 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
3803 3817 text (was a bug).
3804 3818
3805 3819 2002-04-30 Fernando Perez <fperez@colorado.edu>
3806 3820
3807 3821 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3808 3822 a print after ^D or ^C from the user so that the In[] prompt
3809 3823 doesn't over-run the gnuplot one.
3810 3824
3811 3825 2002-04-29 Fernando Perez <fperez@colorado.edu>
3812 3826
3813 3827 * Released 0.2.10
3814 3828
3815 3829 * IPython/__release__.py (version): get date dynamically.
3816 3830
3817 3831 * Misc. documentation updates thanks to Arnd's comments. Also ran
3818 3832 a full spellcheck on the manual (hadn't been done in a while).
3819 3833
3820 3834 2002-04-27 Fernando Perez <fperez@colorado.edu>
3821 3835
3822 3836 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3823 3837 starting a log in mid-session would reset the input history list.
3824 3838
3825 3839 2002-04-26 Fernando Perez <fperez@colorado.edu>
3826 3840
3827 3841 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3828 3842 all files were being included in an update. Now anything in
3829 3843 UserConfig that matches [A-Za-z]*.py will go (this excludes
3830 3844 __init__.py)
3831 3845
3832 3846 2002-04-25 Fernando Perez <fperez@colorado.edu>
3833 3847
3834 3848 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3835 3849 to __builtins__ so that any form of embedded or imported code can
3836 3850 test for being inside IPython.
3837 3851
3838 3852 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3839 3853 changed to GnuplotMagic because it's now an importable module,
3840 3854 this makes the name follow that of the standard Gnuplot module.
3841 3855 GnuplotMagic can now be loaded at any time in mid-session.
3842 3856
3843 3857 2002-04-24 Fernando Perez <fperez@colorado.edu>
3844 3858
3845 3859 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3846 3860 the globals (IPython has its own namespace) and the
3847 3861 PhysicalQuantity stuff is much better anyway.
3848 3862
3849 3863 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3850 3864 embedding example to standard user directory for
3851 3865 distribution. Also put it in the manual.
3852 3866
3853 3867 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3854 3868 instance as first argument (so it doesn't rely on some obscure
3855 3869 hidden global).
3856 3870
3857 3871 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3858 3872 delimiters. While it prevents ().TAB from working, it allows
3859 3873 completions in open (... expressions. This is by far a more common
3860 3874 case.
3861 3875
3862 3876 2002-04-23 Fernando Perez <fperez@colorado.edu>
3863 3877
3864 3878 * IPython/Extensions/InterpreterPasteInput.py: new
3865 3879 syntax-processing module for pasting lines with >>> or ... at the
3866 3880 start.
3867 3881
3868 3882 * IPython/Extensions/PhysicalQ_Interactive.py
3869 3883 (PhysicalQuantityInteractive.__int__): fixed to work with either
3870 3884 Numeric or math.
3871 3885
3872 3886 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3873 3887 provided profiles. Now we have:
3874 3888 -math -> math module as * and cmath with its own namespace.
3875 3889 -numeric -> Numeric as *, plus gnuplot & grace
3876 3890 -physics -> same as before
3877 3891
3878 3892 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3879 3893 user-defined magics wouldn't be found by @magic if they were
3880 3894 defined as class methods. Also cleaned up the namespace search
3881 3895 logic and the string building (to use %s instead of many repeated
3882 3896 string adds).
3883 3897
3884 3898 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3885 3899 of user-defined magics to operate with class methods (cleaner, in
3886 3900 line with the gnuplot code).
3887 3901
3888 3902 2002-04-22 Fernando Perez <fperez@colorado.edu>
3889 3903
3890 3904 * setup.py: updated dependency list so that manual is updated when
3891 3905 all included files change.
3892 3906
3893 3907 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3894 3908 the delimiter removal option (the fix is ugly right now).
3895 3909
3896 3910 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3897 3911 all of the math profile (quicker loading, no conflict between
3898 3912 g-9.8 and g-gnuplot).
3899 3913
3900 3914 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3901 3915 name of post-mortem files to IPython_crash_report.txt.
3902 3916
3903 3917 * Cleanup/update of the docs. Added all the new readline info and
3904 3918 formatted all lists as 'real lists'.
3905 3919
3906 3920 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3907 3921 tab-completion options, since the full readline parse_and_bind is
3908 3922 now accessible.
3909 3923
3910 3924 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3911 3925 handling of readline options. Now users can specify any string to
3912 3926 be passed to parse_and_bind(), as well as the delimiters to be
3913 3927 removed.
3914 3928 (InteractiveShell.__init__): Added __name__ to the global
3915 3929 namespace so that things like Itpl which rely on its existence
3916 3930 don't crash.
3917 3931 (InteractiveShell._prefilter): Defined the default with a _ so
3918 3932 that prefilter() is easier to override, while the default one
3919 3933 remains available.
3920 3934
3921 3935 2002-04-18 Fernando Perez <fperez@colorado.edu>
3922 3936
3923 3937 * Added information about pdb in the docs.
3924 3938
3925 3939 2002-04-17 Fernando Perez <fperez@colorado.edu>
3926 3940
3927 3941 * IPython/ipmaker.py (make_IPython): added rc_override option to
3928 3942 allow passing config options at creation time which may override
3929 3943 anything set in the config files or command line. This is
3930 3944 particularly useful for configuring embedded instances.
3931 3945
3932 3946 2002-04-15 Fernando Perez <fperez@colorado.edu>
3933 3947
3934 3948 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3935 3949 crash embedded instances because of the input cache falling out of
3936 3950 sync with the output counter.
3937 3951
3938 3952 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3939 3953 mode which calls pdb after an uncaught exception in IPython itself.
3940 3954
3941 3955 2002-04-14 Fernando Perez <fperez@colorado.edu>
3942 3956
3943 3957 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3944 3958 readline, fix it back after each call.
3945 3959
3946 3960 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3947 3961 method to force all access via __call__(), which guarantees that
3948 3962 traceback references are properly deleted.
3949 3963
3950 3964 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3951 3965 improve printing when pprint is in use.
3952 3966
3953 3967 2002-04-13 Fernando Perez <fperez@colorado.edu>
3954 3968
3955 3969 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3956 3970 exceptions aren't caught anymore. If the user triggers one, he
3957 3971 should know why he's doing it and it should go all the way up,
3958 3972 just like any other exception. So now @abort will fully kill the
3959 3973 embedded interpreter and the embedding code (unless that happens
3960 3974 to catch SystemExit).
3961 3975
3962 3976 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3963 3977 and a debugger() method to invoke the interactive pdb debugger
3964 3978 after printing exception information. Also added the corresponding
3965 3979 -pdb option and @pdb magic to control this feature, and updated
3966 3980 the docs. After a suggestion from Christopher Hart
3967 3981 (hart-AT-caltech.edu).
3968 3982
3969 3983 2002-04-12 Fernando Perez <fperez@colorado.edu>
3970 3984
3971 3985 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3972 3986 the exception handlers defined by the user (not the CrashHandler)
3973 3987 so that user exceptions don't trigger an ipython bug report.
3974 3988
3975 3989 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3976 3990 configurable (it should have always been so).
3977 3991
3978 3992 2002-03-26 Fernando Perez <fperez@colorado.edu>
3979 3993
3980 3994 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3981 3995 and there to fix embedding namespace issues. This should all be
3982 3996 done in a more elegant way.
3983 3997
3984 3998 2002-03-25 Fernando Perez <fperez@colorado.edu>
3985 3999
3986 4000 * IPython/genutils.py (get_home_dir): Try to make it work under
3987 4001 win9x also.
3988 4002
3989 4003 2002-03-20 Fernando Perez <fperez@colorado.edu>
3990 4004
3991 4005 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3992 4006 sys.displayhook untouched upon __init__.
3993 4007
3994 4008 2002-03-19 Fernando Perez <fperez@colorado.edu>
3995 4009
3996 4010 * Released 0.2.9 (for embedding bug, basically).
3997 4011
3998 4012 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3999 4013 exceptions so that enclosing shell's state can be restored.
4000 4014
4001 4015 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4002 4016 naming conventions in the .ipython/ dir.
4003 4017
4004 4018 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4005 4019 from delimiters list so filenames with - in them get expanded.
4006 4020
4007 4021 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4008 4022 sys.displayhook not being properly restored after an embedded call.
4009 4023
4010 4024 2002-03-18 Fernando Perez <fperez@colorado.edu>
4011 4025
4012 4026 * Released 0.2.8
4013 4027
4014 4028 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4015 4029 some files weren't being included in a -upgrade.
4016 4030 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4017 4031 on' so that the first tab completes.
4018 4032 (InteractiveShell.handle_magic): fixed bug with spaces around
4019 4033 quotes breaking many magic commands.
4020 4034
4021 4035 * setup.py: added note about ignoring the syntax error messages at
4022 4036 installation.
4023 4037
4024 4038 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4025 4039 streamlining the gnuplot interface, now there's only one magic @gp.
4026 4040
4027 4041 2002-03-17 Fernando Perez <fperez@colorado.edu>
4028 4042
4029 4043 * IPython/UserConfig/magic_gnuplot.py: new name for the
4030 4044 example-magic_pm.py file. Much enhanced system, now with a shell
4031 4045 for communicating directly with gnuplot, one command at a time.
4032 4046
4033 4047 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4034 4048 setting __name__=='__main__'.
4035 4049
4036 4050 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4037 4051 mini-shell for accessing gnuplot from inside ipython. Should
4038 4052 extend it later for grace access too. Inspired by Arnd's
4039 4053 suggestion.
4040 4054
4041 4055 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4042 4056 calling magic functions with () in their arguments. Thanks to Arnd
4043 4057 Baecker for pointing this to me.
4044 4058
4045 4059 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4046 4060 infinitely for integer or complex arrays (only worked with floats).
4047 4061
4048 4062 2002-03-16 Fernando Perez <fperez@colorado.edu>
4049 4063
4050 4064 * setup.py: Merged setup and setup_windows into a single script
4051 4065 which properly handles things for windows users.
4052 4066
4053 4067 2002-03-15 Fernando Perez <fperez@colorado.edu>
4054 4068
4055 4069 * Big change to the manual: now the magics are all automatically
4056 4070 documented. This information is generated from their docstrings
4057 4071 and put in a latex file included by the manual lyx file. This way
4058 4072 we get always up to date information for the magics. The manual
4059 4073 now also has proper version information, also auto-synced.
4060 4074
4061 4075 For this to work, an undocumented --magic_docstrings option was added.
4062 4076
4063 4077 2002-03-13 Fernando Perez <fperez@colorado.edu>
4064 4078
4065 4079 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4066 4080 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4067 4081
4068 4082 2002-03-12 Fernando Perez <fperez@colorado.edu>
4069 4083
4070 4084 * IPython/ultraTB.py (TermColors): changed color escapes again to
4071 4085 fix the (old, reintroduced) line-wrapping bug. Basically, if
4072 4086 \001..\002 aren't given in the color escapes, lines get wrapped
4073 4087 weirdly. But giving those screws up old xterms and emacs terms. So
4074 4088 I added some logic for emacs terms to be ok, but I can't identify old
4075 4089 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4076 4090
4077 4091 2002-03-10 Fernando Perez <fperez@colorado.edu>
4078 4092
4079 4093 * IPython/usage.py (__doc__): Various documentation cleanups and
4080 4094 updates, both in usage docstrings and in the manual.
4081 4095
4082 4096 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4083 4097 handling of caching. Set minimum acceptabe value for having a
4084 4098 cache at 20 values.
4085 4099
4086 4100 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4087 4101 install_first_time function to a method, renamed it and added an
4088 4102 'upgrade' mode. Now people can update their config directory with
4089 4103 a simple command line switch (-upgrade, also new).
4090 4104
4091 4105 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4092 4106 @file (convenient for automagic users under Python >= 2.2).
4093 4107 Removed @files (it seemed more like a plural than an abbrev. of
4094 4108 'file show').
4095 4109
4096 4110 * IPython/iplib.py (install_first_time): Fixed crash if there were
4097 4111 backup files ('~') in .ipython/ install directory.
4098 4112
4099 4113 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4100 4114 system. Things look fine, but these changes are fairly
4101 4115 intrusive. Test them for a few days.
4102 4116
4103 4117 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4104 4118 the prompts system. Now all in/out prompt strings are user
4105 4119 controllable. This is particularly useful for embedding, as one
4106 4120 can tag embedded instances with particular prompts.
4107 4121
4108 4122 Also removed global use of sys.ps1/2, which now allows nested
4109 4123 embeddings without any problems. Added command-line options for
4110 4124 the prompt strings.
4111 4125
4112 4126 2002-03-08 Fernando Perez <fperez@colorado.edu>
4113 4127
4114 4128 * IPython/UserConfig/example-embed-short.py (ipshell): added
4115 4129 example file with the bare minimum code for embedding.
4116 4130
4117 4131 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4118 4132 functionality for the embeddable shell to be activated/deactivated
4119 4133 either globally or at each call.
4120 4134
4121 4135 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4122 4136 rewriting the prompt with '--->' for auto-inputs with proper
4123 4137 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4124 4138 this is handled by the prompts class itself, as it should.
4125 4139
4126 4140 2002-03-05 Fernando Perez <fperez@colorado.edu>
4127 4141
4128 4142 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4129 4143 @logstart to avoid name clashes with the math log function.
4130 4144
4131 4145 * Big updates to X/Emacs section of the manual.
4132 4146
4133 4147 * Removed ipython_emacs. Milan explained to me how to pass
4134 4148 arguments to ipython through Emacs. Some day I'm going to end up
4135 4149 learning some lisp...
4136 4150
4137 4151 2002-03-04 Fernando Perez <fperez@colorado.edu>
4138 4152
4139 4153 * IPython/ipython_emacs: Created script to be used as the
4140 4154 py-python-command Emacs variable so we can pass IPython
4141 4155 parameters. I can't figure out how to tell Emacs directly to pass
4142 4156 parameters to IPython, so a dummy shell script will do it.
4143 4157
4144 4158 Other enhancements made for things to work better under Emacs'
4145 4159 various types of terminals. Many thanks to Milan Zamazal
4146 4160 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4147 4161
4148 4162 2002-03-01 Fernando Perez <fperez@colorado.edu>
4149 4163
4150 4164 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4151 4165 that loading of readline is now optional. This gives better
4152 4166 control to emacs users.
4153 4167
4154 4168 * IPython/ultraTB.py (__date__): Modified color escape sequences
4155 4169 and now things work fine under xterm and in Emacs' term buffers
4156 4170 (though not shell ones). Well, in emacs you get colors, but all
4157 4171 seem to be 'light' colors (no difference between dark and light
4158 4172 ones). But the garbage chars are gone, and also in xterms. It
4159 4173 seems that now I'm using 'cleaner' ansi sequences.
4160 4174
4161 4175 2002-02-21 Fernando Perez <fperez@colorado.edu>
4162 4176
4163 4177 * Released 0.2.7 (mainly to publish the scoping fix).
4164 4178
4165 4179 * IPython/Logger.py (Logger.logstate): added. A corresponding
4166 4180 @logstate magic was created.
4167 4181
4168 4182 * IPython/Magic.py: fixed nested scoping problem under Python
4169 4183 2.1.x (automagic wasn't working).
4170 4184
4171 4185 2002-02-20 Fernando Perez <fperez@colorado.edu>
4172 4186
4173 4187 * Released 0.2.6.
4174 4188
4175 4189 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4176 4190 option so that logs can come out without any headers at all.
4177 4191
4178 4192 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4179 4193 SciPy.
4180 4194
4181 4195 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4182 4196 that embedded IPython calls don't require vars() to be explicitly
4183 4197 passed. Now they are extracted from the caller's frame (code
4184 4198 snatched from Eric Jones' weave). Added better documentation to
4185 4199 the section on embedding and the example file.
4186 4200
4187 4201 * IPython/genutils.py (page): Changed so that under emacs, it just
4188 4202 prints the string. You can then page up and down in the emacs
4189 4203 buffer itself. This is how the builtin help() works.
4190 4204
4191 4205 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4192 4206 macro scoping: macros need to be executed in the user's namespace
4193 4207 to work as if they had been typed by the user.
4194 4208
4195 4209 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4196 4210 execute automatically (no need to type 'exec...'). They then
4197 4211 behave like 'true macros'. The printing system was also modified
4198 4212 for this to work.
4199 4213
4200 4214 2002-02-19 Fernando Perez <fperez@colorado.edu>
4201 4215
4202 4216 * IPython/genutils.py (page_file): new function for paging files
4203 4217 in an OS-independent way. Also necessary for file viewing to work
4204 4218 well inside Emacs buffers.
4205 4219 (page): Added checks for being in an emacs buffer.
4206 4220 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4207 4221 same bug in iplib.
4208 4222
4209 4223 2002-02-18 Fernando Perez <fperez@colorado.edu>
4210 4224
4211 4225 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4212 4226 of readline so that IPython can work inside an Emacs buffer.
4213 4227
4214 4228 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4215 4229 method signatures (they weren't really bugs, but it looks cleaner
4216 4230 and keeps PyChecker happy).
4217 4231
4218 4232 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4219 4233 for implementing various user-defined hooks. Currently only
4220 4234 display is done.
4221 4235
4222 4236 * IPython/Prompts.py (CachedOutput._display): changed display
4223 4237 functions so that they can be dynamically changed by users easily.
4224 4238
4225 4239 * IPython/Extensions/numeric_formats.py (num_display): added an
4226 4240 extension for printing NumPy arrays in flexible manners. It
4227 4241 doesn't do anything yet, but all the structure is in
4228 4242 place. Ultimately the plan is to implement output format control
4229 4243 like in Octave.
4230 4244
4231 4245 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4232 4246 methods are found at run-time by all the automatic machinery.
4233 4247
4234 4248 2002-02-17 Fernando Perez <fperez@colorado.edu>
4235 4249
4236 4250 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4237 4251 whole file a little.
4238 4252
4239 4253 * ToDo: closed this document. Now there's a new_design.lyx
4240 4254 document for all new ideas. Added making a pdf of it for the
4241 4255 end-user distro.
4242 4256
4243 4257 * IPython/Logger.py (Logger.switch_log): Created this to replace
4244 4258 logon() and logoff(). It also fixes a nasty crash reported by
4245 4259 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4246 4260
4247 4261 * IPython/iplib.py (complete): got auto-completion to work with
4248 4262 automagic (I had wanted this for a long time).
4249 4263
4250 4264 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4251 4265 to @file, since file() is now a builtin and clashes with automagic
4252 4266 for @file.
4253 4267
4254 4268 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4255 4269 of this was previously in iplib, which had grown to more than 2000
4256 4270 lines, way too long. No new functionality, but it makes managing
4257 4271 the code a bit easier.
4258 4272
4259 4273 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4260 4274 information to crash reports.
4261 4275
4262 4276 2002-02-12 Fernando Perez <fperez@colorado.edu>
4263 4277
4264 4278 * Released 0.2.5.
4265 4279
4266 4280 2002-02-11 Fernando Perez <fperez@colorado.edu>
4267 4281
4268 4282 * Wrote a relatively complete Windows installer. It puts
4269 4283 everything in place, creates Start Menu entries and fixes the
4270 4284 color issues. Nothing fancy, but it works.
4271 4285
4272 4286 2002-02-10 Fernando Perez <fperez@colorado.edu>
4273 4287
4274 4288 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4275 4289 os.path.expanduser() call so that we can type @run ~/myfile.py and
4276 4290 have thigs work as expected.
4277 4291
4278 4292 * IPython/genutils.py (page): fixed exception handling so things
4279 4293 work both in Unix and Windows correctly. Quitting a pager triggers
4280 4294 an IOError/broken pipe in Unix, and in windows not finding a pager
4281 4295 is also an IOError, so I had to actually look at the return value
4282 4296 of the exception, not just the exception itself. Should be ok now.
4283 4297
4284 4298 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4285 4299 modified to allow case-insensitive color scheme changes.
4286 4300
4287 4301 2002-02-09 Fernando Perez <fperez@colorado.edu>
4288 4302
4289 4303 * IPython/genutils.py (native_line_ends): new function to leave
4290 4304 user config files with os-native line-endings.
4291 4305
4292 4306 * README and manual updates.
4293 4307
4294 4308 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4295 4309 instead of StringType to catch Unicode strings.
4296 4310
4297 4311 * IPython/genutils.py (filefind): fixed bug for paths with
4298 4312 embedded spaces (very common in Windows).
4299 4313
4300 4314 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4301 4315 files under Windows, so that they get automatically associated
4302 4316 with a text editor. Windows makes it a pain to handle
4303 4317 extension-less files.
4304 4318
4305 4319 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4306 4320 warning about readline only occur for Posix. In Windows there's no
4307 4321 way to get readline, so why bother with the warning.
4308 4322
4309 4323 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4310 4324 for __str__ instead of dir(self), since dir() changed in 2.2.
4311 4325
4312 4326 * Ported to Windows! Tested on XP, I suspect it should work fine
4313 4327 on NT/2000, but I don't think it will work on 98 et al. That
4314 4328 series of Windows is such a piece of junk anyway that I won't try
4315 4329 porting it there. The XP port was straightforward, showed a few
4316 4330 bugs here and there (fixed all), in particular some string
4317 4331 handling stuff which required considering Unicode strings (which
4318 4332 Windows uses). This is good, but hasn't been too tested :) No
4319 4333 fancy installer yet, I'll put a note in the manual so people at
4320 4334 least make manually a shortcut.
4321 4335
4322 4336 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4323 4337 into a single one, "colors". This now controls both prompt and
4324 4338 exception color schemes, and can be changed both at startup
4325 4339 (either via command-line switches or via ipythonrc files) and at
4326 4340 runtime, with @colors.
4327 4341 (Magic.magic_run): renamed @prun to @run and removed the old
4328 4342 @run. The two were too similar to warrant keeping both.
4329 4343
4330 4344 2002-02-03 Fernando Perez <fperez@colorado.edu>
4331 4345
4332 4346 * IPython/iplib.py (install_first_time): Added comment on how to
4333 4347 configure the color options for first-time users. Put a <return>
4334 4348 request at the end so that small-terminal users get a chance to
4335 4349 read the startup info.
4336 4350
4337 4351 2002-01-23 Fernando Perez <fperez@colorado.edu>
4338 4352
4339 4353 * IPython/iplib.py (CachedOutput.update): Changed output memory
4340 4354 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4341 4355 input history we still use _i. Did this b/c these variable are
4342 4356 very commonly used in interactive work, so the less we need to
4343 4357 type the better off we are.
4344 4358 (Magic.magic_prun): updated @prun to better handle the namespaces
4345 4359 the file will run in, including a fix for __name__ not being set
4346 4360 before.
4347 4361
4348 4362 2002-01-20 Fernando Perez <fperez@colorado.edu>
4349 4363
4350 4364 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4351 4365 extra garbage for Python 2.2. Need to look more carefully into
4352 4366 this later.
4353 4367
4354 4368 2002-01-19 Fernando Perez <fperez@colorado.edu>
4355 4369
4356 4370 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
4357 4371 display SyntaxError exceptions properly formatted when they occur
4358 4372 (they can be triggered by imported code).
4359 4373
4360 4374 2002-01-18 Fernando Perez <fperez@colorado.edu>
4361 4375
4362 4376 * IPython/iplib.py (InteractiveShell.safe_execfile): now
4363 4377 SyntaxError exceptions are reported nicely formatted, instead of
4364 4378 spitting out only offset information as before.
4365 4379 (Magic.magic_prun): Added the @prun function for executing
4366 4380 programs with command line args inside IPython.
4367 4381
4368 4382 2002-01-16 Fernando Perez <fperez@colorado.edu>
4369 4383
4370 4384 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
4371 4385 to *not* include the last item given in a range. This brings their
4372 4386 behavior in line with Python's slicing:
4373 4387 a[n1:n2] -> a[n1]...a[n2-1]
4374 4388 It may be a bit less convenient, but I prefer to stick to Python's
4375 4389 conventions *everywhere*, so users never have to wonder.
4376 4390 (Magic.magic_macro): Added @macro function to ease the creation of
4377 4391 macros.
4378 4392
4379 4393 2002-01-05 Fernando Perez <fperez@colorado.edu>
4380 4394
4381 4395 * Released 0.2.4.
4382 4396
4383 4397 * IPython/iplib.py (Magic.magic_pdef):
4384 4398 (InteractiveShell.safe_execfile): report magic lines and error
4385 4399 lines without line numbers so one can easily copy/paste them for
4386 4400 re-execution.
4387 4401
4388 4402 * Updated manual with recent changes.
4389 4403
4390 4404 * IPython/iplib.py (Magic.magic_oinfo): added constructor
4391 4405 docstring printing when class? is called. Very handy for knowing
4392 4406 how to create class instances (as long as __init__ is well
4393 4407 documented, of course :)
4394 4408 (Magic.magic_doc): print both class and constructor docstrings.
4395 4409 (Magic.magic_pdef): give constructor info if passed a class and
4396 4410 __call__ info for callable object instances.
4397 4411
4398 4412 2002-01-04 Fernando Perez <fperez@colorado.edu>
4399 4413
4400 4414 * Made deep_reload() off by default. It doesn't always work
4401 4415 exactly as intended, so it's probably safer to have it off. It's
4402 4416 still available as dreload() anyway, so nothing is lost.
4403 4417
4404 4418 2002-01-02 Fernando Perez <fperez@colorado.edu>
4405 4419
4406 4420 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
4407 4421 so I wanted an updated release).
4408 4422
4409 4423 2001-12-27 Fernando Perez <fperez@colorado.edu>
4410 4424
4411 4425 * IPython/iplib.py (InteractiveShell.interact): Added the original
4412 4426 code from 'code.py' for this module in order to change the
4413 4427 handling of a KeyboardInterrupt. This was necessary b/c otherwise
4414 4428 the history cache would break when the user hit Ctrl-C, and
4415 4429 interact() offers no way to add any hooks to it.
4416 4430
4417 4431 2001-12-23 Fernando Perez <fperez@colorado.edu>
4418 4432
4419 4433 * setup.py: added check for 'MANIFEST' before trying to remove
4420 4434 it. Thanks to Sean Reifschneider.
4421 4435
4422 4436 2001-12-22 Fernando Perez <fperez@colorado.edu>
4423 4437
4424 4438 * Released 0.2.2.
4425 4439
4426 4440 * Finished (reasonably) writing the manual. Later will add the
4427 4441 python-standard navigation stylesheets, but for the time being
4428 4442 it's fairly complete. Distribution will include html and pdf
4429 4443 versions.
4430 4444
4431 4445 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
4432 4446 (MayaVi author).
4433 4447
4434 4448 2001-12-21 Fernando Perez <fperez@colorado.edu>
4435 4449
4436 4450 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
4437 4451 good public release, I think (with the manual and the distutils
4438 4452 installer). The manual can use some work, but that can go
4439 4453 slowly. Otherwise I think it's quite nice for end users. Next
4440 4454 summer, rewrite the guts of it...
4441 4455
4442 4456 * Changed format of ipythonrc files to use whitespace as the
4443 4457 separator instead of an explicit '='. Cleaner.
4444 4458
4445 4459 2001-12-20 Fernando Perez <fperez@colorado.edu>
4446 4460
4447 4461 * Started a manual in LyX. For now it's just a quick merge of the
4448 4462 various internal docstrings and READMEs. Later it may grow into a
4449 4463 nice, full-blown manual.
4450 4464
4451 4465 * Set up a distutils based installer. Installation should now be
4452 4466 trivially simple for end-users.
4453 4467
4454 4468 2001-12-11 Fernando Perez <fperez@colorado.edu>
4455 4469
4456 4470 * Released 0.2.0. First public release, announced it at
4457 4471 comp.lang.python. From now on, just bugfixes...
4458 4472
4459 4473 * Went through all the files, set copyright/license notices and
4460 4474 cleaned up things. Ready for release.
4461 4475
4462 4476 2001-12-10 Fernando Perez <fperez@colorado.edu>
4463 4477
4464 4478 * Changed the first-time installer not to use tarfiles. It's more
4465 4479 robust now and less unix-dependent. Also makes it easier for
4466 4480 people to later upgrade versions.
4467 4481
4468 4482 * Changed @exit to @abort to reflect the fact that it's pretty
4469 4483 brutal (a sys.exit()). The difference between @abort and Ctrl-D
4470 4484 becomes significant only when IPyhton is embedded: in that case,
4471 4485 C-D closes IPython only, but @abort kills the enclosing program
4472 4486 too (unless it had called IPython inside a try catching
4473 4487 SystemExit).
4474 4488
4475 4489 * Created Shell module which exposes the actuall IPython Shell
4476 4490 classes, currently the normal and the embeddable one. This at
4477 4491 least offers a stable interface we won't need to change when
4478 4492 (later) the internals are rewritten. That rewrite will be confined
4479 4493 to iplib and ipmaker, but the Shell interface should remain as is.
4480 4494
4481 4495 * Added embed module which offers an embeddable IPShell object,
4482 4496 useful to fire up IPython *inside* a running program. Great for
4483 4497 debugging or dynamical data analysis.
4484 4498
4485 4499 2001-12-08 Fernando Perez <fperez@colorado.edu>
4486 4500
4487 4501 * Fixed small bug preventing seeing info from methods of defined
4488 4502 objects (incorrect namespace in _ofind()).
4489 4503
4490 4504 * Documentation cleanup. Moved the main usage docstrings to a
4491 4505 separate file, usage.py (cleaner to maintain, and hopefully in the
4492 4506 future some perlpod-like way of producing interactive, man and
4493 4507 html docs out of it will be found).
4494 4508
4495 4509 * Added @profile to see your profile at any time.
4496 4510
4497 4511 * Added @p as an alias for 'print'. It's especially convenient if
4498 4512 using automagic ('p x' prints x).
4499 4513
4500 4514 * Small cleanups and fixes after a pychecker run.
4501 4515
4502 4516 * Changed the @cd command to handle @cd - and @cd -<n> for
4503 4517 visiting any directory in _dh.
4504 4518
4505 4519 * Introduced _dh, a history of visited directories. @dhist prints
4506 4520 it out with numbers.
4507 4521
4508 4522 2001-12-07 Fernando Perez <fperez@colorado.edu>
4509 4523
4510 4524 * Released 0.1.22
4511 4525
4512 4526 * Made initialization a bit more robust against invalid color
4513 4527 options in user input (exit, not traceback-crash).
4514 4528
4515 4529 * Changed the bug crash reporter to write the report only in the
4516 4530 user's .ipython directory. That way IPython won't litter people's
4517 4531 hard disks with crash files all over the place. Also print on
4518 4532 screen the necessary mail command.
4519 4533
4520 4534 * With the new ultraTB, implemented LightBG color scheme for light
4521 4535 background terminals. A lot of people like white backgrounds, so I
4522 4536 guess we should at least give them something readable.
4523 4537
4524 4538 2001-12-06 Fernando Perez <fperez@colorado.edu>
4525 4539
4526 4540 * Modified the structure of ultraTB. Now there's a proper class
4527 4541 for tables of color schemes which allow adding schemes easily and
4528 4542 switching the active scheme without creating a new instance every
4529 4543 time (which was ridiculous). The syntax for creating new schemes
4530 4544 is also cleaner. I think ultraTB is finally done, with a clean
4531 4545 class structure. Names are also much cleaner (now there's proper
4532 4546 color tables, no need for every variable to also have 'color' in
4533 4547 its name).
4534 4548
4535 4549 * Broke down genutils into separate files. Now genutils only
4536 4550 contains utility functions, and classes have been moved to their
4537 4551 own files (they had enough independent functionality to warrant
4538 4552 it): ConfigLoader, OutputTrap, Struct.
4539 4553
4540 4554 2001-12-05 Fernando Perez <fperez@colorado.edu>
4541 4555
4542 4556 * IPython turns 21! Released version 0.1.21, as a candidate for
4543 4557 public consumption. If all goes well, release in a few days.
4544 4558
4545 4559 * Fixed path bug (files in Extensions/ directory wouldn't be found
4546 4560 unless IPython/ was explicitly in sys.path).
4547 4561
4548 4562 * Extended the FlexCompleter class as MagicCompleter to allow
4549 4563 completion of @-starting lines.
4550 4564
4551 4565 * Created __release__.py file as a central repository for release
4552 4566 info that other files can read from.
4553 4567
4554 4568 * Fixed small bug in logging: when logging was turned on in
4555 4569 mid-session, old lines with special meanings (!@?) were being
4556 4570 logged without the prepended comment, which is necessary since
4557 4571 they are not truly valid python syntax. This should make session
4558 4572 restores produce less errors.
4559 4573
4560 4574 * The namespace cleanup forced me to make a FlexCompleter class
4561 4575 which is nothing but a ripoff of rlcompleter, but with selectable
4562 4576 namespace (rlcompleter only works in __main__.__dict__). I'll try
4563 4577 to submit a note to the authors to see if this change can be
4564 4578 incorporated in future rlcompleter releases (Dec.6: done)
4565 4579
4566 4580 * More fixes to namespace handling. It was a mess! Now all
4567 4581 explicit references to __main__.__dict__ are gone (except when
4568 4582 really needed) and everything is handled through the namespace
4569 4583 dicts in the IPython instance. We seem to be getting somewhere
4570 4584 with this, finally...
4571 4585
4572 4586 * Small documentation updates.
4573 4587
4574 4588 * Created the Extensions directory under IPython (with an
4575 4589 __init__.py). Put the PhysicalQ stuff there. This directory should
4576 4590 be used for all special-purpose extensions.
4577 4591
4578 4592 * File renaming:
4579 4593 ipythonlib --> ipmaker
4580 4594 ipplib --> iplib
4581 4595 This makes a bit more sense in terms of what these files actually do.
4582 4596
4583 4597 * Moved all the classes and functions in ipythonlib to ipplib, so
4584 4598 now ipythonlib only has make_IPython(). This will ease up its
4585 4599 splitting in smaller functional chunks later.
4586 4600
4587 4601 * Cleaned up (done, I think) output of @whos. Better column
4588 4602 formatting, and now shows str(var) for as much as it can, which is
4589 4603 typically what one gets with a 'print var'.
4590 4604
4591 4605 2001-12-04 Fernando Perez <fperez@colorado.edu>
4592 4606
4593 4607 * Fixed namespace problems. Now builtin/IPyhton/user names get
4594 4608 properly reported in their namespace. Internal namespace handling
4595 4609 is finally getting decent (not perfect yet, but much better than
4596 4610 the ad-hoc mess we had).
4597 4611
4598 4612 * Removed -exit option. If people just want to run a python
4599 4613 script, that's what the normal interpreter is for. Less
4600 4614 unnecessary options, less chances for bugs.
4601 4615
4602 4616 * Added a crash handler which generates a complete post-mortem if
4603 4617 IPython crashes. This will help a lot in tracking bugs down the
4604 4618 road.
4605 4619
4606 4620 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4607 4621 which were boud to functions being reassigned would bypass the
4608 4622 logger, breaking the sync of _il with the prompt counter. This
4609 4623 would then crash IPython later when a new line was logged.
4610 4624
4611 4625 2001-12-02 Fernando Perez <fperez@colorado.edu>
4612 4626
4613 4627 * Made IPython a package. This means people don't have to clutter
4614 4628 their sys.path with yet another directory. Changed the INSTALL
4615 4629 file accordingly.
4616 4630
4617 4631 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4618 4632 sorts its output (so @who shows it sorted) and @whos formats the
4619 4633 table according to the width of the first column. Nicer, easier to
4620 4634 read. Todo: write a generic table_format() which takes a list of
4621 4635 lists and prints it nicely formatted, with optional row/column
4622 4636 separators and proper padding and justification.
4623 4637
4624 4638 * Released 0.1.20
4625 4639
4626 4640 * Fixed bug in @log which would reverse the inputcache list (a
4627 4641 copy operation was missing).
4628 4642
4629 4643 * Code cleanup. @config was changed to use page(). Better, since
4630 4644 its output is always quite long.
4631 4645
4632 4646 * Itpl is back as a dependency. I was having too many problems
4633 4647 getting the parametric aliases to work reliably, and it's just
4634 4648 easier to code weird string operations with it than playing %()s
4635 4649 games. It's only ~6k, so I don't think it's too big a deal.
4636 4650
4637 4651 * Found (and fixed) a very nasty bug with history. !lines weren't
4638 4652 getting cached, and the out of sync caches would crash
4639 4653 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4640 4654 division of labor a bit better. Bug fixed, cleaner structure.
4641 4655
4642 4656 2001-12-01 Fernando Perez <fperez@colorado.edu>
4643 4657
4644 4658 * Released 0.1.19
4645 4659
4646 4660 * Added option -n to @hist to prevent line number printing. Much
4647 4661 easier to copy/paste code this way.
4648 4662
4649 4663 * Created global _il to hold the input list. Allows easy
4650 4664 re-execution of blocks of code by slicing it (inspired by Janko's
4651 4665 comment on 'macros').
4652 4666
4653 4667 * Small fixes and doc updates.
4654 4668
4655 4669 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4656 4670 much too fragile with automagic. Handles properly multi-line
4657 4671 statements and takes parameters.
4658 4672
4659 4673 2001-11-30 Fernando Perez <fperez@colorado.edu>
4660 4674
4661 4675 * Version 0.1.18 released.
4662 4676
4663 4677 * Fixed nasty namespace bug in initial module imports.
4664 4678
4665 4679 * Added copyright/license notes to all code files (except
4666 4680 DPyGetOpt). For the time being, LGPL. That could change.
4667 4681
4668 4682 * Rewrote a much nicer README, updated INSTALL, cleaned up
4669 4683 ipythonrc-* samples.
4670 4684
4671 4685 * Overall code/documentation cleanup. Basically ready for
4672 4686 release. Only remaining thing: licence decision (LGPL?).
4673 4687
4674 4688 * Converted load_config to a class, ConfigLoader. Now recursion
4675 4689 control is better organized. Doesn't include the same file twice.
4676 4690
4677 4691 2001-11-29 Fernando Perez <fperez@colorado.edu>
4678 4692
4679 4693 * Got input history working. Changed output history variables from
4680 4694 _p to _o so that _i is for input and _o for output. Just cleaner
4681 4695 convention.
4682 4696
4683 4697 * Implemented parametric aliases. This pretty much allows the
4684 4698 alias system to offer full-blown shell convenience, I think.
4685 4699
4686 4700 * Version 0.1.17 released, 0.1.18 opened.
4687 4701
4688 4702 * dot_ipython/ipythonrc (alias): added documentation.
4689 4703 (xcolor): Fixed small bug (xcolors -> xcolor)
4690 4704
4691 4705 * Changed the alias system. Now alias is a magic command to define
4692 4706 aliases just like the shell. Rationale: the builtin magics should
4693 4707 be there for things deeply connected to IPython's
4694 4708 architecture. And this is a much lighter system for what I think
4695 4709 is the really important feature: allowing users to define quickly
4696 4710 magics that will do shell things for them, so they can customize
4697 4711 IPython easily to match their work habits. If someone is really
4698 4712 desperate to have another name for a builtin alias, they can
4699 4713 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4700 4714 works.
4701 4715
4702 4716 2001-11-28 Fernando Perez <fperez@colorado.edu>
4703 4717
4704 4718 * Changed @file so that it opens the source file at the proper
4705 4719 line. Since it uses less, if your EDITOR environment is
4706 4720 configured, typing v will immediately open your editor of choice
4707 4721 right at the line where the object is defined. Not as quick as
4708 4722 having a direct @edit command, but for all intents and purposes it
4709 4723 works. And I don't have to worry about writing @edit to deal with
4710 4724 all the editors, less does that.
4711 4725
4712 4726 * Version 0.1.16 released, 0.1.17 opened.
4713 4727
4714 4728 * Fixed some nasty bugs in the page/page_dumb combo that could
4715 4729 crash IPython.
4716 4730
4717 4731 2001-11-27 Fernando Perez <fperez@colorado.edu>
4718 4732
4719 4733 * Version 0.1.15 released, 0.1.16 opened.
4720 4734
4721 4735 * Finally got ? and ?? to work for undefined things: now it's
4722 4736 possible to type {}.get? and get information about the get method
4723 4737 of dicts, or os.path? even if only os is defined (so technically
4724 4738 os.path isn't). Works at any level. For example, after import os,
4725 4739 os?, os.path?, os.path.abspath? all work. This is great, took some
4726 4740 work in _ofind.
4727 4741
4728 4742 * Fixed more bugs with logging. The sanest way to do it was to add
4729 4743 to @log a 'mode' parameter. Killed two in one shot (this mode
4730 4744 option was a request of Janko's). I think it's finally clean
4731 4745 (famous last words).
4732 4746
4733 4747 * Added a page_dumb() pager which does a decent job of paging on
4734 4748 screen, if better things (like less) aren't available. One less
4735 4749 unix dependency (someday maybe somebody will port this to
4736 4750 windows).
4737 4751
4738 4752 * Fixed problem in magic_log: would lock of logging out if log
4739 4753 creation failed (because it would still think it had succeeded).
4740 4754
4741 4755 * Improved the page() function using curses to auto-detect screen
4742 4756 size. Now it can make a much better decision on whether to print
4743 4757 or page a string. Option screen_length was modified: a value 0
4744 4758 means auto-detect, and that's the default now.
4745 4759
4746 4760 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4747 4761 go out. I'll test it for a few days, then talk to Janko about
4748 4762 licences and announce it.
4749 4763
4750 4764 * Fixed the length of the auto-generated ---> prompt which appears
4751 4765 for auto-parens and auto-quotes. Getting this right isn't trivial,
4752 4766 with all the color escapes, different prompt types and optional
4753 4767 separators. But it seems to be working in all the combinations.
4754 4768
4755 4769 2001-11-26 Fernando Perez <fperez@colorado.edu>
4756 4770
4757 4771 * Wrote a regexp filter to get option types from the option names
4758 4772 string. This eliminates the need to manually keep two duplicate
4759 4773 lists.
4760 4774
4761 4775 * Removed the unneeded check_option_names. Now options are handled
4762 4776 in a much saner manner and it's easy to visually check that things
4763 4777 are ok.
4764 4778
4765 4779 * Updated version numbers on all files I modified to carry a
4766 4780 notice so Janko and Nathan have clear version markers.
4767 4781
4768 4782 * Updated docstring for ultraTB with my changes. I should send
4769 4783 this to Nathan.
4770 4784
4771 4785 * Lots of small fixes. Ran everything through pychecker again.
4772 4786
4773 4787 * Made loading of deep_reload an cmd line option. If it's not too
4774 4788 kosher, now people can just disable it. With -nodeep_reload it's
4775 4789 still available as dreload(), it just won't overwrite reload().
4776 4790
4777 4791 * Moved many options to the no| form (-opt and -noopt
4778 4792 accepted). Cleaner.
4779 4793
4780 4794 * Changed magic_log so that if called with no parameters, it uses
4781 4795 'rotate' mode. That way auto-generated logs aren't automatically
4782 4796 over-written. For normal logs, now a backup is made if it exists
4783 4797 (only 1 level of backups). A new 'backup' mode was added to the
4784 4798 Logger class to support this. This was a request by Janko.
4785 4799
4786 4800 * Added @logoff/@logon to stop/restart an active log.
4787 4801
4788 4802 * Fixed a lot of bugs in log saving/replay. It was pretty
4789 4803 broken. Now special lines (!@,/) appear properly in the command
4790 4804 history after a log replay.
4791 4805
4792 4806 * Tried and failed to implement full session saving via pickle. My
4793 4807 idea was to pickle __main__.__dict__, but modules can't be
4794 4808 pickled. This would be a better alternative to replaying logs, but
4795 4809 seems quite tricky to get to work. Changed -session to be called
4796 4810 -logplay, which more accurately reflects what it does. And if we
4797 4811 ever get real session saving working, -session is now available.
4798 4812
4799 4813 * Implemented color schemes for prompts also. As for tracebacks,
4800 4814 currently only NoColor and Linux are supported. But now the
4801 4815 infrastructure is in place, based on a generic ColorScheme
4802 4816 class. So writing and activating new schemes both for the prompts
4803 4817 and the tracebacks should be straightforward.
4804 4818
4805 4819 * Version 0.1.13 released, 0.1.14 opened.
4806 4820
4807 4821 * Changed handling of options for output cache. Now counter is
4808 4822 hardwired starting at 1 and one specifies the maximum number of
4809 4823 entries *in the outcache* (not the max prompt counter). This is
4810 4824 much better, since many statements won't increase the cache
4811 4825 count. It also eliminated some confusing options, now there's only
4812 4826 one: cache_size.
4813 4827
4814 4828 * Added 'alias' magic function and magic_alias option in the
4815 4829 ipythonrc file. Now the user can easily define whatever names he
4816 4830 wants for the magic functions without having to play weird
4817 4831 namespace games. This gives IPython a real shell-like feel.
4818 4832
4819 4833 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4820 4834 @ or not).
4821 4835
4822 4836 This was one of the last remaining 'visible' bugs (that I know
4823 4837 of). I think if I can clean up the session loading so it works
4824 4838 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4825 4839 about licensing).
4826 4840
4827 4841 2001-11-25 Fernando Perez <fperez@colorado.edu>
4828 4842
4829 4843 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4830 4844 there's a cleaner distinction between what ? and ?? show.
4831 4845
4832 4846 * Added screen_length option. Now the user can define his own
4833 4847 screen size for page() operations.
4834 4848
4835 4849 * Implemented magic shell-like functions with automatic code
4836 4850 generation. Now adding another function is just a matter of adding
4837 4851 an entry to a dict, and the function is dynamically generated at
4838 4852 run-time. Python has some really cool features!
4839 4853
4840 4854 * Renamed many options to cleanup conventions a little. Now all
4841 4855 are lowercase, and only underscores where needed. Also in the code
4842 4856 option name tables are clearer.
4843 4857
4844 4858 * Changed prompts a little. Now input is 'In [n]:' instead of
4845 4859 'In[n]:='. This allows it the numbers to be aligned with the
4846 4860 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4847 4861 Python (it was a Mathematica thing). The '...' continuation prompt
4848 4862 was also changed a little to align better.
4849 4863
4850 4864 * Fixed bug when flushing output cache. Not all _p<n> variables
4851 4865 exist, so their deletion needs to be wrapped in a try:
4852 4866
4853 4867 * Figured out how to properly use inspect.formatargspec() (it
4854 4868 requires the args preceded by *). So I removed all the code from
4855 4869 _get_pdef in Magic, which was just replicating that.
4856 4870
4857 4871 * Added test to prefilter to allow redefining magic function names
4858 4872 as variables. This is ok, since the @ form is always available,
4859 4873 but whe should allow the user to define a variable called 'ls' if
4860 4874 he needs it.
4861 4875
4862 4876 * Moved the ToDo information from README into a separate ToDo.
4863 4877
4864 4878 * General code cleanup and small bugfixes. I think it's close to a
4865 4879 state where it can be released, obviously with a big 'beta'
4866 4880 warning on it.
4867 4881
4868 4882 * Got the magic function split to work. Now all magics are defined
4869 4883 in a separate class. It just organizes things a bit, and now
4870 4884 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4871 4885 was too long).
4872 4886
4873 4887 * Changed @clear to @reset to avoid potential confusions with
4874 4888 the shell command clear. Also renamed @cl to @clear, which does
4875 4889 exactly what people expect it to from their shell experience.
4876 4890
4877 4891 Added a check to the @reset command (since it's so
4878 4892 destructive, it's probably a good idea to ask for confirmation).
4879 4893 But now reset only works for full namespace resetting. Since the
4880 4894 del keyword is already there for deleting a few specific
4881 4895 variables, I don't see the point of having a redundant magic
4882 4896 function for the same task.
4883 4897
4884 4898 2001-11-24 Fernando Perez <fperez@colorado.edu>
4885 4899
4886 4900 * Updated the builtin docs (esp. the ? ones).
4887 4901
4888 4902 * Ran all the code through pychecker. Not terribly impressed with
4889 4903 it: lots of spurious warnings and didn't really find anything of
4890 4904 substance (just a few modules being imported and not used).
4891 4905
4892 4906 * Implemented the new ultraTB functionality into IPython. New
4893 4907 option: xcolors. This chooses color scheme. xmode now only selects
4894 4908 between Plain and Verbose. Better orthogonality.
4895 4909
4896 4910 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4897 4911 mode and color scheme for the exception handlers. Now it's
4898 4912 possible to have the verbose traceback with no coloring.
4899 4913
4900 4914 2001-11-23 Fernando Perez <fperez@colorado.edu>
4901 4915
4902 4916 * Version 0.1.12 released, 0.1.13 opened.
4903 4917
4904 4918 * Removed option to set auto-quote and auto-paren escapes by
4905 4919 user. The chances of breaking valid syntax are just too high. If
4906 4920 someone *really* wants, they can always dig into the code.
4907 4921
4908 4922 * Made prompt separators configurable.
4909 4923
4910 4924 2001-11-22 Fernando Perez <fperez@colorado.edu>
4911 4925
4912 4926 * Small bugfixes in many places.
4913 4927
4914 4928 * Removed the MyCompleter class from ipplib. It seemed redundant
4915 4929 with the C-p,C-n history search functionality. Less code to
4916 4930 maintain.
4917 4931
4918 4932 * Moved all the original ipython.py code into ipythonlib.py. Right
4919 4933 now it's just one big dump into a function called make_IPython, so
4920 4934 no real modularity has been gained. But at least it makes the
4921 4935 wrapper script tiny, and since ipythonlib is a module, it gets
4922 4936 compiled and startup is much faster.
4923 4937
4924 4938 This is a reasobably 'deep' change, so we should test it for a
4925 4939 while without messing too much more with the code.
4926 4940
4927 4941 2001-11-21 Fernando Perez <fperez@colorado.edu>
4928 4942
4929 4943 * Version 0.1.11 released, 0.1.12 opened for further work.
4930 4944
4931 4945 * Removed dependency on Itpl. It was only needed in one place. It
4932 4946 would be nice if this became part of python, though. It makes life
4933 4947 *a lot* easier in some cases.
4934 4948
4935 4949 * Simplified the prefilter code a bit. Now all handlers are
4936 4950 expected to explicitly return a value (at least a blank string).
4937 4951
4938 4952 * Heavy edits in ipplib. Removed the help system altogether. Now
4939 4953 obj?/?? is used for inspecting objects, a magic @doc prints
4940 4954 docstrings, and full-blown Python help is accessed via the 'help'
4941 4955 keyword. This cleans up a lot of code (less to maintain) and does
4942 4956 the job. Since 'help' is now a standard Python component, might as
4943 4957 well use it and remove duplicate functionality.
4944 4958
4945 4959 Also removed the option to use ipplib as a standalone program. By
4946 4960 now it's too dependent on other parts of IPython to function alone.
4947 4961
4948 4962 * Fixed bug in genutils.pager. It would crash if the pager was
4949 4963 exited immediately after opening (broken pipe).
4950 4964
4951 4965 * Trimmed down the VerboseTB reporting a little. The header is
4952 4966 much shorter now and the repeated exception arguments at the end
4953 4967 have been removed. For interactive use the old header seemed a bit
4954 4968 excessive.
4955 4969
4956 4970 * Fixed small bug in output of @whos for variables with multi-word
4957 4971 types (only first word was displayed).
4958 4972
4959 4973 2001-11-17 Fernando Perez <fperez@colorado.edu>
4960 4974
4961 4975 * Version 0.1.10 released, 0.1.11 opened for further work.
4962 4976
4963 4977 * Modified dirs and friends. dirs now *returns* the stack (not
4964 4978 prints), so one can manipulate it as a variable. Convenient to
4965 4979 travel along many directories.
4966 4980
4967 4981 * Fixed bug in magic_pdef: would only work with functions with
4968 4982 arguments with default values.
4969 4983
4970 4984 2001-11-14 Fernando Perez <fperez@colorado.edu>
4971 4985
4972 4986 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4973 4987 example with IPython. Various other minor fixes and cleanups.
4974 4988
4975 4989 * Version 0.1.9 released, 0.1.10 opened for further work.
4976 4990
4977 4991 * Added sys.path to the list of directories searched in the
4978 4992 execfile= option. It used to be the current directory and the
4979 4993 user's IPYTHONDIR only.
4980 4994
4981 4995 2001-11-13 Fernando Perez <fperez@colorado.edu>
4982 4996
4983 4997 * Reinstated the raw_input/prefilter separation that Janko had
4984 4998 initially. This gives a more convenient setup for extending the
4985 4999 pre-processor from the outside: raw_input always gets a string,
4986 5000 and prefilter has to process it. We can then redefine prefilter
4987 5001 from the outside and implement extensions for special
4988 5002 purposes.
4989 5003
4990 5004 Today I got one for inputting PhysicalQuantity objects
4991 5005 (from Scientific) without needing any function calls at
4992 5006 all. Extremely convenient, and it's all done as a user-level
4993 5007 extension (no IPython code was touched). Now instead of:
4994 5008 a = PhysicalQuantity(4.2,'m/s**2')
4995 5009 one can simply say
4996 5010 a = 4.2 m/s**2
4997 5011 or even
4998 5012 a = 4.2 m/s^2
4999 5013
5000 5014 I use this, but it's also a proof of concept: IPython really is
5001 5015 fully user-extensible, even at the level of the parsing of the
5002 5016 command line. It's not trivial, but it's perfectly doable.
5003 5017
5004 5018 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5005 5019 the problem of modules being loaded in the inverse order in which
5006 5020 they were defined in
5007 5021
5008 5022 * Version 0.1.8 released, 0.1.9 opened for further work.
5009 5023
5010 5024 * Added magics pdef, source and file. They respectively show the
5011 5025 definition line ('prototype' in C), source code and full python
5012 5026 file for any callable object. The object inspector oinfo uses
5013 5027 these to show the same information.
5014 5028
5015 5029 * Version 0.1.7 released, 0.1.8 opened for further work.
5016 5030
5017 5031 * Separated all the magic functions into a class called Magic. The
5018 5032 InteractiveShell class was becoming too big for Xemacs to handle
5019 5033 (de-indenting a line would lock it up for 10 seconds while it
5020 5034 backtracked on the whole class!)
5021 5035
5022 5036 FIXME: didn't work. It can be done, but right now namespaces are
5023 5037 all messed up. Do it later (reverted it for now, so at least
5024 5038 everything works as before).
5025 5039
5026 5040 * Got the object introspection system (magic_oinfo) working! I
5027 5041 think this is pretty much ready for release to Janko, so he can
5028 5042 test it for a while and then announce it. Pretty much 100% of what
5029 5043 I wanted for the 'phase 1' release is ready. Happy, tired.
5030 5044
5031 5045 2001-11-12 Fernando Perez <fperez@colorado.edu>
5032 5046
5033 5047 * Version 0.1.6 released, 0.1.7 opened for further work.
5034 5048
5035 5049 * Fixed bug in printing: it used to test for truth before
5036 5050 printing, so 0 wouldn't print. Now checks for None.
5037 5051
5038 5052 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5039 5053 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5040 5054 reaches by hand into the outputcache. Think of a better way to do
5041 5055 this later.
5042 5056
5043 5057 * Various small fixes thanks to Nathan's comments.
5044 5058
5045 5059 * Changed magic_pprint to magic_Pprint. This way it doesn't
5046 5060 collide with pprint() and the name is consistent with the command
5047 5061 line option.
5048 5062
5049 5063 * Changed prompt counter behavior to be fully like
5050 5064 Mathematica's. That is, even input that doesn't return a result
5051 5065 raises the prompt counter. The old behavior was kind of confusing
5052 5066 (getting the same prompt number several times if the operation
5053 5067 didn't return a result).
5054 5068
5055 5069 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5056 5070
5057 5071 * Fixed -Classic mode (wasn't working anymore).
5058 5072
5059 5073 * Added colored prompts using Nathan's new code. Colors are
5060 5074 currently hardwired, they can be user-configurable. For
5061 5075 developers, they can be chosen in file ipythonlib.py, at the
5062 5076 beginning of the CachedOutput class def.
5063 5077
5064 5078 2001-11-11 Fernando Perez <fperez@colorado.edu>
5065 5079
5066 5080 * Version 0.1.5 released, 0.1.6 opened for further work.
5067 5081
5068 5082 * Changed magic_env to *return* the environment as a dict (not to
5069 5083 print it). This way it prints, but it can also be processed.
5070 5084
5071 5085 * Added Verbose exception reporting to interactive
5072 5086 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5073 5087 traceback. Had to make some changes to the ultraTB file. This is
5074 5088 probably the last 'big' thing in my mental todo list. This ties
5075 5089 in with the next entry:
5076 5090
5077 5091 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5078 5092 has to specify is Plain, Color or Verbose for all exception
5079 5093 handling.
5080 5094
5081 5095 * Removed ShellServices option. All this can really be done via
5082 5096 the magic system. It's easier to extend, cleaner and has automatic
5083 5097 namespace protection and documentation.
5084 5098
5085 5099 2001-11-09 Fernando Perez <fperez@colorado.edu>
5086 5100
5087 5101 * Fixed bug in output cache flushing (missing parameter to
5088 5102 __init__). Other small bugs fixed (found using pychecker).
5089 5103
5090 5104 * Version 0.1.4 opened for bugfixing.
5091 5105
5092 5106 2001-11-07 Fernando Perez <fperez@colorado.edu>
5093 5107
5094 5108 * Version 0.1.3 released, mainly because of the raw_input bug.
5095 5109
5096 5110 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5097 5111 and when testing for whether things were callable, a call could
5098 5112 actually be made to certain functions. They would get called again
5099 5113 once 'really' executed, with a resulting double call. A disaster
5100 5114 in many cases (list.reverse() would never work!).
5101 5115
5102 5116 * Removed prefilter() function, moved its code to raw_input (which
5103 5117 after all was just a near-empty caller for prefilter). This saves
5104 5118 a function call on every prompt, and simplifies the class a tiny bit.
5105 5119
5106 5120 * Fix _ip to __ip name in magic example file.
5107 5121
5108 5122 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5109 5123 work with non-gnu versions of tar.
5110 5124
5111 5125 2001-11-06 Fernando Perez <fperez@colorado.edu>
5112 5126
5113 5127 * Version 0.1.2. Just to keep track of the recent changes.
5114 5128
5115 5129 * Fixed nasty bug in output prompt routine. It used to check 'if
5116 5130 arg != None...'. Problem is, this fails if arg implements a
5117 5131 special comparison (__cmp__) which disallows comparing to
5118 5132 None. Found it when trying to use the PhysicalQuantity module from
5119 5133 ScientificPython.
5120 5134
5121 5135 2001-11-05 Fernando Perez <fperez@colorado.edu>
5122 5136
5123 5137 * Also added dirs. Now the pushd/popd/dirs family functions
5124 5138 basically like the shell, with the added convenience of going home
5125 5139 when called with no args.
5126 5140
5127 5141 * pushd/popd slightly modified to mimic shell behavior more
5128 5142 closely.
5129 5143
5130 5144 * Added env,pushd,popd from ShellServices as magic functions. I
5131 5145 think the cleanest will be to port all desired functions from
5132 5146 ShellServices as magics and remove ShellServices altogether. This
5133 5147 will provide a single, clean way of adding functionality
5134 5148 (shell-type or otherwise) to IP.
5135 5149
5136 5150 2001-11-04 Fernando Perez <fperez@colorado.edu>
5137 5151
5138 5152 * Added .ipython/ directory to sys.path. This way users can keep
5139 5153 customizations there and access them via import.
5140 5154
5141 5155 2001-11-03 Fernando Perez <fperez@colorado.edu>
5142 5156
5143 5157 * Opened version 0.1.1 for new changes.
5144 5158
5145 5159 * Changed version number to 0.1.0: first 'public' release, sent to
5146 5160 Nathan and Janko.
5147 5161
5148 5162 * Lots of small fixes and tweaks.
5149 5163
5150 5164 * Minor changes to whos format. Now strings are shown, snipped if
5151 5165 too long.
5152 5166
5153 5167 * Changed ShellServices to work on __main__ so they show up in @who
5154 5168
5155 5169 * Help also works with ? at the end of a line:
5156 5170 ?sin and sin?
5157 5171 both produce the same effect. This is nice, as often I use the
5158 5172 tab-complete to find the name of a method, but I used to then have
5159 5173 to go to the beginning of the line to put a ? if I wanted more
5160 5174 info. Now I can just add the ? and hit return. Convenient.
5161 5175
5162 5176 2001-11-02 Fernando Perez <fperez@colorado.edu>
5163 5177
5164 5178 * Python version check (>=2.1) added.
5165 5179
5166 5180 * Added LazyPython documentation. At this point the docs are quite
5167 5181 a mess. A cleanup is in order.
5168 5182
5169 5183 * Auto-installer created. For some bizarre reason, the zipfiles
5170 5184 module isn't working on my system. So I made a tar version
5171 5185 (hopefully the command line options in various systems won't kill
5172 5186 me).
5173 5187
5174 5188 * Fixes to Struct in genutils. Now all dictionary-like methods are
5175 5189 protected (reasonably).
5176 5190
5177 5191 * Added pager function to genutils and changed ? to print usage
5178 5192 note through it (it was too long).
5179 5193
5180 5194 * Added the LazyPython functionality. Works great! I changed the
5181 5195 auto-quote escape to ';', it's on home row and next to '. But
5182 5196 both auto-quote and auto-paren (still /) escapes are command-line
5183 5197 parameters.
5184 5198
5185 5199
5186 5200 2001-11-01 Fernando Perez <fperez@colorado.edu>
5187 5201
5188 5202 * Version changed to 0.0.7. Fairly large change: configuration now
5189 5203 is all stored in a directory, by default .ipython. There, all
5190 5204 config files have normal looking names (not .names)
5191 5205
5192 5206 * Version 0.0.6 Released first to Lucas and Archie as a test
5193 5207 run. Since it's the first 'semi-public' release, change version to
5194 5208 > 0.0.6 for any changes now.
5195 5209
5196 5210 * Stuff I had put in the ipplib.py changelog:
5197 5211
5198 5212 Changes to InteractiveShell:
5199 5213
5200 5214 - Made the usage message a parameter.
5201 5215
5202 5216 - Require the name of the shell variable to be given. It's a bit
5203 5217 of a hack, but allows the name 'shell' not to be hardwire in the
5204 5218 magic (@) handler, which is problematic b/c it requires
5205 5219 polluting the global namespace with 'shell'. This in turn is
5206 5220 fragile: if a user redefines a variable called shell, things
5207 5221 break.
5208 5222
5209 5223 - magic @: all functions available through @ need to be defined
5210 5224 as magic_<name>, even though they can be called simply as
5211 5225 @<name>. This allows the special command @magic to gather
5212 5226 information automatically about all existing magic functions,
5213 5227 even if they are run-time user extensions, by parsing the shell
5214 5228 instance __dict__ looking for special magic_ names.
5215 5229
5216 5230 - mainloop: added *two* local namespace parameters. This allows
5217 5231 the class to differentiate between parameters which were there
5218 5232 before and after command line initialization was processed. This
5219 5233 way, later @who can show things loaded at startup by the
5220 5234 user. This trick was necessary to make session saving/reloading
5221 5235 really work: ideally after saving/exiting/reloading a session,
5222 5236 *everythin* should look the same, including the output of @who. I
5223 5237 was only able to make this work with this double namespace
5224 5238 trick.
5225 5239
5226 5240 - added a header to the logfile which allows (almost) full
5227 5241 session restoring.
5228 5242
5229 5243 - prepend lines beginning with @ or !, with a and log
5230 5244 them. Why? !lines: may be useful to know what you did @lines:
5231 5245 they may affect session state. So when restoring a session, at
5232 5246 least inform the user of their presence. I couldn't quite get
5233 5247 them to properly re-execute, but at least the user is warned.
5234 5248
5235 5249 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now