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