##// END OF EJS Templates
unix readline does not accept unicode in history, encode to str. Patch by Tiago, close #201
vivainio -
Show More
@@ -1,2579 +1,2580 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 2891 2007-12-12 22:33:50Z vivainio $
9 $Id: iplib.py 2894 2007-12-13 20:34:23Z vivainio $
10 10 """
11 11
12 12 #*****************************************************************************
13 13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
14 14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
15 15 #
16 16 # Distributed under the terms of the BSD License. The full license is in
17 17 # the file COPYING, distributed as part of this software.
18 18 #
19 19 # Note: this code originally subclassed code.InteractiveConsole from the
20 20 # Python standard library. Over time, all of that class has been copied
21 21 # verbatim here for modifications which could not be accomplished by
22 22 # subclassing. At this point, there are no dependencies at all on the code
23 23 # module anymore (it is not even imported). The Python License (sec. 2)
24 24 # allows for this, but it's always nice to acknowledge credit where credit is
25 25 # due.
26 26 #*****************************************************************************
27 27
28 28 #****************************************************************************
29 29 # Modules and globals
30 30
31 31 from IPython import Release
32 32 __author__ = '%s <%s>\n%s <%s>' % \
33 33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
34 34 __license__ = Release.license
35 35 __version__ = Release.version
36 36
37 37 # Python standard modules
38 38 import __main__
39 39 import __builtin__
40 40 import StringIO
41 41 import bdb
42 42 import cPickle as pickle
43 43 import codeop
44 44 import exceptions
45 45 import glob
46 46 import inspect
47 47 import keyword
48 48 import new
49 49 import os
50 50 import pydoc
51 51 import re
52 52 import shutil
53 53 import string
54 54 import sys
55 55 import tempfile
56 56 import traceback
57 57 import types
58 58 from sets import Set
59 59 from pprint import pprint, pformat
60 60
61 61 # IPython's own modules
62 62 #import IPython
63 63 from IPython import Debugger,OInspect,PyColorize,ultraTB
64 64 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
65 65 from IPython.Extensions import pickleshare
66 66 from IPython.FakeModule import FakeModule
67 67 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
68 68 from IPython.Logger import Logger
69 69 from IPython.Magic import Magic
70 70 from IPython.Prompts import CachedOutput
71 71 from IPython.ipstruct import Struct
72 72 from IPython.background_jobs import BackgroundJobManager
73 73 from IPython.usage import cmd_line_usage,interactive_usage
74 74 from IPython.genutils import *
75 75 from IPython.strdispatch import StrDispatch
76 76 import IPython.ipapi
77 77 import IPython.history
78 78 import IPython.prefilter as prefilter
79 79 import IPython.shadowns
80 80 # Globals
81 81
82 82 # store the builtin raw_input globally, and use this always, in case user code
83 83 # overwrites it (like wx.py.PyShell does)
84 84 raw_input_original = raw_input
85 85
86 86 # compiled regexps for autoindent management
87 87 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
88 88
89 89
90 90 #****************************************************************************
91 91 # Some utility function definitions
92 92
93 93 ini_spaces_re = re.compile(r'^(\s+)')
94 94
95 95 def num_ini_spaces(strng):
96 96 """Return the number of initial spaces in a string"""
97 97
98 98 ini_spaces = ini_spaces_re.match(strng)
99 99 if ini_spaces:
100 100 return ini_spaces.end()
101 101 else:
102 102 return 0
103 103
104 104 def softspace(file, newvalue):
105 105 """Copied from code.py, to remove the dependency"""
106 106
107 107 oldvalue = 0
108 108 try:
109 109 oldvalue = file.softspace
110 110 except AttributeError:
111 111 pass
112 112 try:
113 113 file.softspace = newvalue
114 114 except (AttributeError, TypeError):
115 115 # "attribute-less object" or "read-only attributes"
116 116 pass
117 117 return oldvalue
118 118
119 119
120 120 #****************************************************************************
121 121 # Local use exceptions
122 122 class SpaceInInput(exceptions.Exception): pass
123 123
124 124
125 125 #****************************************************************************
126 126 # Local use classes
127 127 class Bunch: pass
128 128
129 129 class Undefined: pass
130 130
131 131 class Quitter(object):
132 132 """Simple class to handle exit, similar to Python 2.5's.
133 133
134 134 It handles exiting in an ipython-safe manner, which the one in Python 2.5
135 135 doesn't do (obviously, since it doesn't know about ipython)."""
136 136
137 137 def __init__(self,shell,name):
138 138 self.shell = shell
139 139 self.name = name
140 140
141 141 def __repr__(self):
142 142 return 'Type %s() to exit.' % self.name
143 143 __str__ = __repr__
144 144
145 145 def __call__(self):
146 146 self.shell.exit()
147 147
148 148 class InputList(list):
149 149 """Class to store user input.
150 150
151 151 It's basically a list, but slices return a string instead of a list, thus
152 152 allowing things like (assuming 'In' is an instance):
153 153
154 154 exec In[4:7]
155 155
156 156 or
157 157
158 158 exec In[5:9] + In[14] + In[21:25]"""
159 159
160 160 def __getslice__(self,i,j):
161 161 return ''.join(list.__getslice__(self,i,j))
162 162
163 163 class SyntaxTB(ultraTB.ListTB):
164 164 """Extension which holds some state: the last exception value"""
165 165
166 166 def __init__(self,color_scheme = 'NoColor'):
167 167 ultraTB.ListTB.__init__(self,color_scheme)
168 168 self.last_syntax_error = None
169 169
170 170 def __call__(self, etype, value, elist):
171 171 self.last_syntax_error = value
172 172 ultraTB.ListTB.__call__(self,etype,value,elist)
173 173
174 174 def clear_err_state(self):
175 175 """Return the current error state and clear it"""
176 176 e = self.last_syntax_error
177 177 self.last_syntax_error = None
178 178 return e
179 179
180 180 #****************************************************************************
181 181 # Main IPython class
182 182
183 183 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
184 184 # until a full rewrite is made. I've cleaned all cross-class uses of
185 185 # attributes and methods, but too much user code out there relies on the
186 186 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
187 187 #
188 188 # But at least now, all the pieces have been separated and we could, in
189 189 # principle, stop using the mixin. This will ease the transition to the
190 190 # chainsaw branch.
191 191
192 192 # For reference, the following is the list of 'self.foo' uses in the Magic
193 193 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
194 194 # class, to prevent clashes.
195 195
196 196 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
197 197 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
198 198 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
199 199 # 'self.value']
200 200
201 201 class InteractiveShell(object,Magic):
202 202 """An enhanced console for Python."""
203 203
204 204 # class attribute to indicate whether the class supports threads or not.
205 205 # Subclasses with thread support should override this as needed.
206 206 isthreaded = False
207 207
208 208 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
209 209 user_ns = None,user_global_ns=None,banner2='',
210 210 custom_exceptions=((),None),embedded=False):
211 211
212 212 # log system
213 213 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
214 214
215 215 # some minimal strict typechecks. For some core data structures, I
216 216 # want actual basic python types, not just anything that looks like
217 217 # one. This is especially true for namespaces.
218 218 for ns in (user_ns,user_global_ns):
219 219 if ns is not None and type(ns) != types.DictType:
220 220 raise TypeError,'namespace must be a dictionary'
221 221
222 222 # Job manager (for jobs run as background threads)
223 223 self.jobs = BackgroundJobManager()
224 224
225 225 # Store the actual shell's name
226 226 self.name = name
227 227
228 228 # We need to know whether the instance is meant for embedding, since
229 229 # global/local namespaces need to be handled differently in that case
230 230 self.embedded = embedded
231 231 if embedded:
232 232 # Control variable so users can, from within the embedded instance,
233 233 # permanently deactivate it.
234 234 self.embedded_active = True
235 235
236 236 # command compiler
237 237 self.compile = codeop.CommandCompiler()
238 238
239 239 # User input buffer
240 240 self.buffer = []
241 241
242 242 # Default name given in compilation of code
243 243 self.filename = '<ipython console>'
244 244
245 245 # Install our own quitter instead of the builtins. For python2.3-2.4,
246 246 # this brings in behavior like 2.5, and for 2.5 it's identical.
247 247 __builtin__.exit = Quitter(self,'exit')
248 248 __builtin__.quit = Quitter(self,'quit')
249 249
250 250 # Make an empty namespace, which extension writers can rely on both
251 251 # existing and NEVER being used by ipython itself. This gives them a
252 252 # convenient location for storing additional information and state
253 253 # their extensions may require, without fear of collisions with other
254 254 # ipython names that may develop later.
255 255 self.meta = Struct()
256 256
257 257 # Create the namespace where the user will operate. user_ns is
258 258 # normally the only one used, and it is passed to the exec calls as
259 259 # the locals argument. But we do carry a user_global_ns namespace
260 260 # given as the exec 'globals' argument, This is useful in embedding
261 261 # situations where the ipython shell opens in a context where the
262 262 # distinction between locals and globals is meaningful.
263 263
264 264 # FIXME. For some strange reason, __builtins__ is showing up at user
265 265 # level as a dict instead of a module. This is a manual fix, but I
266 266 # should really track down where the problem is coming from. Alex
267 267 # Schmolck reported this problem first.
268 268
269 269 # A useful post by Alex Martelli on this topic:
270 270 # Re: inconsistent value from __builtins__
271 271 # Von: Alex Martelli <aleaxit@yahoo.com>
272 272 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
273 273 # Gruppen: comp.lang.python
274 274
275 275 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
276 276 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
277 277 # > <type 'dict'>
278 278 # > >>> print type(__builtins__)
279 279 # > <type 'module'>
280 280 # > Is this difference in return value intentional?
281 281
282 282 # Well, it's documented that '__builtins__' can be either a dictionary
283 283 # or a module, and it's been that way for a long time. Whether it's
284 284 # intentional (or sensible), I don't know. In any case, the idea is
285 285 # that if you need to access the built-in namespace directly, you
286 286 # should start with "import __builtin__" (note, no 's') which will
287 287 # definitely give you a module. Yeah, it's somewhat confusing:-(.
288 288
289 289 # These routines return properly built dicts as needed by the rest of
290 290 # the code, and can also be used by extension writers to generate
291 291 # properly initialized namespaces.
292 292 user_ns = IPython.ipapi.make_user_ns(user_ns)
293 293 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
294 294
295 295 # Assign namespaces
296 296 # This is the namespace where all normal user variables live
297 297 self.user_ns = user_ns
298 298 # Embedded instances require a separate namespace for globals.
299 299 # Normally this one is unused by non-embedded instances.
300 300 self.user_global_ns = user_global_ns
301 301 # A namespace to keep track of internal data structures to prevent
302 302 # them from cluttering user-visible stuff. Will be updated later
303 303 self.internal_ns = {}
304 304
305 305 # Namespace of system aliases. Each entry in the alias
306 306 # table must be a 2-tuple of the form (N,name), where N is the number
307 307 # of positional arguments of the alias.
308 308 self.alias_table = {}
309 309
310 310 # A table holding all the namespaces IPython deals with, so that
311 311 # introspection facilities can search easily.
312 312 self.ns_table = {'user':user_ns,
313 313 'user_global':user_global_ns,
314 314 'alias':self.alias_table,
315 315 'internal':self.internal_ns,
316 316 'builtin':__builtin__.__dict__
317 317 }
318 318 # The user namespace MUST have a pointer to the shell itself.
319 319 self.user_ns[name] = self
320 320
321 321 # We need to insert into sys.modules something that looks like a
322 322 # module but which accesses the IPython namespace, for shelve and
323 323 # pickle to work interactively. Normally they rely on getting
324 324 # everything out of __main__, but for embedding purposes each IPython
325 325 # instance has its own private namespace, so we can't go shoving
326 326 # everything into __main__.
327 327
328 328 # note, however, that we should only do this for non-embedded
329 329 # ipythons, which really mimic the __main__.__dict__ with their own
330 330 # namespace. Embedded instances, on the other hand, should not do
331 331 # this because they need to manage the user local/global namespaces
332 332 # only, but they live within a 'normal' __main__ (meaning, they
333 333 # shouldn't overtake the execution environment of the script they're
334 334 # embedded in).
335 335
336 336 if not embedded:
337 337 try:
338 338 main_name = self.user_ns['__name__']
339 339 except KeyError:
340 340 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
341 341 else:
342 342 #print "pickle hack in place" # dbg
343 343 #print 'main_name:',main_name # dbg
344 344 sys.modules[main_name] = FakeModule(self.user_ns)
345 345
346 346 # Now that FakeModule produces a real module, we've run into a nasty
347 347 # problem: after script execution (via %run), the module where the user
348 348 # code ran is deleted. Now that this object is a true module (needed
349 349 # so docetst and other tools work correctly), the Python module
350 350 # teardown mechanism runs over it, and sets to None every variable
351 351 # present in that module. This means that later calls to functions
352 352 # defined in the script (which have become interactively visible after
353 353 # script exit) fail, because they hold references to objects that have
354 354 # become overwritten into None. The only solution I see right now is
355 355 # to protect every FakeModule used by %run by holding an internal
356 356 # reference to it. This private list will be used for that. The
357 357 # %reset command will flush it as well.
358 358 self._user_main_modules = []
359 359
360 360 # List of input with multi-line handling.
361 361 # Fill its zero entry, user counter starts at 1
362 362 self.input_hist = InputList(['\n'])
363 363 # This one will hold the 'raw' input history, without any
364 364 # pre-processing. This will allow users to retrieve the input just as
365 365 # it was exactly typed in by the user, with %hist -r.
366 366 self.input_hist_raw = InputList(['\n'])
367 367
368 368 # list of visited directories
369 369 try:
370 370 self.dir_hist = [os.getcwd()]
371 371 except OSError:
372 372 self.dir_hist = []
373 373
374 374 # dict of output history
375 375 self.output_hist = {}
376 376
377 377 # Get system encoding at startup time. Certain terminals (like Emacs
378 378 # under Win32 have it set to None, and we need to have a known valid
379 379 # encoding to use in the raw_input() method
380 380 self.stdin_encoding = sys.stdin.encoding or 'ascii'
381 381
382 382 # dict of things NOT to alias (keywords, builtins and some magics)
383 383 no_alias = {}
384 384 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
385 385 for key in keyword.kwlist + no_alias_magics:
386 386 no_alias[key] = 1
387 387 no_alias.update(__builtin__.__dict__)
388 388 self.no_alias = no_alias
389 389
390 390 # make global variables for user access to these
391 391 self.user_ns['_ih'] = self.input_hist
392 392 self.user_ns['_oh'] = self.output_hist
393 393 self.user_ns['_dh'] = self.dir_hist
394 394
395 395 # user aliases to input and output histories
396 396 self.user_ns['In'] = self.input_hist
397 397 self.user_ns['Out'] = self.output_hist
398 398
399 399 self.user_ns['_sh'] = IPython.shadowns
400 400 # Object variable to store code object waiting execution. This is
401 401 # used mainly by the multithreaded shells, but it can come in handy in
402 402 # other situations. No need to use a Queue here, since it's a single
403 403 # item which gets cleared once run.
404 404 self.code_to_run = None
405 405
406 406 # escapes for automatic behavior on the command line
407 407 self.ESC_SHELL = '!'
408 408 self.ESC_SH_CAP = '!!'
409 409 self.ESC_HELP = '?'
410 410 self.ESC_MAGIC = '%'
411 411 self.ESC_QUOTE = ','
412 412 self.ESC_QUOTE2 = ';'
413 413 self.ESC_PAREN = '/'
414 414
415 415 # And their associated handlers
416 416 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
417 417 self.ESC_QUOTE : self.handle_auto,
418 418 self.ESC_QUOTE2 : self.handle_auto,
419 419 self.ESC_MAGIC : self.handle_magic,
420 420 self.ESC_HELP : self.handle_help,
421 421 self.ESC_SHELL : self.handle_shell_escape,
422 422 self.ESC_SH_CAP : self.handle_shell_escape,
423 423 }
424 424
425 425 # class initializations
426 426 Magic.__init__(self,self)
427 427
428 428 # Python source parser/formatter for syntax highlighting
429 429 pyformat = PyColorize.Parser().format
430 430 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
431 431
432 432 # hooks holds pointers used for user-side customizations
433 433 self.hooks = Struct()
434 434
435 435 self.strdispatchers = {}
436 436
437 437 # Set all default hooks, defined in the IPython.hooks module.
438 438 hooks = IPython.hooks
439 439 for hook_name in hooks.__all__:
440 440 # default hooks have priority 100, i.e. low; user hooks should have
441 441 # 0-100 priority
442 442 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
443 443 #print "bound hook",hook_name
444 444
445 445 # Flag to mark unconditional exit
446 446 self.exit_now = False
447 447
448 448 self.usage_min = """\
449 449 An enhanced console for Python.
450 450 Some of its features are:
451 451 - Readline support if the readline library is present.
452 452 - Tab completion in the local namespace.
453 453 - Logging of input, see command-line options.
454 454 - System shell escape via ! , eg !ls.
455 455 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
456 456 - Keeps track of locally defined variables via %who, %whos.
457 457 - Show object information with a ? eg ?x or x? (use ?? for more info).
458 458 """
459 459 if usage: self.usage = usage
460 460 else: self.usage = self.usage_min
461 461
462 462 # Storage
463 463 self.rc = rc # This will hold all configuration information
464 464 self.pager = 'less'
465 465 # temporary files used for various purposes. Deleted at exit.
466 466 self.tempfiles = []
467 467
468 468 # Keep track of readline usage (later set by init_readline)
469 469 self.has_readline = False
470 470
471 471 # template for logfile headers. It gets resolved at runtime by the
472 472 # logstart method.
473 473 self.loghead_tpl = \
474 474 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
475 475 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
476 476 #log# opts = %s
477 477 #log# args = %s
478 478 #log# It is safe to make manual edits below here.
479 479 #log#-----------------------------------------------------------------------
480 480 """
481 481 # for pushd/popd management
482 482 try:
483 483 self.home_dir = get_home_dir()
484 484 except HomeDirError,msg:
485 485 fatal(msg)
486 486
487 487 self.dir_stack = []
488 488
489 489 # Functions to call the underlying shell.
490 490
491 491 # The first is similar to os.system, but it doesn't return a value,
492 492 # and it allows interpolation of variables in the user's namespace.
493 493 self.system = lambda cmd: \
494 494 shell(self.var_expand(cmd,depth=2),
495 495 header=self.rc.system_header,
496 496 verbose=self.rc.system_verbose)
497 497
498 498 # These are for getoutput and getoutputerror:
499 499 self.getoutput = lambda cmd: \
500 500 getoutput(self.var_expand(cmd,depth=2),
501 501 header=self.rc.system_header,
502 502 verbose=self.rc.system_verbose)
503 503
504 504 self.getoutputerror = lambda cmd: \
505 505 getoutputerror(self.var_expand(cmd,depth=2),
506 506 header=self.rc.system_header,
507 507 verbose=self.rc.system_verbose)
508 508
509 509
510 510 # keep track of where we started running (mainly for crash post-mortem)
511 511 self.starting_dir = os.getcwd()
512 512
513 513 # Various switches which can be set
514 514 self.CACHELENGTH = 5000 # this is cheap, it's just text
515 515 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
516 516 self.banner2 = banner2
517 517
518 518 # TraceBack handlers:
519 519
520 520 # Syntax error handler.
521 521 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
522 522
523 523 # The interactive one is initialized with an offset, meaning we always
524 524 # want to remove the topmost item in the traceback, which is our own
525 525 # internal code. Valid modes: ['Plain','Context','Verbose']
526 526 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
527 527 color_scheme='NoColor',
528 528 tb_offset = 1)
529 529
530 530 # IPython itself shouldn't crash. This will produce a detailed
531 531 # post-mortem if it does. But we only install the crash handler for
532 532 # non-threaded shells, the threaded ones use a normal verbose reporter
533 533 # and lose the crash handler. This is because exceptions in the main
534 534 # thread (such as in GUI code) propagate directly to sys.excepthook,
535 535 # and there's no point in printing crash dumps for every user exception.
536 536 if self.isthreaded:
537 537 ipCrashHandler = ultraTB.FormattedTB()
538 538 else:
539 539 from IPython import CrashHandler
540 540 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
541 541 self.set_crash_handler(ipCrashHandler)
542 542
543 543 # and add any custom exception handlers the user may have specified
544 544 self.set_custom_exc(*custom_exceptions)
545 545
546 546 # indentation management
547 547 self.autoindent = False
548 548 self.indent_current_nsp = 0
549 549
550 550 # Make some aliases automatically
551 551 # Prepare list of shell aliases to auto-define
552 552 if os.name == 'posix':
553 553 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
554 554 'mv mv -i','rm rm -i','cp cp -i',
555 555 'cat cat','less less','clear clear',
556 556 # a better ls
557 557 'ls ls -F',
558 558 # long ls
559 559 'll ls -lF')
560 560 # Extra ls aliases with color, which need special treatment on BSD
561 561 # variants
562 562 ls_extra = ( # color ls
563 563 'lc ls -F -o --color',
564 564 # ls normal files only
565 565 'lf ls -F -o --color %l | grep ^-',
566 566 # ls symbolic links
567 567 'lk ls -F -o --color %l | grep ^l',
568 568 # directories or links to directories,
569 569 'ldir ls -F -o --color %l | grep /$',
570 570 # things which are executable
571 571 'lx ls -F -o --color %l | grep ^-..x',
572 572 )
573 573 # The BSDs don't ship GNU ls, so they don't understand the
574 574 # --color switch out of the box
575 575 if 'bsd' in sys.platform:
576 576 ls_extra = ( # ls normal files only
577 577 'lf ls -lF | grep ^-',
578 578 # ls symbolic links
579 579 'lk ls -lF | grep ^l',
580 580 # directories or links to directories,
581 581 'ldir ls -lF | grep /$',
582 582 # things which are executable
583 583 'lx ls -lF | grep ^-..x',
584 584 )
585 585 auto_alias = auto_alias + ls_extra
586 586 elif os.name in ['nt','dos']:
587 587 auto_alias = ('ls dir /on',
588 588 'ddir dir /ad /on', 'ldir dir /ad /on',
589 589 'mkdir mkdir','rmdir rmdir','echo echo',
590 590 'ren ren','cls cls','copy copy')
591 591 else:
592 592 auto_alias = ()
593 593 self.auto_alias = [s.split(None,1) for s in auto_alias]
594 594
595 595 # Produce a public API instance
596 596 self.api = IPython.ipapi.IPApi(self)
597 597
598 598 # Call the actual (public) initializer
599 599 self.init_auto_alias()
600 600
601 601 # track which builtins we add, so we can clean up later
602 602 self.builtins_added = {}
603 603 # This method will add the necessary builtins for operation, but
604 604 # tracking what it did via the builtins_added dict.
605 605 self.add_builtins()
606 606
607 607
608 608
609 609 # end __init__
610 610
611 611 def var_expand(self,cmd,depth=0):
612 612 """Expand python variables in a string.
613 613
614 614 The depth argument indicates how many frames above the caller should
615 615 be walked to look for the local namespace where to expand variables.
616 616
617 617 The global namespace for expansion is always the user's interactive
618 618 namespace.
619 619 """
620 620
621 621 return str(ItplNS(cmd,
622 622 self.user_ns, # globals
623 623 # Skip our own frame in searching for locals:
624 624 sys._getframe(depth+1).f_locals # locals
625 625 ))
626 626
627 627 def pre_config_initialization(self):
628 628 """Pre-configuration init method
629 629
630 630 This is called before the configuration files are processed to
631 631 prepare the services the config files might need.
632 632
633 633 self.rc already has reasonable default values at this point.
634 634 """
635 635 rc = self.rc
636 636 try:
637 637 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
638 638 except exceptions.UnicodeDecodeError:
639 639 print "Your ipythondir can't be decoded to unicode!"
640 640 print "Please set HOME environment variable to something that"
641 641 print r"only has ASCII characters, e.g. c:\home"
642 642 print "Now it is",rc.ipythondir
643 643 sys.exit()
644 644 self.shadowhist = IPython.history.ShadowHist(self.db)
645 645
646 646
647 647 def post_config_initialization(self):
648 648 """Post configuration init method
649 649
650 650 This is called after the configuration files have been processed to
651 651 'finalize' the initialization."""
652 652
653 653 rc = self.rc
654 654
655 655 # Object inspector
656 656 self.inspector = OInspect.Inspector(OInspect.InspectColors,
657 657 PyColorize.ANSICodeColors,
658 658 'NoColor',
659 659 rc.object_info_string_level)
660 660
661 661 self.rl_next_input = None
662 662 self.rl_do_indent = False
663 663 # Load readline proper
664 664 if rc.readline:
665 665 self.init_readline()
666 666
667 667
668 668 # local shortcut, this is used a LOT
669 669 self.log = self.logger.log
670 670
671 671 # Initialize cache, set in/out prompts and printing system
672 672 self.outputcache = CachedOutput(self,
673 673 rc.cache_size,
674 674 rc.pprint,
675 675 input_sep = rc.separate_in,
676 676 output_sep = rc.separate_out,
677 677 output_sep2 = rc.separate_out2,
678 678 ps1 = rc.prompt_in1,
679 679 ps2 = rc.prompt_in2,
680 680 ps_out = rc.prompt_out,
681 681 pad_left = rc.prompts_pad_left)
682 682
683 683 # user may have over-ridden the default print hook:
684 684 try:
685 685 self.outputcache.__class__.display = self.hooks.display
686 686 except AttributeError:
687 687 pass
688 688
689 689 # I don't like assigning globally to sys, because it means when
690 690 # embedding instances, each embedded instance overrides the previous
691 691 # choice. But sys.displayhook seems to be called internally by exec,
692 692 # so I don't see a way around it. We first save the original and then
693 693 # overwrite it.
694 694 self.sys_displayhook = sys.displayhook
695 695 sys.displayhook = self.outputcache
696 696
697 697 # Do a proper resetting of doctest, including the necessary displayhook
698 698 # monkeypatching
699 699 doctest_reload()
700 700
701 701 # Set user colors (don't do it in the constructor above so that it
702 702 # doesn't crash if colors option is invalid)
703 703 self.magic_colors(rc.colors)
704 704
705 705 # Set calling of pdb on exceptions
706 706 self.call_pdb = rc.pdb
707 707
708 708 # Load user aliases
709 709 for alias in rc.alias:
710 710 self.magic_alias(alias)
711 711
712 712 self.hooks.late_startup_hook()
713 713
714 714 batchrun = False
715 715 for batchfile in [path(arg) for arg in self.rc.args
716 716 if arg.lower().endswith('.ipy')]:
717 717 if not batchfile.isfile():
718 718 print "No such batch file:", batchfile
719 719 continue
720 720 self.api.runlines(batchfile.text())
721 721 batchrun = True
722 722 # without -i option, exit after running the batch file
723 723 if batchrun and not self.rc.interact:
724 724 self.exit_now = True
725 725
726 726 def add_builtins(self):
727 727 """Store ipython references into the builtin namespace.
728 728
729 729 Some parts of ipython operate via builtins injected here, which hold a
730 730 reference to IPython itself."""
731 731
732 732 # TODO: deprecate all except _ip; 'jobs' should be installed
733 733 # by an extension and the rest are under _ip, ipalias is redundant
734 734 builtins_new = dict(__IPYTHON__ = self,
735 735 ip_set_hook = self.set_hook,
736 736 jobs = self.jobs,
737 737 ipmagic = wrap_deprecated(self.ipmagic,'_ip.magic()'),
738 738 ipalias = wrap_deprecated(self.ipalias),
739 739 ipsystem = wrap_deprecated(self.ipsystem,'_ip.system()'),
740 740 _ip = self.api
741 741 )
742 742 for biname,bival in builtins_new.items():
743 743 try:
744 744 # store the orignal value so we can restore it
745 745 self.builtins_added[biname] = __builtin__.__dict__[biname]
746 746 except KeyError:
747 747 # or mark that it wasn't defined, and we'll just delete it at
748 748 # cleanup
749 749 self.builtins_added[biname] = Undefined
750 750 __builtin__.__dict__[biname] = bival
751 751
752 752 # Keep in the builtins a flag for when IPython is active. We set it
753 753 # with setdefault so that multiple nested IPythons don't clobber one
754 754 # another. Each will increase its value by one upon being activated,
755 755 # which also gives us a way to determine the nesting level.
756 756 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
757 757
758 758 def clean_builtins(self):
759 759 """Remove any builtins which might have been added by add_builtins, or
760 760 restore overwritten ones to their previous values."""
761 761 for biname,bival in self.builtins_added.items():
762 762 if bival is Undefined:
763 763 del __builtin__.__dict__[biname]
764 764 else:
765 765 __builtin__.__dict__[biname] = bival
766 766 self.builtins_added.clear()
767 767
768 768 def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
769 769 """set_hook(name,hook) -> sets an internal IPython hook.
770 770
771 771 IPython exposes some of its internal API as user-modifiable hooks. By
772 772 adding your function to one of these hooks, you can modify IPython's
773 773 behavior to call at runtime your own routines."""
774 774
775 775 # At some point in the future, this should validate the hook before it
776 776 # accepts it. Probably at least check that the hook takes the number
777 777 # of args it's supposed to.
778 778
779 779 f = new.instancemethod(hook,self,self.__class__)
780 780
781 781 # check if the hook is for strdispatcher first
782 782 if str_key is not None:
783 783 sdp = self.strdispatchers.get(name, StrDispatch())
784 784 sdp.add_s(str_key, f, priority )
785 785 self.strdispatchers[name] = sdp
786 786 return
787 787 if re_key is not None:
788 788 sdp = self.strdispatchers.get(name, StrDispatch())
789 789 sdp.add_re(re.compile(re_key), f, priority )
790 790 self.strdispatchers[name] = sdp
791 791 return
792 792
793 793 dp = getattr(self.hooks, name, None)
794 794 if name not in IPython.hooks.__all__:
795 795 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
796 796 if not dp:
797 797 dp = IPython.hooks.CommandChainDispatcher()
798 798
799 799 try:
800 800 dp.add(f,priority)
801 801 except AttributeError:
802 802 # it was not commandchain, plain old func - replace
803 803 dp = f
804 804
805 805 setattr(self.hooks,name, dp)
806 806
807 807
808 808 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
809 809
810 810 def set_crash_handler(self,crashHandler):
811 811 """Set the IPython crash handler.
812 812
813 813 This must be a callable with a signature suitable for use as
814 814 sys.excepthook."""
815 815
816 816 # Install the given crash handler as the Python exception hook
817 817 sys.excepthook = crashHandler
818 818
819 819 # The instance will store a pointer to this, so that runtime code
820 820 # (such as magics) can access it. This is because during the
821 821 # read-eval loop, it gets temporarily overwritten (to deal with GUI
822 822 # frameworks).
823 823 self.sys_excepthook = sys.excepthook
824 824
825 825
826 826 def set_custom_exc(self,exc_tuple,handler):
827 827 """set_custom_exc(exc_tuple,handler)
828 828
829 829 Set a custom exception handler, which will be called if any of the
830 830 exceptions in exc_tuple occur in the mainloop (specifically, in the
831 831 runcode() method.
832 832
833 833 Inputs:
834 834
835 835 - exc_tuple: a *tuple* of valid exceptions to call the defined
836 836 handler for. It is very important that you use a tuple, and NOT A
837 837 LIST here, because of the way Python's except statement works. If
838 838 you only want to trap a single exception, use a singleton tuple:
839 839
840 840 exc_tuple == (MyCustomException,)
841 841
842 842 - handler: this must be defined as a function with the following
843 843 basic interface: def my_handler(self,etype,value,tb).
844 844
845 845 This will be made into an instance method (via new.instancemethod)
846 846 of IPython itself, and it will be called if any of the exceptions
847 847 listed in the exc_tuple are caught. If the handler is None, an
848 848 internal basic one is used, which just prints basic info.
849 849
850 850 WARNING: by putting in your own exception handler into IPython's main
851 851 execution loop, you run a very good chance of nasty crashes. This
852 852 facility should only be used if you really know what you are doing."""
853 853
854 854 assert type(exc_tuple)==type(()) , \
855 855 "The custom exceptions must be given AS A TUPLE."
856 856
857 857 def dummy_handler(self,etype,value,tb):
858 858 print '*** Simple custom exception handler ***'
859 859 print 'Exception type :',etype
860 860 print 'Exception value:',value
861 861 print 'Traceback :',tb
862 862 print 'Source code :','\n'.join(self.buffer)
863 863
864 864 if handler is None: handler = dummy_handler
865 865
866 866 self.CustomTB = new.instancemethod(handler,self,self.__class__)
867 867 self.custom_exceptions = exc_tuple
868 868
869 869 def set_custom_completer(self,completer,pos=0):
870 870 """set_custom_completer(completer,pos=0)
871 871
872 872 Adds a new custom completer function.
873 873
874 874 The position argument (defaults to 0) is the index in the completers
875 875 list where you want the completer to be inserted."""
876 876
877 877 newcomp = new.instancemethod(completer,self.Completer,
878 878 self.Completer.__class__)
879 879 self.Completer.matchers.insert(pos,newcomp)
880 880
881 881 def set_completer(self):
882 882 """reset readline's completer to be our own."""
883 883 self.readline.set_completer(self.Completer.complete)
884 884
885 885 def _get_call_pdb(self):
886 886 return self._call_pdb
887 887
888 888 def _set_call_pdb(self,val):
889 889
890 890 if val not in (0,1,False,True):
891 891 raise ValueError,'new call_pdb value must be boolean'
892 892
893 893 # store value in instance
894 894 self._call_pdb = val
895 895
896 896 # notify the actual exception handlers
897 897 self.InteractiveTB.call_pdb = val
898 898 if self.isthreaded:
899 899 try:
900 900 self.sys_excepthook.call_pdb = val
901 901 except:
902 902 warn('Failed to activate pdb for threaded exception handler')
903 903
904 904 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
905 905 'Control auto-activation of pdb at exceptions')
906 906
907 907
908 908 # These special functions get installed in the builtin namespace, to
909 909 # provide programmatic (pure python) access to magics, aliases and system
910 910 # calls. This is important for logging, user scripting, and more.
911 911
912 912 # We are basically exposing, via normal python functions, the three
913 913 # mechanisms in which ipython offers special call modes (magics for
914 914 # internal control, aliases for direct system access via pre-selected
915 915 # names, and !cmd for calling arbitrary system commands).
916 916
917 917 def ipmagic(self,arg_s):
918 918 """Call a magic function by name.
919 919
920 920 Input: a string containing the name of the magic function to call and any
921 921 additional arguments to be passed to the magic.
922 922
923 923 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
924 924 prompt:
925 925
926 926 In[1]: %name -opt foo bar
927 927
928 928 To call a magic without arguments, simply use ipmagic('name').
929 929
930 930 This provides a proper Python function to call IPython's magics in any
931 931 valid Python code you can type at the interpreter, including loops and
932 932 compound statements. It is added by IPython to the Python builtin
933 933 namespace upon initialization."""
934 934
935 935 args = arg_s.split(' ',1)
936 936 magic_name = args[0]
937 937 magic_name = magic_name.lstrip(self.ESC_MAGIC)
938 938
939 939 try:
940 940 magic_args = args[1]
941 941 except IndexError:
942 942 magic_args = ''
943 943 fn = getattr(self,'magic_'+magic_name,None)
944 944 if fn is None:
945 945 error("Magic function `%s` not found." % magic_name)
946 946 else:
947 947 magic_args = self.var_expand(magic_args,1)
948 948 return fn(magic_args)
949 949
950 950 def ipalias(self,arg_s):
951 951 """Call an alias by name.
952 952
953 953 Input: a string containing the name of the alias to call and any
954 954 additional arguments to be passed to the magic.
955 955
956 956 ipalias('name -opt foo bar') is equivalent to typing at the ipython
957 957 prompt:
958 958
959 959 In[1]: name -opt foo bar
960 960
961 961 To call an alias without arguments, simply use ipalias('name').
962 962
963 963 This provides a proper Python function to call IPython's aliases in any
964 964 valid Python code you can type at the interpreter, including loops and
965 965 compound statements. It is added by IPython to the Python builtin
966 966 namespace upon initialization."""
967 967
968 968 args = arg_s.split(' ',1)
969 969 alias_name = args[0]
970 970 try:
971 971 alias_args = args[1]
972 972 except IndexError:
973 973 alias_args = ''
974 974 if alias_name in self.alias_table:
975 975 self.call_alias(alias_name,alias_args)
976 976 else:
977 977 error("Alias `%s` not found." % alias_name)
978 978
979 979 def ipsystem(self,arg_s):
980 980 """Make a system call, using IPython."""
981 981
982 982 self.system(arg_s)
983 983
984 984 def complete(self,text):
985 985 """Return a sorted list of all possible completions on text.
986 986
987 987 Inputs:
988 988
989 989 - text: a string of text to be completed on.
990 990
991 991 This is a wrapper around the completion mechanism, similar to what
992 992 readline does at the command line when the TAB key is hit. By
993 993 exposing it as a method, it can be used by other non-readline
994 994 environments (such as GUIs) for text completion.
995 995
996 996 Simple usage example:
997 997
998 998 In [1]: x = 'hello'
999 999
1000 1000 In [2]: __IP.complete('x.l')
1001 1001 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
1002 1002
1003 1003 complete = self.Completer.complete
1004 1004 state = 0
1005 1005 # use a dict so we get unique keys, since ipyhton's multiple
1006 1006 # completers can return duplicates. When we make 2.4 a requirement,
1007 1007 # start using sets instead, which are faster.
1008 1008 comps = {}
1009 1009 while True:
1010 1010 newcomp = complete(text,state,line_buffer=text)
1011 1011 if newcomp is None:
1012 1012 break
1013 1013 comps[newcomp] = 1
1014 1014 state += 1
1015 1015 outcomps = comps.keys()
1016 1016 outcomps.sort()
1017 1017 return outcomps
1018 1018
1019 1019 def set_completer_frame(self, frame=None):
1020 1020 if frame:
1021 1021 self.Completer.namespace = frame.f_locals
1022 1022 self.Completer.global_namespace = frame.f_globals
1023 1023 else:
1024 1024 self.Completer.namespace = self.user_ns
1025 1025 self.Completer.global_namespace = self.user_global_ns
1026 1026
1027 1027 def init_auto_alias(self):
1028 1028 """Define some aliases automatically.
1029 1029
1030 1030 These are ALL parameter-less aliases"""
1031 1031
1032 1032 for alias,cmd in self.auto_alias:
1033 1033 self.getapi().defalias(alias,cmd)
1034 1034
1035 1035
1036 1036 def alias_table_validate(self,verbose=0):
1037 1037 """Update information about the alias table.
1038 1038
1039 1039 In particular, make sure no Python keywords/builtins are in it."""
1040 1040
1041 1041 no_alias = self.no_alias
1042 1042 for k in self.alias_table.keys():
1043 1043 if k in no_alias:
1044 1044 del self.alias_table[k]
1045 1045 if verbose:
1046 1046 print ("Deleting alias <%s>, it's a Python "
1047 1047 "keyword or builtin." % k)
1048 1048
1049 1049 def set_autoindent(self,value=None):
1050 1050 """Set the autoindent flag, checking for readline support.
1051 1051
1052 1052 If called with no arguments, it acts as a toggle."""
1053 1053
1054 1054 if not self.has_readline:
1055 1055 if os.name == 'posix':
1056 1056 warn("The auto-indent feature requires the readline library")
1057 1057 self.autoindent = 0
1058 1058 return
1059 1059 if value is None:
1060 1060 self.autoindent = not self.autoindent
1061 1061 else:
1062 1062 self.autoindent = value
1063 1063
1064 1064 def rc_set_toggle(self,rc_field,value=None):
1065 1065 """Set or toggle a field in IPython's rc config. structure.
1066 1066
1067 1067 If called with no arguments, it acts as a toggle.
1068 1068
1069 1069 If called with a non-existent field, the resulting AttributeError
1070 1070 exception will propagate out."""
1071 1071
1072 1072 rc_val = getattr(self.rc,rc_field)
1073 1073 if value is None:
1074 1074 value = not rc_val
1075 1075 setattr(self.rc,rc_field,value)
1076 1076
1077 1077 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1078 1078 """Install the user configuration directory.
1079 1079
1080 1080 Can be called when running for the first time or to upgrade the user's
1081 1081 .ipython/ directory with the mode parameter. Valid modes are 'install'
1082 1082 and 'upgrade'."""
1083 1083
1084 1084 def wait():
1085 1085 try:
1086 1086 raw_input("Please press <RETURN> to start IPython.")
1087 1087 except EOFError:
1088 1088 print >> Term.cout
1089 1089 print '*'*70
1090 1090
1091 1091 cwd = os.getcwd() # remember where we started
1092 1092 glb = glob.glob
1093 1093 print '*'*70
1094 1094 if mode == 'install':
1095 1095 print \
1096 1096 """Welcome to IPython. I will try to create a personal configuration directory
1097 1097 where you can customize many aspects of IPython's functionality in:\n"""
1098 1098 else:
1099 1099 print 'I am going to upgrade your configuration in:'
1100 1100
1101 1101 print ipythondir
1102 1102
1103 1103 rcdirend = os.path.join('IPython','UserConfig')
1104 1104 cfg = lambda d: os.path.join(d,rcdirend)
1105 1105 try:
1106 1106 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1107 1107 print "Initializing from configuration",rcdir
1108 1108 except IndexError:
1109 1109 warning = """
1110 1110 Installation error. IPython's directory was not found.
1111 1111
1112 1112 Check the following:
1113 1113
1114 1114 The ipython/IPython directory should be in a directory belonging to your
1115 1115 PYTHONPATH environment variable (that is, it should be in a directory
1116 1116 belonging to sys.path). You can copy it explicitly there or just link to it.
1117 1117
1118 1118 IPython will create a minimal default configuration for you.
1119 1119
1120 1120 """
1121 1121 warn(warning)
1122 1122 wait()
1123 1123
1124 1124 if sys.platform =='win32':
1125 1125 inif = 'ipythonrc.ini'
1126 1126 else:
1127 1127 inif = 'ipythonrc'
1128 1128 minimal_setup = {'ipy_user_conf.py' : 'import ipy_defaults', inif : '# intentionally left blank' }
1129 1129 os.makedirs(ipythondir)
1130 1130 for f, cont in minimal_setup.items():
1131 1131 open(ipythondir + '/' + f,'w').write(cont)
1132 1132
1133 1133 return
1134 1134
1135 1135 if mode == 'install':
1136 1136 try:
1137 1137 shutil.copytree(rcdir,ipythondir)
1138 1138 os.chdir(ipythondir)
1139 1139 rc_files = glb("ipythonrc*")
1140 1140 for rc_file in rc_files:
1141 1141 os.rename(rc_file,rc_file+rc_suffix)
1142 1142 except:
1143 1143 warning = """
1144 1144
1145 1145 There was a problem with the installation:
1146 1146 %s
1147 1147 Try to correct it or contact the developers if you think it's a bug.
1148 1148 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1149 1149 warn(warning)
1150 1150 wait()
1151 1151 return
1152 1152
1153 1153 elif mode == 'upgrade':
1154 1154 try:
1155 1155 os.chdir(ipythondir)
1156 1156 except:
1157 1157 print """
1158 1158 Can not upgrade: changing to directory %s failed. Details:
1159 1159 %s
1160 1160 """ % (ipythondir,sys.exc_info()[1])
1161 1161 wait()
1162 1162 return
1163 1163 else:
1164 1164 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1165 1165 for new_full_path in sources:
1166 1166 new_filename = os.path.basename(new_full_path)
1167 1167 if new_filename.startswith('ipythonrc'):
1168 1168 new_filename = new_filename + rc_suffix
1169 1169 # The config directory should only contain files, skip any
1170 1170 # directories which may be there (like CVS)
1171 1171 if os.path.isdir(new_full_path):
1172 1172 continue
1173 1173 if os.path.exists(new_filename):
1174 1174 old_file = new_filename+'.old'
1175 1175 if os.path.exists(old_file):
1176 1176 os.remove(old_file)
1177 1177 os.rename(new_filename,old_file)
1178 1178 shutil.copy(new_full_path,new_filename)
1179 1179 else:
1180 1180 raise ValueError,'unrecognized mode for install:',`mode`
1181 1181
1182 1182 # Fix line-endings to those native to each platform in the config
1183 1183 # directory.
1184 1184 try:
1185 1185 os.chdir(ipythondir)
1186 1186 except:
1187 1187 print """
1188 1188 Problem: changing to directory %s failed.
1189 1189 Details:
1190 1190 %s
1191 1191
1192 1192 Some configuration files may have incorrect line endings. This should not
1193 1193 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1194 1194 wait()
1195 1195 else:
1196 1196 for fname in glb('ipythonrc*'):
1197 1197 try:
1198 1198 native_line_ends(fname,backup=0)
1199 1199 except IOError:
1200 1200 pass
1201 1201
1202 1202 if mode == 'install':
1203 1203 print """
1204 1204 Successful installation!
1205 1205
1206 1206 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1207 1207 IPython manual (there are both HTML and PDF versions supplied with the
1208 1208 distribution) to make sure that your system environment is properly configured
1209 1209 to take advantage of IPython's features.
1210 1210
1211 1211 Important note: the configuration system has changed! The old system is
1212 1212 still in place, but its setting may be partly overridden by the settings in
1213 1213 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1214 1214 if some of the new settings bother you.
1215 1215
1216 1216 """
1217 1217 else:
1218 1218 print """
1219 1219 Successful upgrade!
1220 1220
1221 1221 All files in your directory:
1222 1222 %(ipythondir)s
1223 1223 which would have been overwritten by the upgrade were backed up with a .old
1224 1224 extension. If you had made particular customizations in those files you may
1225 1225 want to merge them back into the new files.""" % locals()
1226 1226 wait()
1227 1227 os.chdir(cwd)
1228 1228 # end user_setup()
1229 1229
1230 1230 def atexit_operations(self):
1231 1231 """This will be executed at the time of exit.
1232 1232
1233 1233 Saving of persistent data should be performed here. """
1234 1234
1235 1235 #print '*** IPython exit cleanup ***' # dbg
1236 1236 # input history
1237 1237 self.savehist()
1238 1238
1239 1239 # Cleanup all tempfiles left around
1240 1240 for tfile in self.tempfiles:
1241 1241 try:
1242 1242 os.unlink(tfile)
1243 1243 except OSError:
1244 1244 pass
1245 1245
1246 1246 self.hooks.shutdown_hook()
1247 1247
1248 1248 def savehist(self):
1249 1249 """Save input history to a file (via readline library)."""
1250 1250 try:
1251 1251 self.readline.write_history_file(self.histfile)
1252 1252 except:
1253 1253 print 'Unable to save IPython command history to file: ' + \
1254 1254 `self.histfile`
1255 1255
1256 1256 def reloadhist(self):
1257 1257 """Reload the input history from disk file."""
1258 1258
1259 1259 if self.has_readline:
1260 1260 self.readline.clear_history()
1261 1261 self.readline.read_history_file(self.shell.histfile)
1262 1262
1263 1263 def history_saving_wrapper(self, func):
1264 1264 """ Wrap func for readline history saving
1265 1265
1266 1266 Convert func into callable that saves & restores
1267 1267 history around the call """
1268 1268
1269 1269 if not self.has_readline:
1270 1270 return func
1271 1271
1272 1272 def wrapper():
1273 1273 self.savehist()
1274 1274 try:
1275 1275 func()
1276 1276 finally:
1277 1277 readline.read_history_file(self.histfile)
1278 1278 return wrapper
1279 1279
1280 1280
1281 1281 def pre_readline(self):
1282 1282 """readline hook to be used at the start of each line.
1283 1283
1284 1284 Currently it handles auto-indent only."""
1285 1285
1286 1286 #debugx('self.indent_current_nsp','pre_readline:')
1287 1287
1288 1288 if self.rl_do_indent:
1289 1289 self.readline.insert_text(self.indent_current_str())
1290 1290 if self.rl_next_input is not None:
1291 1291 self.readline.insert_text(self.rl_next_input)
1292 1292 self.rl_next_input = None
1293 1293
1294 1294 def init_readline(self):
1295 1295 """Command history completion/saving/reloading."""
1296 1296
1297 1297
1298 1298 import IPython.rlineimpl as readline
1299 1299
1300 1300 if not readline.have_readline:
1301 1301 self.has_readline = 0
1302 1302 self.readline = None
1303 1303 # no point in bugging windows users with this every time:
1304 1304 warn('Readline services not available on this platform.')
1305 1305 else:
1306 1306 sys.modules['readline'] = readline
1307 1307 import atexit
1308 1308 from IPython.completer import IPCompleter
1309 1309 self.Completer = IPCompleter(self,
1310 1310 self.user_ns,
1311 1311 self.user_global_ns,
1312 1312 self.rc.readline_omit__names,
1313 1313 self.alias_table)
1314 1314 sdisp = self.strdispatchers.get('complete_command', StrDispatch())
1315 1315 self.strdispatchers['complete_command'] = sdisp
1316 1316 self.Completer.custom_completers = sdisp
1317 1317 # Platform-specific configuration
1318 1318 if os.name == 'nt':
1319 1319 self.readline_startup_hook = readline.set_pre_input_hook
1320 1320 else:
1321 1321 self.readline_startup_hook = readline.set_startup_hook
1322 1322
1323 1323 # Load user's initrc file (readline config)
1324 1324 # Or if libedit is used, load editrc.
1325 1325 inputrc_name = os.environ.get('INPUTRC')
1326 1326 if inputrc_name is None:
1327 1327 home_dir = get_home_dir()
1328 1328 if home_dir is not None:
1329 1329 inputrc_name = '.inputrc'
1330 1330 if readline.uses_libedit:
1331 1331 inputrc_name = '.editrc'
1332 1332 inputrc_name = os.path.join(home_dir, inputrc_name)
1333 1333 if os.path.isfile(inputrc_name):
1334 1334 try:
1335 1335 readline.read_init_file(inputrc_name)
1336 1336 except:
1337 1337 warn('Problems reading readline initialization file <%s>'
1338 1338 % inputrc_name)
1339 1339
1340 1340 self.has_readline = 1
1341 1341 self.readline = readline
1342 1342 # save this in sys so embedded copies can restore it properly
1343 1343 sys.ipcompleter = self.Completer.complete
1344 1344 self.set_completer()
1345 1345
1346 1346 # Configure readline according to user's prefs
1347 1347 # This is only done if GNU readline is being used. If libedit
1348 1348 # is being used (as on Leopard) the readline config is
1349 1349 # not run as the syntax for libedit is different.
1350 1350 if not readline.uses_libedit:
1351 1351 for rlcommand in self.rc.readline_parse_and_bind:
1352 1352 readline.parse_and_bind(rlcommand)
1353 1353
1354 1354 # remove some chars from the delimiters list
1355 1355 delims = readline.get_completer_delims()
1356 1356 delims = delims.translate(string._idmap,
1357 1357 self.rc.readline_remove_delims)
1358 1358 readline.set_completer_delims(delims)
1359 1359 # otherwise we end up with a monster history after a while:
1360 1360 readline.set_history_length(1000)
1361 1361 try:
1362 1362 #print '*** Reading readline history' # dbg
1363 1363 readline.read_history_file(self.histfile)
1364 1364 except IOError:
1365 1365 pass # It doesn't exist yet.
1366 1366
1367 1367 atexit.register(self.atexit_operations)
1368 1368 del atexit
1369 1369
1370 1370 # Configure auto-indent for all platforms
1371 1371 self.set_autoindent(self.rc.autoindent)
1372 1372
1373 1373 def ask_yes_no(self,prompt,default=True):
1374 1374 if self.rc.quiet:
1375 1375 return True
1376 1376 return ask_yes_no(prompt,default)
1377 1377
1378 1378 def _should_recompile(self,e):
1379 1379 """Utility routine for edit_syntax_error"""
1380 1380
1381 1381 if e.filename in ('<ipython console>','<input>','<string>',
1382 1382 '<console>','<BackgroundJob compilation>',
1383 1383 None):
1384 1384
1385 1385 return False
1386 1386 try:
1387 1387 if (self.rc.autoedit_syntax and
1388 1388 not self.ask_yes_no('Return to editor to correct syntax error? '
1389 1389 '[Y/n] ','y')):
1390 1390 return False
1391 1391 except EOFError:
1392 1392 return False
1393 1393
1394 1394 def int0(x):
1395 1395 try:
1396 1396 return int(x)
1397 1397 except TypeError:
1398 1398 return 0
1399 1399 # always pass integer line and offset values to editor hook
1400 1400 self.hooks.fix_error_editor(e.filename,
1401 1401 int0(e.lineno),int0(e.offset),e.msg)
1402 1402 return True
1403 1403
1404 1404 def edit_syntax_error(self):
1405 1405 """The bottom half of the syntax error handler called in the main loop.
1406 1406
1407 1407 Loop until syntax error is fixed or user cancels.
1408 1408 """
1409 1409
1410 1410 while self.SyntaxTB.last_syntax_error:
1411 1411 # copy and clear last_syntax_error
1412 1412 err = self.SyntaxTB.clear_err_state()
1413 1413 if not self._should_recompile(err):
1414 1414 return
1415 1415 try:
1416 1416 # may set last_syntax_error again if a SyntaxError is raised
1417 1417 self.safe_execfile(err.filename,self.user_ns)
1418 1418 except:
1419 1419 self.showtraceback()
1420 1420 else:
1421 1421 try:
1422 1422 f = file(err.filename)
1423 1423 try:
1424 1424 sys.displayhook(f.read())
1425 1425 finally:
1426 1426 f.close()
1427 1427 except:
1428 1428 self.showtraceback()
1429 1429
1430 1430 def showsyntaxerror(self, filename=None):
1431 1431 """Display the syntax error that just occurred.
1432 1432
1433 1433 This doesn't display a stack trace because there isn't one.
1434 1434
1435 1435 If a filename is given, it is stuffed in the exception instead
1436 1436 of what was there before (because Python's parser always uses
1437 1437 "<string>" when reading from a string).
1438 1438 """
1439 1439 etype, value, last_traceback = sys.exc_info()
1440 1440
1441 1441 # See note about these variables in showtraceback() below
1442 1442 sys.last_type = etype
1443 1443 sys.last_value = value
1444 1444 sys.last_traceback = last_traceback
1445 1445
1446 1446 if filename and etype is SyntaxError:
1447 1447 # Work hard to stuff the correct filename in the exception
1448 1448 try:
1449 1449 msg, (dummy_filename, lineno, offset, line) = value
1450 1450 except:
1451 1451 # Not the format we expect; leave it alone
1452 1452 pass
1453 1453 else:
1454 1454 # Stuff in the right filename
1455 1455 try:
1456 1456 # Assume SyntaxError is a class exception
1457 1457 value = SyntaxError(msg, (filename, lineno, offset, line))
1458 1458 except:
1459 1459 # If that failed, assume SyntaxError is a string
1460 1460 value = msg, (filename, lineno, offset, line)
1461 1461 self.SyntaxTB(etype,value,[])
1462 1462
1463 1463 def debugger(self,force=False):
1464 1464 """Call the pydb/pdb debugger.
1465 1465
1466 1466 Keywords:
1467 1467
1468 1468 - force(False): by default, this routine checks the instance call_pdb
1469 1469 flag and does not actually invoke the debugger if the flag is false.
1470 1470 The 'force' option forces the debugger to activate even if the flag
1471 1471 is false.
1472 1472 """
1473 1473
1474 1474 if not (force or self.call_pdb):
1475 1475 return
1476 1476
1477 1477 if not hasattr(sys,'last_traceback'):
1478 1478 error('No traceback has been produced, nothing to debug.')
1479 1479 return
1480 1480
1481 1481 # use pydb if available
1482 1482 if Debugger.has_pydb:
1483 1483 from pydb import pm
1484 1484 else:
1485 1485 # fallback to our internal debugger
1486 1486 pm = lambda : self.InteractiveTB.debugger(force=True)
1487 1487 self.history_saving_wrapper(pm)()
1488 1488
1489 1489 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1490 1490 """Display the exception that just occurred.
1491 1491
1492 1492 If nothing is known about the exception, this is the method which
1493 1493 should be used throughout the code for presenting user tracebacks,
1494 1494 rather than directly invoking the InteractiveTB object.
1495 1495
1496 1496 A specific showsyntaxerror() also exists, but this method can take
1497 1497 care of calling it if needed, so unless you are explicitly catching a
1498 1498 SyntaxError exception, don't try to analyze the stack manually and
1499 1499 simply call this method."""
1500 1500
1501 1501
1502 1502 # Though this won't be called by syntax errors in the input line,
1503 1503 # there may be SyntaxError cases whith imported code.
1504 1504
1505 1505
1506 1506 if exc_tuple is None:
1507 1507 etype, value, tb = sys.exc_info()
1508 1508 else:
1509 1509 etype, value, tb = exc_tuple
1510 1510
1511 1511 if etype is SyntaxError:
1512 1512 self.showsyntaxerror(filename)
1513 1513 elif etype is IPython.ipapi.UsageError:
1514 1514 print "UsageError:", value
1515 1515 else:
1516 1516 # WARNING: these variables are somewhat deprecated and not
1517 1517 # necessarily safe to use in a threaded environment, but tools
1518 1518 # like pdb depend on their existence, so let's set them. If we
1519 1519 # find problems in the field, we'll need to revisit their use.
1520 1520 sys.last_type = etype
1521 1521 sys.last_value = value
1522 1522 sys.last_traceback = tb
1523 1523
1524 1524 if etype in self.custom_exceptions:
1525 1525 self.CustomTB(etype,value,tb)
1526 1526 else:
1527 1527 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1528 1528 if self.InteractiveTB.call_pdb and self.has_readline:
1529 1529 # pdb mucks up readline, fix it back
1530 1530 self.set_completer()
1531 1531
1532 1532
1533 1533 def mainloop(self,banner=None):
1534 1534 """Creates the local namespace and starts the mainloop.
1535 1535
1536 1536 If an optional banner argument is given, it will override the
1537 1537 internally created default banner."""
1538 1538
1539 1539 if self.rc.c: # Emulate Python's -c option
1540 1540 self.exec_init_cmd()
1541 1541 if banner is None:
1542 1542 if not self.rc.banner:
1543 1543 banner = ''
1544 1544 # banner is string? Use it directly!
1545 1545 elif isinstance(self.rc.banner,basestring):
1546 1546 banner = self.rc.banner
1547 1547 else:
1548 1548 banner = self.BANNER+self.banner2
1549 1549
1550 1550 self.interact(banner)
1551 1551
1552 1552 def exec_init_cmd(self):
1553 1553 """Execute a command given at the command line.
1554 1554
1555 1555 This emulates Python's -c option."""
1556 1556
1557 1557 #sys.argv = ['-c']
1558 1558 self.push(self.prefilter(self.rc.c, False))
1559 1559 if not self.rc.interact:
1560 1560 self.exit_now = True
1561 1561
1562 1562 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1563 1563 """Embeds IPython into a running python program.
1564 1564
1565 1565 Input:
1566 1566
1567 1567 - header: An optional header message can be specified.
1568 1568
1569 1569 - local_ns, global_ns: working namespaces. If given as None, the
1570 1570 IPython-initialized one is updated with __main__.__dict__, so that
1571 1571 program variables become visible but user-specific configuration
1572 1572 remains possible.
1573 1573
1574 1574 - stack_depth: specifies how many levels in the stack to go to
1575 1575 looking for namespaces (when local_ns and global_ns are None). This
1576 1576 allows an intermediate caller to make sure that this function gets
1577 1577 the namespace from the intended level in the stack. By default (0)
1578 1578 it will get its locals and globals from the immediate caller.
1579 1579
1580 1580 Warning: it's possible to use this in a program which is being run by
1581 1581 IPython itself (via %run), but some funny things will happen (a few
1582 1582 globals get overwritten). In the future this will be cleaned up, as
1583 1583 there is no fundamental reason why it can't work perfectly."""
1584 1584
1585 1585 # Get locals and globals from caller
1586 1586 if local_ns is None or global_ns is None:
1587 1587 call_frame = sys._getframe(stack_depth).f_back
1588 1588
1589 1589 if local_ns is None:
1590 1590 local_ns = call_frame.f_locals
1591 1591 if global_ns is None:
1592 1592 global_ns = call_frame.f_globals
1593 1593
1594 1594 # Update namespaces and fire up interpreter
1595 1595
1596 1596 # The global one is easy, we can just throw it in
1597 1597 self.user_global_ns = global_ns
1598 1598
1599 1599 # but the user/local one is tricky: ipython needs it to store internal
1600 1600 # data, but we also need the locals. We'll copy locals in the user
1601 1601 # one, but will track what got copied so we can delete them at exit.
1602 1602 # This is so that a later embedded call doesn't see locals from a
1603 1603 # previous call (which most likely existed in a separate scope).
1604 1604 local_varnames = local_ns.keys()
1605 1605 self.user_ns.update(local_ns)
1606 1606
1607 1607 # Patch for global embedding to make sure that things don't overwrite
1608 1608 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1609 1609 # FIXME. Test this a bit more carefully (the if.. is new)
1610 1610 if local_ns is None and global_ns is None:
1611 1611 self.user_global_ns.update(__main__.__dict__)
1612 1612
1613 1613 # make sure the tab-completer has the correct frame information, so it
1614 1614 # actually completes using the frame's locals/globals
1615 1615 self.set_completer_frame()
1616 1616
1617 1617 # before activating the interactive mode, we need to make sure that
1618 1618 # all names in the builtin namespace needed by ipython point to
1619 1619 # ourselves, and not to other instances.
1620 1620 self.add_builtins()
1621 1621
1622 1622 self.interact(header)
1623 1623
1624 1624 # now, purge out the user namespace from anything we might have added
1625 1625 # from the caller's local namespace
1626 1626 delvar = self.user_ns.pop
1627 1627 for var in local_varnames:
1628 1628 delvar(var,None)
1629 1629 # and clean builtins we may have overridden
1630 1630 self.clean_builtins()
1631 1631
1632 1632 def interact(self, banner=None):
1633 1633 """Closely emulate the interactive Python console.
1634 1634
1635 1635 The optional banner argument specify the banner to print
1636 1636 before the first interaction; by default it prints a banner
1637 1637 similar to the one printed by the real Python interpreter,
1638 1638 followed by the current class name in parentheses (so as not
1639 1639 to confuse this with the real interpreter -- since it's so
1640 1640 close!).
1641 1641
1642 1642 """
1643 1643
1644 1644 if self.exit_now:
1645 1645 # batch run -> do not interact
1646 1646 return
1647 1647 cprt = 'Type "copyright", "credits" or "license" for more information.'
1648 1648 if banner is None:
1649 1649 self.write("Python %s on %s\n%s\n(%s)\n" %
1650 1650 (sys.version, sys.platform, cprt,
1651 1651 self.__class__.__name__))
1652 1652 else:
1653 1653 self.write(banner)
1654 1654
1655 1655 more = 0
1656 1656
1657 1657 # Mark activity in the builtins
1658 1658 __builtin__.__dict__['__IPYTHON__active'] += 1
1659 1659
1660 1660 if self.has_readline:
1661 1661 self.readline_startup_hook(self.pre_readline)
1662 1662 # exit_now is set by a call to %Exit or %Quit
1663 1663
1664 1664 while not self.exit_now:
1665 1665 if more:
1666 1666 prompt = self.hooks.generate_prompt(True)
1667 1667 if self.autoindent:
1668 1668 self.rl_do_indent = True
1669 1669
1670 1670 else:
1671 1671 prompt = self.hooks.generate_prompt(False)
1672 1672 try:
1673 1673 line = self.raw_input(prompt,more)
1674 1674 if self.exit_now:
1675 1675 # quick exit on sys.std[in|out] close
1676 1676 break
1677 1677 if self.autoindent:
1678 1678 self.rl_do_indent = False
1679 1679
1680 1680 except KeyboardInterrupt:
1681 1681 self.write('\nKeyboardInterrupt\n')
1682 1682 self.resetbuffer()
1683 1683 # keep cache in sync with the prompt counter:
1684 1684 self.outputcache.prompt_count -= 1
1685 1685
1686 1686 if self.autoindent:
1687 1687 self.indent_current_nsp = 0
1688 1688 more = 0
1689 1689 except EOFError:
1690 1690 if self.autoindent:
1691 1691 self.rl_do_indent = False
1692 1692 self.readline_startup_hook(None)
1693 1693 self.write('\n')
1694 1694 self.exit()
1695 1695 except bdb.BdbQuit:
1696 1696 warn('The Python debugger has exited with a BdbQuit exception.\n'
1697 1697 'Because of how pdb handles the stack, it is impossible\n'
1698 1698 'for IPython to properly format this particular exception.\n'
1699 1699 'IPython will resume normal operation.')
1700 1700 except:
1701 1701 # exceptions here are VERY RARE, but they can be triggered
1702 1702 # asynchronously by signal handlers, for example.
1703 1703 self.showtraceback()
1704 1704 else:
1705 1705 more = self.push(line)
1706 1706 if (self.SyntaxTB.last_syntax_error and
1707 1707 self.rc.autoedit_syntax):
1708 1708 self.edit_syntax_error()
1709 1709
1710 1710 # We are off again...
1711 1711 __builtin__.__dict__['__IPYTHON__active'] -= 1
1712 1712
1713 1713 def excepthook(self, etype, value, tb):
1714 1714 """One more defense for GUI apps that call sys.excepthook.
1715 1715
1716 1716 GUI frameworks like wxPython trap exceptions and call
1717 1717 sys.excepthook themselves. I guess this is a feature that
1718 1718 enables them to keep running after exceptions that would
1719 1719 otherwise kill their mainloop. This is a bother for IPython
1720 1720 which excepts to catch all of the program exceptions with a try:
1721 1721 except: statement.
1722 1722
1723 1723 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1724 1724 any app directly invokes sys.excepthook, it will look to the user like
1725 1725 IPython crashed. In order to work around this, we can disable the
1726 1726 CrashHandler and replace it with this excepthook instead, which prints a
1727 1727 regular traceback using our InteractiveTB. In this fashion, apps which
1728 1728 call sys.excepthook will generate a regular-looking exception from
1729 1729 IPython, and the CrashHandler will only be triggered by real IPython
1730 1730 crashes.
1731 1731
1732 1732 This hook should be used sparingly, only in places which are not likely
1733 1733 to be true IPython errors.
1734 1734 """
1735 1735 self.showtraceback((etype,value,tb),tb_offset=0)
1736 1736
1737 1737 def expand_aliases(self,fn,rest):
1738 1738 """ Expand multiple levels of aliases:
1739 1739
1740 1740 if:
1741 1741
1742 1742 alias foo bar /tmp
1743 1743 alias baz foo
1744 1744
1745 1745 then:
1746 1746
1747 1747 baz huhhahhei -> bar /tmp huhhahhei
1748 1748
1749 1749 """
1750 1750 line = fn + " " + rest
1751 1751
1752 1752 done = Set()
1753 1753 while 1:
1754 1754 pre,fn,rest = prefilter.splitUserInput(line,
1755 1755 prefilter.shell_line_split)
1756 1756 if fn in self.alias_table:
1757 1757 if fn in done:
1758 1758 warn("Cyclic alias definition, repeated '%s'" % fn)
1759 1759 return ""
1760 1760 done.add(fn)
1761 1761
1762 1762 l2 = self.transform_alias(fn,rest)
1763 1763 # dir -> dir
1764 1764 # print "alias",line, "->",l2 #dbg
1765 1765 if l2 == line:
1766 1766 break
1767 1767 # ls -> ls -F should not recurse forever
1768 1768 if l2.split(None,1)[0] == line.split(None,1)[0]:
1769 1769 line = l2
1770 1770 break
1771 1771
1772 1772 line=l2
1773 1773
1774 1774
1775 1775 # print "al expand to",line #dbg
1776 1776 else:
1777 1777 break
1778 1778
1779 1779 return line
1780 1780
1781 1781 def transform_alias(self, alias,rest=''):
1782 1782 """ Transform alias to system command string.
1783 1783 """
1784 1784 trg = self.alias_table[alias]
1785 1785
1786 1786 nargs,cmd = trg
1787 1787 # print trg #dbg
1788 1788 if ' ' in cmd and os.path.isfile(cmd):
1789 1789 cmd = '"%s"' % cmd
1790 1790
1791 1791 # Expand the %l special to be the user's input line
1792 1792 if cmd.find('%l') >= 0:
1793 1793 cmd = cmd.replace('%l',rest)
1794 1794 rest = ''
1795 1795 if nargs==0:
1796 1796 # Simple, argument-less aliases
1797 1797 cmd = '%s %s' % (cmd,rest)
1798 1798 else:
1799 1799 # Handle aliases with positional arguments
1800 1800 args = rest.split(None,nargs)
1801 1801 if len(args)< nargs:
1802 1802 error('Alias <%s> requires %s arguments, %s given.' %
1803 1803 (alias,nargs,len(args)))
1804 1804 return None
1805 1805 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1806 1806 # Now call the macro, evaluating in the user's namespace
1807 1807 #print 'new command: <%r>' % cmd # dbg
1808 1808 return cmd
1809 1809
1810 1810 def call_alias(self,alias,rest=''):
1811 1811 """Call an alias given its name and the rest of the line.
1812 1812
1813 1813 This is only used to provide backwards compatibility for users of
1814 1814 ipalias(), use of which is not recommended for anymore."""
1815 1815
1816 1816 # Now call the macro, evaluating in the user's namespace
1817 1817 cmd = self.transform_alias(alias, rest)
1818 1818 try:
1819 1819 self.system(cmd)
1820 1820 except:
1821 1821 self.showtraceback()
1822 1822
1823 1823 def indent_current_str(self):
1824 1824 """return the current level of indentation as a string"""
1825 1825 return self.indent_current_nsp * ' '
1826 1826
1827 1827 def autoindent_update(self,line):
1828 1828 """Keep track of the indent level."""
1829 1829
1830 1830 #debugx('line')
1831 1831 #debugx('self.indent_current_nsp')
1832 1832 if self.autoindent:
1833 1833 if line:
1834 1834 inisp = num_ini_spaces(line)
1835 1835 if inisp < self.indent_current_nsp:
1836 1836 self.indent_current_nsp = inisp
1837 1837
1838 1838 if line[-1] == ':':
1839 1839 self.indent_current_nsp += 4
1840 1840 elif dedent_re.match(line):
1841 1841 self.indent_current_nsp -= 4
1842 1842 else:
1843 1843 self.indent_current_nsp = 0
1844 1844
1845 1845 def runlines(self,lines):
1846 1846 """Run a string of one or more lines of source.
1847 1847
1848 1848 This method is capable of running a string containing multiple source
1849 1849 lines, as if they had been entered at the IPython prompt. Since it
1850 1850 exposes IPython's processing machinery, the given strings can contain
1851 1851 magic calls (%magic), special shell access (!cmd), etc."""
1852 1852
1853 1853 # We must start with a clean buffer, in case this is run from an
1854 1854 # interactive IPython session (via a magic, for example).
1855 1855 self.resetbuffer()
1856 1856 lines = lines.split('\n')
1857 1857 more = 0
1858 1858
1859 1859 for line in lines:
1860 1860 # skip blank lines so we don't mess up the prompt counter, but do
1861 1861 # NOT skip even a blank line if we are in a code block (more is
1862 1862 # true)
1863 1863
1864 1864
1865 1865 if line or more:
1866 1866 # push to raw history, so hist line numbers stay in sync
1867 1867 self.input_hist_raw.append("# " + line + "\n")
1868 1868 more = self.push(self.prefilter(line,more))
1869 1869 # IPython's runsource returns None if there was an error
1870 1870 # compiling the code. This allows us to stop processing right
1871 1871 # away, so the user gets the error message at the right place.
1872 1872 if more is None:
1873 1873 break
1874 1874 else:
1875 1875 self.input_hist_raw.append("\n")
1876 1876 # final newline in case the input didn't have it, so that the code
1877 1877 # actually does get executed
1878 1878 if more:
1879 1879 self.push('\n')
1880 1880
1881 1881 def runsource(self, source, filename='<input>', symbol='single'):
1882 1882 """Compile and run some source in the interpreter.
1883 1883
1884 1884 Arguments are as for compile_command().
1885 1885
1886 1886 One several things can happen:
1887 1887
1888 1888 1) The input is incorrect; compile_command() raised an
1889 1889 exception (SyntaxError or OverflowError). A syntax traceback
1890 1890 will be printed by calling the showsyntaxerror() method.
1891 1891
1892 1892 2) The input is incomplete, and more input is required;
1893 1893 compile_command() returned None. Nothing happens.
1894 1894
1895 1895 3) The input is complete; compile_command() returned a code
1896 1896 object. The code is executed by calling self.runcode() (which
1897 1897 also handles run-time exceptions, except for SystemExit).
1898 1898
1899 1899 The return value is:
1900 1900
1901 1901 - True in case 2
1902 1902
1903 1903 - False in the other cases, unless an exception is raised, where
1904 1904 None is returned instead. This can be used by external callers to
1905 1905 know whether to continue feeding input or not.
1906 1906
1907 1907 The return value can be used to decide whether to use sys.ps1 or
1908 1908 sys.ps2 to prompt the next line."""
1909 1909
1910 1910 # if the source code has leading blanks, add 'if 1:\n' to it
1911 1911 # this allows execution of indented pasted code. It is tempting
1912 1912 # to add '\n' at the end of source to run commands like ' a=1'
1913 1913 # directly, but this fails for more complicated scenarios
1914 1914 source=source.encode(self.stdin_encoding)
1915 1915 if source[:1] in [' ', '\t']:
1916 1916 source = 'if 1:\n%s' % source
1917 1917
1918 1918 try:
1919 1919 code = self.compile(source,filename,symbol)
1920 1920 except (OverflowError, SyntaxError, ValueError):
1921 1921 # Case 1
1922 1922 self.showsyntaxerror(filename)
1923 1923 return None
1924 1924
1925 1925 if code is None:
1926 1926 # Case 2
1927 1927 return True
1928 1928
1929 1929 # Case 3
1930 1930 # We store the code object so that threaded shells and
1931 1931 # custom exception handlers can access all this info if needed.
1932 1932 # The source corresponding to this can be obtained from the
1933 1933 # buffer attribute as '\n'.join(self.buffer).
1934 1934 self.code_to_run = code
1935 1935 # now actually execute the code object
1936 1936 if self.runcode(code) == 0:
1937 1937 return False
1938 1938 else:
1939 1939 return None
1940 1940
1941 1941 def runcode(self,code_obj):
1942 1942 """Execute a code object.
1943 1943
1944 1944 When an exception occurs, self.showtraceback() is called to display a
1945 1945 traceback.
1946 1946
1947 1947 Return value: a flag indicating whether the code to be run completed
1948 1948 successfully:
1949 1949
1950 1950 - 0: successful execution.
1951 1951 - 1: an error occurred.
1952 1952 """
1953 1953
1954 1954 # Set our own excepthook in case the user code tries to call it
1955 1955 # directly, so that the IPython crash handler doesn't get triggered
1956 1956 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1957 1957
1958 1958 # we save the original sys.excepthook in the instance, in case config
1959 1959 # code (such as magics) needs access to it.
1960 1960 self.sys_excepthook = old_excepthook
1961 1961 outflag = 1 # happens in more places, so it's easier as default
1962 1962 try:
1963 1963 try:
1964 1964 # Embedded instances require separate global/local namespaces
1965 1965 # so they can see both the surrounding (local) namespace and
1966 1966 # the module-level globals when called inside another function.
1967 1967 if self.embedded:
1968 1968 exec code_obj in self.user_global_ns, self.user_ns
1969 1969 # Normal (non-embedded) instances should only have a single
1970 1970 # namespace for user code execution, otherwise functions won't
1971 1971 # see interactive top-level globals.
1972 1972 else:
1973 1973 exec code_obj in self.user_ns
1974 1974 finally:
1975 1975 # Reset our crash handler in place
1976 1976 sys.excepthook = old_excepthook
1977 1977 except SystemExit:
1978 1978 self.resetbuffer()
1979 1979 self.showtraceback()
1980 1980 warn("Type %exit or %quit to exit IPython "
1981 1981 "(%Exit or %Quit do so unconditionally).",level=1)
1982 1982 except self.custom_exceptions:
1983 1983 etype,value,tb = sys.exc_info()
1984 1984 self.CustomTB(etype,value,tb)
1985 1985 except:
1986 1986 self.showtraceback()
1987 1987 else:
1988 1988 outflag = 0
1989 1989 if softspace(sys.stdout, 0):
1990 1990 print
1991 1991 # Flush out code object which has been run (and source)
1992 1992 self.code_to_run = None
1993 1993 return outflag
1994 1994
1995 1995 def push(self, line):
1996 1996 """Push a line to the interpreter.
1997 1997
1998 1998 The line should not have a trailing newline; it may have
1999 1999 internal newlines. The line is appended to a buffer and the
2000 2000 interpreter's runsource() method is called with the
2001 2001 concatenated contents of the buffer as source. If this
2002 2002 indicates that the command was executed or invalid, the buffer
2003 2003 is reset; otherwise, the command is incomplete, and the buffer
2004 2004 is left as it was after the line was appended. The return
2005 2005 value is 1 if more input is required, 0 if the line was dealt
2006 2006 with in some way (this is the same as runsource()).
2007 2007 """
2008 2008
2009 2009 # autoindent management should be done here, and not in the
2010 2010 # interactive loop, since that one is only seen by keyboard input. We
2011 2011 # need this done correctly even for code run via runlines (which uses
2012 2012 # push).
2013 2013
2014 2014 #print 'push line: <%s>' % line # dbg
2015 2015 for subline in line.splitlines():
2016 2016 self.autoindent_update(subline)
2017 2017 self.buffer.append(line)
2018 2018 more = self.runsource('\n'.join(self.buffer), self.filename)
2019 2019 if not more:
2020 2020 self.resetbuffer()
2021 2021 return more
2022 2022
2023 2023 def split_user_input(self, line):
2024 2024 # This is really a hold-over to support ipapi and some extensions
2025 2025 return prefilter.splitUserInput(line)
2026 2026
2027 2027 def resetbuffer(self):
2028 2028 """Reset the input buffer."""
2029 2029 self.buffer[:] = []
2030 2030
2031 2031 def raw_input(self,prompt='',continue_prompt=False):
2032 2032 """Write a prompt and read a line.
2033 2033
2034 2034 The returned line does not include the trailing newline.
2035 2035 When the user enters the EOF key sequence, EOFError is raised.
2036 2036
2037 2037 Optional inputs:
2038 2038
2039 2039 - prompt(''): a string to be printed to prompt the user.
2040 2040
2041 2041 - continue_prompt(False): whether this line is the first one or a
2042 2042 continuation in a sequence of inputs.
2043 2043 """
2044 2044
2045 2045 # Code run by the user may have modified the readline completer state.
2046 2046 # We must ensure that our completer is back in place.
2047 2047 if self.has_readline:
2048 2048 self.set_completer()
2049 2049
2050 2050 try:
2051 2051 line = raw_input_original(prompt).decode(self.stdin_encoding)
2052 2052 except ValueError:
2053 2053 warn("\n********\nYou or a %run:ed script called sys.stdin.close()"
2054 2054 " or sys.stdout.close()!\nExiting IPython!")
2055 2055 self.exit_now = True
2056 2056 return ""
2057 2057
2058 2058 # Try to be reasonably smart about not re-indenting pasted input more
2059 2059 # than necessary. We do this by trimming out the auto-indent initial
2060 2060 # spaces, if the user's actual input started itself with whitespace.
2061 2061 #debugx('self.buffer[-1]')
2062 2062
2063 2063 if self.autoindent:
2064 2064 if num_ini_spaces(line) > self.indent_current_nsp:
2065 2065 line = line[self.indent_current_nsp:]
2066 2066 self.indent_current_nsp = 0
2067 2067
2068 2068 # store the unfiltered input before the user has any chance to modify
2069 2069 # it.
2070 2070 if line.strip():
2071 2071 if continue_prompt:
2072 2072 self.input_hist_raw[-1] += '%s\n' % line
2073 2073 if self.has_readline: # and some config option is set?
2074 2074 try:
2075 2075 histlen = self.readline.get_current_history_length()
2076 2076 newhist = self.input_hist_raw[-1].rstrip()
2077 2077 self.readline.remove_history_item(histlen-1)
2078 self.readline.replace_history_item(histlen-2,newhist)
2078 self.readline.replace_history_item(histlen-2,
2079 newhist.encode(self.stdin_encoding))
2079 2080 except AttributeError:
2080 2081 pass # re{move,place}_history_item are new in 2.4.
2081 2082 else:
2082 2083 self.input_hist_raw.append('%s\n' % line)
2083 2084 # only entries starting at first column go to shadow history
2084 2085 if line.lstrip() == line:
2085 2086 self.shadowhist.add(line.strip())
2086 2087 elif not continue_prompt:
2087 2088 self.input_hist_raw.append('\n')
2088 2089 try:
2089 2090 lineout = self.prefilter(line,continue_prompt)
2090 2091 except:
2091 2092 # blanket except, in case a user-defined prefilter crashes, so it
2092 2093 # can't take all of ipython with it.
2093 2094 self.showtraceback()
2094 2095 return ''
2095 2096 else:
2096 2097 return lineout
2097 2098
2098 2099 def _prefilter(self, line, continue_prompt):
2099 2100 """Calls different preprocessors, depending on the form of line."""
2100 2101
2101 2102 # All handlers *must* return a value, even if it's blank ('').
2102 2103
2103 2104 # Lines are NOT logged here. Handlers should process the line as
2104 2105 # needed, update the cache AND log it (so that the input cache array
2105 2106 # stays synced).
2106 2107
2107 2108 #.....................................................................
2108 2109 # Code begins
2109 2110
2110 2111 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
2111 2112
2112 2113 # save the line away in case we crash, so the post-mortem handler can
2113 2114 # record it
2114 2115 self._last_input_line = line
2115 2116
2116 2117 #print '***line: <%s>' % line # dbg
2117 2118
2118 2119 if not line:
2119 2120 # Return immediately on purely empty lines, so that if the user
2120 2121 # previously typed some whitespace that started a continuation
2121 2122 # prompt, he can break out of that loop with just an empty line.
2122 2123 # This is how the default python prompt works.
2123 2124
2124 2125 # Only return if the accumulated input buffer was just whitespace!
2125 2126 if ''.join(self.buffer).isspace():
2126 2127 self.buffer[:] = []
2127 2128 return ''
2128 2129
2129 2130 line_info = prefilter.LineInfo(line, continue_prompt)
2130 2131
2131 2132 # the input history needs to track even empty lines
2132 2133 stripped = line.strip()
2133 2134
2134 2135 if not stripped:
2135 2136 if not continue_prompt:
2136 2137 self.outputcache.prompt_count -= 1
2137 2138 return self.handle_normal(line_info)
2138 2139
2139 2140 # print '***cont',continue_prompt # dbg
2140 2141 # special handlers are only allowed for single line statements
2141 2142 if continue_prompt and not self.rc.multi_line_specials:
2142 2143 return self.handle_normal(line_info)
2143 2144
2144 2145
2145 2146 # See whether any pre-existing handler can take care of it
2146 2147 rewritten = self.hooks.input_prefilter(stripped)
2147 2148 if rewritten != stripped: # ok, some prefilter did something
2148 2149 rewritten = line_info.pre + rewritten # add indentation
2149 2150 return self.handle_normal(prefilter.LineInfo(rewritten,
2150 2151 continue_prompt))
2151 2152
2152 2153 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2153 2154
2154 2155 return prefilter.prefilter(line_info, self)
2155 2156
2156 2157
2157 2158 def _prefilter_dumb(self, line, continue_prompt):
2158 2159 """simple prefilter function, for debugging"""
2159 2160 return self.handle_normal(line,continue_prompt)
2160 2161
2161 2162
2162 2163 def multiline_prefilter(self, line, continue_prompt):
2163 2164 """ Run _prefilter for each line of input
2164 2165
2165 2166 Covers cases where there are multiple lines in the user entry,
2166 2167 which is the case when the user goes back to a multiline history
2167 2168 entry and presses enter.
2168 2169
2169 2170 """
2170 2171 out = []
2171 2172 for l in line.rstrip('\n').split('\n'):
2172 2173 out.append(self._prefilter(l, continue_prompt))
2173 2174 return '\n'.join(out)
2174 2175
2175 2176 # Set the default prefilter() function (this can be user-overridden)
2176 2177 prefilter = multiline_prefilter
2177 2178
2178 2179 def handle_normal(self,line_info):
2179 2180 """Handle normal input lines. Use as a template for handlers."""
2180 2181
2181 2182 # With autoindent on, we need some way to exit the input loop, and I
2182 2183 # don't want to force the user to have to backspace all the way to
2183 2184 # clear the line. The rule will be in this case, that either two
2184 2185 # lines of pure whitespace in a row, or a line of pure whitespace but
2185 2186 # of a size different to the indent level, will exit the input loop.
2186 2187 line = line_info.line
2187 2188 continue_prompt = line_info.continue_prompt
2188 2189
2189 2190 if (continue_prompt and self.autoindent and line.isspace() and
2190 2191 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2191 2192 (self.buffer[-1]).isspace() )):
2192 2193 line = ''
2193 2194
2194 2195 self.log(line,line,continue_prompt)
2195 2196 return line
2196 2197
2197 2198 def handle_alias(self,line_info):
2198 2199 """Handle alias input lines. """
2199 2200 tgt = self.alias_table[line_info.iFun]
2200 2201 # print "=>",tgt #dbg
2201 2202 if callable(tgt):
2202 2203 if '$' in line_info.line:
2203 2204 call_meth = '(_ip, _ip.itpl(%s))'
2204 2205 else:
2205 2206 call_meth = '(_ip,%s)'
2206 2207 line_out = ("%s_sh.%s" + call_meth) % (line_info.preWhitespace,
2207 2208 line_info.iFun,
2208 2209 make_quoted_expr(line_info.line))
2209 2210 else:
2210 2211 transformed = self.expand_aliases(line_info.iFun,line_info.theRest)
2211 2212
2212 2213 # pre is needed, because it carries the leading whitespace. Otherwise
2213 2214 # aliases won't work in indented sections.
2214 2215 line_out = '%s_ip.system(%s)' % (line_info.preWhitespace,
2215 2216 make_quoted_expr( transformed ))
2216 2217
2217 2218 self.log(line_info.line,line_out,line_info.continue_prompt)
2218 2219 #print 'line out:',line_out # dbg
2219 2220 return line_out
2220 2221
2221 2222 def handle_shell_escape(self, line_info):
2222 2223 """Execute the line in a shell, empty return value"""
2223 2224 #print 'line in :', `line` # dbg
2224 2225 line = line_info.line
2225 2226 if line.lstrip().startswith('!!'):
2226 2227 # rewrite LineInfo's line, iFun and theRest to properly hold the
2227 2228 # call to %sx and the actual command to be executed, so
2228 2229 # handle_magic can work correctly. Note that this works even if
2229 2230 # the line is indented, so it handles multi_line_specials
2230 2231 # properly.
2231 2232 new_rest = line.lstrip()[2:]
2232 2233 line_info.line = '%ssx %s' % (self.ESC_MAGIC,new_rest)
2233 2234 line_info.iFun = 'sx'
2234 2235 line_info.theRest = new_rest
2235 2236 return self.handle_magic(line_info)
2236 2237 else:
2237 2238 cmd = line.lstrip().lstrip('!')
2238 2239 line_out = '%s_ip.system(%s)' % (line_info.preWhitespace,
2239 2240 make_quoted_expr(cmd))
2240 2241 # update cache/log and return
2241 2242 self.log(line,line_out,line_info.continue_prompt)
2242 2243 return line_out
2243 2244
2244 2245 def handle_magic(self, line_info):
2245 2246 """Execute magic functions."""
2246 2247 iFun = line_info.iFun
2247 2248 theRest = line_info.theRest
2248 2249 cmd = '%s_ip.magic(%s)' % (line_info.preWhitespace,
2249 2250 make_quoted_expr(iFun + " " + theRest))
2250 2251 self.log(line_info.line,cmd,line_info.continue_prompt)
2251 2252 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2252 2253 return cmd
2253 2254
2254 2255 def handle_auto(self, line_info):
2255 2256 """Hande lines which can be auto-executed, quoting if requested."""
2256 2257
2257 2258 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2258 2259 line = line_info.line
2259 2260 iFun = line_info.iFun
2260 2261 theRest = line_info.theRest
2261 2262 pre = line_info.pre
2262 2263 continue_prompt = line_info.continue_prompt
2263 2264 obj = line_info.ofind(self)['obj']
2264 2265
2265 2266 # This should only be active for single-line input!
2266 2267 if continue_prompt:
2267 2268 self.log(line,line,continue_prompt)
2268 2269 return line
2269 2270
2270 2271 force_auto = isinstance(obj, IPython.ipapi.IPyAutocall)
2271 2272 auto_rewrite = True
2272 2273
2273 2274 if pre == self.ESC_QUOTE:
2274 2275 # Auto-quote splitting on whitespace
2275 2276 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2276 2277 elif pre == self.ESC_QUOTE2:
2277 2278 # Auto-quote whole string
2278 2279 newcmd = '%s("%s")' % (iFun,theRest)
2279 2280 elif pre == self.ESC_PAREN:
2280 2281 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2281 2282 else:
2282 2283 # Auto-paren.
2283 2284 # We only apply it to argument-less calls if the autocall
2284 2285 # parameter is set to 2. We only need to check that autocall is <
2285 2286 # 2, since this function isn't called unless it's at least 1.
2286 2287 if not theRest and (self.rc.autocall < 2) and not force_auto:
2287 2288 newcmd = '%s %s' % (iFun,theRest)
2288 2289 auto_rewrite = False
2289 2290 else:
2290 2291 if not force_auto and theRest.startswith('['):
2291 2292 if hasattr(obj,'__getitem__'):
2292 2293 # Don't autocall in this case: item access for an object
2293 2294 # which is BOTH callable and implements __getitem__.
2294 2295 newcmd = '%s %s' % (iFun,theRest)
2295 2296 auto_rewrite = False
2296 2297 else:
2297 2298 # if the object doesn't support [] access, go ahead and
2298 2299 # autocall
2299 2300 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2300 2301 elif theRest.endswith(';'):
2301 2302 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2302 2303 else:
2303 2304 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2304 2305
2305 2306 if auto_rewrite:
2306 2307 rw = self.outputcache.prompt1.auto_rewrite() + newcmd
2307 2308
2308 2309 try:
2309 2310 # plain ascii works better w/ pyreadline, on some machines, so
2310 2311 # we use it and only print uncolored rewrite if we have unicode
2311 2312 rw = str(rw)
2312 2313 print >>Term.cout, rw
2313 2314 except UnicodeEncodeError:
2314 2315 print "-------------->" + newcmd
2315 2316
2316 2317 # log what is now valid Python, not the actual user input (without the
2317 2318 # final newline)
2318 2319 self.log(line,newcmd,continue_prompt)
2319 2320 return newcmd
2320 2321
2321 2322 def handle_help(self, line_info):
2322 2323 """Try to get some help for the object.
2323 2324
2324 2325 obj? or ?obj -> basic information.
2325 2326 obj?? or ??obj -> more details.
2326 2327 """
2327 2328
2328 2329 line = line_info.line
2329 2330 # We need to make sure that we don't process lines which would be
2330 2331 # otherwise valid python, such as "x=1 # what?"
2331 2332 try:
2332 2333 codeop.compile_command(line)
2333 2334 except SyntaxError:
2334 2335 # We should only handle as help stuff which is NOT valid syntax
2335 2336 if line[0]==self.ESC_HELP:
2336 2337 line = line[1:]
2337 2338 elif line[-1]==self.ESC_HELP:
2338 2339 line = line[:-1]
2339 2340 self.log(line,'#?'+line,line_info.continue_prompt)
2340 2341 if line:
2341 2342 #print 'line:<%r>' % line # dbg
2342 2343 self.magic_pinfo(line)
2343 2344 else:
2344 2345 page(self.usage,screen_lines=self.rc.screen_length)
2345 2346 return '' # Empty string is needed here!
2346 2347 except:
2347 2348 # Pass any other exceptions through to the normal handler
2348 2349 return self.handle_normal(line_info)
2349 2350 else:
2350 2351 # If the code compiles ok, we should handle it normally
2351 2352 return self.handle_normal(line_info)
2352 2353
2353 2354 def getapi(self):
2354 2355 """ Get an IPApi object for this shell instance
2355 2356
2356 2357 Getting an IPApi object is always preferable to accessing the shell
2357 2358 directly, but this holds true especially for extensions.
2358 2359
2359 2360 It should always be possible to implement an extension with IPApi
2360 2361 alone. If not, contact maintainer to request an addition.
2361 2362
2362 2363 """
2363 2364 return self.api
2364 2365
2365 2366 def handle_emacs(self, line_info):
2366 2367 """Handle input lines marked by python-mode."""
2367 2368
2368 2369 # Currently, nothing is done. Later more functionality can be added
2369 2370 # here if needed.
2370 2371
2371 2372 # The input cache shouldn't be updated
2372 2373 return line_info.line
2373 2374
2374 2375
2375 2376 def mktempfile(self,data=None):
2376 2377 """Make a new tempfile and return its filename.
2377 2378
2378 2379 This makes a call to tempfile.mktemp, but it registers the created
2379 2380 filename internally so ipython cleans it up at exit time.
2380 2381
2381 2382 Optional inputs:
2382 2383
2383 2384 - data(None): if data is given, it gets written out to the temp file
2384 2385 immediately, and the file is closed again."""
2385 2386
2386 2387 filename = tempfile.mktemp('.py','ipython_edit_')
2387 2388 self.tempfiles.append(filename)
2388 2389
2389 2390 if data:
2390 2391 tmp_file = open(filename,'w')
2391 2392 tmp_file.write(data)
2392 2393 tmp_file.close()
2393 2394 return filename
2394 2395
2395 2396 def write(self,data):
2396 2397 """Write a string to the default output"""
2397 2398 Term.cout.write(data)
2398 2399
2399 2400 def write_err(self,data):
2400 2401 """Write a string to the default error output"""
2401 2402 Term.cerr.write(data)
2402 2403
2403 2404 def exit(self):
2404 2405 """Handle interactive exit.
2405 2406
2406 2407 This method sets the exit_now attribute."""
2407 2408
2408 2409 if self.rc.confirm_exit:
2409 2410 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2410 2411 self.exit_now = True
2411 2412 else:
2412 2413 self.exit_now = True
2413 2414
2414 2415 def safe_execfile(self,fname,*where,**kw):
2415 2416 """A safe version of the builtin execfile().
2416 2417
2417 2418 This version will never throw an exception, and knows how to handle
2418 2419 ipython logs as well.
2419 2420
2420 2421 :Parameters:
2421 2422 fname : string
2422 2423 Name of the file to be executed.
2423 2424
2424 2425 where : tuple
2425 2426 One or two namespaces, passed to execfile() as (globals,locals).
2426 2427 If only one is given, it is passed as both.
2427 2428
2428 2429 :Keywords:
2429 2430 islog : boolean (False)
2430 2431
2431 2432 quiet : boolean (True)
2432 2433
2433 2434 exit_ignore : boolean (False)
2434 2435 """
2435 2436
2436 2437 def syspath_cleanup():
2437 2438 """Internal cleanup routine for sys.path."""
2438 2439 if add_dname:
2439 2440 try:
2440 2441 sys.path.remove(dname)
2441 2442 except ValueError:
2442 2443 # For some reason the user has already removed it, ignore.
2443 2444 pass
2444 2445
2445 2446 fname = os.path.expanduser(fname)
2446 2447
2447 2448 # Find things also in current directory. This is needed to mimic the
2448 2449 # behavior of running a script from the system command line, where
2449 2450 # Python inserts the script's directory into sys.path
2450 2451 dname = os.path.dirname(os.path.abspath(fname))
2451 2452 add_dname = False
2452 2453 if dname not in sys.path:
2453 2454 sys.path.insert(0,dname)
2454 2455 add_dname = True
2455 2456
2456 2457 try:
2457 2458 xfile = open(fname)
2458 2459 except:
2459 2460 print >> Term.cerr, \
2460 2461 'Could not open file <%s> for safe execution.' % fname
2461 2462 syspath_cleanup()
2462 2463 return None
2463 2464
2464 2465 kw.setdefault('islog',0)
2465 2466 kw.setdefault('quiet',1)
2466 2467 kw.setdefault('exit_ignore',0)
2467 2468
2468 2469 first = xfile.readline()
2469 2470 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2470 2471 xfile.close()
2471 2472 # line by line execution
2472 2473 if first.startswith(loghead) or kw['islog']:
2473 2474 print 'Loading log file <%s> one line at a time...' % fname
2474 2475 if kw['quiet']:
2475 2476 stdout_save = sys.stdout
2476 2477 sys.stdout = StringIO.StringIO()
2477 2478 try:
2478 2479 globs,locs = where[0:2]
2479 2480 except:
2480 2481 try:
2481 2482 globs = locs = where[0]
2482 2483 except:
2483 2484 globs = locs = globals()
2484 2485 badblocks = []
2485 2486
2486 2487 # we also need to identify indented blocks of code when replaying
2487 2488 # logs and put them together before passing them to an exec
2488 2489 # statement. This takes a bit of regexp and look-ahead work in the
2489 2490 # file. It's easiest if we swallow the whole thing in memory
2490 2491 # first, and manually walk through the lines list moving the
2491 2492 # counter ourselves.
2492 2493 indent_re = re.compile('\s+\S')
2493 2494 xfile = open(fname)
2494 2495 filelines = xfile.readlines()
2495 2496 xfile.close()
2496 2497 nlines = len(filelines)
2497 2498 lnum = 0
2498 2499 while lnum < nlines:
2499 2500 line = filelines[lnum]
2500 2501 lnum += 1
2501 2502 # don't re-insert logger status info into cache
2502 2503 if line.startswith('#log#'):
2503 2504 continue
2504 2505 else:
2505 2506 # build a block of code (maybe a single line) for execution
2506 2507 block = line
2507 2508 try:
2508 2509 next = filelines[lnum] # lnum has already incremented
2509 2510 except:
2510 2511 next = None
2511 2512 while next and indent_re.match(next):
2512 2513 block += next
2513 2514 lnum += 1
2514 2515 try:
2515 2516 next = filelines[lnum]
2516 2517 except:
2517 2518 next = None
2518 2519 # now execute the block of one or more lines
2519 2520 try:
2520 2521 exec block in globs,locs
2521 2522 except SystemExit:
2522 2523 pass
2523 2524 except:
2524 2525 badblocks.append(block.rstrip())
2525 2526 if kw['quiet']: # restore stdout
2526 2527 sys.stdout.close()
2527 2528 sys.stdout = stdout_save
2528 2529 print 'Finished replaying log file <%s>' % fname
2529 2530 if badblocks:
2530 2531 print >> sys.stderr, ('\nThe following lines/blocks in file '
2531 2532 '<%s> reported errors:' % fname)
2532 2533
2533 2534 for badline in badblocks:
2534 2535 print >> sys.stderr, badline
2535 2536 else: # regular file execution
2536 2537 try:
2537 2538 if sys.platform == 'win32' and sys.version_info < (2,5,1):
2538 2539 # Work around a bug in Python for Windows. The bug was
2539 2540 # fixed in in Python 2.5 r54159 and 54158, but that's still
2540 2541 # SVN Python as of March/07. For details, see:
2541 2542 # http://projects.scipy.org/ipython/ipython/ticket/123
2542 2543 try:
2543 2544 globs,locs = where[0:2]
2544 2545 except:
2545 2546 try:
2546 2547 globs = locs = where[0]
2547 2548 except:
2548 2549 globs = locs = globals()
2549 2550 exec file(fname) in globs,locs
2550 2551 else:
2551 2552 execfile(fname,*where)
2552 2553 except SyntaxError:
2553 2554 self.showsyntaxerror()
2554 2555 warn('Failure executing file: <%s>' % fname)
2555 2556 except SystemExit,status:
2556 2557 # Code that correctly sets the exit status flag to success (0)
2557 2558 # shouldn't be bothered with a traceback. Note that a plain
2558 2559 # sys.exit() does NOT set the message to 0 (it's empty) so that
2559 2560 # will still get a traceback. Note that the structure of the
2560 2561 # SystemExit exception changed between Python 2.4 and 2.5, so
2561 2562 # the checks must be done in a version-dependent way.
2562 2563 show = False
2563 2564
2564 2565 if sys.version_info[:2] > (2,5):
2565 2566 if status.message!=0 and not kw['exit_ignore']:
2566 2567 show = True
2567 2568 else:
2568 2569 if status.code and not kw['exit_ignore']:
2569 2570 show = True
2570 2571 if show:
2571 2572 self.showtraceback()
2572 2573 warn('Failure executing file: <%s>' % fname)
2573 2574 except:
2574 2575 self.showtraceback()
2575 2576 warn('Failure executing file: <%s>' % fname)
2576 2577
2577 2578 syspath_cleanup()
2578 2579
2579 2580 #************************* end of file <iplib.py> *****************************
@@ -1,7294 +1,7295 b''
1 2007-12-13 Ville Vainio <vivainio@gmail.com>
2
3 * iplib.py(raw_input): unix readline does not allow unicode in
4 history, encode to normal string. After patch by Tiago.
5 Close #201
6
1 7 2007-12-12 Ville Vainio <vivainio@gmail.com>
2 8
3 * genutils.py (abbrev_cwd): Terminal title now shows 2 levels of current
4 directory.
9 * genutils.py (abbrev_cwd): Terminal title now shows 2 levels of
10 current directory.
5 11
6 * iplib.py: We now set system default encoding to sys.stdin.encoding with
7 sys.setdefaultencoding, after a patch by 'pan'. This makes str() calls that
8 IPython still has implicitly work. This should be removed when such calls
9 are cleaned.
10
11 12 2007-12-12 Fernando Perez <Fernando.Perez@colorado.edu>
12 13
13 14 * IPython/Shell.py (_select_shell): add support for controlling
14 15 the pylab threading mode directly at the command line, without
15 16 having to modify MPL config files. Added unit tests for this
16 17 feature, though manual/docs update is still pending, will do later.
17 18
18 19 2007-12-11 Ville Vainio <vivainio@gmail.com>
19 20
20 21 * ext_rescapture.py: var = !cmd is no longer verbose (to facilitate
21 22 use in scripts)
22 23
23 24 2007-12-07 Ville Vainio <vivainio@gmail.com>
24 25
25 26 * iplib.py, ipy_profile_sh.py: Do not escape # on command lines
26 27 anymore (to \#) - even if it is a comment char that is implicitly
27 28 escaped in some unix shells in interactive mode, it is ok to leave
28 29 it in IPython as such.
29 30
30 31
31 32 2007-12-01 Robert Kern <robert.kern@gmail.com>
32 33
33 34 * IPython/ultraTB.py (findsource): Improve the monkeypatch to
34 35 inspect.findsource(). It can now find source lines inside zipped
35 36 packages.
36 37
37 38 * IPython/ultraTB.py: When constructing tracebacks, try to use __file__
38 39 in the frame's namespace before trusting the filename in the code object
39 40 which created the frame.
40 41
41 42 2007-11-29 *** Released version 0.8.2
42 43
43 44 2007-11-25 Fernando Perez <Fernando.Perez@colorado.edu>
44 45
45 46 * IPython/Logger.py (Logger.logstop): add a proper logstop()
46 47 method to fully stop the logger, along with a corresponding
47 48 %logstop magic for interactive use.
48 49
49 50 * IPython/Extensions/ipy_host_completers.py: added new host
50 51 completers functionality, contributed by Gael Pasgrimaud
51 52 <gawel-AT-afpy.org>.
52 53
53 54 2007-11-24 Fernando Perez <Fernando.Perez@colorado.edu>
54 55
55 56 * IPython/DPyGetOpt.py (ArgumentError): Apply patch by Paul Mueller
56 57 <gakusei-AT-dakotacom.net>, to fix deprecated string exceptions in
57 58 options handling. Unicode fix in %whos (committed a while ago)
58 59 was also contributed by Paul.
59 60
60 61 2007-11-23 Darren Dale <darren.dale@cornell.edu>
61 62 * ipy_traits_completer.py: let traits_completer respect the user's
62 63 readline_omit__names setting.
63 64
64 65 2007-11-08 Ville Vainio <vivainio@gmail.com>
65 66
66 67 * ipy_completers.py (import completer): assume 'xml' module exists.
67 68 Do not add every module twice anymore. Closes #196.
68 69
69 70 * ipy_completers.py, ipy_app_completers.py: Add proper apt-get
70 71 completer that uses apt-cache to search for existing packages.
71 72
72 73 2007-11-06 Ville Vainio <vivainio@gmail.com>
73 74
74 75 * Prompts.py: Do not update _oh and _123 when do_full_cache is not
75 76 true. Closes #194.
76 77
77 78 2007-11-01 Brian Granger <ellisonbg@gmail.com>
78 79
79 80 * iplib.py, rlineimpl.py: Applied Body Water's patches to get IPython
80 81 working with OS X 10.5 libedit implementation of readline.
81 82
82 83 2007-10-24 Ville Vainio <vivainio@gmail.com>
83 84
84 85 * iplib.py(user_setup): To route around buggy installations where
85 86 UserConfig is not available, create a minimal _ipython.
86 87
87 88 * iplib.py: Unicode fixes from Jorgen.
88 89
89 90 * genutils.py: Slist now has new method 'fields()' for extraction of
90 91 whitespace-separated fields from line-oriented data.
91 92
92 93 2007-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
93 94
94 95 * IPython/OInspect.py (Inspector.pinfo): fix bug that could arise
95 96 when querying objects with no __class__ attribute (such as
96 97 f2py-generated modules).
97 98
98 99 2007-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
99 100
100 101 * IPython/Magic.py (magic_time): track compilation time and report
101 102 it if longer than 0.1s (fix done to %time and %timeit). After a
102 103 SAGE bug report: http://trac.sagemath.org/sage_trac/ticket/632.
103 104
104 105 2007-09-18 Ville Vainio <vivainio@gmail.com>
105 106
106 107 * genutils.py(make_quoted_expr): Do not use Itpl, it does
107 108 not support unicode at the moment. Fixes (many) magic calls with
108 109 special characters.
109 110
110 111 2007-09-14 Fernando Perez <Fernando.Perez@colorado.edu>
111 112
112 113 * IPython/genutils.py (doctest_reload): expose the doctest
113 114 reloader to the user so that people can easily reset doctest while
114 115 using it interactively. Fixes a problem reported by Jorgen.
115 116
116 117 * IPython/iplib.py (InteractiveShell.__init__): protect the
117 118 FakeModule instances used for __main__ in %run calls from
118 119 deletion, so that user code defined in them isn't left with
119 120 dangling references due to the Python module deletion machinery.
120 121 This should fix the problems reported by Darren.
121 122
122 123 2007-09-10 Darren Dale <dd55@cornell.edu>
123 124
124 125 * Cleanup of IPShellQt and IPShellQt4
125 126
126 127 2007-09-09 Fernando Perez <Fernando.Perez@colorado.edu>
127 128
128 129 * IPython/FakeModule.py (FakeModule.__init__): further fixes for
129 130 doctest support.
130 131
131 132 * IPython/iplib.py (safe_execfile): minor docstring improvements.
132 133
133 134 2007-09-08 Ville Vainio <vivainio@gmail.com>
134 135
135 136 * Magic.py (%pushd, %popd, %dirs): Fix dir stack - push *current*
136 137 directory, not the target directory.
137 138
138 139 * ipapi.py, Magic.py, iplib.py: Add ipapi.UsageError, a lighter weight
139 140 exception that won't print the tracebacks. Switched many magics to
140 141 raise them on error situations, also GetoptError is not printed
141 142 anymore.
142 143
143 144 2007-09-07 Ville Vainio <vivainio@gmail.com>
144 145
145 146 * iplib.py: do not auto-alias "dir", it screws up other dir auto
146 147 aliases.
147 148
148 149 * genutils.py: SList.grep() implemented.
149 150
150 151 * ipy_editors.py, UserConfig/ipy_user_conf.py: Add some editors
151 152 for easy "out of the box" setup of several common editors, so that
152 153 e.g. '%edit os.path.isfile' will jump to the correct line
153 154 automatically. Contributions for command lines of your favourite
154 155 editors welcome.
155 156
156 157 2007-09-07 Fernando Perez <Fernando.Perez@colorado.edu>
157 158
158 159 * IPython/OInspect.py (Inspector.pinfo): fixed bug that was
159 160 preventing source display in certain cases. In reality I think
160 161 the problem is with Ubuntu's Python build, but this change works
161 162 around the issue in some cases (not in all, unfortunately). I'd
162 163 filed a Python bug on this with more details, but in the change of
163 164 bug trackers it seems to have been lost.
164 165
165 166 * IPython/Magic.py (magic_dhist): restore %dhist. No, cd -TAB is
166 167 not the same, it's not self-documenting, doesn't allow range
167 168 selection, and sorts alphabetically instead of numerically.
168 169 (magic_r): restore %r. No, "up + enter. One char magic" is not
169 170 the same thing, since %r takes parameters to allow fast retrieval
170 171 of old commands. I've received emails from users who use this a
171 172 LOT, so it stays.
172 173 (magic_automagic): restore %automagic. "use _ip.option.automagic"
173 174 is not a valid replacement b/c it doesn't provide an complete
174 175 explanation (which the automagic docstring does).
175 176 (magic_autocall): restore %autocall, with improved docstring.
176 177 Same argument as for others, "use _ip.options.autocall" is not a
177 178 valid replacement.
178 179 (magic_pdef): restore %pdef & friends. Used widely, mentioned in
179 180 tutorials and online docs.
180 181
181 182 2007-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
182 183
183 184 * IPython/usage.py (quick_reference): mention magics in quickref,
184 185 modified main banner to mention %quickref.
185 186
186 187 * IPython/FakeModule.py (FakeModule): fixes for doctest compatibility.
187 188
188 189 2007-09-06 Ville Vainio <vivainio@gmail.com>
189 190
190 191 * ipy_rehashdir.py, ipy_workdir.py, ipy_fsops.py, iplib.py:
191 192 Callable aliases now pass the _ip as first arg. This breaks
192 193 compatibility with earlier 0.8.2.svn series! (though they should
193 194 not have been in use yet outside these few extensions)
194 195
195 196 2007-09-05 Ville Vainio <vivainio@gmail.com>
196 197
197 198 * external/mglob.py: expand('dirname') => ['dirname'], instead
198 199 of ['dirname/foo','dirname/bar', ...].
199 200
200 201 * Extensions/ipy_fsops.py: added, has usefull shell utils for plain
201 202 win32 installations: icp, imv, imkdir, igrep, irm, collect (collect
202 203 is useful for others as well).
203 204
204 205 * iplib.py: on callable aliases (as opposed to old style aliases),
205 206 do var_expand() immediately, and use make_quoted_expr instead
206 207 of hardcoded r"""
207 208
208 209 * Extensions/ipy_profile_sh.py: Try to detect cygwin on win32,
209 210 if not available load ipy_fsops.py for cp, mv, etc. replacements
210 211
211 212 * OInspect.py, ipy_which.py: improve %which and obj? for callable
212 213 aliases
213 214
214 215 2007-09-04 Ville Vainio <vivainio@gmail.com>
215 216
216 217 * ipy_profile_zope.py: add zope profile, by Stefan Eletzhofer.
217 218 Relicensed under BSD with the authors approval.
218 219
219 220 * ipmaker.py, usage.py: Remove %magic from default banner, improve
220 221 %quickref
221 222
222 223 2007-09-03 Ville Vainio <vivainio@gmail.com>
223 224
224 225 * Magic.py: %time now passes expression through prefilter,
225 226 allowing IPython syntax.
226 227
227 228 2007-09-01 Ville Vainio <vivainio@gmail.com>
228 229
229 230 * ipmaker.py: Always show full traceback when newstyle config fails
230 231
231 232 2007-08-27 Ville Vainio <vivainio@gmail.com>
232 233
233 234 * Magic.py: fix %cd for nonexistent dir when dhist is empty, close #180
234 235
235 236 2007-08-26 Ville Vainio <vivainio@gmail.com>
236 237
237 238 * ipmaker.py: Command line args have the highest priority again
238 239
239 240 * iplib.py, ipmaker.py: -i command line argument now behaves as in
240 241 normal python, i.e. leaves the IPython session running after -c
241 242 command or running a batch file from command line.
242 243
243 244 2007-08-22 Ville Vainio <vivainio@gmail.com>
244 245
245 246 * iplib.py: no extra empty (last) line in raw hist w/ multiline
246 247 statements
247 248
248 249 * logger.py: Fix bug where blank lines in history were not
249 250 added until AFTER adding the current line; translated and raw
250 251 history should finally be in sync with prompt now.
251 252
252 253 * ipy_completers.py: quick_completer now makes it easy to create
253 254 trivial custom completers
254 255
255 256 * clearcmd.py: shadow history compression & erasing, fixed input hist
256 257 clearing.
257 258
258 259 * envpersist.py, history.py: %env (sh profile only), %hist completers
259 260
260 261 * genutils.py, Prompts.py, Magic.py: win32 - prompt (with \yDEPTH) and
261 262 term title now include the drive letter, and always use / instead of
262 263 os.sep (as per recommended approach for win32 ipython in general).
263 264
264 265 * ipykit.py, ipy_kitcfg.py: special launcher for ipykit. Allows running
265 266 plain python scripts from ipykit command line by running
266 267 "py myscript.py", even w/o installed python.
267 268
268 269 2007-08-21 Ville Vainio <vivainio@gmail.com>
269 270
270 271 * ipmaker.py: finding ipythonrc-PROF now skips ipy_profile_PROF.
271 272 (for backwards compatibility)
272 273
273 274 * history.py: switch back to %hist -t from %hist -r as default.
274 275 At least until raw history is fixed for good.
275 276
276 277 2007-08-20 Ville Vainio <vivainio@gmail.com>
277 278
278 279 * ipapi.py, iplib.py: DebugTools accessible via _ip.dbg, to catch &
279 280 locate alias redeclarations etc. Also, avoid handling
280 281 _ip.IP.alias_table directly, prefer using _ip.defalias.
281 282
282 283
283 284 2007-08-15 Ville Vainio <vivainio@gmail.com>
284 285
285 286 * prefilter.py: ! is now always served first
286 287
287 288 2007-08-15 Fernando Perez <Fernando.Perez@colorado.edu>
288 289
289 290 * IPython/iplib.py (safe_execfile): fix the SystemExit
290 291 auto-suppression code to work in Python2.4 (the internal structure
291 292 of that exception changed and I'd only tested the code with 2.5).
292 293 Bug reported by a SciPy attendee.
293 294
294 295 2007-08-13 Ville Vainio <vivainio@gmail.com>
295 296
296 297 * prefilter.py: reverted !c:/bin/foo fix, made % in
297 298 multiline specials work again
298 299
299 300 2007-08-13 Ville Vainio <vivainio@gmail.com>
300 301
301 302 * prefilter.py: Take more care to special-case !, so that
302 303 !c:/bin/foo.exe works.
303 304
304 305 * setup.py: if we are building eggs, strip all docs and
305 306 examples (it doesn't make sense to bytecompile examples,
306 307 and docs would be in an awkward place anyway).
307 308
308 309 * Ryan Krauss' patch fixes start menu shortcuts when IPython
309 310 is installed into a directory that has spaces in the name.
310 311
311 312 2007-08-13 Fernando Perez <Fernando.Perez@colorado.edu>
312 313
313 314 * IPython/Magic.py (magic_doctest_mode): fix prompt separators in
314 315 doctest profile and %doctest_mode, so they actually generate the
315 316 blank lines needed by doctest to separate individual tests.
316 317
317 318 * IPython/iplib.py (safe_execfile): modify so that running code
318 319 which calls sys.exit(0) (or equivalently, raise SystemExit(0))
319 320 doesn't get a printed traceback. Any other value in sys.exit(),
320 321 including the empty call, still generates a traceback. This
321 322 enables use of %run without having to pass '-e' for codes that
322 323 correctly set the exit status flag.
323 324
324 325 2007-08-12 Fernando Perez <Fernando.Perez@colorado.edu>
325 326
326 327 * IPython/iplib.py (InteractiveShell.post_config_initialization):
327 328 fix problems with doctests failing when run inside IPython due to
328 329 IPython's modifications of sys.displayhook.
329 330
330 331 2007-8-9 Fernando Perez <fperez@planck.colorado.edu>
331 332
332 333 * IPython/ipapi.py (to_user_ns): update to accept a dict as well as
333 334 a string with names.
334 335
335 336 2007-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
336 337
337 338 * IPython/Magic.py (magic_doctest_mode): added new %doctest_mode
338 339 magic to toggle on/off the doctest pasting support without having
339 340 to leave a session to switch to a separate profile.
340 341
341 342 2007-08-08 Fernando Perez <Fernando.Perez@colorado.edu>
342 343
343 344 * IPython/Extensions/ipy_profile_doctest.py (main): fix prompt to
344 345 introduce a blank line between inputs, to conform to doctest
345 346 requirements.
346 347
347 348 * IPython/OInspect.py (Inspector.pinfo): fix another part where
348 349 auto-generated docstrings for new-style classes were showing up.
349 350
350 351 2007-08-07 Fernando Perez <Fernando.Perez@colorado.edu>
351 352
352 353 * api_changes: Add new file to track backward-incompatible
353 354 user-visible changes.
354 355
355 356 2007-08-06 Ville Vainio <vivainio@gmail.com>
356 357
357 358 * ipmaker.py: fix bug where user_config_ns didn't exist at all
358 359 before all the config files were handled.
359 360
360 361 2007-08-04 Fernando Perez <Fernando.Perez@colorado.edu>
361 362
362 363 * IPython/irunner.py (RunnerFactory): Add new factory class for
363 364 creating reusable runners based on filenames.
364 365
365 366 * IPython/Extensions/ipy_profile_doctest.py: New profile for
366 367 doctest support. It sets prompts/exceptions as similar to
367 368 standard Python as possible, so that ipython sessions in this
368 369 profile can be easily pasted as doctests with minimal
369 370 modifications. It also enables pasting of doctests from external
370 371 sources (even if they have leading whitespace), so that you can
371 372 rerun doctests from existing sources.
372 373
373 374 * IPython/iplib.py (_prefilter): fix a buglet where after entering
374 375 some whitespace, the prompt would become a continuation prompt
375 376 with no way of exiting it other than Ctrl-C. This fix brings us
376 377 into conformity with how the default python prompt works.
377 378
378 379 * IPython/Extensions/InterpreterPasteInput.py (prefilter_paste):
379 380 Add support for pasting not only lines that start with '>>>', but
380 381 also with ' >>>'. That is, arbitrary whitespace can now precede
381 382 the prompts. This makes the system useful for pasting doctests
382 383 from docstrings back into a normal session.
383 384
384 385 2007-08-02 Fernando Perez <Fernando.Perez@colorado.edu>
385 386
386 387 * IPython/Shell.py (IPShellEmbed.__call__): fix bug introduced in
387 388 r1357, which had killed multiple invocations of an embedded
388 389 ipython (this means that example-embed has been broken for over 1
389 390 year!!!). Rather than possibly breaking the batch stuff for which
390 391 the code in iplib.py/interact was introduced, I worked around the
391 392 problem in the embedding class in Shell.py. We really need a
392 393 bloody test suite for this code, I'm sick of finding stuff that
393 394 used to work breaking left and right every time I use an old
394 395 feature I hadn't touched in a few months.
395 396 (kill_embedded): Add a new magic that only shows up in embedded
396 397 mode, to allow users to permanently deactivate an embedded instance.
397 398
398 399 2007-08-01 Ville Vainio <vivainio@gmail.com>
399 400
400 401 * iplib.py, ipy_profile_sh.py (runlines): Fix the bug where raw
401 402 history gets out of sync on runlines (e.g. when running macros).
402 403
403 404 2007-07-31 Fernando Perez <Fernando.Perez@colorado.edu>
404 405
405 406 * IPython/Magic.py (magic_colors): fix win32-related error message
406 407 that could appear under *nix when readline was missing. Patch by
407 408 Scott Jackson, closes #175.
408 409
409 410 2007-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
410 411
411 412 * IPython/Extensions/ipy_traits_completer.py: Add a new custom
412 413 completer that it traits-aware, so that traits objects don't show
413 414 all of their internal attributes all the time.
414 415
415 416 * IPython/genutils.py (dir2): moved this code from inside
416 417 completer.py to expose it publicly, so I could use it in the
417 418 wildcards bugfix.
418 419
419 420 * IPython/wildcard.py (NameSpace.__init__): fix a bug reported by
420 421 Stefan with Traits.
421 422
422 423 * IPython/completer.py (Completer.attr_matches): change internal
423 424 var name from 'object' to 'obj', since 'object' is now a builtin
424 425 and this can lead to weird bugs if reusing this code elsewhere.
425 426
426 427 2007-07-25 Fernando Perez <Fernando.Perez@colorado.edu>
427 428
428 429 * IPython/OInspect.py (Inspector.pinfo): fix small glitches in
429 430 'foo?' and update the code to prevent printing of default
430 431 docstrings that started appearing after I added support for
431 432 new-style classes. The approach I'm using isn't ideal (I just
432 433 special-case those strings) but I'm not sure how to more robustly
433 434 differentiate between truly user-written strings and Python's
434 435 automatic ones.
435 436
436 437 2007-07-09 Ville Vainio <vivainio@gmail.com>
437 438
438 439 * completer.py: Applied Matthew Neeley's patch:
439 440 Dynamic attributes from trait_names and _getAttributeNames are added
440 441 to the list of tab completions, but when this happens, the attribute
441 442 list is turned into a set, so the attributes are unordered when
442 443 printed, which makes it hard to find the right completion. This patch
443 444 turns this set back into a list and sort it.
444 445
445 446 2007-07-06 Fernando Perez <Fernando.Perez@colorado.edu>
446 447
447 448 * IPython/OInspect.py (Inspector.pinfo): Add support for new-style
448 449 classes in various inspector functions.
449 450
450 451 2007-06-28 Ville Vainio <vivainio@gmail.com>
451 452
452 453 * shadowns.py, iplib.py, ipapi.py, OInspect.py:
453 454 Implement "shadow" namespace, and callable aliases that reside there.
454 455 Use them by:
455 456
456 457 _ip.defalias('foo',myfunc) # creates _sh.foo that points to myfunc
457 458
458 459 foo hello world
459 460 (gets translated to:)
460 461 _sh.foo(r"""hello world""")
461 462
462 463 In practice, this kind of alias can take the role of a magic function
463 464
464 465 * New generic inspect_object, called on obj? and obj??
465 466
466 467 2007-06-15 Fernando Perez <Fernando.Perez@colorado.edu>
467 468
468 469 * IPython/ultraTB.py (findsource): fix a problem with
469 470 inspect.getfile that can cause crashes during traceback construction.
470 471
471 472 2007-06-14 Ville Vainio <vivainio@gmail.com>
472 473
473 474 * iplib.py (handle_auto): Try to use ascii for printing "--->"
474 475 autocall rewrite indication, becausesometimes unicode fails to print
475 476 properly (and you get ' - - - '). Use plain uncoloured ---> for
476 477 unicode.
477 478
478 479 * shadow history. Usable through "%hist -g <pat>" and "%rep 0123".
479 480
480 481 . pickleshare 'hash' commands (hget, hset, hcompress,
481 482 hdict) for efficient shadow history storage.
482 483
483 484 2007-06-13 Ville Vainio <vivainio@gmail.com>
484 485
485 486 * ipapi.py: _ip.to_user_ns(vars, interactive = True).
486 487 Added kw arg 'interactive', tell whether vars should be visible
487 488 with %whos.
488 489
489 490 2007-06-11 Ville Vainio <vivainio@gmail.com>
490 491
491 492 * pspersistence.py, Magic.py, iplib.py: directory history now saved
492 493 to db
493 494
494 495 * iplib.py: "ipython -c <cmd>" now passes the command through prefilter.
495 496 Also, it exits IPython immediately after evaluating the command (just like
496 497 std python)
497 498
498 499 2007-06-05 Walter Doerwald <walter@livinglogic.de>
499 500
500 501 * IPython/Extensions/ipipe.py: Added a new table icap, which executes a
501 502 Python string and captures the output. (Idea and original patch by
502 503 Stefan van der Walt)
503 504
504 505 2007-06-01 Fernando Perez <Fernando.Perez@colorado.edu>
505 506
506 507 * IPython/ultraTB.py (VerboseTB.text): update printing of
507 508 exception types for Python 2.5 (now all exceptions in the stdlib
508 509 are new-style classes).
509 510
510 511 2007-05-31 Walter Doerwald <walter@livinglogic.de>
511 512
512 513 * IPython/Extensions/igrid.py: Add new commands refresh and
513 514 refresh_timer (mapped to "R"/"F5" and to the menu) which restarts
514 515 the iterator once (refresh) or after every x seconds (refresh_timer).
515 516 Add a working implementation of "searchexpression", where the text
516 517 entered is not the text to search for, but an expression that must
517 518 be true. Added display of shortcuts to the menu. Added commands "pickinput"
518 519 and "pickinputattr" that put the object or attribute under the cursor
519 520 in the input line. Split the statusbar to be able to display the currently
520 521 active refresh interval. (Patch by Nik Tautenhahn)
521 522
522 523 2007-05-29 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
523 524
524 525 * fixing set_term_title to use ctypes as default
525 526
526 527 * fixing set_term_title fallback to work when curent dir
527 528 is on a windows network share
528 529
529 530 2007-05-28 Ville Vainio <vivainio@gmail.com>
530 531
531 532 * %cpaste: strip + with > from left (diffs).
532 533
533 534 * iplib.py: Fix crash when readline not installed
534 535
535 536 2007-05-26 Ville Vainio <vivainio@gmail.com>
536 537
537 538 * generics.py: intruduce easy to extend result_display generic
538 539 function (using simplegeneric.py).
539 540
540 541 * Fixed the append functionality of %set.
541 542
542 543 2007-05-25 Ville Vainio <vivainio@gmail.com>
543 544
544 545 * New magic: %rep (fetch / run old commands from history)
545 546
546 547 * New extension: mglob (%mglob magic), for powerful glob / find /filter
547 548 like functionality
548 549
549 550 % maghistory.py: %hist -g PATTERM greps the history for pattern
550 551
551 552 2007-05-24 Walter Doerwald <walter@livinglogic.de>
552 553
553 554 * IPython/Extensions/ipipe.py: Added a Table ihist that can be used to
554 555 browse the IPython input history
555 556
556 557 * IPython/Extensions/ibrowse.py: Added two command to ibrowse: pickinput
557 558 (mapped to "i") can be used to put the object under the curser in the input
558 559 line. pickinputattr (mapped to "I") does the same for the attribute under
559 560 the cursor.
560 561
561 562 2007-05-24 Ville Vainio <vivainio@gmail.com>
562 563
563 564 * Grand magic cleansing (changeset [2380]):
564 565
565 566 * Introduce ipy_legacy.py where the following magics were
566 567 moved:
567 568
568 569 pdef pdoc psource pfile rehash dhist Quit p r automagic autocall
569 570
570 571 If you need them, either use default profile or "import ipy_legacy"
571 572 in your ipy_user_conf.py
572 573
573 574 * Move sh and scipy profile to Extensions from UserConfig. this implies
574 575 you should not edit them, but you don't need to run %upgrade when
575 576 upgrading IPython anymore.
576 577
577 578 * %hist/%history now operates in "raw" mode by default. To get the old
578 579 behaviour, run '%hist -n' (native mode).
579 580
580 581 * split ipy_stock_completers.py to ipy_stock_completers.py and
581 582 ipy_app_completers.py. Stock completers (%cd, import, %run) are now
582 583 installed as default.
583 584
584 585 * sh profile now installs ipy_signals.py, for (hopefully) better ctrl+c
585 586 handling.
586 587
587 588 * iplib.py, ipapi.py: _ip.set_next_input(s) sets the next ("default")
588 589 input if readline is available.
589 590
590 591 2007-05-23 Ville Vainio <vivainio@gmail.com>
591 592
592 593 * macro.py: %store uses __getstate__ properly
593 594
594 595 * exesetup.py: added new setup script for creating
595 596 standalone IPython executables with py2exe (i.e.
596 597 no python installation required).
597 598
598 599 * Removed ipythonrc-scipy, ipy_profile_scipy.py takes
599 600 its place.
600 601
601 602 * rlineimpl.py, genutils.py (get_home_dir): py2exe support
602 603
603 604 2007-05-21 Ville Vainio <vivainio@gmail.com>
604 605
605 606 * platutil_win32.py (set_term_title): handle
606 607 failure of 'title' system call properly.
607 608
608 609 2007-05-17 Walter Doerwald <walter@livinglogic.de>
609 610
610 611 * IPython/Extensions/ipipe.py: Fix xrepr for ifiles.
611 612 (Bug detected by Paul Mueller).
612 613
613 614 2007-05-16 Ville Vainio <vivainio@gmail.com>
614 615
615 616 * ipy_profile_sci.py, ipython_win_post_install.py: Create
616 617 new "sci" profile, effectively a modern version of the old
617 618 "scipy" profile (which is now slated for deprecation).
618 619
619 620 2007-05-15 Ville Vainio <vivainio@gmail.com>
620 621
621 622 * pycolorize.py, pycolor.1: Paul Mueller's patches that
622 623 make pycolorize read input from stdin when run without arguments.
623 624
624 625 * Magic.py: do not require 'PATH' in %rehash/%rehashx. Closes #155
625 626
626 627 * ipy_rehashdir.py: rename ext_rehashdir to ipy_rehashdir, import
627 628 it in sh profile (instead of ipy_system_conf.py).
628 629
629 630 * Magic.py, ipy_rehashdir.py, ipy_profile_sh.py: System command
630 631 aliases are now lower case on windows (MyCommand.exe => mycommand).
631 632
632 633 * macro.py, ipapi.py, iplib.py, Prompts.py: Macro system rehaul.
633 634 Macros are now callable objects that inherit from ipapi.IPyAutocall,
634 635 i.e. get autocalled regardless of system autocall setting.
635 636
636 637 2007-05-10 Fernando Perez <Fernando.Perez@colorado.edu>
637 638
638 639 * IPython/rlineimpl.py: check for clear_history in readline and
639 640 make it a dummy no-op if not available. This function isn't
640 641 guaranteed to be in the API and appeared in Python 2.4, so we need
641 642 to check it ourselves. Also, clean up this file quite a bit.
642 643
643 644 * ipython.1: update man page and full manual with information
644 645 about threads (remove outdated warning). Closes #151.
645 646
646 647 2007-05-09 Fernando Perez <Fernando.Perez@colorado.edu>
647 648
648 649 * IPython/Extensions/ipy_constants.py: Add Gael's constants module
649 650 in trunk (note that this made it into the 0.8.1 release already,
650 651 but the changelogs didn't get coordinated). Many thanks to Gael
651 652 Varoquaux <gael.varoquaux-AT-normalesup.org>
652 653
653 654 2007-05-09 *** Released version 0.8.1
654 655
655 656 2007-05-10 Walter Doerwald <walter@livinglogic.de>
656 657
657 658 * IPython/Extensions/igrid.py: Incorporate html help into
658 659 the module, so we don't have to search for the file.
659 660
660 661 2007-05-02 Fernando Perez <Fernando.Perez@colorado.edu>
661 662
662 663 * test/test_irunner.py (RunnerTestCase._test_runner): Close #147.
663 664
664 665 2007-04-30 Ville Vainio <vivainio@gmail.com>
665 666
666 667 * iplib.py: (pre_config_initialization) Catch UnicodeDecodeError if the
667 668 user has illegal (non-ascii) home directory name
668 669
669 670 2007-04-27 Ville Vainio <vivainio@gmail.com>
670 671
671 672 * platutils_win32.py: implement set_term_title for windows
672 673
673 674 * Update version number
674 675
675 676 * ipy_profile_sh.py: more informative prompt (2 dir levels)
676 677
677 678 2007-04-26 Walter Doerwald <walter@livinglogic.de>
678 679
679 680 * IPython/Extensions/igrid.py: (igrid) Fix bug that surfaced
680 681 when the igrid input raised an exception. (Patch by Nik Tautenhahn,
681 682 bug discovered by Ville).
682 683
683 684 2007-04-26 Ville Vainio <vivainio@gmail.com>
684 685
685 686 * Extensions/ipy_completers.py: Olivier's module completer now
686 687 saves the list of root modules if it takes > 4 secs on the first run.
687 688
688 689 * Magic.py (%rehashx): %rehashx now clears the completer cache
689 690
690 691
691 692 2007-04-26 Fernando Perez <Fernando.Perez@colorado.edu>
692 693
693 694 * ipython.el: fix incorrect color scheme, reported by Stefan.
694 695 Closes #149.
695 696
696 697 * IPython/PyColorize.py (Parser.format2): fix state-handling
697 698 logic. I still don't like how that code handles state, but at
698 699 least now it should be correct, if inelegant. Closes #146.
699 700
700 701 2007-04-25 Ville Vainio <vivainio@gmail.com>
701 702
702 703 * Extensions/ipy_which.py: added extension for %which magic, works
703 704 a lot like unix 'which' but also finds and expands aliases, and
704 705 allows wildcards.
705 706
706 707 * ipapi.py (expand_alias): Now actually *return* the expanded alias,
707 708 as opposed to returning nothing.
708 709
709 710 * UserConfig/ipy_user_conf.py, ipy_profile_sh.py: do not import
710 711 ipy_stock_completers on default profile, do import on sh profile.
711 712
712 713 2007-04-22 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
713 714
714 715 * Fix bug in iplib.py/safe_execfile when launching ipython with a script
715 716 like ipython.py foo.py which raised a IndexError.
716 717
717 718 2007-04-21 Ville Vainio <vivainio@gmail.com>
718 719
719 720 * Extensions/ipy_extutil.py: added extension to manage other ipython
720 721 extensions. Now only supports 'ls' == list extensions.
721 722
722 723 2007-04-20 Fernando Perez <Fernando.Perez@colorado.edu>
723 724
724 725 * IPython/Debugger.py (BdbQuit_excepthook): fix small bug that
725 726 would prevent use of the exception system outside of a running
726 727 IPython instance.
727 728
728 729 2007-04-20 Ville Vainio <vivainio@gmail.com>
729 730
730 731 * Extensions/ipy_render.py: added extension for easy
731 732 interactive text template rendering (to clipboard). Uses Ka-Ping Yee's
732 733 'Iptl' template notation,
733 734
734 735 * Extensions/ipy_completers.py: introduced Olivier Lauzanne's
735 736 safer & faster 'import' completer.
736 737
737 738 * ipapi.py: Introduced new ipapi methods, _ip.defmacro(name, value)
738 739 and _ip.defalias(name, command).
739 740
740 741 * Extensions/ipy_exportdb.py: New extension for exporting all the
741 742 %store'd data in a portable format (normal ipapi calls like
742 743 defmacro() etc.)
743 744
744 745 2007-04-19 Ville Vainio <vivainio@gmail.com>
745 746
746 747 * upgrade_dir.py: skip junk files like *.pyc
747 748
748 749 * Release.py: version number to 0.8.1
749 750
750 751 2007-04-18 Ville Vainio <vivainio@gmail.com>
751 752
752 753 * iplib.py (safe_execfile): make "ipython foo.py" work with 2.5.1c1
753 754 and later on win32.
754 755
755 756 2007-04-16 Ville Vainio <vivainio@gmail.com>
756 757
757 758 * iplib.py (showtraceback): Do not crash when running w/o readline.
758 759
759 760 2007-04-12 Walter Doerwald <walter@livinglogic.de>
760 761
761 762 * IPython/Extensions/ipipe.py: (ils) Directoy listings are now
762 763 sorted (case sensitive with files and dirs mixed).
763 764
764 765 2007-04-10 Fernando Perez <Fernando.Perez@colorado.edu>
765 766
766 767 * IPython/Release.py (version): Open trunk for 0.8.1 development.
767 768
768 769 2007-04-10 *** Released version 0.8.0
769 770
770 771 2007-04-07 Fernando Perez <Fernando.Perez@colorado.edu>
771 772
772 773 * Tag 0.8.0 for release.
773 774
774 775 * IPython/iplib.py (reloadhist): add API function to cleanly
775 776 reload the readline history, which was growing inappropriately on
776 777 every %run call.
777 778
778 779 * win32_manual_post_install.py (run): apply last part of Nicolas
779 780 Pernetty's patch (I'd accidentally applied it in a different
780 781 directory and this particular file didn't get patched).
781 782
782 783 2007-04-05 Fernando Perez <Fernando.Perez@colorado.edu>
783 784
784 785 * IPython/Shell.py (MAIN_THREAD_ID): get rid of my stupid hack to
785 786 find the main thread id and use the proper API call. Thanks to
786 787 Stefan for the fix.
787 788
788 789 * test/test_prefilter.py (esc_handler_tests): udpate one of Dan's
789 790 unit tests to reflect fixed ticket #52, and add more tests sent by
790 791 him.
791 792
792 793 * IPython/iplib.py (raw_input): restore the readline completer
793 794 state on every input, in case third-party code messed it up.
794 795 (_prefilter): revert recent addition of early-escape checks which
795 796 prevent many valid alias calls from working.
796 797
797 798 * IPython/Shell.py (MTInteractiveShell.runcode): add a tracking
798 799 flag for sigint handler so we don't run a full signal() call on
799 800 each runcode access.
800 801
801 802 * IPython/Magic.py (magic_whos): small improvement to diagnostic
802 803 message.
803 804
804 805 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
805 806
806 807 * IPython/Shell.py (sigint_handler): I *THINK* I finally got
807 808 asynchronous exceptions working, i.e., Ctrl-C can actually
808 809 interrupt long-running code in the multithreaded shells.
809 810
810 811 This is using Tomer Filiba's great ctypes-based trick:
811 812 http://sebulba.wikispaces.com/recipe+thread2. I'd already tried
812 813 this in the past, but hadn't been able to make it work before. So
813 814 far it looks like it's actually running, but this needs more
814 815 testing. If it really works, I'll be *very* happy, and we'll owe
815 816 a huge thank you to Tomer. My current implementation is ugly,
816 817 hackish and uses nasty globals, but I don't want to try and clean
817 818 anything up until we know if it actually works.
818 819
819 820 NOTE: this feature needs ctypes to work. ctypes is included in
820 821 Python2.5, but 2.4 users will need to manually install it. This
821 822 feature makes multi-threaded shells so much more usable that it's
822 823 a minor price to pay (ctypes is very easy to install, already a
823 824 requirement for win32 and available in major linux distros).
824 825
825 826 2007-04-04 Ville Vainio <vivainio@gmail.com>
826 827
827 828 * Extensions/ipy_completers.py, ipy_stock_completers.py:
828 829 Moved implementations of 'bundled' completers to ipy_completers.py,
829 830 they are only enabled in ipy_stock_completers.py.
830 831
831 832 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
832 833
833 834 * IPython/PyColorize.py (Parser.format2): Fix identation of
834 835 colorzied output and return early if color scheme is NoColor, to
835 836 avoid unnecessary and expensive tokenization. Closes #131.
836 837
837 838 2007-04-03 Fernando Perez <Fernando.Perez@colorado.edu>
838 839
839 840 * IPython/Debugger.py: disable the use of pydb version 1.17. It
840 841 has a critical bug (a missing import that makes post-mortem not
841 842 work at all). Unfortunately as of this time, this is the version
842 843 shipped with Ubuntu Edgy, so quite a few people have this one. I
843 844 hope Edgy will update to a more recent package.
844 845
845 846 2007-04-02 Fernando Perez <Fernando.Perez@colorado.edu>
846 847
847 848 * IPython/iplib.py (_prefilter): close #52, second part of a patch
848 849 set by Stefan (only the first part had been applied before).
849 850
850 851 * IPython/Extensions/ipy_stock_completers.py (module_completer):
851 852 remove usage of the dangerous pkgutil.walk_packages(). See
852 853 details in comments left in the code.
853 854
854 855 * IPython/Magic.py (magic_whos): add support for numpy arrays
855 856 similar to what we had for Numeric.
856 857
857 858 * IPython/completer.py (IPCompleter.complete): extend the
858 859 complete() call API to support completions by other mechanisms
859 860 than readline. Closes #109.
860 861
861 862 * IPython/iplib.py (safe_execfile): add a safeguard under Win32 to
862 863 protect against a bug in Python's execfile(). Closes #123.
863 864
864 865 2007-04-01 Fernando Perez <Fernando.Perez@colorado.edu>
865 866
866 867 * IPython/iplib.py (split_user_input): ensure that when splitting
867 868 user input, the part that can be treated as a python name is pure
868 869 ascii (Python identifiers MUST be pure ascii). Part of the
869 870 ongoing Unicode support work.
870 871
871 872 * IPython/Prompts.py (prompt_specials_color): Add \N for the
872 873 actual prompt number, without any coloring. This allows users to
873 874 produce numbered prompts with their own colors. Added after a
874 875 report/request by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
875 876
876 877 2007-03-31 Walter Doerwald <walter@livinglogic.de>
877 878
878 879 * IPython/Extensions/igrid.py: Map the return key
879 880 to enter() and shift-return to enterattr().
880 881
881 882 2007-03-30 Fernando Perez <Fernando.Perez@colorado.edu>
882 883
883 884 * IPython/Magic.py (magic_psearch): add unicode support by
884 885 encoding to ascii the input, since this routine also only deals
885 886 with valid Python names. Fixes a bug reported by Stefan.
886 887
887 888 2007-03-29 Fernando Perez <Fernando.Perez@colorado.edu>
888 889
889 890 * IPython/Magic.py (_inspect): convert unicode input into ascii
890 891 before trying to evaluate it as a Python identifier. This fixes a
891 892 problem that the new unicode support had introduced when analyzing
892 893 long definition lines for functions.
893 894
894 895 2007-03-24 Walter Doerwald <walter@livinglogic.de>
895 896
896 897 * IPython/Extensions/igrid.py: Fix picking. Using
897 898 igrid with wxPython 2.6 and -wthread should work now.
898 899 igrid.display() simply tries to create a frame without
899 900 an application. Only if this fails an application is created.
900 901
901 902 2007-03-23 Walter Doerwald <walter@livinglogic.de>
902 903
903 904 * IPython/Extensions/path.py: Updated to version 2.2.
904 905
905 906 2007-03-23 Ville Vainio <vivainio@gmail.com>
906 907
907 908 * iplib.py: recursive alias expansion now works better, so that
908 909 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
909 910 doesn't trip up the process, if 'd' has been aliased to 'ls'.
910 911
911 912 * Extensions/ipy_gnuglobal.py added, provides %global magic
912 913 for users of http://www.gnu.org/software/global
913 914
914 915 * iplib.py: '!command /?' now doesn't invoke IPython's help system.
915 916 Closes #52. Patch by Stefan van der Walt.
916 917
917 918 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
918 919
919 920 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
920 921 respect the __file__ attribute when using %run. Thanks to a bug
921 922 report by Sebastian Rooks <sebastian.rooks-AT-free.fr>.
922 923
923 924 2007-03-22 Fernando Perez <Fernando.Perez@colorado.edu>
924 925
925 926 * IPython/iplib.py (raw_input): Fix mishandling of unicode at
926 927 input. Patch sent by Stefan.
927 928
928 929 2007-03-20 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
929 930 * IPython/Extensions/ipy_stock_completer.py
930 931 shlex_split, fix bug in shlex_split. len function
931 932 call was missing an if statement. Caused shlex_split to
932 933 sometimes return "" as last element.
933 934
934 935 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
935 936
936 937 * IPython/completer.py
937 938 (IPCompleter.file_matches.single_dir_expand): fix a problem
938 939 reported by Stefan, where directories containign a single subdir
939 940 would be completed too early.
940 941
941 942 * IPython/Shell.py (_load_pylab): Make the execution of 'from
942 943 pylab import *' when -pylab is given be optional. A new flag,
943 944 pylab_import_all controls this behavior, the default is True for
944 945 backwards compatibility.
945 946
946 947 * IPython/ultraTB.py (_formatTracebackLines): Added (slightly
947 948 modified) R. Bernstein's patch for fully syntax highlighted
948 949 tracebacks. The functionality is also available under ultraTB for
949 950 non-ipython users (someone using ultraTB but outside an ipython
950 951 session). They can select the color scheme by setting the
951 952 module-level global DEFAULT_SCHEME. The highlight functionality
952 953 also works when debugging.
953 954
954 955 * IPython/genutils.py (IOStream.close): small patch by
955 956 R. Bernstein for improved pydb support.
956 957
957 958 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
958 959 DaveS <davls@telus.net> to improve support of debugging under
959 960 NTEmacs, including improved pydb behavior.
960 961
961 962 * IPython/Magic.py (magic_prun): Fix saving of profile info for
962 963 Python 2.5, where the stats object API changed a little. Thanks
963 964 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
964 965
965 966 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
966 967 Pernetty's patch to improve support for (X)Emacs under Win32.
967 968
968 969 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
969 970
970 971 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
971 972 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
972 973 a report by Nik Tautenhahn.
973 974
974 975 2007-03-16 Walter Doerwald <walter@livinglogic.de>
975 976
976 977 * setup.py: Add the igrid help files to the list of data files
977 978 to be installed alongside igrid.
978 979 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
979 980 Show the input object of the igrid browser as the window tile.
980 981 Show the object the cursor is on in the statusbar.
981 982
982 983 2007-03-15 Ville Vainio <vivainio@gmail.com>
983 984
984 985 * Extensions/ipy_stock_completers.py: Fixed exception
985 986 on mismatching quotes in %run completer. Patch by
986 987 Jorgen Stenarson. Closes #127.
987 988
988 989 2007-03-14 Ville Vainio <vivainio@gmail.com>
989 990
990 991 * Extensions/ext_rehashdir.py: Do not do auto_alias
991 992 in %rehashdir, it clobbers %store'd aliases.
992 993
993 994 * UserConfig/ipy_profile_sh.py: envpersist.py extension
994 995 (beefed up %env) imported for sh profile.
995 996
996 997 2007-03-10 Walter Doerwald <walter@livinglogic.de>
997 998
998 999 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
999 1000 as the default browser.
1000 1001 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
1001 1002 As igrid displays all attributes it ever encounters, fetch() (which has
1002 1003 been renamed to _fetch()) doesn't have to recalculate the display attributes
1003 1004 every time a new item is fetched. This should speed up scrolling.
1004 1005
1005 1006 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
1006 1007
1007 1008 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
1008 1009 Schmolck's recently reported tab-completion bug (my previous one
1009 1010 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
1010 1011
1011 1012 2007-03-09 Walter Doerwald <walter@livinglogic.de>
1012 1013
1013 1014 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
1014 1015 Close help window if exiting igrid.
1015 1016
1016 1017 2007-03-02 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
1017 1018
1018 1019 * IPython/Extensions/ipy_defaults.py: Check if readline is available
1019 1020 before calling functions from readline.
1020 1021
1021 1022 2007-03-02 Walter Doerwald <walter@livinglogic.de>
1022 1023
1023 1024 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
1024 1025 igrid is a wxPython-based display object for ipipe. If your system has
1025 1026 wx installed igrid will be the default display. Without wx ipipe falls
1026 1027 back to ibrowse (which needs curses). If no curses is installed ipipe
1027 1028 falls back to idump.
1028 1029
1029 1030 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
1030 1031
1031 1032 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
1032 1033 my changes from yesterday, they introduced bugs. Will reactivate
1033 1034 once I get a correct solution, which will be much easier thanks to
1034 1035 Dan Milstein's new prefilter test suite.
1035 1036
1036 1037 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
1037 1038
1038 1039 * IPython/iplib.py (split_user_input): fix input splitting so we
1039 1040 don't attempt attribute accesses on things that can't possibly be
1040 1041 valid Python attributes. After a bug report by Alex Schmolck.
1041 1042 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
1042 1043 %magic with explicit % prefix.
1043 1044
1044 1045 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
1045 1046
1046 1047 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
1047 1048 avoid a DeprecationWarning from GTK.
1048 1049
1049 1050 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
1050 1051
1051 1052 * IPython/genutils.py (clock): I modified clock() to return total
1052 1053 time, user+system. This is a more commonly needed metric. I also
1053 1054 introduced the new clocku/clocks to get only user/system time if
1054 1055 one wants those instead.
1055 1056
1056 1057 ***WARNING: API CHANGE*** clock() used to return only user time,
1057 1058 so if you want exactly the same results as before, use clocku
1058 1059 instead.
1059 1060
1060 1061 2007-02-22 Ville Vainio <vivainio@gmail.com>
1061 1062
1062 1063 * IPython/Extensions/ipy_p4.py: Extension for improved
1063 1064 p4 (perforce version control system) experience.
1064 1065 Adds %p4 magic with p4 command completion and
1065 1066 automatic -G argument (marshall output as python dict)
1066 1067
1067 1068 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
1068 1069
1069 1070 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
1070 1071 stop marks.
1071 1072 (ClearingMixin): a simple mixin to easily make a Demo class clear
1072 1073 the screen in between blocks and have empty marquees. The
1073 1074 ClearDemo and ClearIPDemo classes that use it are included.
1074 1075
1075 1076 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
1076 1077
1077 1078 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
1078 1079 protect against exceptions at Python shutdown time. Patch
1079 1080 sumbmitted to upstream.
1080 1081
1081 1082 2007-02-14 Walter Doerwald <walter@livinglogic.de>
1082 1083
1083 1084 * IPython/Extensions/ibrowse.py: If entering the first object level
1084 1085 (i.e. the object for which the browser has been started) fails,
1085 1086 now the error is raised directly (aborting the browser) instead of
1086 1087 running into an empty levels list later.
1087 1088
1088 1089 2007-02-03 Walter Doerwald <walter@livinglogic.de>
1089 1090
1090 1091 * IPython/Extensions/ipipe.py: Add an xrepr implementation
1091 1092 for the noitem object.
1092 1093
1093 1094 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
1094 1095
1095 1096 * IPython/completer.py (Completer.attr_matches): Fix small
1096 1097 tab-completion bug with Enthought Traits objects with units.
1097 1098 Thanks to a bug report by Tom Denniston
1098 1099 <tom.denniston-AT-alum.dartmouth.org>.
1099 1100
1100 1101 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
1101 1102
1102 1103 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
1103 1104 bug where only .ipy or .py would be completed. Once the first
1104 1105 argument to %run has been given, all completions are valid because
1105 1106 they are the arguments to the script, which may well be non-python
1106 1107 filenames.
1107 1108
1108 1109 * IPython/irunner.py (InteractiveRunner.run_source): major updates
1109 1110 to irunner to allow it to correctly support real doctesting of
1110 1111 out-of-process ipython code.
1111 1112
1112 1113 * IPython/Magic.py (magic_cd): Make the setting of the terminal
1113 1114 title an option (-noterm_title) because it completely breaks
1114 1115 doctesting.
1115 1116
1116 1117 * IPython/demo.py: fix IPythonDemo class that was not actually working.
1117 1118
1118 1119 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
1119 1120
1120 1121 * IPython/irunner.py (main): fix small bug where extensions were
1121 1122 not being correctly recognized.
1122 1123
1123 1124 2007-01-23 Walter Doerwald <walter@livinglogic.de>
1124 1125
1125 1126 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
1126 1127 a string containing a single line yields the string itself as the
1127 1128 only item.
1128 1129
1129 1130 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
1130 1131 object if it's the same as the one on the last level (This avoids
1131 1132 infinite recursion for one line strings).
1132 1133
1133 1134 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1134 1135
1135 1136 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
1136 1137 all output streams before printing tracebacks. This ensures that
1137 1138 user output doesn't end up interleaved with traceback output.
1138 1139
1139 1140 2007-01-10 Ville Vainio <vivainio@gmail.com>
1140 1141
1141 1142 * Extensions/envpersist.py: Turbocharged %env that remembers
1142 1143 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
1143 1144 "%env VISUAL=jed".
1144 1145
1145 1146 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
1146 1147
1147 1148 * IPython/iplib.py (showtraceback): ensure that we correctly call
1148 1149 custom handlers in all cases (some with pdb were slipping through,
1149 1150 but I'm not exactly sure why).
1150 1151
1151 1152 * IPython/Debugger.py (Tracer.__init__): added new class to
1152 1153 support set_trace-like usage of IPython's enhanced debugger.
1153 1154
1154 1155 2006-12-24 Ville Vainio <vivainio@gmail.com>
1155 1156
1156 1157 * ipmaker.py: more informative message when ipy_user_conf
1157 1158 import fails (suggest running %upgrade).
1158 1159
1159 1160 * tools/run_ipy_in_profiler.py: Utility to see where
1160 1161 the time during IPython startup is spent.
1161 1162
1162 1163 2006-12-20 Ville Vainio <vivainio@gmail.com>
1163 1164
1164 1165 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
1165 1166
1166 1167 * ipapi.py: Add new ipapi method, expand_alias.
1167 1168
1168 1169 * Release.py: Bump up version to 0.7.4.svn
1169 1170
1170 1171 2006-12-17 Ville Vainio <vivainio@gmail.com>
1171 1172
1172 1173 * Extensions/jobctrl.py: Fixed &cmd arg arg...
1173 1174 to work properly on posix too
1174 1175
1175 1176 * Release.py: Update revnum (version is still just 0.7.3).
1176 1177
1177 1178 2006-12-15 Ville Vainio <vivainio@gmail.com>
1178 1179
1179 1180 * scripts/ipython_win_post_install: create ipython.py in
1180 1181 prefix + "/scripts".
1181 1182
1182 1183 * Release.py: Update version to 0.7.3.
1183 1184
1184 1185 2006-12-14 Ville Vainio <vivainio@gmail.com>
1185 1186
1186 1187 * scripts/ipython_win_post_install: Overwrite old shortcuts
1187 1188 if they already exist
1188 1189
1189 1190 * Release.py: release 0.7.3rc2
1190 1191
1191 1192 2006-12-13 Ville Vainio <vivainio@gmail.com>
1192 1193
1193 1194 * Branch and update Release.py for 0.7.3rc1
1194 1195
1195 1196 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
1196 1197
1197 1198 * IPython/Shell.py (IPShellWX): update for current WX naming
1198 1199 conventions, to avoid a deprecation warning with current WX
1199 1200 versions. Thanks to a report by Danny Shevitz.
1200 1201
1201 1202 2006-12-12 Ville Vainio <vivainio@gmail.com>
1202 1203
1203 1204 * ipmaker.py: apply david cournapeau's patch to make
1204 1205 import_some work properly even when ipythonrc does
1205 1206 import_some on empty list (it was an old bug!).
1206 1207
1207 1208 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
1208 1209 Add deprecation note to ipythonrc and a url to wiki
1209 1210 in ipy_user_conf.py
1210 1211
1211 1212
1212 1213 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
1213 1214 as if it was typed on IPython command prompt, i.e.
1214 1215 as IPython script.
1215 1216
1216 1217 * example-magic.py, magic_grepl.py: remove outdated examples
1217 1218
1218 1219 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
1219 1220
1220 1221 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
1221 1222 is called before any exception has occurred.
1222 1223
1223 1224 2006-12-08 Ville Vainio <vivainio@gmail.com>
1224 1225
1225 1226 * Extensions/ipy_stock_completers.py: fix cd completer
1226 1227 to translate /'s to \'s again.
1227 1228
1228 1229 * completer.py: prevent traceback on file completions w/
1229 1230 backslash.
1230 1231
1231 1232 * Release.py: Update release number to 0.7.3b3 for release
1232 1233
1233 1234 2006-12-07 Ville Vainio <vivainio@gmail.com>
1234 1235
1235 1236 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
1236 1237 while executing external code. Provides more shell-like behaviour
1237 1238 and overall better response to ctrl + C / ctrl + break.
1238 1239
1239 1240 * tools/make_tarball.py: new script to create tarball straight from svn
1240 1241 (setup.py sdist doesn't work on win32).
1241 1242
1242 1243 * Extensions/ipy_stock_completers.py: fix cd completer to give up
1243 1244 on dirnames with spaces and use the default completer instead.
1244 1245
1245 1246 * Revision.py: Change version to 0.7.3b2 for release.
1246 1247
1247 1248 2006-12-05 Ville Vainio <vivainio@gmail.com>
1248 1249
1249 1250 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
1250 1251 pydb patch 4 (rm debug printing, py 2.5 checking)
1251 1252
1252 1253 2006-11-30 Walter Doerwald <walter@livinglogic.de>
1253 1254 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
1254 1255 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
1255 1256 "refreshfind" (mapped to "R") does the same but tries to go back to the same
1256 1257 object the cursor was on before the refresh. The command "markrange" is
1257 1258 mapped to "%" now.
1258 1259 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
1259 1260
1260 1261 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
1261 1262
1262 1263 * IPython/Magic.py (magic_debug): new %debug magic to activate the
1263 1264 interactive debugger on the last traceback, without having to call
1264 1265 %pdb and rerun your code. Made minor changes in various modules,
1265 1266 should automatically recognize pydb if available.
1266 1267
1267 1268 2006-11-28 Ville Vainio <vivainio@gmail.com>
1268 1269
1269 1270 * completer.py: If the text start with !, show file completions
1270 1271 properly. This helps when trying to complete command name
1271 1272 for shell escapes.
1272 1273
1273 1274 2006-11-27 Ville Vainio <vivainio@gmail.com>
1274 1275
1275 1276 * ipy_stock_completers.py: bzr completer submitted by Stefan van
1276 1277 der Walt. Clean up svn and hg completers by using a common
1277 1278 vcs_completer.
1278 1279
1279 1280 2006-11-26 Ville Vainio <vivainio@gmail.com>
1280 1281
1281 1282 * Remove ipconfig and %config; you should use _ip.options structure
1282 1283 directly instead!
1283 1284
1284 1285 * genutils.py: add wrap_deprecated function for deprecating callables
1285 1286
1286 1287 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
1287 1288 _ip.system instead. ipalias is redundant.
1288 1289
1289 1290 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
1290 1291 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
1291 1292 explicit.
1292 1293
1293 1294 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
1294 1295 completer. Try it by entering 'hg ' and pressing tab.
1295 1296
1296 1297 * macro.py: Give Macro a useful __repr__ method
1297 1298
1298 1299 * Magic.py: %whos abbreviates the typename of Macro for brevity.
1299 1300
1300 1301 2006-11-24 Walter Doerwald <walter@livinglogic.de>
1301 1302 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
1302 1303 we don't get a duplicate ipipe module, where registration of the xrepr
1303 1304 implementation for Text is useless.
1304 1305
1305 1306 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
1306 1307
1307 1308 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
1308 1309
1309 1310 2006-11-24 Ville Vainio <vivainio@gmail.com>
1310 1311
1311 1312 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
1312 1313 try to use "cProfile" instead of the slower pure python
1313 1314 "profile"
1314 1315
1315 1316 2006-11-23 Ville Vainio <vivainio@gmail.com>
1316 1317
1317 1318 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
1318 1319 Qt+IPython+Designer link in documentation.
1319 1320
1320 1321 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
1321 1322 correct Pdb object to %pydb.
1322 1323
1323 1324
1324 1325 2006-11-22 Walter Doerwald <walter@livinglogic.de>
1325 1326 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
1326 1327 generic xrepr(), otherwise the list implementation would kick in.
1327 1328
1328 1329 2006-11-21 Ville Vainio <vivainio@gmail.com>
1329 1330
1330 1331 * upgrade_dir.py: Now actually overwrites a nonmodified user file
1331 1332 with one from UserConfig.
1332 1333
1333 1334 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
1334 1335 it was missing which broke the sh profile.
1335 1336
1336 1337 * completer.py: file completer now uses explicit '/' instead
1337 1338 of os.path.join, expansion of 'foo' was broken on win32
1338 1339 if there was one directory with name 'foobar'.
1339 1340
1340 1341 * A bunch of patches from Kirill Smelkov:
1341 1342
1342 1343 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
1343 1344
1344 1345 * [patch 7/9] Implement %page -r (page in raw mode) -
1345 1346
1346 1347 * [patch 5/9] ScientificPython webpage has moved
1347 1348
1348 1349 * [patch 4/9] The manual mentions %ds, should be %dhist
1349 1350
1350 1351 * [patch 3/9] Kill old bits from %prun doc.
1351 1352
1352 1353 * [patch 1/9] Fix typos here and there.
1353 1354
1354 1355 2006-11-08 Ville Vainio <vivainio@gmail.com>
1355 1356
1356 1357 * completer.py (attr_matches): catch all exceptions raised
1357 1358 by eval of expr with dots.
1358 1359
1359 1360 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
1360 1361
1361 1362 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
1362 1363 input if it starts with whitespace. This allows you to paste
1363 1364 indented input from any editor without manually having to type in
1364 1365 the 'if 1:', which is convenient when working interactively.
1365 1366 Slightly modifed version of a patch by Bo Peng
1366 1367 <bpeng-AT-rice.edu>.
1367 1368
1368 1369 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1369 1370
1370 1371 * IPython/irunner.py (main): modified irunner so it automatically
1371 1372 recognizes the right runner to use based on the extension (.py for
1372 1373 python, .ipy for ipython and .sage for sage).
1373 1374
1374 1375 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
1375 1376 visible in ipapi as ip.config(), to programatically control the
1376 1377 internal rc object. There's an accompanying %config magic for
1377 1378 interactive use, which has been enhanced to match the
1378 1379 funtionality in ipconfig.
1379 1380
1380 1381 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
1381 1382 so it's not just a toggle, it now takes an argument. Add support
1382 1383 for a customizable header when making system calls, as the new
1383 1384 system_header variable in the ipythonrc file.
1384 1385
1385 1386 2006-11-03 Walter Doerwald <walter@livinglogic.de>
1386 1387
1387 1388 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
1388 1389 generic functions (using Philip J. Eby's simplegeneric package).
1389 1390 This makes it possible to customize the display of third-party classes
1390 1391 without having to monkeypatch them. xiter() no longer supports a mode
1391 1392 argument and the XMode class has been removed. The same functionality can
1392 1393 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
1393 1394 One consequence of the switch to generic functions is that xrepr() and
1394 1395 xattrs() implementation must define the default value for the mode
1395 1396 argument themselves and xattrs() implementations must return real
1396 1397 descriptors.
1397 1398
1398 1399 * IPython/external: This new subpackage will contain all third-party
1399 1400 packages that are bundled with IPython. (The first one is simplegeneric).
1400 1401
1401 1402 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
1402 1403 directory which as been dropped in r1703.
1403 1404
1404 1405 * IPython/Extensions/ipipe.py (iless): Fixed.
1405 1406
1406 1407 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
1407 1408
1408 1409 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1409 1410
1410 1411 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
1411 1412 handling in variable expansion so that shells and magics recognize
1412 1413 function local scopes correctly. Bug reported by Brian.
1413 1414
1414 1415 * scripts/ipython: remove the very first entry in sys.path which
1415 1416 Python auto-inserts for scripts, so that sys.path under IPython is
1416 1417 as similar as possible to that under plain Python.
1417 1418
1418 1419 * IPython/completer.py (IPCompleter.file_matches): Fix
1419 1420 tab-completion so that quotes are not closed unless the completion
1420 1421 is unambiguous. After a request by Stefan. Minor cleanups in
1421 1422 ipy_stock_completers.
1422 1423
1423 1424 2006-11-02 Ville Vainio <vivainio@gmail.com>
1424 1425
1425 1426 * ipy_stock_completers.py: Add %run and %cd completers.
1426 1427
1427 1428 * completer.py: Try running custom completer for both
1428 1429 "foo" and "%foo" if the command is just "foo". Ignore case
1429 1430 when filtering possible completions.
1430 1431
1431 1432 * UserConfig/ipy_user_conf.py: install stock completers as default
1432 1433
1433 1434 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
1434 1435 simplified readline history save / restore through a wrapper
1435 1436 function
1436 1437
1437 1438
1438 1439 2006-10-31 Ville Vainio <vivainio@gmail.com>
1439 1440
1440 1441 * strdispatch.py, completer.py, ipy_stock_completers.py:
1441 1442 Allow str_key ("command") in completer hooks. Implement
1442 1443 trivial completer for 'import' (stdlib modules only). Rename
1443 1444 ipy_linux_package_managers.py to ipy_stock_completers.py.
1444 1445 SVN completer.
1445 1446
1446 1447 * Extensions/ledit.py: %magic line editor for easily and
1447 1448 incrementally manipulating lists of strings. The magic command
1448 1449 name is %led.
1449 1450
1450 1451 2006-10-30 Ville Vainio <vivainio@gmail.com>
1451 1452
1452 1453 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
1453 1454 Bernsteins's patches for pydb integration.
1454 1455 http://bashdb.sourceforge.net/pydb/
1455 1456
1456 1457 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
1457 1458 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
1458 1459 custom completer hook to allow the users to implement their own
1459 1460 completers. See ipy_linux_package_managers.py for example. The
1460 1461 hook name is 'complete_command'.
1461 1462
1462 1463 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
1463 1464
1464 1465 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
1465 1466 Numeric leftovers.
1466 1467
1467 1468 * ipython.el (py-execute-region): apply Stefan's patch to fix
1468 1469 garbled results if the python shell hasn't been previously started.
1469 1470
1470 1471 * IPython/genutils.py (arg_split): moved to genutils, since it's a
1471 1472 pretty generic function and useful for other things.
1472 1473
1473 1474 * IPython/OInspect.py (getsource): Add customizable source
1474 1475 extractor. After a request/patch form W. Stein (SAGE).
1475 1476
1476 1477 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
1477 1478 window size to a more reasonable value from what pexpect does,
1478 1479 since their choice causes wrapping bugs with long input lines.
1479 1480
1480 1481 2006-10-28 Ville Vainio <vivainio@gmail.com>
1481 1482
1482 1483 * Magic.py (%run): Save and restore the readline history from
1483 1484 file around %run commands to prevent side effects from
1484 1485 %runned programs that might use readline (e.g. pydb).
1485 1486
1486 1487 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
1487 1488 invoking the pydb enhanced debugger.
1488 1489
1489 1490 2006-10-23 Walter Doerwald <walter@livinglogic.de>
1490 1491
1491 1492 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
1492 1493 call the base class method and propagate the return value to
1493 1494 ifile. This is now done by path itself.
1494 1495
1495 1496 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1496 1497
1497 1498 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
1498 1499 api: set_crash_handler(), to expose the ability to change the
1499 1500 internal crash handler.
1500 1501
1501 1502 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
1502 1503 the various parameters of the crash handler so that apps using
1503 1504 IPython as their engine can customize crash handling. Ipmlemented
1504 1505 at the request of SAGE.
1505 1506
1506 1507 2006-10-14 Ville Vainio <vivainio@gmail.com>
1507 1508
1508 1509 * Magic.py, ipython.el: applied first "safe" part of Rocky
1509 1510 Bernstein's patch set for pydb integration.
1510 1511
1511 1512 * Magic.py (%unalias, %alias): %store'd aliases can now be
1512 1513 removed with '%unalias'. %alias w/o args now shows most
1513 1514 interesting (stored / manually defined) aliases last
1514 1515 where they catch the eye w/o scrolling.
1515 1516
1516 1517 * Magic.py (%rehashx), ext_rehashdir.py: files with
1517 1518 'py' extension are always considered executable, even
1518 1519 when not in PATHEXT environment variable.
1519 1520
1520 1521 2006-10-12 Ville Vainio <vivainio@gmail.com>
1521 1522
1522 1523 * jobctrl.py: Add new "jobctrl" extension for spawning background
1523 1524 processes with "&find /". 'import jobctrl' to try it out. Requires
1524 1525 'subprocess' module, standard in python 2.4+.
1525 1526
1526 1527 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
1527 1528 so if foo -> bar and bar -> baz, then foo -> baz.
1528 1529
1529 1530 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
1530 1531
1531 1532 * IPython/Magic.py (Magic.parse_options): add a new posix option
1532 1533 to allow parsing of input args in magics that doesn't strip quotes
1533 1534 (if posix=False). This also closes %timeit bug reported by
1534 1535 Stefan.
1535 1536
1536 1537 2006-10-03 Ville Vainio <vivainio@gmail.com>
1537 1538
1538 1539 * iplib.py (raw_input, interact): Return ValueError catching for
1539 1540 raw_input. Fixes infinite loop for sys.stdin.close() or
1540 1541 sys.stdout.close().
1541 1542
1542 1543 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1543 1544
1544 1545 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
1545 1546 to help in handling doctests. irunner is now pretty useful for
1546 1547 running standalone scripts and simulate a full interactive session
1547 1548 in a format that can be then pasted as a doctest.
1548 1549
1549 1550 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
1550 1551 on top of the default (useless) ones. This also fixes the nasty
1551 1552 way in which 2.5's Quitter() exits (reverted [1785]).
1552 1553
1553 1554 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
1554 1555 2.5.
1555 1556
1556 1557 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
1557 1558 color scheme is updated as well when color scheme is changed
1558 1559 interactively.
1559 1560
1560 1561 2006-09-27 Ville Vainio <vivainio@gmail.com>
1561 1562
1562 1563 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
1563 1564 infinite loop and just exit. It's a hack, but will do for a while.
1564 1565
1565 1566 2006-08-25 Walter Doerwald <walter@livinglogic.de>
1566 1567
1567 1568 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
1568 1569 the constructor, this makes it possible to get a list of only directories
1569 1570 or only files.
1570 1571
1571 1572 2006-08-12 Ville Vainio <vivainio@gmail.com>
1572 1573
1573 1574 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
1574 1575 they broke unittest
1575 1576
1576 1577 2006-08-11 Ville Vainio <vivainio@gmail.com>
1577 1578
1578 1579 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
1579 1580 by resolving issue properly, i.e. by inheriting FakeModule
1580 1581 from types.ModuleType. Pickling ipython interactive data
1581 1582 should still work as usual (testing appreciated).
1582 1583
1583 1584 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
1584 1585
1585 1586 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
1586 1587 running under python 2.3 with code from 2.4 to fix a bug with
1587 1588 help(). Reported by the Debian maintainers, Norbert Tretkowski
1588 1589 <norbert-AT-tretkowski.de> and Alexandre Fayolle
1589 1590 <afayolle-AT-debian.org>.
1590 1591
1591 1592 2006-08-04 Walter Doerwald <walter@livinglogic.de>
1592 1593
1593 1594 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
1594 1595 (which was displaying "quit" twice).
1595 1596
1596 1597 2006-07-28 Walter Doerwald <walter@livinglogic.de>
1597 1598
1598 1599 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
1599 1600 the mode argument).
1600 1601
1601 1602 2006-07-27 Walter Doerwald <walter@livinglogic.de>
1602 1603
1603 1604 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
1604 1605 not running under IPython.
1605 1606
1606 1607 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
1607 1608 and make it iterable (iterating over the attribute itself). Add two new
1608 1609 magic strings for __xattrs__(): If the string starts with "-", the attribute
1609 1610 will not be displayed in ibrowse's detail view (but it can still be
1610 1611 iterated over). This makes it possible to add attributes that are large
1611 1612 lists or generator methods to the detail view. Replace magic attribute names
1612 1613 and _attrname() and _getattr() with "descriptors": For each type of magic
1613 1614 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
1614 1615 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
1615 1616 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
1616 1617 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
1617 1618 are still supported.
1618 1619
1619 1620 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
1620 1621 fails in ibrowse.fetch(), the exception object is added as the last item
1621 1622 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
1622 1623 a generator throws an exception midway through execution.
1623 1624
1624 1625 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
1625 1626 encoding into methods.
1626 1627
1627 1628 2006-07-26 Ville Vainio <vivainio@gmail.com>
1628 1629
1629 1630 * iplib.py: history now stores multiline input as single
1630 1631 history entries. Patch by Jorgen Cederlof.
1631 1632
1632 1633 2006-07-18 Walter Doerwald <walter@livinglogic.de>
1633 1634
1634 1635 * IPython/Extensions/ibrowse.py: Make cursor visible over
1635 1636 non existing attributes.
1636 1637
1637 1638 2006-07-14 Walter Doerwald <walter@livinglogic.de>
1638 1639
1639 1640 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
1640 1641 error output of the running command doesn't mess up the screen.
1641 1642
1642 1643 2006-07-13 Walter Doerwald <walter@livinglogic.de>
1643 1644
1644 1645 * IPython/Extensions/ipipe.py (isort): Make isort usable without
1645 1646 argument. This sorts the items themselves.
1646 1647
1647 1648 2006-07-12 Walter Doerwald <walter@livinglogic.de>
1648 1649
1649 1650 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
1650 1651 Compile expression strings into code objects. This should speed
1651 1652 up ifilter and friends somewhat.
1652 1653
1653 1654 2006-07-08 Ville Vainio <vivainio@gmail.com>
1654 1655
1655 1656 * Magic.py: %cpaste now strips > from the beginning of lines
1656 1657 to ease pasting quoted code from emails. Contributed by
1657 1658 Stefan van der Walt.
1658 1659
1659 1660 2006-06-29 Ville Vainio <vivainio@gmail.com>
1660 1661
1661 1662 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
1662 1663 mode, patch contributed by Darren Dale. NEEDS TESTING!
1663 1664
1664 1665 2006-06-28 Walter Doerwald <walter@livinglogic.de>
1665 1666
1666 1667 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
1667 1668 a blue background. Fix fetching new display rows when the browser
1668 1669 scrolls more than a screenful (e.g. by using the goto command).
1669 1670
1670 1671 2006-06-27 Ville Vainio <vivainio@gmail.com>
1671 1672
1672 1673 * Magic.py (_inspect, _ofind) Apply David Huard's
1673 1674 patch for displaying the correct docstring for 'property'
1674 1675 attributes.
1675 1676
1676 1677 2006-06-23 Walter Doerwald <walter@livinglogic.de>
1677 1678
1678 1679 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
1679 1680 commands into the methods implementing them.
1680 1681
1681 1682 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
1682 1683
1683 1684 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
1684 1685 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
1685 1686 autoindent support was authored by Jin Liu.
1686 1687
1687 1688 2006-06-22 Walter Doerwald <walter@livinglogic.de>
1688 1689
1689 1690 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
1690 1691 for keymaps with a custom class that simplifies handling.
1691 1692
1692 1693 2006-06-19 Walter Doerwald <walter@livinglogic.de>
1693 1694
1694 1695 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
1695 1696 resizing. This requires Python 2.5 to work.
1696 1697
1697 1698 2006-06-16 Walter Doerwald <walter@livinglogic.de>
1698 1699
1699 1700 * IPython/Extensions/ibrowse.py: Add two new commands to
1700 1701 ibrowse: "hideattr" (mapped to "h") hides the attribute under
1701 1702 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
1702 1703 attributes again. Remapped the help command to "?". Display
1703 1704 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
1704 1705 as keys for the "home" and "end" commands. Add three new commands
1705 1706 to the input mode for "find" and friends: "delend" (CTRL-K)
1706 1707 deletes to the end of line. "incsearchup" searches upwards in the
1707 1708 command history for an input that starts with the text before the cursor.
1708 1709 "incsearchdown" does the same downwards. Removed a bogus mapping of
1709 1710 the x key to "delete".
1710 1711
1711 1712 2006-06-15 Ville Vainio <vivainio@gmail.com>
1712 1713
1713 1714 * iplib.py, hooks.py: Added new generate_prompt hook that can be
1714 1715 used to create prompts dynamically, instead of the "old" way of
1715 1716 assigning "magic" strings to prompt_in1 and prompt_in2. The old
1716 1717 way still works (it's invoked by the default hook), of course.
1717 1718
1718 1719 * Prompts.py: added generate_output_prompt hook for altering output
1719 1720 prompt
1720 1721
1721 1722 * Release.py: Changed version string to 0.7.3.svn.
1722 1723
1723 1724 2006-06-15 Walter Doerwald <walter@livinglogic.de>
1724 1725
1725 1726 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
1726 1727 the call to fetch() always tries to fetch enough data for at least one
1727 1728 full screen. This makes it possible to simply call moveto(0,0,True) in
1728 1729 the constructor. Fix typos and removed the obsolete goto attribute.
1729 1730
1730 1731 2006-06-12 Ville Vainio <vivainio@gmail.com>
1731 1732
1732 1733 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
1733 1734 allowing $variable interpolation within multiline statements,
1734 1735 though so far only with "sh" profile for a testing period.
1735 1736 The patch also enables splitting long commands with \ but it
1736 1737 doesn't work properly yet.
1737 1738
1738 1739 2006-06-12 Walter Doerwald <walter@livinglogic.de>
1739 1740
1740 1741 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
1741 1742 input history and the position of the cursor in the input history for
1742 1743 the find, findbackwards and goto command.
1743 1744
1744 1745 2006-06-10 Walter Doerwald <walter@livinglogic.de>
1745 1746
1746 1747 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
1747 1748 implements the basic functionality of browser commands that require
1748 1749 input. Reimplement the goto, find and findbackwards commands as
1749 1750 subclasses of _CommandInput. Add an input history and keymaps to those
1750 1751 commands. Add "\r" as a keyboard shortcut for the enterdefault and
1751 1752 execute commands.
1752 1753
1753 1754 2006-06-07 Ville Vainio <vivainio@gmail.com>
1754 1755
1755 1756 * iplib.py: ipython mybatch.ipy exits ipython immediately after
1756 1757 running the batch files instead of leaving the session open.
1757 1758
1758 1759 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
1759 1760
1760 1761 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
1761 1762 the original fix was incomplete. Patch submitted by W. Maier.
1762 1763
1763 1764 2006-06-07 Ville Vainio <vivainio@gmail.com>
1764 1765
1765 1766 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
1766 1767 Confirmation prompts can be supressed by 'quiet' option.
1767 1768 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
1768 1769
1769 1770 2006-06-06 *** Released version 0.7.2
1770 1771
1771 1772 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
1772 1773
1773 1774 * IPython/Release.py (version): Made 0.7.2 final for release.
1774 1775 Repo tagged and release cut.
1775 1776
1776 1777 2006-06-05 Ville Vainio <vivainio@gmail.com>
1777 1778
1778 1779 * Magic.py (magic_rehashx): Honor no_alias list earlier in
1779 1780 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
1780 1781
1781 1782 * upgrade_dir.py: try import 'path' module a bit harder
1782 1783 (for %upgrade)
1783 1784
1784 1785 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
1785 1786
1786 1787 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
1787 1788 instead of looping 20 times.
1788 1789
1789 1790 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
1790 1791 correctly at initialization time. Bug reported by Krishna Mohan
1791 1792 Gundu <gkmohan-AT-gmail.com> on the user list.
1792 1793
1793 1794 * IPython/Release.py (version): Mark 0.7.2 version to start
1794 1795 testing for release on 06/06.
1795 1796
1796 1797 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
1797 1798
1798 1799 * scripts/irunner: thin script interface so users don't have to
1799 1800 find the module and call it as an executable, since modules rarely
1800 1801 live in people's PATH.
1801 1802
1802 1803 * IPython/irunner.py (InteractiveRunner.__init__): added
1803 1804 delaybeforesend attribute to control delays with newer versions of
1804 1805 pexpect. Thanks to detailed help from pexpect's author, Noah
1805 1806 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
1806 1807 correctly (it works in NoColor mode).
1807 1808
1808 1809 * IPython/iplib.py (handle_normal): fix nasty crash reported on
1809 1810 SAGE list, from improper log() calls.
1810 1811
1811 1812 2006-05-31 Ville Vainio <vivainio@gmail.com>
1812 1813
1813 1814 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
1814 1815 with args in parens to work correctly with dirs that have spaces.
1815 1816
1816 1817 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
1817 1818
1818 1819 * IPython/Logger.py (Logger.logstart): add option to log raw input
1819 1820 instead of the processed one. A -r flag was added to the
1820 1821 %logstart magic used for controlling logging.
1821 1822
1822 1823 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
1823 1824
1824 1825 * IPython/iplib.py (InteractiveShell.__init__): add check for the
1825 1826 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
1826 1827 recognize the option. After a bug report by Will Maier. This
1827 1828 closes #64 (will do it after confirmation from W. Maier).
1828 1829
1829 1830 * IPython/irunner.py: New module to run scripts as if manually
1830 1831 typed into an interactive environment, based on pexpect. After a
1831 1832 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
1832 1833 ipython-user list. Simple unittests in the tests/ directory.
1833 1834
1834 1835 * tools/release: add Will Maier, OpenBSD port maintainer, to
1835 1836 recepients list. We are now officially part of the OpenBSD ports:
1836 1837 http://www.openbsd.org/ports.html ! Many thanks to Will for the
1837 1838 work.
1838 1839
1839 1840 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
1840 1841
1841 1842 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
1842 1843 so that it doesn't break tkinter apps.
1843 1844
1844 1845 * IPython/iplib.py (_prefilter): fix bug where aliases would
1845 1846 shadow variables when autocall was fully off. Reported by SAGE
1846 1847 author William Stein.
1847 1848
1848 1849 * IPython/OInspect.py (Inspector.__init__): add a flag to control
1849 1850 at what detail level strings are computed when foo? is requested.
1850 1851 This allows users to ask for example that the string form of an
1851 1852 object is only computed when foo?? is called, or even never, by
1852 1853 setting the object_info_string_level >= 2 in the configuration
1853 1854 file. This new option has been added and documented. After a
1854 1855 request by SAGE to be able to control the printing of very large
1855 1856 objects more easily.
1856 1857
1857 1858 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
1858 1859
1859 1860 * IPython/ipmaker.py (make_IPython): remove the ipython call path
1860 1861 from sys.argv, to be 100% consistent with how Python itself works
1861 1862 (as seen for example with python -i file.py). After a bug report
1862 1863 by Jeffrey Collins.
1863 1864
1864 1865 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
1865 1866 nasty bug which was preventing custom namespaces with -pylab,
1866 1867 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
1867 1868 compatibility (long gone from mpl).
1868 1869
1869 1870 * IPython/ipapi.py (make_session): name change: create->make. We
1870 1871 use make in other places (ipmaker,...), it's shorter and easier to
1871 1872 type and say, etc. I'm trying to clean things before 0.7.2 so
1872 1873 that I can keep things stable wrt to ipapi in the chainsaw branch.
1873 1874
1874 1875 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
1875 1876 python-mode recognizes our debugger mode. Add support for
1876 1877 autoindent inside (X)emacs. After a patch sent in by Jin Liu
1877 1878 <m.liu.jin-AT-gmail.com> originally written by
1878 1879 doxgen-AT-newsmth.net (with minor modifications for xemacs
1879 1880 compatibility)
1880 1881
1881 1882 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
1882 1883 tracebacks when walking the stack so that the stack tracking system
1883 1884 in emacs' python-mode can identify the frames correctly.
1884 1885
1885 1886 * IPython/ipmaker.py (make_IPython): make the internal (and
1886 1887 default config) autoedit_syntax value false by default. Too many
1887 1888 users have complained to me (both on and off-list) about problems
1888 1889 with this option being on by default, so I'm making it default to
1889 1890 off. It can still be enabled by anyone via the usual mechanisms.
1890 1891
1891 1892 * IPython/completer.py (Completer.attr_matches): add support for
1892 1893 PyCrust-style _getAttributeNames magic method. Patch contributed
1893 1894 by <mscott-AT-goldenspud.com>. Closes #50.
1894 1895
1895 1896 * IPython/iplib.py (InteractiveShell.__init__): remove the
1896 1897 deletion of exit/quit from __builtin__, which can break
1897 1898 third-party tools like the Zope debugging console. The
1898 1899 %exit/%quit magics remain. In general, it's probably a good idea
1899 1900 not to delete anything from __builtin__, since we never know what
1900 1901 that will break. In any case, python now (for 2.5) will support
1901 1902 'real' exit/quit, so this issue is moot. Closes #55.
1902 1903
1903 1904 * IPython/genutils.py (with_obj): rename the 'with' function to
1904 1905 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
1905 1906 becomes a language keyword. Closes #53.
1906 1907
1907 1908 * IPython/FakeModule.py (FakeModule.__init__): add a proper
1908 1909 __file__ attribute to this so it fools more things into thinking
1909 1910 it is a real module. Closes #59.
1910 1911
1911 1912 * IPython/Magic.py (magic_edit): add -n option to open the editor
1912 1913 at a specific line number. After a patch by Stefan van der Walt.
1913 1914
1914 1915 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
1915 1916
1916 1917 * IPython/iplib.py (edit_syntax_error): fix crash when for some
1917 1918 reason the file could not be opened. After automatic crash
1918 1919 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
1919 1920 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
1920 1921 (_should_recompile): Don't fire editor if using %bg, since there
1921 1922 is no file in the first place. From the same report as above.
1922 1923 (raw_input): protect against faulty third-party prefilters. After
1923 1924 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
1924 1925 while running under SAGE.
1925 1926
1926 1927 2006-05-23 Ville Vainio <vivainio@gmail.com>
1927 1928
1928 1929 * ipapi.py: Stripped down ip.to_user_ns() to work only as
1929 1930 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
1930 1931 now returns None (again), unless dummy is specifically allowed by
1931 1932 ipapi.get(allow_dummy=True).
1932 1933
1933 1934 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
1934 1935
1935 1936 * IPython: remove all 2.2-compatibility objects and hacks from
1936 1937 everywhere, since we only support 2.3 at this point. Docs
1937 1938 updated.
1938 1939
1939 1940 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
1940 1941 Anything requiring extra validation can be turned into a Python
1941 1942 property in the future. I used a property for the db one b/c
1942 1943 there was a nasty circularity problem with the initialization
1943 1944 order, which right now I don't have time to clean up.
1944 1945
1945 1946 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
1946 1947 another locking bug reported by Jorgen. I'm not 100% sure though,
1947 1948 so more testing is needed...
1948 1949
1949 1950 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
1950 1951
1951 1952 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
1952 1953 local variables from any routine in user code (typically executed
1953 1954 with %run) directly into the interactive namespace. Very useful
1954 1955 when doing complex debugging.
1955 1956 (IPythonNotRunning): Changed the default None object to a dummy
1956 1957 whose attributes can be queried as well as called without
1957 1958 exploding, to ease writing code which works transparently both in
1958 1959 and out of ipython and uses some of this API.
1959 1960
1960 1961 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
1961 1962
1962 1963 * IPython/hooks.py (result_display): Fix the fact that our display
1963 1964 hook was using str() instead of repr(), as the default python
1964 1965 console does. This had gone unnoticed b/c it only happened if
1965 1966 %Pprint was off, but the inconsistency was there.
1966 1967
1967 1968 2006-05-15 Ville Vainio <vivainio@gmail.com>
1968 1969
1969 1970 * Oinspect.py: Only show docstring for nonexisting/binary files
1970 1971 when doing object??, closing ticket #62
1971 1972
1972 1973 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
1973 1974
1974 1975 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
1975 1976 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
1976 1977 was being released in a routine which hadn't checked if it had
1977 1978 been the one to acquire it.
1978 1979
1979 1980 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
1980 1981
1981 1982 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
1982 1983
1983 1984 2006-04-11 Ville Vainio <vivainio@gmail.com>
1984 1985
1985 1986 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
1986 1987 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
1987 1988 prefilters, allowing stuff like magics and aliases in the file.
1988 1989
1989 1990 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
1990 1991 added. Supported now are "%clear in" and "%clear out" (clear input and
1991 1992 output history, respectively). Also fixed CachedOutput.flush to
1992 1993 properly flush the output cache.
1993 1994
1994 1995 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
1995 1996 half-success (and fail explicitly).
1996 1997
1997 1998 2006-03-28 Ville Vainio <vivainio@gmail.com>
1998 1999
1999 2000 * iplib.py: Fix quoting of aliases so that only argless ones
2000 2001 are quoted
2001 2002
2002 2003 2006-03-28 Ville Vainio <vivainio@gmail.com>
2003 2004
2004 2005 * iplib.py: Quote aliases with spaces in the name.
2005 2006 "c:\program files\blah\bin" is now legal alias target.
2006 2007
2007 2008 * ext_rehashdir.py: Space no longer allowed as arg
2008 2009 separator, since space is legal in path names.
2009 2010
2010 2011 2006-03-16 Ville Vainio <vivainio@gmail.com>
2011 2012
2012 2013 * upgrade_dir.py: Take path.py from Extensions, correcting
2013 2014 %upgrade magic
2014 2015
2015 2016 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
2016 2017
2017 2018 * hooks.py: Only enclose editor binary in quotes if legal and
2018 2019 necessary (space in the name, and is an existing file). Fixes a bug
2019 2020 reported by Zachary Pincus.
2020 2021
2021 2022 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
2022 2023
2023 2024 * Manual: thanks to a tip on proper color handling for Emacs, by
2024 2025 Eric J Haywiser <ejh1-AT-MIT.EDU>.
2025 2026
2026 2027 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
2027 2028 by applying the provided patch. Thanks to Liu Jin
2028 2029 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
2029 2030 XEmacs/Linux, I'm trusting the submitter that it actually helps
2030 2031 under win32/GNU Emacs. Will revisit if any problems are reported.
2031 2032
2032 2033 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
2033 2034
2034 2035 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
2035 2036 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
2036 2037
2037 2038 2006-03-12 Ville Vainio <vivainio@gmail.com>
2038 2039
2039 2040 * Magic.py (magic_timeit): Added %timeit magic, contributed by
2040 2041 Torsten Marek.
2041 2042
2042 2043 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
2043 2044
2044 2045 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
2045 2046 line ranges works again.
2046 2047
2047 2048 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
2048 2049
2049 2050 * IPython/iplib.py (showtraceback): add back sys.last_traceback
2050 2051 and friends, after a discussion with Zach Pincus on ipython-user.
2051 2052 I'm not 100% sure, but after thinking about it quite a bit, it may
2052 2053 be OK. Testing with the multithreaded shells didn't reveal any
2053 2054 problems, but let's keep an eye out.
2054 2055
2055 2056 In the process, I fixed a few things which were calling
2056 2057 self.InteractiveTB() directly (like safe_execfile), which is a
2057 2058 mistake: ALL exception reporting should be done by calling
2058 2059 self.showtraceback(), which handles state and tab-completion and
2059 2060 more.
2060 2061
2061 2062 2006-03-01 Ville Vainio <vivainio@gmail.com>
2062 2063
2063 2064 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
2064 2065 To use, do "from ipipe import *".
2065 2066
2066 2067 2006-02-24 Ville Vainio <vivainio@gmail.com>
2067 2068
2068 2069 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
2069 2070 "cleanly" and safely than the older upgrade mechanism.
2070 2071
2071 2072 2006-02-21 Ville Vainio <vivainio@gmail.com>
2072 2073
2073 2074 * Magic.py: %save works again.
2074 2075
2075 2076 2006-02-15 Ville Vainio <vivainio@gmail.com>
2076 2077
2077 2078 * Magic.py: %Pprint works again
2078 2079
2079 2080 * Extensions/ipy_sane_defaults.py: Provide everything provided
2080 2081 in default ipythonrc, to make it possible to have a completely empty
2081 2082 ipythonrc (and thus completely rc-file free configuration)
2082 2083
2083 2084 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
2084 2085
2085 2086 * IPython/hooks.py (editor): quote the call to the editor command,
2086 2087 to allow commands with spaces in them. Problem noted by watching
2087 2088 Ian Oswald's video about textpad under win32 at
2088 2089 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
2089 2090
2090 2091 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
2091 2092 describing magics (we haven't used @ for a loong time).
2092 2093
2093 2094 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
2094 2095 contributed by marienz to close
2095 2096 http://www.scipy.net/roundup/ipython/issue53.
2096 2097
2097 2098 2006-02-10 Ville Vainio <vivainio@gmail.com>
2098 2099
2099 2100 * genutils.py: getoutput now works in win32 too
2100 2101
2101 2102 * completer.py: alias and magic completion only invoked
2102 2103 at the first "item" in the line, to avoid "cd %store"
2103 2104 nonsense.
2104 2105
2105 2106 2006-02-09 Ville Vainio <vivainio@gmail.com>
2106 2107
2107 2108 * test/*: Added a unit testing framework (finally).
2108 2109 '%run runtests.py' to run test_*.
2109 2110
2110 2111 * ipapi.py: Exposed runlines and set_custom_exc
2111 2112
2112 2113 2006-02-07 Ville Vainio <vivainio@gmail.com>
2113 2114
2114 2115 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
2115 2116 instead use "f(1 2)" as before.
2116 2117
2117 2118 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
2118 2119
2119 2120 * IPython/demo.py (IPythonDemo): Add new classes to the demo
2120 2121 facilities, for demos processed by the IPython input filter
2121 2122 (IPythonDemo), and for running a script one-line-at-a-time as a
2122 2123 demo, both for pure Python (LineDemo) and for IPython-processed
2123 2124 input (IPythonLineDemo). After a request by Dave Kohel, from the
2124 2125 SAGE team.
2125 2126 (Demo.edit): added an edit() method to the demo objects, to edit
2126 2127 the in-memory copy of the last executed block.
2127 2128
2128 2129 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
2129 2130 processing to %edit, %macro and %save. These commands can now be
2130 2131 invoked on the unprocessed input as it was typed by the user
2131 2132 (without any prefilters applied). After requests by the SAGE team
2132 2133 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
2133 2134
2134 2135 2006-02-01 Ville Vainio <vivainio@gmail.com>
2135 2136
2136 2137 * setup.py, eggsetup.py: easy_install ipython==dev works
2137 2138 correctly now (on Linux)
2138 2139
2139 2140 * ipy_user_conf,ipmaker: user config changes, removed spurious
2140 2141 warnings
2141 2142
2142 2143 * iplib: if rc.banner is string, use it as is.
2143 2144
2144 2145 * Magic: %pycat accepts a string argument and pages it's contents.
2145 2146
2146 2147
2147 2148 2006-01-30 Ville Vainio <vivainio@gmail.com>
2148 2149
2149 2150 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
2150 2151 Now %store and bookmarks work through PickleShare, meaning that
2151 2152 concurrent access is possible and all ipython sessions see the
2152 2153 same database situation all the time, instead of snapshot of
2153 2154 the situation when the session was started. Hence, %bookmark
2154 2155 results are immediately accessible from othes sessions. The database
2155 2156 is also available for use by user extensions. See:
2156 2157 http://www.python.org/pypi/pickleshare
2157 2158
2158 2159 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
2159 2160
2160 2161 * aliases can now be %store'd
2161 2162
2162 2163 * path.py moved to Extensions so that pickleshare does not need
2163 2164 IPython-specific import. Extensions added to pythonpath right
2164 2165 at __init__.
2165 2166
2166 2167 * iplib.py: ipalias deprecated/redundant; aliases are converted and
2167 2168 called with _ip.system and the pre-transformed command string.
2168 2169
2169 2170 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
2170 2171
2171 2172 * IPython/iplib.py (interact): Fix that we were not catching
2172 2173 KeyboardInterrupt exceptions properly. I'm not quite sure why the
2173 2174 logic here had to change, but it's fixed now.
2174 2175
2175 2176 2006-01-29 Ville Vainio <vivainio@gmail.com>
2176 2177
2177 2178 * iplib.py: Try to import pyreadline on Windows.
2178 2179
2179 2180 2006-01-27 Ville Vainio <vivainio@gmail.com>
2180 2181
2181 2182 * iplib.py: Expose ipapi as _ip in builtin namespace.
2182 2183 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
2183 2184 and ip_set_hook (-> _ip.set_hook) redundant. % and !
2184 2185 syntax now produce _ip.* variant of the commands.
2185 2186
2186 2187 * "_ip.options().autoedit_syntax = 2" automatically throws
2187 2188 user to editor for syntax error correction without prompting.
2188 2189
2189 2190 2006-01-27 Ville Vainio <vivainio@gmail.com>
2190 2191
2191 2192 * ipmaker.py: Give "realistic" sys.argv for scripts (without
2192 2193 'ipython' at argv[0]) executed through command line.
2193 2194 NOTE: this DEPRECATES calling ipython with multiple scripts
2194 2195 ("ipython a.py b.py c.py")
2195 2196
2196 2197 * iplib.py, hooks.py: Added configurable input prefilter,
2197 2198 named 'input_prefilter'. See ext_rescapture.py for example
2198 2199 usage.
2199 2200
2200 2201 * ext_rescapture.py, Magic.py: Better system command output capture
2201 2202 through 'var = !ls' (deprecates user-visible %sc). Same notation
2202 2203 applies for magics, 'var = %alias' assigns alias list to var.
2203 2204
2204 2205 * ipapi.py: added meta() for accessing extension-usable data store.
2205 2206
2206 2207 * iplib.py: added InteractiveShell.getapi(). New magics should be
2207 2208 written doing self.getapi() instead of using the shell directly.
2208 2209
2209 2210 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
2210 2211 %store foo >> ~/myfoo.txt to store variables to files (in clean
2211 2212 textual form, not a restorable pickle).
2212 2213
2213 2214 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
2214 2215
2215 2216 * usage.py, Magic.py: added %quickref
2216 2217
2217 2218 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
2218 2219
2219 2220 * GetoptErrors when invoking magics etc. with wrong args
2220 2221 are now more helpful:
2221 2222 GetoptError: option -l not recognized (allowed: "qb" )
2222 2223
2223 2224 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
2224 2225
2225 2226 * IPython/demo.py (Demo.show): Flush stdout after each block, so
2226 2227 computationally intensive blocks don't appear to stall the demo.
2227 2228
2228 2229 2006-01-24 Ville Vainio <vivainio@gmail.com>
2229 2230
2230 2231 * iplib.py, hooks.py: 'result_display' hook can return a non-None
2231 2232 value to manipulate resulting history entry.
2232 2233
2233 2234 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
2234 2235 to instance methods of IPApi class, to make extending an embedded
2235 2236 IPython feasible. See ext_rehashdir.py for example usage.
2236 2237
2237 2238 * Merged 1071-1076 from branches/0.7.1
2238 2239
2239 2240
2240 2241 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
2241 2242
2242 2243 * tools/release (daystamp): Fix build tools to use the new
2243 2244 eggsetup.py script to build lightweight eggs.
2244 2245
2245 2246 * Applied changesets 1062 and 1064 before 0.7.1 release.
2246 2247
2247 2248 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
2248 2249 see the raw input history (without conversions like %ls ->
2249 2250 ipmagic("ls")). After a request from W. Stein, SAGE
2250 2251 (http://modular.ucsd.edu/sage) developer. This information is
2251 2252 stored in the input_hist_raw attribute of the IPython instance, so
2252 2253 developers can access it if needed (it's an InputList instance).
2253 2254
2254 2255 * Versionstring = 0.7.2.svn
2255 2256
2256 2257 * eggsetup.py: A separate script for constructing eggs, creates
2257 2258 proper launch scripts even on Windows (an .exe file in
2258 2259 \python24\scripts).
2259 2260
2260 2261 * ipapi.py: launch_new_instance, launch entry point needed for the
2261 2262 egg.
2262 2263
2263 2264 2006-01-23 Ville Vainio <vivainio@gmail.com>
2264 2265
2265 2266 * Added %cpaste magic for pasting python code
2266 2267
2267 2268 2006-01-22 Ville Vainio <vivainio@gmail.com>
2268 2269
2269 2270 * Merge from branches/0.7.1 into trunk, revs 1052-1057
2270 2271
2271 2272 * Versionstring = 0.7.2.svn
2272 2273
2273 2274 * eggsetup.py: A separate script for constructing eggs, creates
2274 2275 proper launch scripts even on Windows (an .exe file in
2275 2276 \python24\scripts).
2276 2277
2277 2278 * ipapi.py: launch_new_instance, launch entry point needed for the
2278 2279 egg.
2279 2280
2280 2281 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
2281 2282
2282 2283 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
2283 2284 %pfile foo would print the file for foo even if it was a binary.
2284 2285 Now, extensions '.so' and '.dll' are skipped.
2285 2286
2286 2287 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
2287 2288 bug, where macros would fail in all threaded modes. I'm not 100%
2288 2289 sure, so I'm going to put out an rc instead of making a release
2289 2290 today, and wait for feedback for at least a few days.
2290 2291
2291 2292 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
2292 2293 it...) the handling of pasting external code with autoindent on.
2293 2294 To get out of a multiline input, the rule will appear for most
2294 2295 users unchanged: two blank lines or change the indent level
2295 2296 proposed by IPython. But there is a twist now: you can
2296 2297 add/subtract only *one or two spaces*. If you add/subtract three
2297 2298 or more (unless you completely delete the line), IPython will
2298 2299 accept that line, and you'll need to enter a second one of pure
2299 2300 whitespace. I know it sounds complicated, but I can't find a
2300 2301 different solution that covers all the cases, with the right
2301 2302 heuristics. Hopefully in actual use, nobody will really notice
2302 2303 all these strange rules and things will 'just work'.
2303 2304
2304 2305 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
2305 2306
2306 2307 * IPython/iplib.py (interact): catch exceptions which can be
2307 2308 triggered asynchronously by signal handlers. Thanks to an
2308 2309 automatic crash report, submitted by Colin Kingsley
2309 2310 <tercel-AT-gentoo.org>.
2310 2311
2311 2312 2006-01-20 Ville Vainio <vivainio@gmail.com>
2312 2313
2313 2314 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
2314 2315 (%rehashdir, very useful, try it out) of how to extend ipython
2315 2316 with new magics. Also added Extensions dir to pythonpath to make
2316 2317 importing extensions easy.
2317 2318
2318 2319 * %store now complains when trying to store interactively declared
2319 2320 classes / instances of those classes.
2320 2321
2321 2322 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
2322 2323 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
2323 2324 if they exist, and ipy_user_conf.py with some defaults is created for
2324 2325 the user.
2325 2326
2326 2327 * Startup rehashing done by the config file, not InterpreterExec.
2327 2328 This means system commands are available even without selecting the
2328 2329 pysh profile. It's the sensible default after all.
2329 2330
2330 2331 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
2331 2332
2332 2333 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
2333 2334 multiline code with autoindent on working. But I am really not
2334 2335 sure, so this needs more testing. Will commit a debug-enabled
2335 2336 version for now, while I test it some more, so that Ville and
2336 2337 others may also catch any problems. Also made
2337 2338 self.indent_current_str() a method, to ensure that there's no
2338 2339 chance of the indent space count and the corresponding string
2339 2340 falling out of sync. All code needing the string should just call
2340 2341 the method.
2341 2342
2342 2343 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
2343 2344
2344 2345 * IPython/Magic.py (magic_edit): fix check for when users don't
2345 2346 save their output files, the try/except was in the wrong section.
2346 2347
2347 2348 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
2348 2349
2349 2350 * IPython/Magic.py (magic_run): fix __file__ global missing from
2350 2351 script's namespace when executed via %run. After a report by
2351 2352 Vivian.
2352 2353
2353 2354 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
2354 2355 when using python 2.4. The parent constructor changed in 2.4, and
2355 2356 we need to track it directly (we can't call it, as it messes up
2356 2357 readline and tab-completion inside our pdb would stop working).
2357 2358 After a bug report by R. Bernstein <rocky-AT-panix.com>.
2358 2359
2359 2360 2006-01-16 Ville Vainio <vivainio@gmail.com>
2360 2361
2361 2362 * Ipython/magic.py: Reverted back to old %edit functionality
2362 2363 that returns file contents on exit.
2363 2364
2364 2365 * IPython/path.py: Added Jason Orendorff's "path" module to
2365 2366 IPython tree, http://www.jorendorff.com/articles/python/path/.
2366 2367 You can get path objects conveniently through %sc, and !!, e.g.:
2367 2368 sc files=ls
2368 2369 for p in files.paths: # or files.p
2369 2370 print p,p.mtime
2370 2371
2371 2372 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
2372 2373 now work again without considering the exclusion regexp -
2373 2374 hence, things like ',foo my/path' turn to 'foo("my/path")'
2374 2375 instead of syntax error.
2375 2376
2376 2377
2377 2378 2006-01-14 Ville Vainio <vivainio@gmail.com>
2378 2379
2379 2380 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
2380 2381 ipapi decorators for python 2.4 users, options() provides access to rc
2381 2382 data.
2382 2383
2383 2384 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
2384 2385 as path separators (even on Linux ;-). Space character after
2385 2386 backslash (as yielded by tab completer) is still space;
2386 2387 "%cd long\ name" works as expected.
2387 2388
2388 2389 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
2389 2390 as "chain of command", with priority. API stays the same,
2390 2391 TryNext exception raised by a hook function signals that
2391 2392 current hook failed and next hook should try handling it, as
2392 2393 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
2393 2394 requested configurable display hook, which is now implemented.
2394 2395
2395 2396 2006-01-13 Ville Vainio <vivainio@gmail.com>
2396 2397
2397 2398 * IPython/platutils*.py: platform specific utility functions,
2398 2399 so far only set_term_title is implemented (change terminal
2399 2400 label in windowing systems). %cd now changes the title to
2400 2401 current dir.
2401 2402
2402 2403 * IPython/Release.py: Added myself to "authors" list,
2403 2404 had to create new files.
2404 2405
2405 2406 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
2406 2407 shell escape; not a known bug but had potential to be one in the
2407 2408 future.
2408 2409
2409 2410 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
2410 2411 extension API for IPython! See the module for usage example. Fix
2411 2412 OInspect for docstring-less magic functions.
2412 2413
2413 2414
2414 2415 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
2415 2416
2416 2417 * IPython/iplib.py (raw_input): temporarily deactivate all
2417 2418 attempts at allowing pasting of code with autoindent on. It
2418 2419 introduced bugs (reported by Prabhu) and I can't seem to find a
2419 2420 robust combination which works in all cases. Will have to revisit
2420 2421 later.
2421 2422
2422 2423 * IPython/genutils.py: remove isspace() function. We've dropped
2423 2424 2.2 compatibility, so it's OK to use the string method.
2424 2425
2425 2426 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2426 2427
2427 2428 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
2428 2429 matching what NOT to autocall on, to include all python binary
2429 2430 operators (including things like 'and', 'or', 'is' and 'in').
2430 2431 Prompted by a bug report on 'foo & bar', but I realized we had
2431 2432 many more potential bug cases with other operators. The regexp is
2432 2433 self.re_exclude_auto, it's fairly commented.
2433 2434
2434 2435 2006-01-12 Ville Vainio <vivainio@gmail.com>
2435 2436
2436 2437 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
2437 2438 Prettified and hardened string/backslash quoting with ipsystem(),
2438 2439 ipalias() and ipmagic(). Now even \ characters are passed to
2439 2440 %magics, !shell escapes and aliases exactly as they are in the
2440 2441 ipython command line. Should improve backslash experience,
2441 2442 particularly in Windows (path delimiter for some commands that
2442 2443 won't understand '/'), but Unix benefits as well (regexps). %cd
2443 2444 magic still doesn't support backslash path delimiters, though. Also
2444 2445 deleted all pretense of supporting multiline command strings in
2445 2446 !system or %magic commands. Thanks to Jerry McRae for suggestions.
2446 2447
2447 2448 * doc/build_doc_instructions.txt added. Documentation on how to
2448 2449 use doc/update_manual.py, added yesterday. Both files contributed
2449 2450 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
2450 2451 doc/*.sh for deprecation at a later date.
2451 2452
2452 2453 * /ipython.py Added ipython.py to root directory for
2453 2454 zero-installation (tar xzvf ipython.tgz; cd ipython; python
2454 2455 ipython.py) and development convenience (no need to keep doing
2455 2456 "setup.py install" between changes).
2456 2457
2457 2458 * Made ! and !! shell escapes work (again) in multiline expressions:
2458 2459 if 1:
2459 2460 !ls
2460 2461 !!ls
2461 2462
2462 2463 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2463 2464
2464 2465 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
2465 2466 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
2466 2467 module in case-insensitive installation. Was causing crashes
2467 2468 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
2468 2469
2469 2470 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
2470 2471 <marienz-AT-gentoo.org>, closes
2471 2472 http://www.scipy.net/roundup/ipython/issue51.
2472 2473
2473 2474 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
2474 2475
2475 2476 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
2476 2477 problem of excessive CPU usage under *nix and keyboard lag under
2477 2478 win32.
2478 2479
2479 2480 2006-01-10 *** Released version 0.7.0
2480 2481
2481 2482 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
2482 2483
2483 2484 * IPython/Release.py (revision): tag version number to 0.7.0,
2484 2485 ready for release.
2485 2486
2486 2487 * IPython/Magic.py (magic_edit): Add print statement to %edit so
2487 2488 it informs the user of the name of the temp. file used. This can
2488 2489 help if you decide later to reuse that same file, so you know
2489 2490 where to copy the info from.
2490 2491
2491 2492 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
2492 2493
2493 2494 * setup_bdist_egg.py: little script to build an egg. Added
2494 2495 support in the release tools as well.
2495 2496
2496 2497 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
2497 2498
2498 2499 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
2499 2500 version selection (new -wxversion command line and ipythonrc
2500 2501 parameter). Patch contributed by Arnd Baecker
2501 2502 <arnd.baecker-AT-web.de>.
2502 2503
2503 2504 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2504 2505 embedded instances, for variables defined at the interactive
2505 2506 prompt of the embedded ipython. Reported by Arnd.
2506 2507
2507 2508 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
2508 2509 it can be used as a (stateful) toggle, or with a direct parameter.
2509 2510
2510 2511 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
2511 2512 could be triggered in certain cases and cause the traceback
2512 2513 printer not to work.
2513 2514
2514 2515 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
2515 2516
2516 2517 * IPython/iplib.py (_should_recompile): Small fix, closes
2517 2518 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
2518 2519
2519 2520 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
2520 2521
2521 2522 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
2522 2523 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
2523 2524 Moad for help with tracking it down.
2524 2525
2525 2526 * IPython/iplib.py (handle_auto): fix autocall handling for
2526 2527 objects which support BOTH __getitem__ and __call__ (so that f [x]
2527 2528 is left alone, instead of becoming f([x]) automatically).
2528 2529
2529 2530 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
2530 2531 Ville's patch.
2531 2532
2532 2533 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
2533 2534
2534 2535 * IPython/iplib.py (handle_auto): changed autocall semantics to
2535 2536 include 'smart' mode, where the autocall transformation is NOT
2536 2537 applied if there are no arguments on the line. This allows you to
2537 2538 just type 'foo' if foo is a callable to see its internal form,
2538 2539 instead of having it called with no arguments (typically a
2539 2540 mistake). The old 'full' autocall still exists: for that, you
2540 2541 need to set the 'autocall' parameter to 2 in your ipythonrc file.
2541 2542
2542 2543 * IPython/completer.py (Completer.attr_matches): add
2543 2544 tab-completion support for Enthoughts' traits. After a report by
2544 2545 Arnd and a patch by Prabhu.
2545 2546
2546 2547 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
2547 2548
2548 2549 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
2549 2550 Schmolck's patch to fix inspect.getinnerframes().
2550 2551
2551 2552 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
2552 2553 for embedded instances, regarding handling of namespaces and items
2553 2554 added to the __builtin__ one. Multiple embedded instances and
2554 2555 recursive embeddings should work better now (though I'm not sure
2555 2556 I've got all the corner cases fixed, that code is a bit of a brain
2556 2557 twister).
2557 2558
2558 2559 * IPython/Magic.py (magic_edit): added support to edit in-memory
2559 2560 macros (automatically creates the necessary temp files). %edit
2560 2561 also doesn't return the file contents anymore, it's just noise.
2561 2562
2562 2563 * IPython/completer.py (Completer.attr_matches): revert change to
2563 2564 complete only on attributes listed in __all__. I realized it
2564 2565 cripples the tab-completion system as a tool for exploring the
2565 2566 internals of unknown libraries (it renders any non-__all__
2566 2567 attribute off-limits). I got bit by this when trying to see
2567 2568 something inside the dis module.
2568 2569
2569 2570 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
2570 2571
2571 2572 * IPython/iplib.py (InteractiveShell.__init__): add .meta
2572 2573 namespace for users and extension writers to hold data in. This
2573 2574 follows the discussion in
2574 2575 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
2575 2576
2576 2577 * IPython/completer.py (IPCompleter.complete): small patch to help
2577 2578 tab-completion under Emacs, after a suggestion by John Barnard
2578 2579 <barnarj-AT-ccf.org>.
2579 2580
2580 2581 * IPython/Magic.py (Magic.extract_input_slices): added support for
2581 2582 the slice notation in magics to use N-M to represent numbers N...M
2582 2583 (closed endpoints). This is used by %macro and %save.
2583 2584
2584 2585 * IPython/completer.py (Completer.attr_matches): for modules which
2585 2586 define __all__, complete only on those. After a patch by Jeffrey
2586 2587 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
2587 2588 speed up this routine.
2588 2589
2589 2590 * IPython/Logger.py (Logger.log): fix a history handling bug. I
2590 2591 don't know if this is the end of it, but the behavior now is
2591 2592 certainly much more correct. Note that coupled with macros,
2592 2593 slightly surprising (at first) behavior may occur: a macro will in
2593 2594 general expand to multiple lines of input, so upon exiting, the
2594 2595 in/out counters will both be bumped by the corresponding amount
2595 2596 (as if the macro's contents had been typed interactively). Typing
2596 2597 %hist will reveal the intermediate (silently processed) lines.
2597 2598
2598 2599 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
2599 2600 pickle to fail (%run was overwriting __main__ and not restoring
2600 2601 it, but pickle relies on __main__ to operate).
2601 2602
2602 2603 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
2603 2604 using properties, but forgot to make the main InteractiveShell
2604 2605 class a new-style class. Properties fail silently, and
2605 2606 mysteriously, with old-style class (getters work, but
2606 2607 setters don't do anything).
2607 2608
2608 2609 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
2609 2610
2610 2611 * IPython/Magic.py (magic_history): fix history reporting bug (I
2611 2612 know some nasties are still there, I just can't seem to find a
2612 2613 reproducible test case to track them down; the input history is
2613 2614 falling out of sync...)
2614 2615
2615 2616 * IPython/iplib.py (handle_shell_escape): fix bug where both
2616 2617 aliases and system accesses where broken for indented code (such
2617 2618 as loops).
2618 2619
2619 2620 * IPython/genutils.py (shell): fix small but critical bug for
2620 2621 win32 system access.
2621 2622
2622 2623 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2623 2624
2624 2625 * IPython/iplib.py (showtraceback): remove use of the
2625 2626 sys.last_{type/value/traceback} structures, which are non
2626 2627 thread-safe.
2627 2628 (_prefilter): change control flow to ensure that we NEVER
2628 2629 introspect objects when autocall is off. This will guarantee that
2629 2630 having an input line of the form 'x.y', where access to attribute
2630 2631 'y' has side effects, doesn't trigger the side effect TWICE. It
2631 2632 is important to note that, with autocall on, these side effects
2632 2633 can still happen.
2633 2634 (ipsystem): new builtin, to complete the ip{magic/alias/system}
2634 2635 trio. IPython offers these three kinds of special calls which are
2635 2636 not python code, and it's a good thing to have their call method
2636 2637 be accessible as pure python functions (not just special syntax at
2637 2638 the command line). It gives us a better internal implementation
2638 2639 structure, as well as exposing these for user scripting more
2639 2640 cleanly.
2640 2641
2641 2642 * IPython/macro.py (Macro.__init__): moved macros to a standalone
2642 2643 file. Now that they'll be more likely to be used with the
2643 2644 persistance system (%store), I want to make sure their module path
2644 2645 doesn't change in the future, so that we don't break things for
2645 2646 users' persisted data.
2646 2647
2647 2648 * IPython/iplib.py (autoindent_update): move indentation
2648 2649 management into the _text_ processing loop, not the keyboard
2649 2650 interactive one. This is necessary to correctly process non-typed
2650 2651 multiline input (such as macros).
2651 2652
2652 2653 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
2653 2654 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
2654 2655 which was producing problems in the resulting manual.
2655 2656 (magic_whos): improve reporting of instances (show their class,
2656 2657 instead of simply printing 'instance' which isn't terribly
2657 2658 informative).
2658 2659
2659 2660 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
2660 2661 (minor mods) to support network shares under win32.
2661 2662
2662 2663 * IPython/winconsole.py (get_console_size): add new winconsole
2663 2664 module and fixes to page_dumb() to improve its behavior under
2664 2665 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
2665 2666
2666 2667 * IPython/Magic.py (Macro): simplified Macro class to just
2667 2668 subclass list. We've had only 2.2 compatibility for a very long
2668 2669 time, yet I was still avoiding subclassing the builtin types. No
2669 2670 more (I'm also starting to use properties, though I won't shift to
2670 2671 2.3-specific features quite yet).
2671 2672 (magic_store): added Ville's patch for lightweight variable
2672 2673 persistence, after a request on the user list by Matt Wilkie
2673 2674 <maphew-AT-gmail.com>. The new %store magic's docstring has full
2674 2675 details.
2675 2676
2676 2677 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2677 2678 changed the default logfile name from 'ipython.log' to
2678 2679 'ipython_log.py'. These logs are real python files, and now that
2679 2680 we have much better multiline support, people are more likely to
2680 2681 want to use them as such. Might as well name them correctly.
2681 2682
2682 2683 * IPython/Magic.py: substantial cleanup. While we can't stop
2683 2684 using magics as mixins, due to the existing customizations 'out
2684 2685 there' which rely on the mixin naming conventions, at least I
2685 2686 cleaned out all cross-class name usage. So once we are OK with
2686 2687 breaking compatibility, the two systems can be separated.
2687 2688
2688 2689 * IPython/Logger.py: major cleanup. This one is NOT a mixin
2689 2690 anymore, and the class is a fair bit less hideous as well. New
2690 2691 features were also introduced: timestamping of input, and logging
2691 2692 of output results. These are user-visible with the -t and -o
2692 2693 options to %logstart. Closes
2693 2694 http://www.scipy.net/roundup/ipython/issue11 and a request by
2694 2695 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
2695 2696
2696 2697 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
2697 2698
2698 2699 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
2699 2700 better handle backslashes in paths. See the thread 'More Windows
2700 2701 questions part 2 - \/ characters revisited' on the iypthon user
2701 2702 list:
2702 2703 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
2703 2704
2704 2705 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
2705 2706
2706 2707 (InteractiveShell.__init__): change threaded shells to not use the
2707 2708 ipython crash handler. This was causing more problems than not,
2708 2709 as exceptions in the main thread (GUI code, typically) would
2709 2710 always show up as a 'crash', when they really weren't.
2710 2711
2711 2712 The colors and exception mode commands (%colors/%xmode) have been
2712 2713 synchronized to also take this into account, so users can get
2713 2714 verbose exceptions for their threaded code as well. I also added
2714 2715 support for activating pdb inside this exception handler as well,
2715 2716 so now GUI authors can use IPython's enhanced pdb at runtime.
2716 2717
2717 2718 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
2718 2719 true by default, and add it to the shipped ipythonrc file. Since
2719 2720 this asks the user before proceeding, I think it's OK to make it
2720 2721 true by default.
2721 2722
2722 2723 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
2723 2724 of the previous special-casing of input in the eval loop. I think
2724 2725 this is cleaner, as they really are commands and shouldn't have
2725 2726 a special role in the middle of the core code.
2726 2727
2727 2728 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
2728 2729
2729 2730 * IPython/iplib.py (edit_syntax_error): added support for
2730 2731 automatically reopening the editor if the file had a syntax error
2731 2732 in it. Thanks to scottt who provided the patch at:
2732 2733 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
2733 2734 version committed).
2734 2735
2735 2736 * IPython/iplib.py (handle_normal): add suport for multi-line
2736 2737 input with emtpy lines. This fixes
2737 2738 http://www.scipy.net/roundup/ipython/issue43 and a similar
2738 2739 discussion on the user list.
2739 2740
2740 2741 WARNING: a behavior change is necessarily introduced to support
2741 2742 blank lines: now a single blank line with whitespace does NOT
2742 2743 break the input loop, which means that when autoindent is on, by
2743 2744 default hitting return on the next (indented) line does NOT exit.
2744 2745
2745 2746 Instead, to exit a multiline input you can either have:
2746 2747
2747 2748 - TWO whitespace lines (just hit return again), or
2748 2749 - a single whitespace line of a different length than provided
2749 2750 by the autoindent (add or remove a space).
2750 2751
2751 2752 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
2752 2753 module to better organize all readline-related functionality.
2753 2754 I've deleted FlexCompleter and put all completion clases here.
2754 2755
2755 2756 * IPython/iplib.py (raw_input): improve indentation management.
2756 2757 It is now possible to paste indented code with autoindent on, and
2757 2758 the code is interpreted correctly (though it still looks bad on
2758 2759 screen, due to the line-oriented nature of ipython).
2759 2760 (MagicCompleter.complete): change behavior so that a TAB key on an
2760 2761 otherwise empty line actually inserts a tab, instead of completing
2761 2762 on the entire global namespace. This makes it easier to use the
2762 2763 TAB key for indentation. After a request by Hans Meine
2763 2764 <hans_meine-AT-gmx.net>
2764 2765 (_prefilter): add support so that typing plain 'exit' or 'quit'
2765 2766 does a sensible thing. Originally I tried to deviate as little as
2766 2767 possible from the default python behavior, but even that one may
2767 2768 change in this direction (thread on python-dev to that effect).
2768 2769 Regardless, ipython should do the right thing even if CPython's
2769 2770 '>>>' prompt doesn't.
2770 2771 (InteractiveShell): removed subclassing code.InteractiveConsole
2771 2772 class. By now we'd overridden just about all of its methods: I've
2772 2773 copied the remaining two over, and now ipython is a standalone
2773 2774 class. This will provide a clearer picture for the chainsaw
2774 2775 branch refactoring.
2775 2776
2776 2777 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
2777 2778
2778 2779 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
2779 2780 failures for objects which break when dir() is called on them.
2780 2781
2781 2782 * IPython/FlexCompleter.py (Completer.__init__): Added support for
2782 2783 distinct local and global namespaces in the completer API. This
2783 2784 change allows us to properly handle completion with distinct
2784 2785 scopes, including in embedded instances (this had never really
2785 2786 worked correctly).
2786 2787
2787 2788 Note: this introduces a change in the constructor for
2788 2789 MagicCompleter, as a new global_namespace parameter is now the
2789 2790 second argument (the others were bumped one position).
2790 2791
2791 2792 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
2792 2793
2793 2794 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2794 2795 embedded instances (which can be done now thanks to Vivian's
2795 2796 frame-handling fixes for pdb).
2796 2797 (InteractiveShell.__init__): Fix namespace handling problem in
2797 2798 embedded instances. We were overwriting __main__ unconditionally,
2798 2799 and this should only be done for 'full' (non-embedded) IPython;
2799 2800 embedded instances must respect the caller's __main__. Thanks to
2800 2801 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
2801 2802
2802 2803 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
2803 2804
2804 2805 * setup.py: added download_url to setup(). This registers the
2805 2806 download address at PyPI, which is not only useful to humans
2806 2807 browsing the site, but is also picked up by setuptools (the Eggs
2807 2808 machinery). Thanks to Ville and R. Kern for the info/discussion
2808 2809 on this.
2809 2810
2810 2811 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
2811 2812
2812 2813 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
2813 2814 This brings a lot of nice functionality to the pdb mode, which now
2814 2815 has tab-completion, syntax highlighting, and better stack handling
2815 2816 than before. Many thanks to Vivian De Smedt
2816 2817 <vivian-AT-vdesmedt.com> for the original patches.
2817 2818
2818 2819 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
2819 2820
2820 2821 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
2821 2822 sequence to consistently accept the banner argument. The
2822 2823 inconsistency was tripping SAGE, thanks to Gary Zablackis
2823 2824 <gzabl-AT-yahoo.com> for the report.
2824 2825
2825 2826 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2826 2827
2827 2828 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2828 2829 Fix bug where a naked 'alias' call in the ipythonrc file would
2829 2830 cause a crash. Bug reported by Jorgen Stenarson.
2830 2831
2831 2832 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2832 2833
2833 2834 * IPython/ipmaker.py (make_IPython): cleanups which should improve
2834 2835 startup time.
2835 2836
2836 2837 * IPython/iplib.py (runcode): my globals 'fix' for embedded
2837 2838 instances had introduced a bug with globals in normal code. Now
2838 2839 it's working in all cases.
2839 2840
2840 2841 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
2841 2842 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
2842 2843 has been introduced to set the default case sensitivity of the
2843 2844 searches. Users can still select either mode at runtime on a
2844 2845 per-search basis.
2845 2846
2846 2847 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
2847 2848
2848 2849 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
2849 2850 attributes in wildcard searches for subclasses. Modified version
2850 2851 of a patch by Jorgen.
2851 2852
2852 2853 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
2853 2854
2854 2855 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
2855 2856 embedded instances. I added a user_global_ns attribute to the
2856 2857 InteractiveShell class to handle this.
2857 2858
2858 2859 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
2859 2860
2860 2861 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
2861 2862 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
2862 2863 (reported under win32, but may happen also in other platforms).
2863 2864 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
2864 2865
2865 2866 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
2866 2867
2867 2868 * IPython/Magic.py (magic_psearch): new support for wildcard
2868 2869 patterns. Now, typing ?a*b will list all names which begin with a
2869 2870 and end in b, for example. The %psearch magic has full
2870 2871 docstrings. Many thanks to JΓΆrgen Stenarson
2871 2872 <jorgen.stenarson-AT-bostream.nu>, author of the patches
2872 2873 implementing this functionality.
2873 2874
2874 2875 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2875 2876
2876 2877 * Manual: fixed long-standing annoyance of double-dashes (as in
2877 2878 --prefix=~, for example) being stripped in the HTML version. This
2878 2879 is a latex2html bug, but a workaround was provided. Many thanks
2879 2880 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
2880 2881 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
2881 2882 rolling. This seemingly small issue had tripped a number of users
2882 2883 when first installing, so I'm glad to see it gone.
2883 2884
2884 2885 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2885 2886
2886 2887 * IPython/Extensions/numeric_formats.py: fix missing import,
2887 2888 reported by Stephen Walton.
2888 2889
2889 2890 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
2890 2891
2891 2892 * IPython/demo.py: finish demo module, fully documented now.
2892 2893
2893 2894 * IPython/genutils.py (file_read): simple little utility to read a
2894 2895 file and ensure it's closed afterwards.
2895 2896
2896 2897 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
2897 2898
2898 2899 * IPython/demo.py (Demo.__init__): added support for individually
2899 2900 tagging blocks for automatic execution.
2900 2901
2901 2902 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
2902 2903 syntax-highlighted python sources, requested by John.
2903 2904
2904 2905 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
2905 2906
2906 2907 * IPython/demo.py (Demo.again): fix bug where again() blocks after
2907 2908 finishing.
2908 2909
2909 2910 * IPython/genutils.py (shlex_split): moved from Magic to here,
2910 2911 where all 2.2 compatibility stuff lives. I needed it for demo.py.
2911 2912
2912 2913 * IPython/demo.py (Demo.__init__): added support for silent
2913 2914 blocks, improved marks as regexps, docstrings written.
2914 2915 (Demo.__init__): better docstring, added support for sys.argv.
2915 2916
2916 2917 * IPython/genutils.py (marquee): little utility used by the demo
2917 2918 code, handy in general.
2918 2919
2919 2920 * IPython/demo.py (Demo.__init__): new class for interactive
2920 2921 demos. Not documented yet, I just wrote it in a hurry for
2921 2922 scipy'05. Will docstring later.
2922 2923
2923 2924 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
2924 2925
2925 2926 * IPython/Shell.py (sigint_handler): Drastic simplification which
2926 2927 also seems to make Ctrl-C work correctly across threads! This is
2927 2928 so simple, that I can't beleive I'd missed it before. Needs more
2928 2929 testing, though.
2929 2930 (KBINT): Never mind, revert changes. I'm sure I'd tried something
2930 2931 like this before...
2931 2932
2932 2933 * IPython/genutils.py (get_home_dir): add protection against
2933 2934 non-dirs in win32 registry.
2934 2935
2935 2936 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
2936 2937 bug where dict was mutated while iterating (pysh crash).
2937 2938
2938 2939 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
2939 2940
2940 2941 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
2941 2942 spurious newlines added by this routine. After a report by
2942 2943 F. Mantegazza.
2943 2944
2944 2945 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
2945 2946
2946 2947 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
2947 2948 calls. These were a leftover from the GTK 1.x days, and can cause
2948 2949 problems in certain cases (after a report by John Hunter).
2949 2950
2950 2951 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
2951 2952 os.getcwd() fails at init time. Thanks to patch from David Remahl
2952 2953 <chmod007-AT-mac.com>.
2953 2954 (InteractiveShell.__init__): prevent certain special magics from
2954 2955 being shadowed by aliases. Closes
2955 2956 http://www.scipy.net/roundup/ipython/issue41.
2956 2957
2957 2958 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
2958 2959
2959 2960 * IPython/iplib.py (InteractiveShell.complete): Added new
2960 2961 top-level completion method to expose the completion mechanism
2961 2962 beyond readline-based environments.
2962 2963
2963 2964 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
2964 2965
2965 2966 * tools/ipsvnc (svnversion): fix svnversion capture.
2966 2967
2967 2968 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
2968 2969 attribute to self, which was missing. Before, it was set by a
2969 2970 routine which in certain cases wasn't being called, so the
2970 2971 instance could end up missing the attribute. This caused a crash.
2971 2972 Closes http://www.scipy.net/roundup/ipython/issue40.
2972 2973
2973 2974 2005-08-16 Fernando Perez <fperez@colorado.edu>
2974 2975
2975 2976 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
2976 2977 contains non-string attribute. Closes
2977 2978 http://www.scipy.net/roundup/ipython/issue38.
2978 2979
2979 2980 2005-08-14 Fernando Perez <fperez@colorado.edu>
2980 2981
2981 2982 * tools/ipsvnc: Minor improvements, to add changeset info.
2982 2983
2983 2984 2005-08-12 Fernando Perez <fperez@colorado.edu>
2984 2985
2985 2986 * IPython/iplib.py (runsource): remove self.code_to_run_src
2986 2987 attribute. I realized this is nothing more than
2987 2988 '\n'.join(self.buffer), and having the same data in two different
2988 2989 places is just asking for synchronization bugs. This may impact
2989 2990 people who have custom exception handlers, so I need to warn
2990 2991 ipython-dev about it (F. Mantegazza may use them).
2991 2992
2992 2993 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
2993 2994
2994 2995 * IPython/genutils.py: fix 2.2 compatibility (generators)
2995 2996
2996 2997 2005-07-18 Fernando Perez <fperez@colorado.edu>
2997 2998
2998 2999 * IPython/genutils.py (get_home_dir): fix to help users with
2999 3000 invalid $HOME under win32.
3000 3001
3001 3002 2005-07-17 Fernando Perez <fperez@colorado.edu>
3002 3003
3003 3004 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
3004 3005 some old hacks and clean up a bit other routines; code should be
3005 3006 simpler and a bit faster.
3006 3007
3007 3008 * IPython/iplib.py (interact): removed some last-resort attempts
3008 3009 to survive broken stdout/stderr. That code was only making it
3009 3010 harder to abstract out the i/o (necessary for gui integration),
3010 3011 and the crashes it could prevent were extremely rare in practice
3011 3012 (besides being fully user-induced in a pretty violent manner).
3012 3013
3013 3014 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
3014 3015 Nothing major yet, but the code is simpler to read; this should
3015 3016 make it easier to do more serious modifications in the future.
3016 3017
3017 3018 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
3018 3019 which broke in .15 (thanks to a report by Ville).
3019 3020
3020 3021 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
3021 3022 be quite correct, I know next to nothing about unicode). This
3022 3023 will allow unicode strings to be used in prompts, amongst other
3023 3024 cases. It also will prevent ipython from crashing when unicode
3024 3025 shows up unexpectedly in many places. If ascii encoding fails, we
3025 3026 assume utf_8. Currently the encoding is not a user-visible
3026 3027 setting, though it could be made so if there is demand for it.
3027 3028
3028 3029 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
3029 3030
3030 3031 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
3031 3032
3032 3033 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
3033 3034
3034 3035 * IPython/genutils.py: Add 2.2 compatibility here, so all other
3035 3036 code can work transparently for 2.2/2.3.
3036 3037
3037 3038 2005-07-16 Fernando Perez <fperez@colorado.edu>
3038 3039
3039 3040 * IPython/ultraTB.py (ExceptionColors): Make a global variable
3040 3041 out of the color scheme table used for coloring exception
3041 3042 tracebacks. This allows user code to add new schemes at runtime.
3042 3043 This is a minimally modified version of the patch at
3043 3044 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
3044 3045 for the contribution.
3045 3046
3046 3047 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
3047 3048 slightly modified version of the patch in
3048 3049 http://www.scipy.net/roundup/ipython/issue34, which also allows me
3049 3050 to remove the previous try/except solution (which was costlier).
3050 3051 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
3051 3052
3052 3053 2005-06-08 Fernando Perez <fperez@colorado.edu>
3053 3054
3054 3055 * IPython/iplib.py (write/write_err): Add methods to abstract all
3055 3056 I/O a bit more.
3056 3057
3057 3058 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
3058 3059 warning, reported by Aric Hagberg, fix by JD Hunter.
3059 3060
3060 3061 2005-06-02 *** Released version 0.6.15
3061 3062
3062 3063 2005-06-01 Fernando Perez <fperez@colorado.edu>
3063 3064
3064 3065 * IPython/iplib.py (MagicCompleter.file_matches): Fix
3065 3066 tab-completion of filenames within open-quoted strings. Note that
3066 3067 this requires that in ~/.ipython/ipythonrc, users change the
3067 3068 readline delimiters configuration to read:
3068 3069
3069 3070 readline_remove_delims -/~
3070 3071
3071 3072
3072 3073 2005-05-31 *** Released version 0.6.14
3073 3074
3074 3075 2005-05-29 Fernando Perez <fperez@colorado.edu>
3075 3076
3076 3077 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
3077 3078 with files not on the filesystem. Reported by Eliyahu Sandler
3078 3079 <eli@gondolin.net>
3079 3080
3080 3081 2005-05-22 Fernando Perez <fperez@colorado.edu>
3081 3082
3082 3083 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
3083 3084 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
3084 3085
3085 3086 2005-05-19 Fernando Perez <fperez@colorado.edu>
3086 3087
3087 3088 * IPython/iplib.py (safe_execfile): close a file which could be
3088 3089 left open (causing problems in win32, which locks open files).
3089 3090 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
3090 3091
3091 3092 2005-05-18 Fernando Perez <fperez@colorado.edu>
3092 3093
3093 3094 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
3094 3095 keyword arguments correctly to safe_execfile().
3095 3096
3096 3097 2005-05-13 Fernando Perez <fperez@colorado.edu>
3097 3098
3098 3099 * ipython.1: Added info about Qt to manpage, and threads warning
3099 3100 to usage page (invoked with --help).
3100 3101
3101 3102 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
3102 3103 new matcher (it goes at the end of the priority list) to do
3103 3104 tab-completion on named function arguments. Submitted by George
3104 3105 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
3105 3106 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
3106 3107 for more details.
3107 3108
3108 3109 * IPython/Magic.py (magic_run): Added new -e flag to ignore
3109 3110 SystemExit exceptions in the script being run. Thanks to a report
3110 3111 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
3111 3112 producing very annoying behavior when running unit tests.
3112 3113
3113 3114 2005-05-12 Fernando Perez <fperez@colorado.edu>
3114 3115
3115 3116 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
3116 3117 which I'd broken (again) due to a changed regexp. In the process,
3117 3118 added ';' as an escape to auto-quote the whole line without
3118 3119 splitting its arguments. Thanks to a report by Jerry McRae
3119 3120 <qrs0xyc02-AT-sneakemail.com>.
3120 3121
3121 3122 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
3122 3123 possible crashes caused by a TokenError. Reported by Ed Schofield
3123 3124 <schofield-AT-ftw.at>.
3124 3125
3125 3126 2005-05-06 Fernando Perez <fperez@colorado.edu>
3126 3127
3127 3128 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
3128 3129
3129 3130 2005-04-29 Fernando Perez <fperez@colorado.edu>
3130 3131
3131 3132 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
3132 3133 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
3133 3134 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
3134 3135 which provides support for Qt interactive usage (similar to the
3135 3136 existing one for WX and GTK). This had been often requested.
3136 3137
3137 3138 2005-04-14 *** Released version 0.6.13
3138 3139
3139 3140 2005-04-08 Fernando Perez <fperez@colorado.edu>
3140 3141
3141 3142 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
3142 3143 from _ofind, which gets called on almost every input line. Now,
3143 3144 we only try to get docstrings if they are actually going to be
3144 3145 used (the overhead of fetching unnecessary docstrings can be
3145 3146 noticeable for certain objects, such as Pyro proxies).
3146 3147
3147 3148 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
3148 3149 for completers. For some reason I had been passing them the state
3149 3150 variable, which completers never actually need, and was in
3150 3151 conflict with the rlcompleter API. Custom completers ONLY need to
3151 3152 take the text parameter.
3152 3153
3153 3154 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
3154 3155 work correctly in pysh. I've also moved all the logic which used
3155 3156 to be in pysh.py here, which will prevent problems with future
3156 3157 upgrades. However, this time I must warn users to update their
3157 3158 pysh profile to include the line
3158 3159
3159 3160 import_all IPython.Extensions.InterpreterExec
3160 3161
3161 3162 because otherwise things won't work for them. They MUST also
3162 3163 delete pysh.py and the line
3163 3164
3164 3165 execfile pysh.py
3165 3166
3166 3167 from their ipythonrc-pysh.
3167 3168
3168 3169 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
3169 3170 robust in the face of objects whose dir() returns non-strings
3170 3171 (which it shouldn't, but some broken libs like ITK do). Thanks to
3171 3172 a patch by John Hunter (implemented differently, though). Also
3172 3173 minor improvements by using .extend instead of + on lists.
3173 3174
3174 3175 * pysh.py:
3175 3176
3176 3177 2005-04-06 Fernando Perez <fperez@colorado.edu>
3177 3178
3178 3179 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
3179 3180 by default, so that all users benefit from it. Those who don't
3180 3181 want it can still turn it off.
3181 3182
3182 3183 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
3183 3184 config file, I'd forgotten about this, so users were getting it
3184 3185 off by default.
3185 3186
3186 3187 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
3187 3188 consistency. Now magics can be called in multiline statements,
3188 3189 and python variables can be expanded in magic calls via $var.
3189 3190 This makes the magic system behave just like aliases or !system
3190 3191 calls.
3191 3192
3192 3193 2005-03-28 Fernando Perez <fperez@colorado.edu>
3193 3194
3194 3195 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
3195 3196 expensive string additions for building command. Add support for
3196 3197 trailing ';' when autocall is used.
3197 3198
3198 3199 2005-03-26 Fernando Perez <fperez@colorado.edu>
3199 3200
3200 3201 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
3201 3202 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
3202 3203 ipython.el robust against prompts with any number of spaces
3203 3204 (including 0) after the ':' character.
3204 3205
3205 3206 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
3206 3207 continuation prompt, which misled users to think the line was
3207 3208 already indented. Closes debian Bug#300847, reported to me by
3208 3209 Norbert Tretkowski <tretkowski-AT-inittab.de>.
3209 3210
3210 3211 2005-03-23 Fernando Perez <fperez@colorado.edu>
3211 3212
3212 3213 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
3213 3214 properly aligned if they have embedded newlines.
3214 3215
3215 3216 * IPython/iplib.py (runlines): Add a public method to expose
3216 3217 IPython's code execution machinery, so that users can run strings
3217 3218 as if they had been typed at the prompt interactively.
3218 3219 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
3219 3220 methods which can call the system shell, but with python variable
3220 3221 expansion. The three such methods are: __IPYTHON__.system,
3221 3222 .getoutput and .getoutputerror. These need to be documented in a
3222 3223 'public API' section (to be written) of the manual.
3223 3224
3224 3225 2005-03-20 Fernando Perez <fperez@colorado.edu>
3225 3226
3226 3227 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
3227 3228 for custom exception handling. This is quite powerful, and it
3228 3229 allows for user-installable exception handlers which can trap
3229 3230 custom exceptions at runtime and treat them separately from
3230 3231 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
3231 3232 Mantegazza <mantegazza-AT-ill.fr>.
3232 3233 (InteractiveShell.set_custom_completer): public API function to
3233 3234 add new completers at runtime.
3234 3235
3235 3236 2005-03-19 Fernando Perez <fperez@colorado.edu>
3236 3237
3237 3238 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
3238 3239 allow objects which provide their docstrings via non-standard
3239 3240 mechanisms (like Pyro proxies) to still be inspected by ipython's
3240 3241 ? system.
3241 3242
3242 3243 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
3243 3244 automatic capture system. I tried quite hard to make it work
3244 3245 reliably, and simply failed. I tried many combinations with the
3245 3246 subprocess module, but eventually nothing worked in all needed
3246 3247 cases (not blocking stdin for the child, duplicating stdout
3247 3248 without blocking, etc). The new %sc/%sx still do capture to these
3248 3249 magical list/string objects which make shell use much more
3249 3250 conveninent, so not all is lost.
3250 3251
3251 3252 XXX - FIX MANUAL for the change above!
3252 3253
3253 3254 (runsource): I copied code.py's runsource() into ipython to modify
3254 3255 it a bit. Now the code object and source to be executed are
3255 3256 stored in ipython. This makes this info accessible to third-party
3256 3257 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
3257 3258 Mantegazza <mantegazza-AT-ill.fr>.
3258 3259
3259 3260 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
3260 3261 history-search via readline (like C-p/C-n). I'd wanted this for a
3261 3262 long time, but only recently found out how to do it. For users
3262 3263 who already have their ipythonrc files made and want this, just
3263 3264 add:
3264 3265
3265 3266 readline_parse_and_bind "\e[A": history-search-backward
3266 3267 readline_parse_and_bind "\e[B": history-search-forward
3267 3268
3268 3269 2005-03-18 Fernando Perez <fperez@colorado.edu>
3269 3270
3270 3271 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
3271 3272 LSString and SList classes which allow transparent conversions
3272 3273 between list mode and whitespace-separated string.
3273 3274 (magic_r): Fix recursion problem in %r.
3274 3275
3275 3276 * IPython/genutils.py (LSString): New class to be used for
3276 3277 automatic storage of the results of all alias/system calls in _o
3277 3278 and _e (stdout/err). These provide a .l/.list attribute which
3278 3279 does automatic splitting on newlines. This means that for most
3279 3280 uses, you'll never need to do capturing of output with %sc/%sx
3280 3281 anymore, since ipython keeps this always done for you. Note that
3281 3282 only the LAST results are stored, the _o/e variables are
3282 3283 overwritten on each call. If you need to save their contents
3283 3284 further, simply bind them to any other name.
3284 3285
3285 3286 2005-03-17 Fernando Perez <fperez@colorado.edu>
3286 3287
3287 3288 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
3288 3289 prompt namespace handling.
3289 3290
3290 3291 2005-03-16 Fernando Perez <fperez@colorado.edu>
3291 3292
3292 3293 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
3293 3294 classic prompts to be '>>> ' (final space was missing, and it
3294 3295 trips the emacs python mode).
3295 3296 (BasePrompt.__str__): Added safe support for dynamic prompt
3296 3297 strings. Now you can set your prompt string to be '$x', and the
3297 3298 value of x will be printed from your interactive namespace. The
3298 3299 interpolation syntax includes the full Itpl support, so
3299 3300 ${foo()+x+bar()} is a valid prompt string now, and the function
3300 3301 calls will be made at runtime.
3301 3302
3302 3303 2005-03-15 Fernando Perez <fperez@colorado.edu>
3303 3304
3304 3305 * IPython/Magic.py (magic_history): renamed %hist to %history, to
3305 3306 avoid name clashes in pylab. %hist still works, it just forwards
3306 3307 the call to %history.
3307 3308
3308 3309 2005-03-02 *** Released version 0.6.12
3309 3310
3310 3311 2005-03-02 Fernando Perez <fperez@colorado.edu>
3311 3312
3312 3313 * IPython/iplib.py (handle_magic): log magic calls properly as
3313 3314 ipmagic() function calls.
3314 3315
3315 3316 * IPython/Magic.py (magic_time): Improved %time to support
3316 3317 statements and provide wall-clock as well as CPU time.
3317 3318
3318 3319 2005-02-27 Fernando Perez <fperez@colorado.edu>
3319 3320
3320 3321 * IPython/hooks.py: New hooks module, to expose user-modifiable
3321 3322 IPython functionality in a clean manner. For now only the editor
3322 3323 hook is actually written, and other thigns which I intend to turn
3323 3324 into proper hooks aren't yet there. The display and prefilter
3324 3325 stuff, for example, should be hooks. But at least now the
3325 3326 framework is in place, and the rest can be moved here with more
3326 3327 time later. IPython had had a .hooks variable for a long time for
3327 3328 this purpose, but I'd never actually used it for anything.
3328 3329
3329 3330 2005-02-26 Fernando Perez <fperez@colorado.edu>
3330 3331
3331 3332 * IPython/ipmaker.py (make_IPython): make the default ipython
3332 3333 directory be called _ipython under win32, to follow more the
3333 3334 naming peculiarities of that platform (where buggy software like
3334 3335 Visual Sourcesafe breaks with .named directories). Reported by
3335 3336 Ville Vainio.
3336 3337
3337 3338 2005-02-23 Fernando Perez <fperez@colorado.edu>
3338 3339
3339 3340 * IPython/iplib.py (InteractiveShell.__init__): removed a few
3340 3341 auto_aliases for win32 which were causing problems. Users can
3341 3342 define the ones they personally like.
3342 3343
3343 3344 2005-02-21 Fernando Perez <fperez@colorado.edu>
3344 3345
3345 3346 * IPython/Magic.py (magic_time): new magic to time execution of
3346 3347 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
3347 3348
3348 3349 2005-02-19 Fernando Perez <fperez@colorado.edu>
3349 3350
3350 3351 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
3351 3352 into keys (for prompts, for example).
3352 3353
3353 3354 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
3354 3355 prompts in case users want them. This introduces a small behavior
3355 3356 change: ipython does not automatically add a space to all prompts
3356 3357 anymore. To get the old prompts with a space, users should add it
3357 3358 manually to their ipythonrc file, so for example prompt_in1 should
3358 3359 now read 'In [\#]: ' instead of 'In [\#]:'.
3359 3360 (BasePrompt.__init__): New option prompts_pad_left (only in rc
3360 3361 file) to control left-padding of secondary prompts.
3361 3362
3362 3363 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
3363 3364 the profiler can't be imported. Fix for Debian, which removed
3364 3365 profile.py because of License issues. I applied a slightly
3365 3366 modified version of the original Debian patch at
3366 3367 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
3367 3368
3368 3369 2005-02-17 Fernando Perez <fperez@colorado.edu>
3369 3370
3370 3371 * IPython/genutils.py (native_line_ends): Fix bug which would
3371 3372 cause improper line-ends under win32 b/c I was not opening files
3372 3373 in binary mode. Bug report and fix thanks to Ville.
3373 3374
3374 3375 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
3375 3376 trying to catch spurious foo[1] autocalls. My fix actually broke
3376 3377 ',/' autoquote/call with explicit escape (bad regexp).
3377 3378
3378 3379 2005-02-15 *** Released version 0.6.11
3379 3380
3380 3381 2005-02-14 Fernando Perez <fperez@colorado.edu>
3381 3382
3382 3383 * IPython/background_jobs.py: New background job management
3383 3384 subsystem. This is implemented via a new set of classes, and
3384 3385 IPython now provides a builtin 'jobs' object for background job
3385 3386 execution. A convenience %bg magic serves as a lightweight
3386 3387 frontend for starting the more common type of calls. This was
3387 3388 inspired by discussions with B. Granger and the BackgroundCommand
3388 3389 class described in the book Python Scripting for Computational
3389 3390 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
3390 3391 (although ultimately no code from this text was used, as IPython's
3391 3392 system is a separate implementation).
3392 3393
3393 3394 * IPython/iplib.py (MagicCompleter.python_matches): add new option
3394 3395 to control the completion of single/double underscore names
3395 3396 separately. As documented in the example ipytonrc file, the
3396 3397 readline_omit__names variable can now be set to 2, to omit even
3397 3398 single underscore names. Thanks to a patch by Brian Wong
3398 3399 <BrianWong-AT-AirgoNetworks.Com>.
3399 3400 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
3400 3401 be autocalled as foo([1]) if foo were callable. A problem for
3401 3402 things which are both callable and implement __getitem__.
3402 3403 (init_readline): Fix autoindentation for win32. Thanks to a patch
3403 3404 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
3404 3405
3405 3406 2005-02-12 Fernando Perez <fperez@colorado.edu>
3406 3407
3407 3408 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
3408 3409 which I had written long ago to sort out user error messages which
3409 3410 may occur during startup. This seemed like a good idea initially,
3410 3411 but it has proven a disaster in retrospect. I don't want to
3411 3412 change much code for now, so my fix is to set the internal 'debug'
3412 3413 flag to true everywhere, whose only job was precisely to control
3413 3414 this subsystem. This closes issue 28 (as well as avoiding all
3414 3415 sorts of strange hangups which occur from time to time).
3415 3416
3416 3417 2005-02-07 Fernando Perez <fperez@colorado.edu>
3417 3418
3418 3419 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
3419 3420 previous call produced a syntax error.
3420 3421
3421 3422 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3422 3423 classes without constructor.
3423 3424
3424 3425 2005-02-06 Fernando Perez <fperez@colorado.edu>
3425 3426
3426 3427 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
3427 3428 completions with the results of each matcher, so we return results
3428 3429 to the user from all namespaces. This breaks with ipython
3429 3430 tradition, but I think it's a nicer behavior. Now you get all
3430 3431 possible completions listed, from all possible namespaces (python,
3431 3432 filesystem, magics...) After a request by John Hunter
3432 3433 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3433 3434
3434 3435 2005-02-05 Fernando Perez <fperez@colorado.edu>
3435 3436
3436 3437 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
3437 3438 the call had quote characters in it (the quotes were stripped).
3438 3439
3439 3440 2005-01-31 Fernando Perez <fperez@colorado.edu>
3440 3441
3441 3442 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
3442 3443 Itpl.itpl() to make the code more robust against psyco
3443 3444 optimizations.
3444 3445
3445 3446 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
3446 3447 of causing an exception. Quicker, cleaner.
3447 3448
3448 3449 2005-01-28 Fernando Perez <fperez@colorado.edu>
3449 3450
3450 3451 * scripts/ipython_win_post_install.py (install): hardcode
3451 3452 sys.prefix+'python.exe' as the executable path. It turns out that
3452 3453 during the post-installation run, sys.executable resolves to the
3453 3454 name of the binary installer! I should report this as a distutils
3454 3455 bug, I think. I updated the .10 release with this tiny fix, to
3455 3456 avoid annoying the lists further.
3456 3457
3457 3458 2005-01-27 *** Released version 0.6.10
3458 3459
3459 3460 2005-01-27 Fernando Perez <fperez@colorado.edu>
3460 3461
3461 3462 * IPython/numutils.py (norm): Added 'inf' as optional name for
3462 3463 L-infinity norm, included references to mathworld.com for vector
3463 3464 norm definitions.
3464 3465 (amin/amax): added amin/amax for array min/max. Similar to what
3465 3466 pylab ships with after the recent reorganization of names.
3466 3467 (spike/spike_odd): removed deprecated spike/spike_odd functions.
3467 3468
3468 3469 * ipython.el: committed Alex's recent fixes and improvements.
3469 3470 Tested with python-mode from CVS, and it looks excellent. Since
3470 3471 python-mode hasn't released anything in a while, I'm temporarily
3471 3472 putting a copy of today's CVS (v 4.70) of python-mode in:
3472 3473 http://ipython.scipy.org/tmp/python-mode.el
3473 3474
3474 3475 * scripts/ipython_win_post_install.py (install): Win32 fix to use
3475 3476 sys.executable for the executable name, instead of assuming it's
3476 3477 called 'python.exe' (the post-installer would have produced broken
3477 3478 setups on systems with a differently named python binary).
3478 3479
3479 3480 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
3480 3481 references to os.linesep, to make the code more
3481 3482 platform-independent. This is also part of the win32 coloring
3482 3483 fixes.
3483 3484
3484 3485 * IPython/genutils.py (page_dumb): Remove attempts to chop long
3485 3486 lines, which actually cause coloring bugs because the length of
3486 3487 the line is very difficult to correctly compute with embedded
3487 3488 escapes. This was the source of all the coloring problems under
3488 3489 Win32. I think that _finally_, Win32 users have a properly
3489 3490 working ipython in all respects. This would never have happened
3490 3491 if not for Gary Bishop and Viktor Ransmayr's great help and work.
3491 3492
3492 3493 2005-01-26 *** Released version 0.6.9
3493 3494
3494 3495 2005-01-25 Fernando Perez <fperez@colorado.edu>
3495 3496
3496 3497 * setup.py: finally, we have a true Windows installer, thanks to
3497 3498 the excellent work of Viktor Ransmayr
3498 3499 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
3499 3500 Windows users. The setup routine is quite a bit cleaner thanks to
3500 3501 this, and the post-install script uses the proper functions to
3501 3502 allow a clean de-installation using the standard Windows Control
3502 3503 Panel.
3503 3504
3504 3505 * IPython/genutils.py (get_home_dir): changed to use the $HOME
3505 3506 environment variable under all OSes (including win32) if
3506 3507 available. This will give consistency to win32 users who have set
3507 3508 this variable for any reason. If os.environ['HOME'] fails, the
3508 3509 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
3509 3510
3510 3511 2005-01-24 Fernando Perez <fperez@colorado.edu>
3511 3512
3512 3513 * IPython/numutils.py (empty_like): add empty_like(), similar to
3513 3514 zeros_like() but taking advantage of the new empty() Numeric routine.
3514 3515
3515 3516 2005-01-23 *** Released version 0.6.8
3516 3517
3517 3518 2005-01-22 Fernando Perez <fperez@colorado.edu>
3518 3519
3519 3520 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
3520 3521 automatic show() calls. After discussing things with JDH, it
3521 3522 turns out there are too many corner cases where this can go wrong.
3522 3523 It's best not to try to be 'too smart', and simply have ipython
3523 3524 reproduce as much as possible the default behavior of a normal
3524 3525 python shell.
3525 3526
3526 3527 * IPython/iplib.py (InteractiveShell.__init__): Modified the
3527 3528 line-splitting regexp and _prefilter() to avoid calling getattr()
3528 3529 on assignments. This closes
3529 3530 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
3530 3531 readline uses getattr(), so a simple <TAB> keypress is still
3531 3532 enough to trigger getattr() calls on an object.
3532 3533
3533 3534 2005-01-21 Fernando Perez <fperez@colorado.edu>
3534 3535
3535 3536 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
3536 3537 docstring under pylab so it doesn't mask the original.
3537 3538
3538 3539 2005-01-21 *** Released version 0.6.7
3539 3540
3540 3541 2005-01-21 Fernando Perez <fperez@colorado.edu>
3541 3542
3542 3543 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
3543 3544 signal handling for win32 users in multithreaded mode.
3544 3545
3545 3546 2005-01-17 Fernando Perez <fperez@colorado.edu>
3546 3547
3547 3548 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3548 3549 instances with no __init__. After a crash report by Norbert Nemec
3549 3550 <Norbert-AT-nemec-online.de>.
3550 3551
3551 3552 2005-01-14 Fernando Perez <fperez@colorado.edu>
3552 3553
3553 3554 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
3554 3555 names for verbose exceptions, when multiple dotted names and the
3555 3556 'parent' object were present on the same line.
3556 3557
3557 3558 2005-01-11 Fernando Perez <fperez@colorado.edu>
3558 3559
3559 3560 * IPython/genutils.py (flag_calls): new utility to trap and flag
3560 3561 calls in functions. I need it to clean up matplotlib support.
3561 3562 Also removed some deprecated code in genutils.
3562 3563
3563 3564 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
3564 3565 that matplotlib scripts called with %run, which don't call show()
3565 3566 themselves, still have their plotting windows open.
3566 3567
3567 3568 2005-01-05 Fernando Perez <fperez@colorado.edu>
3568 3569
3569 3570 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
3570 3571 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
3571 3572
3572 3573 2004-12-19 Fernando Perez <fperez@colorado.edu>
3573 3574
3574 3575 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
3575 3576 parent_runcode, which was an eyesore. The same result can be
3576 3577 obtained with Python's regular superclass mechanisms.
3577 3578
3578 3579 2004-12-17 Fernando Perez <fperez@colorado.edu>
3579 3580
3580 3581 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
3581 3582 reported by Prabhu.
3582 3583 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
3583 3584 sys.stderr) instead of explicitly calling sys.stderr. This helps
3584 3585 maintain our I/O abstractions clean, for future GUI embeddings.
3585 3586
3586 3587 * IPython/genutils.py (info): added new utility for sys.stderr
3587 3588 unified info message handling (thin wrapper around warn()).
3588 3589
3589 3590 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
3590 3591 composite (dotted) names on verbose exceptions.
3591 3592 (VerboseTB.nullrepr): harden against another kind of errors which
3592 3593 Python's inspect module can trigger, and which were crashing
3593 3594 IPython. Thanks to a report by Marco Lombardi
3594 3595 <mlombard-AT-ma010192.hq.eso.org>.
3595 3596
3596 3597 2004-12-13 *** Released version 0.6.6
3597 3598
3598 3599 2004-12-12 Fernando Perez <fperez@colorado.edu>
3599 3600
3600 3601 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
3601 3602 generated by pygtk upon initialization if it was built without
3602 3603 threads (for matplotlib users). After a crash reported by
3603 3604 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
3604 3605
3605 3606 * IPython/ipmaker.py (make_IPython): fix small bug in the
3606 3607 import_some parameter for multiple imports.
3607 3608
3608 3609 * IPython/iplib.py (ipmagic): simplified the interface of
3609 3610 ipmagic() to take a single string argument, just as it would be
3610 3611 typed at the IPython cmd line.
3611 3612 (ipalias): Added new ipalias() with an interface identical to
3612 3613 ipmagic(). This completes exposing a pure python interface to the
3613 3614 alias and magic system, which can be used in loops or more complex
3614 3615 code where IPython's automatic line mangling is not active.
3615 3616
3616 3617 * IPython/genutils.py (timing): changed interface of timing to
3617 3618 simply run code once, which is the most common case. timings()
3618 3619 remains unchanged, for the cases where you want multiple runs.
3619 3620
3620 3621 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
3621 3622 bug where Python2.2 crashes with exec'ing code which does not end
3622 3623 in a single newline. Python 2.3 is OK, so I hadn't noticed this
3623 3624 before.
3624 3625
3625 3626 2004-12-10 Fernando Perez <fperez@colorado.edu>
3626 3627
3627 3628 * IPython/Magic.py (Magic.magic_prun): changed name of option from
3628 3629 -t to -T, to accomodate the new -t flag in %run (the %run and
3629 3630 %prun options are kind of intermixed, and it's not easy to change
3630 3631 this with the limitations of python's getopt).
3631 3632
3632 3633 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
3633 3634 the execution of scripts. It's not as fine-tuned as timeit.py,
3634 3635 but it works from inside ipython (and under 2.2, which lacks
3635 3636 timeit.py). Optionally a number of runs > 1 can be given for
3636 3637 timing very short-running code.
3637 3638
3638 3639 * IPython/genutils.py (uniq_stable): new routine which returns a
3639 3640 list of unique elements in any iterable, but in stable order of
3640 3641 appearance. I needed this for the ultraTB fixes, and it's a handy
3641 3642 utility.
3642 3643
3643 3644 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
3644 3645 dotted names in Verbose exceptions. This had been broken since
3645 3646 the very start, now x.y will properly be printed in a Verbose
3646 3647 traceback, instead of x being shown and y appearing always as an
3647 3648 'undefined global'. Getting this to work was a bit tricky,
3648 3649 because by default python tokenizers are stateless. Saved by
3649 3650 python's ability to easily add a bit of state to an arbitrary
3650 3651 function (without needing to build a full-blown callable object).
3651 3652
3652 3653 Also big cleanup of this code, which had horrendous runtime
3653 3654 lookups of zillions of attributes for colorization. Moved all
3654 3655 this code into a few templates, which make it cleaner and quicker.
3655 3656
3656 3657 Printout quality was also improved for Verbose exceptions: one
3657 3658 variable per line, and memory addresses are printed (this can be
3658 3659 quite handy in nasty debugging situations, which is what Verbose
3659 3660 is for).
3660 3661
3661 3662 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
3662 3663 the command line as scripts to be loaded by embedded instances.
3663 3664 Doing so has the potential for an infinite recursion if there are
3664 3665 exceptions thrown in the process. This fixes a strange crash
3665 3666 reported by Philippe MULLER <muller-AT-irit.fr>.
3666 3667
3667 3668 2004-12-09 Fernando Perez <fperez@colorado.edu>
3668 3669
3669 3670 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
3670 3671 to reflect new names in matplotlib, which now expose the
3671 3672 matlab-compatible interface via a pylab module instead of the
3672 3673 'matlab' name. The new code is backwards compatible, so users of
3673 3674 all matplotlib versions are OK. Patch by J. Hunter.
3674 3675
3675 3676 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
3676 3677 of __init__ docstrings for instances (class docstrings are already
3677 3678 automatically printed). Instances with customized docstrings
3678 3679 (indep. of the class) are also recognized and all 3 separate
3679 3680 docstrings are printed (instance, class, constructor). After some
3680 3681 comments/suggestions by J. Hunter.
3681 3682
3682 3683 2004-12-05 Fernando Perez <fperez@colorado.edu>
3683 3684
3684 3685 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
3685 3686 warnings when tab-completion fails and triggers an exception.
3686 3687
3687 3688 2004-12-03 Fernando Perez <fperez@colorado.edu>
3688 3689
3689 3690 * IPython/Magic.py (magic_prun): Fix bug where an exception would
3690 3691 be triggered when using 'run -p'. An incorrect option flag was
3691 3692 being set ('d' instead of 'D').
3692 3693 (manpage): fix missing escaped \- sign.
3693 3694
3694 3695 2004-11-30 *** Released version 0.6.5
3695 3696
3696 3697 2004-11-30 Fernando Perez <fperez@colorado.edu>
3697 3698
3698 3699 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
3699 3700 setting with -d option.
3700 3701
3701 3702 * setup.py (docfiles): Fix problem where the doc glob I was using
3702 3703 was COMPLETELY BROKEN. It was giving the right files by pure
3703 3704 accident, but failed once I tried to include ipython.el. Note:
3704 3705 glob() does NOT allow you to do exclusion on multiple endings!
3705 3706
3706 3707 2004-11-29 Fernando Perez <fperez@colorado.edu>
3707 3708
3708 3709 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
3709 3710 the manpage as the source. Better formatting & consistency.
3710 3711
3711 3712 * IPython/Magic.py (magic_run): Added new -d option, to run
3712 3713 scripts under the control of the python pdb debugger. Note that
3713 3714 this required changing the %prun option -d to -D, to avoid a clash
3714 3715 (since %run must pass options to %prun, and getopt is too dumb to
3715 3716 handle options with string values with embedded spaces). Thanks
3716 3717 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
3717 3718 (magic_who_ls): added type matching to %who and %whos, so that one
3718 3719 can filter their output to only include variables of certain
3719 3720 types. Another suggestion by Matthew.
3720 3721 (magic_whos): Added memory summaries in kb and Mb for arrays.
3721 3722 (magic_who): Improve formatting (break lines every 9 vars).
3722 3723
3723 3724 2004-11-28 Fernando Perez <fperez@colorado.edu>
3724 3725
3725 3726 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
3726 3727 cache when empty lines were present.
3727 3728
3728 3729 2004-11-24 Fernando Perez <fperez@colorado.edu>
3729 3730
3730 3731 * IPython/usage.py (__doc__): document the re-activated threading
3731 3732 options for WX and GTK.
3732 3733
3733 3734 2004-11-23 Fernando Perez <fperez@colorado.edu>
3734 3735
3735 3736 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
3736 3737 the -wthread and -gthread options, along with a new -tk one to try
3737 3738 and coordinate Tk threading with wx/gtk. The tk support is very
3738 3739 platform dependent, since it seems to require Tcl and Tk to be
3739 3740 built with threads (Fedora1/2 appears NOT to have it, but in
3740 3741 Prabhu's Debian boxes it works OK). But even with some Tk
3741 3742 limitations, this is a great improvement.
3742 3743
3743 3744 * IPython/Prompts.py (prompt_specials_color): Added \t for time
3744 3745 info in user prompts. Patch by Prabhu.
3745 3746
3746 3747 2004-11-18 Fernando Perez <fperez@colorado.edu>
3747 3748
3748 3749 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
3749 3750 EOFErrors and bail, to avoid infinite loops if a non-terminating
3750 3751 file is fed into ipython. Patch submitted in issue 19 by user,
3751 3752 many thanks.
3752 3753
3753 3754 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
3754 3755 autoquote/parens in continuation prompts, which can cause lots of
3755 3756 problems. Closes roundup issue 20.
3756 3757
3757 3758 2004-11-17 Fernando Perez <fperez@colorado.edu>
3758 3759
3759 3760 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
3760 3761 reported as debian bug #280505. I'm not sure my local changelog
3761 3762 entry has the proper debian format (Jack?).
3762 3763
3763 3764 2004-11-08 *** Released version 0.6.4
3764 3765
3765 3766 2004-11-08 Fernando Perez <fperez@colorado.edu>
3766 3767
3767 3768 * IPython/iplib.py (init_readline): Fix exit message for Windows
3768 3769 when readline is active. Thanks to a report by Eric Jones
3769 3770 <eric-AT-enthought.com>.
3770 3771
3771 3772 2004-11-07 Fernando Perez <fperez@colorado.edu>
3772 3773
3773 3774 * IPython/genutils.py (page): Add a trap for OSError exceptions,
3774 3775 sometimes seen by win2k/cygwin users.
3775 3776
3776 3777 2004-11-06 Fernando Perez <fperez@colorado.edu>
3777 3778
3778 3779 * IPython/iplib.py (interact): Change the handling of %Exit from
3779 3780 trying to propagate a SystemExit to an internal ipython flag.
3780 3781 This is less elegant than using Python's exception mechanism, but
3781 3782 I can't get that to work reliably with threads, so under -pylab
3782 3783 %Exit was hanging IPython. Cross-thread exception handling is
3783 3784 really a bitch. Thaks to a bug report by Stephen Walton
3784 3785 <stephen.walton-AT-csun.edu>.
3785 3786
3786 3787 2004-11-04 Fernando Perez <fperez@colorado.edu>
3787 3788
3788 3789 * IPython/iplib.py (raw_input_original): store a pointer to the
3789 3790 true raw_input to harden against code which can modify it
3790 3791 (wx.py.PyShell does this and would otherwise crash ipython).
3791 3792 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
3792 3793
3793 3794 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
3794 3795 Ctrl-C problem, which does not mess up the input line.
3795 3796
3796 3797 2004-11-03 Fernando Perez <fperez@colorado.edu>
3797 3798
3798 3799 * IPython/Release.py: Changed licensing to BSD, in all files.
3799 3800 (name): lowercase name for tarball/RPM release.
3800 3801
3801 3802 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
3802 3803 use throughout ipython.
3803 3804
3804 3805 * IPython/Magic.py (Magic._ofind): Switch to using the new
3805 3806 OInspect.getdoc() function.
3806 3807
3807 3808 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
3808 3809 of the line currently being canceled via Ctrl-C. It's extremely
3809 3810 ugly, but I don't know how to do it better (the problem is one of
3810 3811 handling cross-thread exceptions).
3811 3812
3812 3813 2004-10-28 Fernando Perez <fperez@colorado.edu>
3813 3814
3814 3815 * IPython/Shell.py (signal_handler): add signal handlers to trap
3815 3816 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
3816 3817 report by Francesc Alted.
3817 3818
3818 3819 2004-10-21 Fernando Perez <fperez@colorado.edu>
3819 3820
3820 3821 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
3821 3822 to % for pysh syntax extensions.
3822 3823
3823 3824 2004-10-09 Fernando Perez <fperez@colorado.edu>
3824 3825
3825 3826 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
3826 3827 arrays to print a more useful summary, without calling str(arr).
3827 3828 This avoids the problem of extremely lengthy computations which
3828 3829 occur if arr is large, and appear to the user as a system lockup
3829 3830 with 100% cpu activity. After a suggestion by Kristian Sandberg
3830 3831 <Kristian.Sandberg@colorado.edu>.
3831 3832 (Magic.__init__): fix bug in global magic escapes not being
3832 3833 correctly set.
3833 3834
3834 3835 2004-10-08 Fernando Perez <fperez@colorado.edu>
3835 3836
3836 3837 * IPython/Magic.py (__license__): change to absolute imports of
3837 3838 ipython's own internal packages, to start adapting to the absolute
3838 3839 import requirement of PEP-328.
3839 3840
3840 3841 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
3841 3842 files, and standardize author/license marks through the Release
3842 3843 module instead of having per/file stuff (except for files with
3843 3844 particular licenses, like the MIT/PSF-licensed codes).
3844 3845
3845 3846 * IPython/Debugger.py: remove dead code for python 2.1
3846 3847
3847 3848 2004-10-04 Fernando Perez <fperez@colorado.edu>
3848 3849
3849 3850 * IPython/iplib.py (ipmagic): New function for accessing magics
3850 3851 via a normal python function call.
3851 3852
3852 3853 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
3853 3854 from '@' to '%', to accomodate the new @decorator syntax of python
3854 3855 2.4.
3855 3856
3856 3857 2004-09-29 Fernando Perez <fperez@colorado.edu>
3857 3858
3858 3859 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
3859 3860 matplotlib.use to prevent running scripts which try to switch
3860 3861 interactive backends from within ipython. This will just crash
3861 3862 the python interpreter, so we can't allow it (but a detailed error
3862 3863 is given to the user).
3863 3864
3864 3865 2004-09-28 Fernando Perez <fperez@colorado.edu>
3865 3866
3866 3867 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
3867 3868 matplotlib-related fixes so that using @run with non-matplotlib
3868 3869 scripts doesn't pop up spurious plot windows. This requires
3869 3870 matplotlib >= 0.63, where I had to make some changes as well.
3870 3871
3871 3872 * IPython/ipmaker.py (make_IPython): update version requirement to
3872 3873 python 2.2.
3873 3874
3874 3875 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
3875 3876 banner arg for embedded customization.
3876 3877
3877 3878 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
3878 3879 explicit uses of __IP as the IPython's instance name. Now things
3879 3880 are properly handled via the shell.name value. The actual code
3880 3881 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
3881 3882 is much better than before. I'll clean things completely when the
3882 3883 magic stuff gets a real overhaul.
3883 3884
3884 3885 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
3885 3886 minor changes to debian dir.
3886 3887
3887 3888 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
3888 3889 pointer to the shell itself in the interactive namespace even when
3889 3890 a user-supplied dict is provided. This is needed for embedding
3890 3891 purposes (found by tests with Michel Sanner).
3891 3892
3892 3893 2004-09-27 Fernando Perez <fperez@colorado.edu>
3893 3894
3894 3895 * IPython/UserConfig/ipythonrc: remove []{} from
3895 3896 readline_remove_delims, so that things like [modname.<TAB> do
3896 3897 proper completion. This disables [].TAB, but that's a less common
3897 3898 case than module names in list comprehensions, for example.
3898 3899 Thanks to a report by Andrea Riciputi.
3899 3900
3900 3901 2004-09-09 Fernando Perez <fperez@colorado.edu>
3901 3902
3902 3903 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
3903 3904 blocking problems in win32 and osx. Fix by John.
3904 3905
3905 3906 2004-09-08 Fernando Perez <fperez@colorado.edu>
3906 3907
3907 3908 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
3908 3909 for Win32 and OSX. Fix by John Hunter.
3909 3910
3910 3911 2004-08-30 *** Released version 0.6.3
3911 3912
3912 3913 2004-08-30 Fernando Perez <fperez@colorado.edu>
3913 3914
3914 3915 * setup.py (isfile): Add manpages to list of dependent files to be
3915 3916 updated.
3916 3917
3917 3918 2004-08-27 Fernando Perez <fperez@colorado.edu>
3918 3919
3919 3920 * IPython/Shell.py (start): I've disabled -wthread and -gthread
3920 3921 for now. They don't really work with standalone WX/GTK code
3921 3922 (though matplotlib IS working fine with both of those backends).
3922 3923 This will neeed much more testing. I disabled most things with
3923 3924 comments, so turning it back on later should be pretty easy.
3924 3925
3925 3926 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
3926 3927 autocalling of expressions like r'foo', by modifying the line
3927 3928 split regexp. Closes
3928 3929 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
3929 3930 Riley <ipythonbugs-AT-sabi.net>.
3930 3931 (InteractiveShell.mainloop): honor --nobanner with banner
3931 3932 extensions.
3932 3933
3933 3934 * IPython/Shell.py: Significant refactoring of all classes, so
3934 3935 that we can really support ALL matplotlib backends and threading
3935 3936 models (John spotted a bug with Tk which required this). Now we
3936 3937 should support single-threaded, WX-threads and GTK-threads, both
3937 3938 for generic code and for matplotlib.
3938 3939
3939 3940 * IPython/ipmaker.py (__call__): Changed -mpthread option to
3940 3941 -pylab, to simplify things for users. Will also remove the pylab
3941 3942 profile, since now all of matplotlib configuration is directly
3942 3943 handled here. This also reduces startup time.
3943 3944
3944 3945 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
3945 3946 shell wasn't being correctly called. Also in IPShellWX.
3946 3947
3947 3948 * IPython/iplib.py (InteractiveShell.__init__): Added option to
3948 3949 fine-tune banner.
3949 3950
3950 3951 * IPython/numutils.py (spike): Deprecate these spike functions,
3951 3952 delete (long deprecated) gnuplot_exec handler.
3952 3953
3953 3954 2004-08-26 Fernando Perez <fperez@colorado.edu>
3954 3955
3955 3956 * ipython.1: Update for threading options, plus some others which
3956 3957 were missing.
3957 3958
3958 3959 * IPython/ipmaker.py (__call__): Added -wthread option for
3959 3960 wxpython thread handling. Make sure threading options are only
3960 3961 valid at the command line.
3961 3962
3962 3963 * scripts/ipython: moved shell selection into a factory function
3963 3964 in Shell.py, to keep the starter script to a minimum.
3964 3965
3965 3966 2004-08-25 Fernando Perez <fperez@colorado.edu>
3966 3967
3967 3968 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
3968 3969 John. Along with some recent changes he made to matplotlib, the
3969 3970 next versions of both systems should work very well together.
3970 3971
3971 3972 2004-08-24 Fernando Perez <fperez@colorado.edu>
3972 3973
3973 3974 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
3974 3975 tried to switch the profiling to using hotshot, but I'm getting
3975 3976 strange errors from prof.runctx() there. I may be misreading the
3976 3977 docs, but it looks weird. For now the profiling code will
3977 3978 continue to use the standard profiler.
3978 3979
3979 3980 2004-08-23 Fernando Perez <fperez@colorado.edu>
3980 3981
3981 3982 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
3982 3983 threaded shell, by John Hunter. It's not quite ready yet, but
3983 3984 close.
3984 3985
3985 3986 2004-08-22 Fernando Perez <fperez@colorado.edu>
3986 3987
3987 3988 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
3988 3989 in Magic and ultraTB.
3989 3990
3990 3991 * ipython.1: document threading options in manpage.
3991 3992
3992 3993 * scripts/ipython: Changed name of -thread option to -gthread,
3993 3994 since this is GTK specific. I want to leave the door open for a
3994 3995 -wthread option for WX, which will most likely be necessary. This
3995 3996 change affects usage and ipmaker as well.
3996 3997
3997 3998 * IPython/Shell.py (matplotlib_shell): Add a factory function to
3998 3999 handle the matplotlib shell issues. Code by John Hunter
3999 4000 <jdhunter-AT-nitace.bsd.uchicago.edu>.
4000 4001 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
4001 4002 broken (and disabled for end users) for now, but it puts the
4002 4003 infrastructure in place.
4003 4004
4004 4005 2004-08-21 Fernando Perez <fperez@colorado.edu>
4005 4006
4006 4007 * ipythonrc-pylab: Add matplotlib support.
4007 4008
4008 4009 * matplotlib_config.py: new files for matplotlib support, part of
4009 4010 the pylab profile.
4010 4011
4011 4012 * IPython/usage.py (__doc__): documented the threading options.
4012 4013
4013 4014 2004-08-20 Fernando Perez <fperez@colorado.edu>
4014 4015
4015 4016 * ipython: Modified the main calling routine to handle the -thread
4016 4017 and -mpthread options. This needs to be done as a top-level hack,
4017 4018 because it determines which class to instantiate for IPython
4018 4019 itself.
4019 4020
4020 4021 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
4021 4022 classes to support multithreaded GTK operation without blocking,
4022 4023 and matplotlib with all backends. This is a lot of still very
4023 4024 experimental code, and threads are tricky. So it may still have a
4024 4025 few rough edges... This code owes a lot to
4025 4026 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
4026 4027 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
4027 4028 to John Hunter for all the matplotlib work.
4028 4029
4029 4030 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
4030 4031 options for gtk thread and matplotlib support.
4031 4032
4032 4033 2004-08-16 Fernando Perez <fperez@colorado.edu>
4033 4034
4034 4035 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
4035 4036 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
4036 4037 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
4037 4038
4038 4039 2004-08-11 Fernando Perez <fperez@colorado.edu>
4039 4040
4040 4041 * setup.py (isfile): Fix build so documentation gets updated for
4041 4042 rpms (it was only done for .tgz builds).
4042 4043
4043 4044 2004-08-10 Fernando Perez <fperez@colorado.edu>
4044 4045
4045 4046 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
4046 4047
4047 4048 * iplib.py : Silence syntax error exceptions in tab-completion.
4048 4049
4049 4050 2004-08-05 Fernando Perez <fperez@colorado.edu>
4050 4051
4051 4052 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
4052 4053 'color off' mark for continuation prompts. This was causing long
4053 4054 continuation lines to mis-wrap.
4054 4055
4055 4056 2004-08-01 Fernando Perez <fperez@colorado.edu>
4056 4057
4057 4058 * IPython/ipmaker.py (make_IPython): Allow the shell class used
4058 4059 for building ipython to be a parameter. All this is necessary
4059 4060 right now to have a multithreaded version, but this insane
4060 4061 non-design will be cleaned up soon. For now, it's a hack that
4061 4062 works.
4062 4063
4063 4064 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
4064 4065 args in various places. No bugs so far, but it's a dangerous
4065 4066 practice.
4066 4067
4067 4068 2004-07-31 Fernando Perez <fperez@colorado.edu>
4068 4069
4069 4070 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
4070 4071 fix completion of files with dots in their names under most
4071 4072 profiles (pysh was OK because the completion order is different).
4072 4073
4073 4074 2004-07-27 Fernando Perez <fperez@colorado.edu>
4074 4075
4075 4076 * IPython/iplib.py (InteractiveShell.__init__): build dict of
4076 4077 keywords manually, b/c the one in keyword.py was removed in python
4077 4078 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
4078 4079 This is NOT a bug under python 2.3 and earlier.
4079 4080
4080 4081 2004-07-26 Fernando Perez <fperez@colorado.edu>
4081 4082
4082 4083 * IPython/ultraTB.py (VerboseTB.text): Add another
4083 4084 linecache.checkcache() call to try to prevent inspect.py from
4084 4085 crashing under python 2.3. I think this fixes
4085 4086 http://www.scipy.net/roundup/ipython/issue17.
4086 4087
4087 4088 2004-07-26 *** Released version 0.6.2
4088 4089
4089 4090 2004-07-26 Fernando Perez <fperez@colorado.edu>
4090 4091
4091 4092 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
4092 4093 fail for any number.
4093 4094 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
4094 4095 empty bookmarks.
4095 4096
4096 4097 2004-07-26 *** Released version 0.6.1
4097 4098
4098 4099 2004-07-26 Fernando Perez <fperez@colorado.edu>
4099 4100
4100 4101 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
4101 4102
4102 4103 * IPython/iplib.py (protect_filename): Applied Ville's patch for
4103 4104 escaping '()[]{}' in filenames.
4104 4105
4105 4106 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
4106 4107 Python 2.2 users who lack a proper shlex.split.
4107 4108
4108 4109 2004-07-19 Fernando Perez <fperez@colorado.edu>
4109 4110
4110 4111 * IPython/iplib.py (InteractiveShell.init_readline): Add support
4111 4112 for reading readline's init file. I follow the normal chain:
4112 4113 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
4113 4114 report by Mike Heeter. This closes
4114 4115 http://www.scipy.net/roundup/ipython/issue16.
4115 4116
4116 4117 2004-07-18 Fernando Perez <fperez@colorado.edu>
4117 4118
4118 4119 * IPython/iplib.py (__init__): Add better handling of '\' under
4119 4120 Win32 for filenames. After a patch by Ville.
4120 4121
4121 4122 2004-07-17 Fernando Perez <fperez@colorado.edu>
4122 4123
4123 4124 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4124 4125 autocalling would be triggered for 'foo is bar' if foo is
4125 4126 callable. I also cleaned up the autocall detection code to use a
4126 4127 regexp, which is faster. Bug reported by Alexander Schmolck.
4127 4128
4128 4129 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
4129 4130 '?' in them would confuse the help system. Reported by Alex
4130 4131 Schmolck.
4131 4132
4132 4133 2004-07-16 Fernando Perez <fperez@colorado.edu>
4133 4134
4134 4135 * IPython/GnuplotInteractive.py (__all__): added plot2.
4135 4136
4136 4137 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
4137 4138 plotting dictionaries, lists or tuples of 1d arrays.
4138 4139
4139 4140 * IPython/Magic.py (Magic.magic_hist): small clenaups and
4140 4141 optimizations.
4141 4142
4142 4143 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
4143 4144 the information which was there from Janko's original IPP code:
4144 4145
4145 4146 03.05.99 20:53 porto.ifm.uni-kiel.de
4146 4147 --Started changelog.
4147 4148 --make clear do what it say it does
4148 4149 --added pretty output of lines from inputcache
4149 4150 --Made Logger a mixin class, simplifies handling of switches
4150 4151 --Added own completer class. .string<TAB> expands to last history
4151 4152 line which starts with string. The new expansion is also present
4152 4153 with Ctrl-r from the readline library. But this shows, who this
4153 4154 can be done for other cases.
4154 4155 --Added convention that all shell functions should accept a
4155 4156 parameter_string This opens the door for different behaviour for
4156 4157 each function. @cd is a good example of this.
4157 4158
4158 4159 04.05.99 12:12 porto.ifm.uni-kiel.de
4159 4160 --added logfile rotation
4160 4161 --added new mainloop method which freezes first the namespace
4161 4162
4162 4163 07.05.99 21:24 porto.ifm.uni-kiel.de
4163 4164 --added the docreader classes. Now there is a help system.
4164 4165 -This is only a first try. Currently it's not easy to put new
4165 4166 stuff in the indices. But this is the way to go. Info would be
4166 4167 better, but HTML is every where and not everybody has an info
4167 4168 system installed and it's not so easy to change html-docs to info.
4168 4169 --added global logfile option
4169 4170 --there is now a hook for object inspection method pinfo needs to
4170 4171 be provided for this. Can be reached by two '??'.
4171 4172
4172 4173 08.05.99 20:51 porto.ifm.uni-kiel.de
4173 4174 --added a README
4174 4175 --bug in rc file. Something has changed so functions in the rc
4175 4176 file need to reference the shell and not self. Not clear if it's a
4176 4177 bug or feature.
4177 4178 --changed rc file for new behavior
4178 4179
4179 4180 2004-07-15 Fernando Perez <fperez@colorado.edu>
4180 4181
4181 4182 * IPython/Logger.py (Logger.log): fixed recent bug where the input
4182 4183 cache was falling out of sync in bizarre manners when multi-line
4183 4184 input was present. Minor optimizations and cleanup.
4184 4185
4185 4186 (Logger): Remove old Changelog info for cleanup. This is the
4186 4187 information which was there from Janko's original code:
4187 4188
4188 4189 Changes to Logger: - made the default log filename a parameter
4189 4190
4190 4191 - put a check for lines beginning with !@? in log(). Needed
4191 4192 (even if the handlers properly log their lines) for mid-session
4192 4193 logging activation to work properly. Without this, lines logged
4193 4194 in mid session, which get read from the cache, would end up
4194 4195 'bare' (with !@? in the open) in the log. Now they are caught
4195 4196 and prepended with a #.
4196 4197
4197 4198 * IPython/iplib.py (InteractiveShell.init_readline): added check
4198 4199 in case MagicCompleter fails to be defined, so we don't crash.
4199 4200
4200 4201 2004-07-13 Fernando Perez <fperez@colorado.edu>
4201 4202
4202 4203 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
4203 4204 of EPS if the requested filename ends in '.eps'.
4204 4205
4205 4206 2004-07-04 Fernando Perez <fperez@colorado.edu>
4206 4207
4207 4208 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
4208 4209 escaping of quotes when calling the shell.
4209 4210
4210 4211 2004-07-02 Fernando Perez <fperez@colorado.edu>
4211 4212
4212 4213 * IPython/Prompts.py (CachedOutput.update): Fix problem with
4213 4214 gettext not working because we were clobbering '_'. Fixes
4214 4215 http://www.scipy.net/roundup/ipython/issue6.
4215 4216
4216 4217 2004-07-01 Fernando Perez <fperez@colorado.edu>
4217 4218
4218 4219 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
4219 4220 into @cd. Patch by Ville.
4220 4221
4221 4222 * IPython/iplib.py (InteractiveShell.post_config_initialization):
4222 4223 new function to store things after ipmaker runs. Patch by Ville.
4223 4224 Eventually this will go away once ipmaker is removed and the class
4224 4225 gets cleaned up, but for now it's ok. Key functionality here is
4225 4226 the addition of the persistent storage mechanism, a dict for
4226 4227 keeping data across sessions (for now just bookmarks, but more can
4227 4228 be implemented later).
4228 4229
4229 4230 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
4230 4231 persistent across sections. Patch by Ville, I modified it
4231 4232 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
4232 4233 added a '-l' option to list all bookmarks.
4233 4234
4234 4235 * IPython/iplib.py (InteractiveShell.atexit_operations): new
4235 4236 center for cleanup. Registered with atexit.register(). I moved
4236 4237 here the old exit_cleanup(). After a patch by Ville.
4237 4238
4238 4239 * IPython/Magic.py (get_py_filename): added '~' to the accepted
4239 4240 characters in the hacked shlex_split for python 2.2.
4240 4241
4241 4242 * IPython/iplib.py (file_matches): more fixes to filenames with
4242 4243 whitespace in them. It's not perfect, but limitations in python's
4243 4244 readline make it impossible to go further.
4244 4245
4245 4246 2004-06-29 Fernando Perez <fperez@colorado.edu>
4246 4247
4247 4248 * IPython/iplib.py (file_matches): escape whitespace correctly in
4248 4249 filename completions. Bug reported by Ville.
4249 4250
4250 4251 2004-06-28 Fernando Perez <fperez@colorado.edu>
4251 4252
4252 4253 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
4253 4254 the history file will be called 'history-PROFNAME' (or just
4254 4255 'history' if no profile is loaded). I was getting annoyed at
4255 4256 getting my Numerical work history clobbered by pysh sessions.
4256 4257
4257 4258 * IPython/iplib.py (InteractiveShell.__init__): Internal
4258 4259 getoutputerror() function so that we can honor the system_verbose
4259 4260 flag for _all_ system calls. I also added escaping of #
4260 4261 characters here to avoid confusing Itpl.
4261 4262
4262 4263 * IPython/Magic.py (shlex_split): removed call to shell in
4263 4264 parse_options and replaced it with shlex.split(). The annoying
4264 4265 part was that in Python 2.2, shlex.split() doesn't exist, so I had
4265 4266 to backport it from 2.3, with several frail hacks (the shlex
4266 4267 module is rather limited in 2.2). Thanks to a suggestion by Ville
4267 4268 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
4268 4269 problem.
4269 4270
4270 4271 (Magic.magic_system_verbose): new toggle to print the actual
4271 4272 system calls made by ipython. Mainly for debugging purposes.
4272 4273
4273 4274 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
4274 4275 doesn't support persistence. Reported (and fix suggested) by
4275 4276 Travis Caldwell <travis_caldwell2000@yahoo.com>.
4276 4277
4277 4278 2004-06-26 Fernando Perez <fperez@colorado.edu>
4278 4279
4279 4280 * IPython/Logger.py (Logger.log): fix to handle correctly empty
4280 4281 continue prompts.
4281 4282
4282 4283 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
4283 4284 function (basically a big docstring) and a few more things here to
4284 4285 speedup startup. pysh.py is now very lightweight. We want because
4285 4286 it gets execfile'd, while InterpreterExec gets imported, so
4286 4287 byte-compilation saves time.
4287 4288
4288 4289 2004-06-25 Fernando Perez <fperez@colorado.edu>
4289 4290
4290 4291 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
4291 4292 -NUM', which was recently broken.
4292 4293
4293 4294 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
4294 4295 in multi-line input (but not !!, which doesn't make sense there).
4295 4296
4296 4297 * IPython/UserConfig/ipythonrc: made autoindent on by default.
4297 4298 It's just too useful, and people can turn it off in the less
4298 4299 common cases where it's a problem.
4299 4300
4300 4301 2004-06-24 Fernando Perez <fperez@colorado.edu>
4301 4302
4302 4303 * IPython/iplib.py (InteractiveShell._prefilter): big change -
4303 4304 special syntaxes (like alias calling) is now allied in multi-line
4304 4305 input. This is still _very_ experimental, but it's necessary for
4305 4306 efficient shell usage combining python looping syntax with system
4306 4307 calls. For now it's restricted to aliases, I don't think it
4307 4308 really even makes sense to have this for magics.
4308 4309
4309 4310 2004-06-23 Fernando Perez <fperez@colorado.edu>
4310 4311
4311 4312 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
4312 4313 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
4313 4314
4314 4315 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
4315 4316 extensions under Windows (after code sent by Gary Bishop). The
4316 4317 extensions considered 'executable' are stored in IPython's rc
4317 4318 structure as win_exec_ext.
4318 4319
4319 4320 * IPython/genutils.py (shell): new function, like system() but
4320 4321 without return value. Very useful for interactive shell work.
4321 4322
4322 4323 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
4323 4324 delete aliases.
4324 4325
4325 4326 * IPython/iplib.py (InteractiveShell.alias_table_update): make
4326 4327 sure that the alias table doesn't contain python keywords.
4327 4328
4328 4329 2004-06-21 Fernando Perez <fperez@colorado.edu>
4329 4330
4330 4331 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
4331 4332 non-existent items are found in $PATH. Reported by Thorsten.
4332 4333
4333 4334 2004-06-20 Fernando Perez <fperez@colorado.edu>
4334 4335
4335 4336 * IPython/iplib.py (complete): modified the completer so that the
4336 4337 order of priorities can be easily changed at runtime.
4337 4338
4338 4339 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
4339 4340 Modified to auto-execute all lines beginning with '~', '/' or '.'.
4340 4341
4341 4342 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
4342 4343 expand Python variables prepended with $ in all system calls. The
4343 4344 same was done to InteractiveShell.handle_shell_escape. Now all
4344 4345 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
4345 4346 expansion of python variables and expressions according to the
4346 4347 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
4347 4348
4348 4349 Though PEP-215 has been rejected, a similar (but simpler) one
4349 4350 seems like it will go into Python 2.4, PEP-292 -
4350 4351 http://www.python.org/peps/pep-0292.html.
4351 4352
4352 4353 I'll keep the full syntax of PEP-215, since IPython has since the
4353 4354 start used Ka-Ping Yee's reference implementation discussed there
4354 4355 (Itpl), and I actually like the powerful semantics it offers.
4355 4356
4356 4357 In order to access normal shell variables, the $ has to be escaped
4357 4358 via an extra $. For example:
4358 4359
4359 4360 In [7]: PATH='a python variable'
4360 4361
4361 4362 In [8]: !echo $PATH
4362 4363 a python variable
4363 4364
4364 4365 In [9]: !echo $$PATH
4365 4366 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
4366 4367
4367 4368 (Magic.parse_options): escape $ so the shell doesn't evaluate
4368 4369 things prematurely.
4369 4370
4370 4371 * IPython/iplib.py (InteractiveShell.call_alias): added the
4371 4372 ability for aliases to expand python variables via $.
4372 4373
4373 4374 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
4374 4375 system, now there's a @rehash/@rehashx pair of magics. These work
4375 4376 like the csh rehash command, and can be invoked at any time. They
4376 4377 build a table of aliases to everything in the user's $PATH
4377 4378 (@rehash uses everything, @rehashx is slower but only adds
4378 4379 executable files). With this, the pysh.py-based shell profile can
4379 4380 now simply call rehash upon startup, and full access to all
4380 4381 programs in the user's path is obtained.
4381 4382
4382 4383 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
4383 4384 functionality is now fully in place. I removed the old dynamic
4384 4385 code generation based approach, in favor of a much lighter one
4385 4386 based on a simple dict. The advantage is that this allows me to
4386 4387 now have thousands of aliases with negligible cost (unthinkable
4387 4388 with the old system).
4388 4389
4389 4390 2004-06-19 Fernando Perez <fperez@colorado.edu>
4390 4391
4391 4392 * IPython/iplib.py (__init__): extended MagicCompleter class to
4392 4393 also complete (last in priority) on user aliases.
4393 4394
4394 4395 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
4395 4396 call to eval.
4396 4397 (ItplNS.__init__): Added a new class which functions like Itpl,
4397 4398 but allows configuring the namespace for the evaluation to occur
4398 4399 in.
4399 4400
4400 4401 2004-06-18 Fernando Perez <fperez@colorado.edu>
4401 4402
4402 4403 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
4403 4404 better message when 'exit' or 'quit' are typed (a common newbie
4404 4405 confusion).
4405 4406
4406 4407 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
4407 4408 check for Windows users.
4408 4409
4409 4410 * IPython/iplib.py (InteractiveShell.user_setup): removed
4410 4411 disabling of colors for Windows. I'll test at runtime and issue a
4411 4412 warning if Gary's readline isn't found, as to nudge users to
4412 4413 download it.
4413 4414
4414 4415 2004-06-16 Fernando Perez <fperez@colorado.edu>
4415 4416
4416 4417 * IPython/genutils.py (Stream.__init__): changed to print errors
4417 4418 to sys.stderr. I had a circular dependency here. Now it's
4418 4419 possible to run ipython as IDLE's shell (consider this pre-alpha,
4419 4420 since true stdout things end up in the starting terminal instead
4420 4421 of IDLE's out).
4421 4422
4422 4423 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
4423 4424 users who haven't # updated their prompt_in2 definitions. Remove
4424 4425 eventually.
4425 4426 (multiple_replace): added credit to original ASPN recipe.
4426 4427
4427 4428 2004-06-15 Fernando Perez <fperez@colorado.edu>
4428 4429
4429 4430 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
4430 4431 list of auto-defined aliases.
4431 4432
4432 4433 2004-06-13 Fernando Perez <fperez@colorado.edu>
4433 4434
4434 4435 * setup.py (scriptfiles): Don't trigger win_post_install unless an
4435 4436 install was really requested (so setup.py can be used for other
4436 4437 things under Windows).
4437 4438
4438 4439 2004-06-10 Fernando Perez <fperez@colorado.edu>
4439 4440
4440 4441 * IPython/Logger.py (Logger.create_log): Manually remove any old
4441 4442 backup, since os.remove may fail under Windows. Fixes bug
4442 4443 reported by Thorsten.
4443 4444
4444 4445 2004-06-09 Fernando Perez <fperez@colorado.edu>
4445 4446
4446 4447 * examples/example-embed.py: fixed all references to %n (replaced
4447 4448 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
4448 4449 for all examples and the manual as well.
4449 4450
4450 4451 2004-06-08 Fernando Perez <fperez@colorado.edu>
4451 4452
4452 4453 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
4453 4454 alignment and color management. All 3 prompt subsystems now
4454 4455 inherit from BasePrompt.
4455 4456
4456 4457 * tools/release: updates for windows installer build and tag rpms
4457 4458 with python version (since paths are fixed).
4458 4459
4459 4460 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
4460 4461 which will become eventually obsolete. Also fixed the default
4461 4462 prompt_in2 to use \D, so at least new users start with the correct
4462 4463 defaults.
4463 4464 WARNING: Users with existing ipythonrc files will need to apply
4464 4465 this fix manually!
4465 4466
4466 4467 * setup.py: make windows installer (.exe). This is finally the
4467 4468 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
4468 4469 which I hadn't included because it required Python 2.3 (or recent
4469 4470 distutils).
4470 4471
4471 4472 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
4472 4473 usage of new '\D' escape.
4473 4474
4474 4475 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
4475 4476 lacks os.getuid())
4476 4477 (CachedOutput.set_colors): Added the ability to turn coloring
4477 4478 on/off with @colors even for manually defined prompt colors. It
4478 4479 uses a nasty global, but it works safely and via the generic color
4479 4480 handling mechanism.
4480 4481 (Prompt2.__init__): Introduced new escape '\D' for continuation
4481 4482 prompts. It represents the counter ('\#') as dots.
4482 4483 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
4483 4484 need to update their ipythonrc files and replace '%n' with '\D' in
4484 4485 their prompt_in2 settings everywhere. Sorry, but there's
4485 4486 otherwise no clean way to get all prompts to properly align. The
4486 4487 ipythonrc shipped with IPython has been updated.
4487 4488
4488 4489 2004-06-07 Fernando Perez <fperez@colorado.edu>
4489 4490
4490 4491 * setup.py (isfile): Pass local_icons option to latex2html, so the
4491 4492 resulting HTML file is self-contained. Thanks to
4492 4493 dryice-AT-liu.com.cn for the tip.
4493 4494
4494 4495 * pysh.py: I created a new profile 'shell', which implements a
4495 4496 _rudimentary_ IPython-based shell. This is in NO WAY a realy
4496 4497 system shell, nor will it become one anytime soon. It's mainly
4497 4498 meant to illustrate the use of the new flexible bash-like prompts.
4498 4499 I guess it could be used by hardy souls for true shell management,
4499 4500 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
4500 4501 profile. This uses the InterpreterExec extension provided by
4501 4502 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
4502 4503
4503 4504 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
4504 4505 auto-align itself with the length of the previous input prompt
4505 4506 (taking into account the invisible color escapes).
4506 4507 (CachedOutput.__init__): Large restructuring of this class. Now
4507 4508 all three prompts (primary1, primary2, output) are proper objects,
4508 4509 managed by the 'parent' CachedOutput class. The code is still a
4509 4510 bit hackish (all prompts share state via a pointer to the cache),
4510 4511 but it's overall far cleaner than before.
4511 4512
4512 4513 * IPython/genutils.py (getoutputerror): modified to add verbose,
4513 4514 debug and header options. This makes the interface of all getout*
4514 4515 functions uniform.
4515 4516 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
4516 4517
4517 4518 * IPython/Magic.py (Magic.default_option): added a function to
4518 4519 allow registering default options for any magic command. This
4519 4520 makes it easy to have profiles which customize the magics globally
4520 4521 for a certain use. The values set through this function are
4521 4522 picked up by the parse_options() method, which all magics should
4522 4523 use to parse their options.
4523 4524
4524 4525 * IPython/genutils.py (warn): modified the warnings framework to
4525 4526 use the Term I/O class. I'm trying to slowly unify all of
4526 4527 IPython's I/O operations to pass through Term.
4527 4528
4528 4529 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
4529 4530 the secondary prompt to correctly match the length of the primary
4530 4531 one for any prompt. Now multi-line code will properly line up
4531 4532 even for path dependent prompts, such as the new ones available
4532 4533 via the prompt_specials.
4533 4534
4534 4535 2004-06-06 Fernando Perez <fperez@colorado.edu>
4535 4536
4536 4537 * IPython/Prompts.py (prompt_specials): Added the ability to have
4537 4538 bash-like special sequences in the prompts, which get
4538 4539 automatically expanded. Things like hostname, current working
4539 4540 directory and username are implemented already, but it's easy to
4540 4541 add more in the future. Thanks to a patch by W.J. van der Laan
4541 4542 <gnufnork-AT-hetdigitalegat.nl>
4542 4543 (prompt_specials): Added color support for prompt strings, so
4543 4544 users can define arbitrary color setups for their prompts.
4544 4545
4545 4546 2004-06-05 Fernando Perez <fperez@colorado.edu>
4546 4547
4547 4548 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
4548 4549 code to load Gary Bishop's readline and configure it
4549 4550 automatically. Thanks to Gary for help on this.
4550 4551
4551 4552 2004-06-01 Fernando Perez <fperez@colorado.edu>
4552 4553
4553 4554 * IPython/Logger.py (Logger.create_log): fix bug for logging
4554 4555 with no filename (previous fix was incomplete).
4555 4556
4556 4557 2004-05-25 Fernando Perez <fperez@colorado.edu>
4557 4558
4558 4559 * IPython/Magic.py (Magic.parse_options): fix bug where naked
4559 4560 parens would get passed to the shell.
4560 4561
4561 4562 2004-05-20 Fernando Perez <fperez@colorado.edu>
4562 4563
4563 4564 * IPython/Magic.py (Magic.magic_prun): changed default profile
4564 4565 sort order to 'time' (the more common profiling need).
4565 4566
4566 4567 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
4567 4568 so that source code shown is guaranteed in sync with the file on
4568 4569 disk (also changed in psource). Similar fix to the one for
4569 4570 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
4570 4571 <yann.ledu-AT-noos.fr>.
4571 4572
4572 4573 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
4573 4574 with a single option would not be correctly parsed. Closes
4574 4575 http://www.scipy.net/roundup/ipython/issue14. This bug had been
4575 4576 introduced in 0.6.0 (on 2004-05-06).
4576 4577
4577 4578 2004-05-13 *** Released version 0.6.0
4578 4579
4579 4580 2004-05-13 Fernando Perez <fperez@colorado.edu>
4580 4581
4581 4582 * debian/: Added debian/ directory to CVS, so that debian support
4582 4583 is publicly accessible. The debian package is maintained by Jack
4583 4584 Moffit <jack-AT-xiph.org>.
4584 4585
4585 4586 * Documentation: included the notes about an ipython-based system
4586 4587 shell (the hypothetical 'pysh') into the new_design.pdf document,
4587 4588 so that these ideas get distributed to users along with the
4588 4589 official documentation.
4589 4590
4590 4591 2004-05-10 Fernando Perez <fperez@colorado.edu>
4591 4592
4592 4593 * IPython/Logger.py (Logger.create_log): fix recently introduced
4593 4594 bug (misindented line) where logstart would fail when not given an
4594 4595 explicit filename.
4595 4596
4596 4597 2004-05-09 Fernando Perez <fperez@colorado.edu>
4597 4598
4598 4599 * IPython/Magic.py (Magic.parse_options): skip system call when
4599 4600 there are no options to look for. Faster, cleaner for the common
4600 4601 case.
4601 4602
4602 4603 * Documentation: many updates to the manual: describing Windows
4603 4604 support better, Gnuplot updates, credits, misc small stuff. Also
4604 4605 updated the new_design doc a bit.
4605 4606
4606 4607 2004-05-06 *** Released version 0.6.0.rc1
4607 4608
4608 4609 2004-05-06 Fernando Perez <fperez@colorado.edu>
4609 4610
4610 4611 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
4611 4612 operations to use the vastly more efficient list/''.join() method.
4612 4613 (FormattedTB.text): Fix
4613 4614 http://www.scipy.net/roundup/ipython/issue12 - exception source
4614 4615 extract not updated after reload. Thanks to Mike Salib
4615 4616 <msalib-AT-mit.edu> for pinning the source of the problem.
4616 4617 Fortunately, the solution works inside ipython and doesn't require
4617 4618 any changes to python proper.
4618 4619
4619 4620 * IPython/Magic.py (Magic.parse_options): Improved to process the
4620 4621 argument list as a true shell would (by actually using the
4621 4622 underlying system shell). This way, all @magics automatically get
4622 4623 shell expansion for variables. Thanks to a comment by Alex
4623 4624 Schmolck.
4624 4625
4625 4626 2004-04-04 Fernando Perez <fperez@colorado.edu>
4626 4627
4627 4628 * IPython/iplib.py (InteractiveShell.interact): Added a special
4628 4629 trap for a debugger quit exception, which is basically impossible
4629 4630 to handle by normal mechanisms, given what pdb does to the stack.
4630 4631 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
4631 4632
4632 4633 2004-04-03 Fernando Perez <fperez@colorado.edu>
4633 4634
4634 4635 * IPython/genutils.py (Term): Standardized the names of the Term
4635 4636 class streams to cin/cout/cerr, following C++ naming conventions
4636 4637 (I can't use in/out/err because 'in' is not a valid attribute
4637 4638 name).
4638 4639
4639 4640 * IPython/iplib.py (InteractiveShell.interact): don't increment
4640 4641 the prompt if there's no user input. By Daniel 'Dang' Griffith
4641 4642 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
4642 4643 Francois Pinard.
4643 4644
4644 4645 2004-04-02 Fernando Perez <fperez@colorado.edu>
4645 4646
4646 4647 * IPython/genutils.py (Stream.__init__): Modified to survive at
4647 4648 least importing in contexts where stdin/out/err aren't true file
4648 4649 objects, such as PyCrust (they lack fileno() and mode). However,
4649 4650 the recovery facilities which rely on these things existing will
4650 4651 not work.
4651 4652
4652 4653 2004-04-01 Fernando Perez <fperez@colorado.edu>
4653 4654
4654 4655 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
4655 4656 use the new getoutputerror() function, so it properly
4656 4657 distinguishes stdout/err.
4657 4658
4658 4659 * IPython/genutils.py (getoutputerror): added a function to
4659 4660 capture separately the standard output and error of a command.
4660 4661 After a comment from dang on the mailing lists. This code is
4661 4662 basically a modified version of commands.getstatusoutput(), from
4662 4663 the standard library.
4663 4664
4664 4665 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
4665 4666 '!!' as a special syntax (shorthand) to access @sx.
4666 4667
4667 4668 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
4668 4669 command and return its output as a list split on '\n'.
4669 4670
4670 4671 2004-03-31 Fernando Perez <fperez@colorado.edu>
4671 4672
4672 4673 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
4673 4674 method to dictionaries used as FakeModule instances if they lack
4674 4675 it. At least pydoc in python2.3 breaks for runtime-defined
4675 4676 functions without this hack. At some point I need to _really_
4676 4677 understand what FakeModule is doing, because it's a gross hack.
4677 4678 But it solves Arnd's problem for now...
4678 4679
4679 4680 2004-02-27 Fernando Perez <fperez@colorado.edu>
4680 4681
4681 4682 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
4682 4683 mode would behave erratically. Also increased the number of
4683 4684 possible logs in rotate mod to 999. Thanks to Rod Holland
4684 4685 <rhh@StructureLABS.com> for the report and fixes.
4685 4686
4686 4687 2004-02-26 Fernando Perez <fperez@colorado.edu>
4687 4688
4688 4689 * IPython/genutils.py (page): Check that the curses module really
4689 4690 has the initscr attribute before trying to use it. For some
4690 4691 reason, the Solaris curses module is missing this. I think this
4691 4692 should be considered a Solaris python bug, but I'm not sure.
4692 4693
4693 4694 2004-01-17 Fernando Perez <fperez@colorado.edu>
4694 4695
4695 4696 * IPython/genutils.py (Stream.__init__): Changes to try to make
4696 4697 ipython robust against stdin/out/err being closed by the user.
4697 4698 This is 'user error' (and blocks a normal python session, at least
4698 4699 the stdout case). However, Ipython should be able to survive such
4699 4700 instances of abuse as gracefully as possible. To simplify the
4700 4701 coding and maintain compatibility with Gary Bishop's Term
4701 4702 contributions, I've made use of classmethods for this. I think
4702 4703 this introduces a dependency on python 2.2.
4703 4704
4704 4705 2004-01-13 Fernando Perez <fperez@colorado.edu>
4705 4706
4706 4707 * IPython/numutils.py (exp_safe): simplified the code a bit and
4707 4708 removed the need for importing the kinds module altogether.
4708 4709
4709 4710 2004-01-06 Fernando Perez <fperez@colorado.edu>
4710 4711
4711 4712 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
4712 4713 a magic function instead, after some community feedback. No
4713 4714 special syntax will exist for it, but its name is deliberately
4714 4715 very short.
4715 4716
4716 4717 2003-12-20 Fernando Perez <fperez@colorado.edu>
4717 4718
4718 4719 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
4719 4720 new functionality, to automagically assign the result of a shell
4720 4721 command to a variable. I'll solicit some community feedback on
4721 4722 this before making it permanent.
4722 4723
4723 4724 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
4724 4725 requested about callables for which inspect couldn't obtain a
4725 4726 proper argspec. Thanks to a crash report sent by Etienne
4726 4727 Posthumus <etienne-AT-apple01.cs.vu.nl>.
4727 4728
4728 4729 2003-12-09 Fernando Perez <fperez@colorado.edu>
4729 4730
4730 4731 * IPython/genutils.py (page): patch for the pager to work across
4731 4732 various versions of Windows. By Gary Bishop.
4732 4733
4733 4734 2003-12-04 Fernando Perez <fperez@colorado.edu>
4734 4735
4735 4736 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
4736 4737 Gnuplot.py version 1.7, whose internal names changed quite a bit.
4737 4738 While I tested this and it looks ok, there may still be corner
4738 4739 cases I've missed.
4739 4740
4740 4741 2003-12-01 Fernando Perez <fperez@colorado.edu>
4741 4742
4742 4743 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
4743 4744 where a line like 'p,q=1,2' would fail because the automagic
4744 4745 system would be triggered for @p.
4745 4746
4746 4747 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
4747 4748 cleanups, code unmodified.
4748 4749
4749 4750 * IPython/genutils.py (Term): added a class for IPython to handle
4750 4751 output. In most cases it will just be a proxy for stdout/err, but
4751 4752 having this allows modifications to be made for some platforms,
4752 4753 such as handling color escapes under Windows. All of this code
4753 4754 was contributed by Gary Bishop, with minor modifications by me.
4754 4755 The actual changes affect many files.
4755 4756
4756 4757 2003-11-30 Fernando Perez <fperez@colorado.edu>
4757 4758
4758 4759 * IPython/iplib.py (file_matches): new completion code, courtesy
4759 4760 of Jeff Collins. This enables filename completion again under
4760 4761 python 2.3, which disabled it at the C level.
4761 4762
4762 4763 2003-11-11 Fernando Perez <fperez@colorado.edu>
4763 4764
4764 4765 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
4765 4766 for Numeric.array(map(...)), but often convenient.
4766 4767
4767 4768 2003-11-05 Fernando Perez <fperez@colorado.edu>
4768 4769
4769 4770 * IPython/numutils.py (frange): Changed a call from int() to
4770 4771 int(round()) to prevent a problem reported with arange() in the
4771 4772 numpy list.
4772 4773
4773 4774 2003-10-06 Fernando Perez <fperez@colorado.edu>
4774 4775
4775 4776 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
4776 4777 prevent crashes if sys lacks an argv attribute (it happens with
4777 4778 embedded interpreters which build a bare-bones sys module).
4778 4779 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
4779 4780
4780 4781 2003-09-24 Fernando Perez <fperez@colorado.edu>
4781 4782
4782 4783 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
4783 4784 to protect against poorly written user objects where __getattr__
4784 4785 raises exceptions other than AttributeError. Thanks to a bug
4785 4786 report by Oliver Sander <osander-AT-gmx.de>.
4786 4787
4787 4788 * IPython/FakeModule.py (FakeModule.__repr__): this method was
4788 4789 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
4789 4790
4790 4791 2003-09-09 Fernando Perez <fperez@colorado.edu>
4791 4792
4792 4793 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4793 4794 unpacking a list whith a callable as first element would
4794 4795 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
4795 4796 Collins.
4796 4797
4797 4798 2003-08-25 *** Released version 0.5.0
4798 4799
4799 4800 2003-08-22 Fernando Perez <fperez@colorado.edu>
4800 4801
4801 4802 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
4802 4803 improperly defined user exceptions. Thanks to feedback from Mark
4803 4804 Russell <mrussell-AT-verio.net>.
4804 4805
4805 4806 2003-08-20 Fernando Perez <fperez@colorado.edu>
4806 4807
4807 4808 * IPython/OInspect.py (Inspector.pinfo): changed String Form
4808 4809 printing so that it would print multi-line string forms starting
4809 4810 with a new line. This way the formatting is better respected for
4810 4811 objects which work hard to make nice string forms.
4811 4812
4812 4813 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
4813 4814 autocall would overtake data access for objects with both
4814 4815 __getitem__ and __call__.
4815 4816
4816 4817 2003-08-19 *** Released version 0.5.0-rc1
4817 4818
4818 4819 2003-08-19 Fernando Perez <fperez@colorado.edu>
4819 4820
4820 4821 * IPython/deep_reload.py (load_tail): single tiny change here
4821 4822 seems to fix the long-standing bug of dreload() failing to work
4822 4823 for dotted names. But this module is pretty tricky, so I may have
4823 4824 missed some subtlety. Needs more testing!.
4824 4825
4825 4826 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
4826 4827 exceptions which have badly implemented __str__ methods.
4827 4828 (VerboseTB.text): harden against inspect.getinnerframes crashing,
4828 4829 which I've been getting reports about from Python 2.3 users. I
4829 4830 wish I had a simple test case to reproduce the problem, so I could
4830 4831 either write a cleaner workaround or file a bug report if
4831 4832 necessary.
4832 4833
4833 4834 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
4834 4835 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
4835 4836 a bug report by Tjabo Kloppenburg.
4836 4837
4837 4838 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
4838 4839 crashes. Wrapped the pdb call in a blanket try/except, since pdb
4839 4840 seems rather unstable. Thanks to a bug report by Tjabo
4840 4841 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
4841 4842
4842 4843 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
4843 4844 this out soon because of the critical fixes in the inner loop for
4844 4845 generators.
4845 4846
4846 4847 * IPython/Magic.py (Magic.getargspec): removed. This (and
4847 4848 _get_def) have been obsoleted by OInspect for a long time, I
4848 4849 hadn't noticed that they were dead code.
4849 4850 (Magic._ofind): restored _ofind functionality for a few literals
4850 4851 (those in ["''",'""','[]','{}','()']). But it won't work anymore
4851 4852 for things like "hello".capitalize?, since that would require a
4852 4853 potentially dangerous eval() again.
4853 4854
4854 4855 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
4855 4856 logic a bit more to clean up the escapes handling and minimize the
4856 4857 use of _ofind to only necessary cases. The interactive 'feel' of
4857 4858 IPython should have improved quite a bit with the changes in
4858 4859 _prefilter and _ofind (besides being far safer than before).
4859 4860
4860 4861 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
4861 4862 obscure, never reported). Edit would fail to find the object to
4862 4863 edit under some circumstances.
4863 4864 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
4864 4865 which were causing double-calling of generators. Those eval calls
4865 4866 were _very_ dangerous, since code with side effects could be
4866 4867 triggered. As they say, 'eval is evil'... These were the
4867 4868 nastiest evals in IPython. Besides, _ofind is now far simpler,
4868 4869 and it should also be quite a bit faster. Its use of inspect is
4869 4870 also safer, so perhaps some of the inspect-related crashes I've
4870 4871 seen lately with Python 2.3 might be taken care of. That will
4871 4872 need more testing.
4872 4873
4873 4874 2003-08-17 Fernando Perez <fperez@colorado.edu>
4874 4875
4875 4876 * IPython/iplib.py (InteractiveShell._prefilter): significant
4876 4877 simplifications to the logic for handling user escapes. Faster
4877 4878 and simpler code.
4878 4879
4879 4880 2003-08-14 Fernando Perez <fperez@colorado.edu>
4880 4881
4881 4882 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
4882 4883 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
4883 4884 but it should be quite a bit faster. And the recursive version
4884 4885 generated O(log N) intermediate storage for all rank>1 arrays,
4885 4886 even if they were contiguous.
4886 4887 (l1norm): Added this function.
4887 4888 (norm): Added this function for arbitrary norms (including
4888 4889 l-infinity). l1 and l2 are still special cases for convenience
4889 4890 and speed.
4890 4891
4891 4892 2003-08-03 Fernando Perez <fperez@colorado.edu>
4892 4893
4893 4894 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
4894 4895 exceptions, which now raise PendingDeprecationWarnings in Python
4895 4896 2.3. There were some in Magic and some in Gnuplot2.
4896 4897
4897 4898 2003-06-30 Fernando Perez <fperez@colorado.edu>
4898 4899
4899 4900 * IPython/genutils.py (page): modified to call curses only for
4900 4901 terminals where TERM=='xterm'. After problems under many other
4901 4902 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
4902 4903
4903 4904 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
4904 4905 would be triggered when readline was absent. This was just an old
4905 4906 debugging statement I'd forgotten to take out.
4906 4907
4907 4908 2003-06-20 Fernando Perez <fperez@colorado.edu>
4908 4909
4909 4910 * IPython/genutils.py (clock): modified to return only user time
4910 4911 (not counting system time), after a discussion on scipy. While
4911 4912 system time may be a useful quantity occasionally, it may much
4912 4913 more easily be skewed by occasional swapping or other similar
4913 4914 activity.
4914 4915
4915 4916 2003-06-05 Fernando Perez <fperez@colorado.edu>
4916 4917
4917 4918 * IPython/numutils.py (identity): new function, for building
4918 4919 arbitrary rank Kronecker deltas (mostly backwards compatible with
4919 4920 Numeric.identity)
4920 4921
4921 4922 2003-06-03 Fernando Perez <fperez@colorado.edu>
4922 4923
4923 4924 * IPython/iplib.py (InteractiveShell.handle_magic): protect
4924 4925 arguments passed to magics with spaces, to allow trailing '\' to
4925 4926 work normally (mainly for Windows users).
4926 4927
4927 4928 2003-05-29 Fernando Perez <fperez@colorado.edu>
4928 4929
4929 4930 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
4930 4931 instead of pydoc.help. This fixes a bizarre behavior where
4931 4932 printing '%s' % locals() would trigger the help system. Now
4932 4933 ipython behaves like normal python does.
4933 4934
4934 4935 Note that if one does 'from pydoc import help', the bizarre
4935 4936 behavior returns, but this will also happen in normal python, so
4936 4937 it's not an ipython bug anymore (it has to do with how pydoc.help
4937 4938 is implemented).
4938 4939
4939 4940 2003-05-22 Fernando Perez <fperez@colorado.edu>
4940 4941
4941 4942 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
4942 4943 return [] instead of None when nothing matches, also match to end
4943 4944 of line. Patch by Gary Bishop.
4944 4945
4945 4946 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
4946 4947 protection as before, for files passed on the command line. This
4947 4948 prevents the CrashHandler from kicking in if user files call into
4948 4949 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
4949 4950 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
4950 4951
4951 4952 2003-05-20 *** Released version 0.4.0
4952 4953
4953 4954 2003-05-20 Fernando Perez <fperez@colorado.edu>
4954 4955
4955 4956 * setup.py: added support for manpages. It's a bit hackish b/c of
4956 4957 a bug in the way the bdist_rpm distutils target handles gzipped
4957 4958 manpages, but it works. After a patch by Jack.
4958 4959
4959 4960 2003-05-19 Fernando Perez <fperez@colorado.edu>
4960 4961
4961 4962 * IPython/numutils.py: added a mockup of the kinds module, since
4962 4963 it was recently removed from Numeric. This way, numutils will
4963 4964 work for all users even if they are missing kinds.
4964 4965
4965 4966 * IPython/Magic.py (Magic._ofind): Harden against an inspect
4966 4967 failure, which can occur with SWIG-wrapped extensions. After a
4967 4968 crash report from Prabhu.
4968 4969
4969 4970 2003-05-16 Fernando Perez <fperez@colorado.edu>
4970 4971
4971 4972 * IPython/iplib.py (InteractiveShell.excepthook): New method to
4972 4973 protect ipython from user code which may call directly
4973 4974 sys.excepthook (this looks like an ipython crash to the user, even
4974 4975 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4975 4976 This is especially important to help users of WxWindows, but may
4976 4977 also be useful in other cases.
4977 4978
4978 4979 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
4979 4980 an optional tb_offset to be specified, and to preserve exception
4980 4981 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4981 4982
4982 4983 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
4983 4984
4984 4985 2003-05-15 Fernando Perez <fperez@colorado.edu>
4985 4986
4986 4987 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
4987 4988 installing for a new user under Windows.
4988 4989
4989 4990 2003-05-12 Fernando Perez <fperez@colorado.edu>
4990 4991
4991 4992 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
4992 4993 handler for Emacs comint-based lines. Currently it doesn't do
4993 4994 much (but importantly, it doesn't update the history cache). In
4994 4995 the future it may be expanded if Alex needs more functionality
4995 4996 there.
4996 4997
4997 4998 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
4998 4999 info to crash reports.
4999 5000
5000 5001 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
5001 5002 just like Python's -c. Also fixed crash with invalid -color
5002 5003 option value at startup. Thanks to Will French
5003 5004 <wfrench-AT-bestweb.net> for the bug report.
5004 5005
5005 5006 2003-05-09 Fernando Perez <fperez@colorado.edu>
5006 5007
5007 5008 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
5008 5009 to EvalDict (it's a mapping, after all) and simplified its code
5009 5010 quite a bit, after a nice discussion on c.l.py where Gustavo
5010 5011 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
5011 5012
5012 5013 2003-04-30 Fernando Perez <fperez@colorado.edu>
5013 5014
5014 5015 * IPython/genutils.py (timings_out): modified it to reduce its
5015 5016 overhead in the common reps==1 case.
5016 5017
5017 5018 2003-04-29 Fernando Perez <fperez@colorado.edu>
5018 5019
5019 5020 * IPython/genutils.py (timings_out): Modified to use the resource
5020 5021 module, which avoids the wraparound problems of time.clock().
5021 5022
5022 5023 2003-04-17 *** Released version 0.2.15pre4
5023 5024
5024 5025 2003-04-17 Fernando Perez <fperez@colorado.edu>
5025 5026
5026 5027 * setup.py (scriptfiles): Split windows-specific stuff over to a
5027 5028 separate file, in an attempt to have a Windows GUI installer.
5028 5029 That didn't work, but part of the groundwork is done.
5029 5030
5030 5031 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
5031 5032 indent/unindent with 4 spaces. Particularly useful in combination
5032 5033 with the new auto-indent option.
5033 5034
5034 5035 2003-04-16 Fernando Perez <fperez@colorado.edu>
5035 5036
5036 5037 * IPython/Magic.py: various replacements of self.rc for
5037 5038 self.shell.rc. A lot more remains to be done to fully disentangle
5038 5039 this class from the main Shell class.
5039 5040
5040 5041 * IPython/GnuplotRuntime.py: added checks for mouse support so
5041 5042 that we don't try to enable it if the current gnuplot doesn't
5042 5043 really support it. Also added checks so that we don't try to
5043 5044 enable persist under Windows (where Gnuplot doesn't recognize the
5044 5045 option).
5045 5046
5046 5047 * IPython/iplib.py (InteractiveShell.interact): Added optional
5047 5048 auto-indenting code, after a patch by King C. Shu
5048 5049 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
5049 5050 get along well with pasting indented code. If I ever figure out
5050 5051 how to make that part go well, it will become on by default.
5051 5052
5052 5053 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
5053 5054 crash ipython if there was an unmatched '%' in the user's prompt
5054 5055 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5055 5056
5056 5057 * IPython/iplib.py (InteractiveShell.interact): removed the
5057 5058 ability to ask the user whether he wants to crash or not at the
5058 5059 'last line' exception handler. Calling functions at that point
5059 5060 changes the stack, and the error reports would have incorrect
5060 5061 tracebacks.
5061 5062
5062 5063 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
5063 5064 pass through a peger a pretty-printed form of any object. After a
5064 5065 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
5065 5066
5066 5067 2003-04-14 Fernando Perez <fperez@colorado.edu>
5067 5068
5068 5069 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
5069 5070 all files in ~ would be modified at first install (instead of
5070 5071 ~/.ipython). This could be potentially disastrous, as the
5071 5072 modification (make line-endings native) could damage binary files.
5072 5073
5073 5074 2003-04-10 Fernando Perez <fperez@colorado.edu>
5074 5075
5075 5076 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
5076 5077 handle only lines which are invalid python. This now means that
5077 5078 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
5078 5079 for the bug report.
5079 5080
5080 5081 2003-04-01 Fernando Perez <fperez@colorado.edu>
5081 5082
5082 5083 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
5083 5084 where failing to set sys.last_traceback would crash pdb.pm().
5084 5085 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
5085 5086 report.
5086 5087
5087 5088 2003-03-25 Fernando Perez <fperez@colorado.edu>
5088 5089
5089 5090 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
5090 5091 before printing it (it had a lot of spurious blank lines at the
5091 5092 end).
5092 5093
5093 5094 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
5094 5095 output would be sent 21 times! Obviously people don't use this
5095 5096 too often, or I would have heard about it.
5096 5097
5097 5098 2003-03-24 Fernando Perez <fperez@colorado.edu>
5098 5099
5099 5100 * setup.py (scriptfiles): renamed the data_files parameter from
5100 5101 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
5101 5102 for the patch.
5102 5103
5103 5104 2003-03-20 Fernando Perez <fperez@colorado.edu>
5104 5105
5105 5106 * IPython/genutils.py (error): added error() and fatal()
5106 5107 functions.
5107 5108
5108 5109 2003-03-18 *** Released version 0.2.15pre3
5109 5110
5110 5111 2003-03-18 Fernando Perez <fperez@colorado.edu>
5111 5112
5112 5113 * setupext/install_data_ext.py
5113 5114 (install_data_ext.initialize_options): Class contributed by Jack
5114 5115 Moffit for fixing the old distutils hack. He is sending this to
5115 5116 the distutils folks so in the future we may not need it as a
5116 5117 private fix.
5117 5118
5118 5119 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
5119 5120 changes for Debian packaging. See his patch for full details.
5120 5121 The old distutils hack of making the ipythonrc* files carry a
5121 5122 bogus .py extension is gone, at last. Examples were moved to a
5122 5123 separate subdir under doc/, and the separate executable scripts
5123 5124 now live in their own directory. Overall a great cleanup. The
5124 5125 manual was updated to use the new files, and setup.py has been
5125 5126 fixed for this setup.
5126 5127
5127 5128 * IPython/PyColorize.py (Parser.usage): made non-executable and
5128 5129 created a pycolor wrapper around it to be included as a script.
5129 5130
5130 5131 2003-03-12 *** Released version 0.2.15pre2
5131 5132
5132 5133 2003-03-12 Fernando Perez <fperez@colorado.edu>
5133 5134
5134 5135 * IPython/ColorANSI.py (make_color_table): Finally fixed the
5135 5136 long-standing problem with garbage characters in some terminals.
5136 5137 The issue was really that the \001 and \002 escapes must _only_ be
5137 5138 passed to input prompts (which call readline), but _never_ to
5138 5139 normal text to be printed on screen. I changed ColorANSI to have
5139 5140 two classes: TermColors and InputTermColors, each with the
5140 5141 appropriate escapes for input prompts or normal text. The code in
5141 5142 Prompts.py got slightly more complicated, but this very old and
5142 5143 annoying bug is finally fixed.
5143 5144
5144 5145 All the credit for nailing down the real origin of this problem
5145 5146 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
5146 5147 *Many* thanks to him for spending quite a bit of effort on this.
5147 5148
5148 5149 2003-03-05 *** Released version 0.2.15pre1
5149 5150
5150 5151 2003-03-03 Fernando Perez <fperez@colorado.edu>
5151 5152
5152 5153 * IPython/FakeModule.py: Moved the former _FakeModule to a
5153 5154 separate file, because it's also needed by Magic (to fix a similar
5154 5155 pickle-related issue in @run).
5155 5156
5156 5157 2003-03-02 Fernando Perez <fperez@colorado.edu>
5157 5158
5158 5159 * IPython/Magic.py (Magic.magic_autocall): new magic to control
5159 5160 the autocall option at runtime.
5160 5161 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
5161 5162 across Magic.py to start separating Magic from InteractiveShell.
5162 5163 (Magic._ofind): Fixed to return proper namespace for dotted
5163 5164 names. Before, a dotted name would always return 'not currently
5164 5165 defined', because it would find the 'parent'. s.x would be found,
5165 5166 but since 'x' isn't defined by itself, it would get confused.
5166 5167 (Magic.magic_run): Fixed pickling problems reported by Ralf
5167 5168 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
5168 5169 that I'd used when Mike Heeter reported similar issues at the
5169 5170 top-level, but now for @run. It boils down to injecting the
5170 5171 namespace where code is being executed with something that looks
5171 5172 enough like a module to fool pickle.dump(). Since a pickle stores
5172 5173 a named reference to the importing module, we need this for
5173 5174 pickles to save something sensible.
5174 5175
5175 5176 * IPython/ipmaker.py (make_IPython): added an autocall option.
5176 5177
5177 5178 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
5178 5179 the auto-eval code. Now autocalling is an option, and the code is
5179 5180 also vastly safer. There is no more eval() involved at all.
5180 5181
5181 5182 2003-03-01 Fernando Perez <fperez@colorado.edu>
5182 5183
5183 5184 * IPython/Magic.py (Magic._ofind): Changed interface to return a
5184 5185 dict with named keys instead of a tuple.
5185 5186
5186 5187 * IPython: Started using CVS for IPython as of 0.2.15pre1.
5187 5188
5188 5189 * setup.py (make_shortcut): Fixed message about directories
5189 5190 created during Windows installation (the directories were ok, just
5190 5191 the printed message was misleading). Thanks to Chris Liechti
5191 5192 <cliechti-AT-gmx.net> for the heads up.
5192 5193
5193 5194 2003-02-21 Fernando Perez <fperez@colorado.edu>
5194 5195
5195 5196 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
5196 5197 of ValueError exception when checking for auto-execution. This
5197 5198 one is raised by things like Numeric arrays arr.flat when the
5198 5199 array is non-contiguous.
5199 5200
5200 5201 2003-01-31 Fernando Perez <fperez@colorado.edu>
5201 5202
5202 5203 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
5203 5204 not return any value at all (even though the command would get
5204 5205 executed).
5205 5206 (xsys): Flush stdout right after printing the command to ensure
5206 5207 proper ordering of commands and command output in the total
5207 5208 output.
5208 5209 (SystemExec/xsys/bq): Switched the names of xsys/bq and
5209 5210 system/getoutput as defaults. The old ones are kept for
5210 5211 compatibility reasons, so no code which uses this library needs
5211 5212 changing.
5212 5213
5213 5214 2003-01-27 *** Released version 0.2.14
5214 5215
5215 5216 2003-01-25 Fernando Perez <fperez@colorado.edu>
5216 5217
5217 5218 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
5218 5219 functions defined in previous edit sessions could not be re-edited
5219 5220 (because the temp files were immediately removed). Now temp files
5220 5221 are removed only at IPython's exit.
5221 5222 (Magic.magic_run): Improved @run to perform shell-like expansions
5222 5223 on its arguments (~users and $VARS). With this, @run becomes more
5223 5224 like a normal command-line.
5224 5225
5225 5226 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
5226 5227 bugs related to embedding and cleaned up that code. A fairly
5227 5228 important one was the impossibility to access the global namespace
5228 5229 through the embedded IPython (only local variables were visible).
5229 5230
5230 5231 2003-01-14 Fernando Perez <fperez@colorado.edu>
5231 5232
5232 5233 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
5233 5234 auto-calling to be a bit more conservative. Now it doesn't get
5234 5235 triggered if any of '!=()<>' are in the rest of the input line, to
5235 5236 allow comparing callables. Thanks to Alex for the heads up.
5236 5237
5237 5238 2003-01-07 Fernando Perez <fperez@colorado.edu>
5238 5239
5239 5240 * IPython/genutils.py (page): fixed estimation of the number of
5240 5241 lines in a string to be paged to simply count newlines. This
5241 5242 prevents over-guessing due to embedded escape sequences. A better
5242 5243 long-term solution would involve stripping out the control chars
5243 5244 for the count, but it's potentially so expensive I just don't
5244 5245 think it's worth doing.
5245 5246
5246 5247 2002-12-19 *** Released version 0.2.14pre50
5247 5248
5248 5249 2002-12-19 Fernando Perez <fperez@colorado.edu>
5249 5250
5250 5251 * tools/release (version): Changed release scripts to inform
5251 5252 Andrea and build a NEWS file with a list of recent changes.
5252 5253
5253 5254 * IPython/ColorANSI.py (__all__): changed terminal detection
5254 5255 code. Seems to work better for xterms without breaking
5255 5256 konsole. Will need more testing to determine if WinXP and Mac OSX
5256 5257 also work ok.
5257 5258
5258 5259 2002-12-18 *** Released version 0.2.14pre49
5259 5260
5260 5261 2002-12-18 Fernando Perez <fperez@colorado.edu>
5261 5262
5262 5263 * Docs: added new info about Mac OSX, from Andrea.
5263 5264
5264 5265 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
5265 5266 allow direct plotting of python strings whose format is the same
5266 5267 of gnuplot data files.
5267 5268
5268 5269 2002-12-16 Fernando Perez <fperez@colorado.edu>
5269 5270
5270 5271 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
5271 5272 value of exit question to be acknowledged.
5272 5273
5273 5274 2002-12-03 Fernando Perez <fperez@colorado.edu>
5274 5275
5275 5276 * IPython/ipmaker.py: removed generators, which had been added
5276 5277 by mistake in an earlier debugging run. This was causing trouble
5277 5278 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
5278 5279 for pointing this out.
5279 5280
5280 5281 2002-11-17 Fernando Perez <fperez@colorado.edu>
5281 5282
5282 5283 * Manual: updated the Gnuplot section.
5283 5284
5284 5285 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
5285 5286 a much better split of what goes in Runtime and what goes in
5286 5287 Interactive.
5287 5288
5288 5289 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
5289 5290 being imported from iplib.
5290 5291
5291 5292 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
5292 5293 for command-passing. Now the global Gnuplot instance is called
5293 5294 'gp' instead of 'g', which was really a far too fragile and
5294 5295 common name.
5295 5296
5296 5297 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
5297 5298 bounding boxes generated by Gnuplot for square plots.
5298 5299
5299 5300 * IPython/genutils.py (popkey): new function added. I should
5300 5301 suggest this on c.l.py as a dict method, it seems useful.
5301 5302
5302 5303 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
5303 5304 to transparently handle PostScript generation. MUCH better than
5304 5305 the previous plot_eps/replot_eps (which I removed now). The code
5305 5306 is also fairly clean and well documented now (including
5306 5307 docstrings).
5307 5308
5308 5309 2002-11-13 Fernando Perez <fperez@colorado.edu>
5309 5310
5310 5311 * IPython/Magic.py (Magic.magic_edit): fixed docstring
5311 5312 (inconsistent with options).
5312 5313
5313 5314 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
5314 5315 manually disabled, I don't know why. Fixed it.
5315 5316 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
5316 5317 eps output.
5317 5318
5318 5319 2002-11-12 Fernando Perez <fperez@colorado.edu>
5319 5320
5320 5321 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
5321 5322 don't propagate up to caller. Fixes crash reported by François
5322 5323 Pinard.
5323 5324
5324 5325 2002-11-09 Fernando Perez <fperez@colorado.edu>
5325 5326
5326 5327 * IPython/ipmaker.py (make_IPython): fixed problem with writing
5327 5328 history file for new users.
5328 5329 (make_IPython): fixed bug where initial install would leave the
5329 5330 user running in the .ipython dir.
5330 5331 (make_IPython): fixed bug where config dir .ipython would be
5331 5332 created regardless of the given -ipythondir option. Thanks to Cory
5332 5333 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
5333 5334
5334 5335 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
5335 5336 type confirmations. Will need to use it in all of IPython's code
5336 5337 consistently.
5337 5338
5338 5339 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
5339 5340 context to print 31 lines instead of the default 5. This will make
5340 5341 the crash reports extremely detailed in case the problem is in
5341 5342 libraries I don't have access to.
5342 5343
5343 5344 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
5344 5345 line of defense' code to still crash, but giving users fair
5345 5346 warning. I don't want internal errors to go unreported: if there's
5346 5347 an internal problem, IPython should crash and generate a full
5347 5348 report.
5348 5349
5349 5350 2002-11-08 Fernando Perez <fperez@colorado.edu>
5350 5351
5351 5352 * IPython/iplib.py (InteractiveShell.interact): added code to trap
5352 5353 otherwise uncaught exceptions which can appear if people set
5353 5354 sys.stdout to something badly broken. Thanks to a crash report
5354 5355 from henni-AT-mail.brainbot.com.
5355 5356
5356 5357 2002-11-04 Fernando Perez <fperez@colorado.edu>
5357 5358
5358 5359 * IPython/iplib.py (InteractiveShell.interact): added
5359 5360 __IPYTHON__active to the builtins. It's a flag which goes on when
5360 5361 the interaction starts and goes off again when it stops. This
5361 5362 allows embedding code to detect being inside IPython. Before this
5362 5363 was done via __IPYTHON__, but that only shows that an IPython
5363 5364 instance has been created.
5364 5365
5365 5366 * IPython/Magic.py (Magic.magic_env): I realized that in a
5366 5367 UserDict, instance.data holds the data as a normal dict. So I
5367 5368 modified @env to return os.environ.data instead of rebuilding a
5368 5369 dict by hand.
5369 5370
5370 5371 2002-11-02 Fernando Perez <fperez@colorado.edu>
5371 5372
5372 5373 * IPython/genutils.py (warn): changed so that level 1 prints no
5373 5374 header. Level 2 is now the default (with 'WARNING' header, as
5374 5375 before). I think I tracked all places where changes were needed in
5375 5376 IPython, but outside code using the old level numbering may have
5376 5377 broken.
5377 5378
5378 5379 * IPython/iplib.py (InteractiveShell.runcode): added this to
5379 5380 handle the tracebacks in SystemExit traps correctly. The previous
5380 5381 code (through interact) was printing more of the stack than
5381 5382 necessary, showing IPython internal code to the user.
5382 5383
5383 5384 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
5384 5385 default. Now that the default at the confirmation prompt is yes,
5385 5386 it's not so intrusive. François' argument that ipython sessions
5386 5387 tend to be complex enough not to lose them from an accidental C-d,
5387 5388 is a valid one.
5388 5389
5389 5390 * IPython/iplib.py (InteractiveShell.interact): added a
5390 5391 showtraceback() call to the SystemExit trap, and modified the exit
5391 5392 confirmation to have yes as the default.
5392 5393
5393 5394 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
5394 5395 this file. It's been gone from the code for a long time, this was
5395 5396 simply leftover junk.
5396 5397
5397 5398 2002-11-01 Fernando Perez <fperez@colorado.edu>
5398 5399
5399 5400 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
5400 5401 added. If set, IPython now traps EOF and asks for
5401 5402 confirmation. After a request by François Pinard.
5402 5403
5403 5404 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
5404 5405 of @abort, and with a new (better) mechanism for handling the
5405 5406 exceptions.
5406 5407
5407 5408 2002-10-27 Fernando Perez <fperez@colorado.edu>
5408 5409
5409 5410 * IPython/usage.py (__doc__): updated the --help information and
5410 5411 the ipythonrc file to indicate that -log generates
5411 5412 ./ipython.log. Also fixed the corresponding info in @logstart.
5412 5413 This and several other fixes in the manuals thanks to reports by
5413 5414 François Pinard <pinard-AT-iro.umontreal.ca>.
5414 5415
5415 5416 * IPython/Logger.py (Logger.switch_log): Fixed error message to
5416 5417 refer to @logstart (instead of @log, which doesn't exist).
5417 5418
5418 5419 * IPython/iplib.py (InteractiveShell._prefilter): fixed
5419 5420 AttributeError crash. Thanks to Christopher Armstrong
5420 5421 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
5421 5422 introduced recently (in 0.2.14pre37) with the fix to the eval
5422 5423 problem mentioned below.
5423 5424
5424 5425 2002-10-17 Fernando Perez <fperez@colorado.edu>
5425 5426
5426 5427 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
5427 5428 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
5428 5429
5429 5430 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
5430 5431 this function to fix a problem reported by Alex Schmolck. He saw
5431 5432 it with list comprehensions and generators, which were getting
5432 5433 called twice. The real problem was an 'eval' call in testing for
5433 5434 automagic which was evaluating the input line silently.
5434 5435
5435 5436 This is a potentially very nasty bug, if the input has side
5436 5437 effects which must not be repeated. The code is much cleaner now,
5437 5438 without any blanket 'except' left and with a regexp test for
5438 5439 actual function names.
5439 5440
5440 5441 But an eval remains, which I'm not fully comfortable with. I just
5441 5442 don't know how to find out if an expression could be a callable in
5442 5443 the user's namespace without doing an eval on the string. However
5443 5444 that string is now much more strictly checked so that no code
5444 5445 slips by, so the eval should only happen for things that can
5445 5446 really be only function/method names.
5446 5447
5447 5448 2002-10-15 Fernando Perez <fperez@colorado.edu>
5448 5449
5449 5450 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
5450 5451 OSX information to main manual, removed README_Mac_OSX file from
5451 5452 distribution. Also updated credits for recent additions.
5452 5453
5453 5454 2002-10-10 Fernando Perez <fperez@colorado.edu>
5454 5455
5455 5456 * README_Mac_OSX: Added a README for Mac OSX users for fixing
5456 5457 terminal-related issues. Many thanks to Andrea Riciputi
5457 5458 <andrea.riciputi-AT-libero.it> for writing it.
5458 5459
5459 5460 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
5460 5461 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5461 5462
5462 5463 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
5463 5464 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
5464 5465 <syver-en-AT-online.no> who both submitted patches for this problem.
5465 5466
5466 5467 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
5467 5468 global embedding to make sure that things don't overwrite user
5468 5469 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
5469 5470
5470 5471 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
5471 5472 compatibility. Thanks to Hayden Callow
5472 5473 <h.callow-AT-elec.canterbury.ac.nz>
5473 5474
5474 5475 2002-10-04 Fernando Perez <fperez@colorado.edu>
5475 5476
5476 5477 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
5477 5478 Gnuplot.File objects.
5478 5479
5479 5480 2002-07-23 Fernando Perez <fperez@colorado.edu>
5480 5481
5481 5482 * IPython/genutils.py (timing): Added timings() and timing() for
5482 5483 quick access to the most commonly needed data, the execution
5483 5484 times. Old timing() renamed to timings_out().
5484 5485
5485 5486 2002-07-18 Fernando Perez <fperez@colorado.edu>
5486 5487
5487 5488 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
5488 5489 bug with nested instances disrupting the parent's tab completion.
5489 5490
5490 5491 * IPython/iplib.py (all_completions): Added Alex Schmolck's
5491 5492 all_completions code to begin the emacs integration.
5492 5493
5493 5494 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
5494 5495 argument to allow titling individual arrays when plotting.
5495 5496
5496 5497 2002-07-15 Fernando Perez <fperez@colorado.edu>
5497 5498
5498 5499 * setup.py (make_shortcut): changed to retrieve the value of
5499 5500 'Program Files' directory from the registry (this value changes in
5500 5501 non-english versions of Windows). Thanks to Thomas Fanslau
5501 5502 <tfanslau-AT-gmx.de> for the report.
5502 5503
5503 5504 2002-07-10 Fernando Perez <fperez@colorado.edu>
5504 5505
5505 5506 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
5506 5507 a bug in pdb, which crashes if a line with only whitespace is
5507 5508 entered. Bug report submitted to sourceforge.
5508 5509
5509 5510 2002-07-09 Fernando Perez <fperez@colorado.edu>
5510 5511
5511 5512 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
5512 5513 reporting exceptions (it's a bug in inspect.py, I just set a
5513 5514 workaround).
5514 5515
5515 5516 2002-07-08 Fernando Perez <fperez@colorado.edu>
5516 5517
5517 5518 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
5518 5519 __IPYTHON__ in __builtins__ to show up in user_ns.
5519 5520
5520 5521 2002-07-03 Fernando Perez <fperez@colorado.edu>
5521 5522
5522 5523 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
5523 5524 name from @gp_set_instance to @gp_set_default.
5524 5525
5525 5526 * IPython/ipmaker.py (make_IPython): default editor value set to
5526 5527 '0' (a string), to match the rc file. Otherwise will crash when
5527 5528 .strip() is called on it.
5528 5529
5529 5530
5530 5531 2002-06-28 Fernando Perez <fperez@colorado.edu>
5531 5532
5532 5533 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
5533 5534 of files in current directory when a file is executed via
5534 5535 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
5535 5536
5536 5537 * setup.py (manfiles): fix for rpm builds, submitted by RA
5537 5538 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
5538 5539
5539 5540 * IPython/ipmaker.py (make_IPython): fixed lookup of default
5540 5541 editor when set to '0'. Problem was, '0' evaluates to True (it's a
5541 5542 string!). A. Schmolck caught this one.
5542 5543
5543 5544 2002-06-27 Fernando Perez <fperez@colorado.edu>
5544 5545
5545 5546 * IPython/ipmaker.py (make_IPython): fixed bug when running user
5546 5547 defined files at the cmd line. __name__ wasn't being set to
5547 5548 __main__.
5548 5549
5549 5550 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
5550 5551 regular lists and tuples besides Numeric arrays.
5551 5552
5552 5553 * IPython/Prompts.py (CachedOutput.__call__): Added output
5553 5554 supression for input ending with ';'. Similar to Mathematica and
5554 5555 Matlab. The _* vars and Out[] list are still updated, just like
5555 5556 Mathematica behaves.
5556 5557
5557 5558 2002-06-25 Fernando Perez <fperez@colorado.edu>
5558 5559
5559 5560 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
5560 5561 .ini extensions for profiels under Windows.
5561 5562
5562 5563 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
5563 5564 string form. Fix contributed by Alexander Schmolck
5564 5565 <a.schmolck-AT-gmx.net>
5565 5566
5566 5567 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
5567 5568 pre-configured Gnuplot instance.
5568 5569
5569 5570 2002-06-21 Fernando Perez <fperez@colorado.edu>
5570 5571
5571 5572 * IPython/numutils.py (exp_safe): new function, works around the
5572 5573 underflow problems in Numeric.
5573 5574 (log2): New fn. Safe log in base 2: returns exact integer answer
5574 5575 for exact integer powers of 2.
5575 5576
5576 5577 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
5577 5578 properly.
5578 5579
5579 5580 2002-06-20 Fernando Perez <fperez@colorado.edu>
5580 5581
5581 5582 * IPython/genutils.py (timing): new function like
5582 5583 Mathematica's. Similar to time_test, but returns more info.
5583 5584
5584 5585 2002-06-18 Fernando Perez <fperez@colorado.edu>
5585 5586
5586 5587 * IPython/Magic.py (Magic.magic_save): modified @save and @r
5587 5588 according to Mike Heeter's suggestions.
5588 5589
5589 5590 2002-06-16 Fernando Perez <fperez@colorado.edu>
5590 5591
5591 5592 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
5592 5593 system. GnuplotMagic is gone as a user-directory option. New files
5593 5594 make it easier to use all the gnuplot stuff both from external
5594 5595 programs as well as from IPython. Had to rewrite part of
5595 5596 hardcopy() b/c of a strange bug: often the ps files simply don't
5596 5597 get created, and require a repeat of the command (often several
5597 5598 times).
5598 5599
5599 5600 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
5600 5601 resolve output channel at call time, so that if sys.stderr has
5601 5602 been redirected by user this gets honored.
5602 5603
5603 5604 2002-06-13 Fernando Perez <fperez@colorado.edu>
5604 5605
5605 5606 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
5606 5607 IPShell. Kept a copy with the old names to avoid breaking people's
5607 5608 embedded code.
5608 5609
5609 5610 * IPython/ipython: simplified it to the bare minimum after
5610 5611 Holger's suggestions. Added info about how to use it in
5611 5612 PYTHONSTARTUP.
5612 5613
5613 5614 * IPython/Shell.py (IPythonShell): changed the options passing
5614 5615 from a string with funky %s replacements to a straight list. Maybe
5615 5616 a bit more typing, but it follows sys.argv conventions, so there's
5616 5617 less special-casing to remember.
5617 5618
5618 5619 2002-06-12 Fernando Perez <fperez@colorado.edu>
5619 5620
5620 5621 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
5621 5622 command. Thanks to a suggestion by Mike Heeter.
5622 5623 (Magic.magic_pfile): added behavior to look at filenames if given
5623 5624 arg is not a defined object.
5624 5625 (Magic.magic_save): New @save function to save code snippets. Also
5625 5626 a Mike Heeter idea.
5626 5627
5627 5628 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
5628 5629 plot() and replot(). Much more convenient now, especially for
5629 5630 interactive use.
5630 5631
5631 5632 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
5632 5633 filenames.
5633 5634
5634 5635 2002-06-02 Fernando Perez <fperez@colorado.edu>
5635 5636
5636 5637 * IPython/Struct.py (Struct.__init__): modified to admit
5637 5638 initialization via another struct.
5638 5639
5639 5640 * IPython/genutils.py (SystemExec.__init__): New stateful
5640 5641 interface to xsys and bq. Useful for writing system scripts.
5641 5642
5642 5643 2002-05-30 Fernando Perez <fperez@colorado.edu>
5643 5644
5644 5645 * MANIFEST.in: Changed docfile selection to exclude all the lyx
5645 5646 documents. This will make the user download smaller (it's getting
5646 5647 too big).
5647 5648
5648 5649 2002-05-29 Fernando Perez <fperez@colorado.edu>
5649 5650
5650 5651 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
5651 5652 fix problems with shelve and pickle. Seems to work, but I don't
5652 5653 know if corner cases break it. Thanks to Mike Heeter
5653 5654 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
5654 5655
5655 5656 2002-05-24 Fernando Perez <fperez@colorado.edu>
5656 5657
5657 5658 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
5658 5659 macros having broken.
5659 5660
5660 5661 2002-05-21 Fernando Perez <fperez@colorado.edu>
5661 5662
5662 5663 * IPython/Magic.py (Magic.magic_logstart): fixed recently
5663 5664 introduced logging bug: all history before logging started was
5664 5665 being written one character per line! This came from the redesign
5665 5666 of the input history as a special list which slices to strings,
5666 5667 not to lists.
5667 5668
5668 5669 2002-05-20 Fernando Perez <fperez@colorado.edu>
5669 5670
5670 5671 * IPython/Prompts.py (CachedOutput.__init__): made the color table
5671 5672 be an attribute of all classes in this module. The design of these
5672 5673 classes needs some serious overhauling.
5673 5674
5674 5675 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
5675 5676 which was ignoring '_' in option names.
5676 5677
5677 5678 * IPython/ultraTB.py (FormattedTB.__init__): Changed
5678 5679 'Verbose_novars' to 'Context' and made it the new default. It's a
5679 5680 bit more readable and also safer than verbose.
5680 5681
5681 5682 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
5682 5683 triple-quoted strings.
5683 5684
5684 5685 * IPython/OInspect.py (__all__): new module exposing the object
5685 5686 introspection facilities. Now the corresponding magics are dummy
5686 5687 wrappers around this. Having this module will make it much easier
5687 5688 to put these functions into our modified pdb.
5688 5689 This new object inspector system uses the new colorizing module,
5689 5690 so source code and other things are nicely syntax highlighted.
5690 5691
5691 5692 2002-05-18 Fernando Perez <fperez@colorado.edu>
5692 5693
5693 5694 * IPython/ColorANSI.py: Split the coloring tools into a separate
5694 5695 module so I can use them in other code easier (they were part of
5695 5696 ultraTB).
5696 5697
5697 5698 2002-05-17 Fernando Perez <fperez@colorado.edu>
5698 5699
5699 5700 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5700 5701 fixed it to set the global 'g' also to the called instance, as
5701 5702 long as 'g' was still a gnuplot instance (so it doesn't overwrite
5702 5703 user's 'g' variables).
5703 5704
5704 5705 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
5705 5706 global variables (aliases to _ih,_oh) so that users which expect
5706 5707 In[5] or Out[7] to work aren't unpleasantly surprised.
5707 5708 (InputList.__getslice__): new class to allow executing slices of
5708 5709 input history directly. Very simple class, complements the use of
5709 5710 macros.
5710 5711
5711 5712 2002-05-16 Fernando Perez <fperez@colorado.edu>
5712 5713
5713 5714 * setup.py (docdirbase): make doc directory be just doc/IPython
5714 5715 without version numbers, it will reduce clutter for users.
5715 5716
5716 5717 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
5717 5718 execfile call to prevent possible memory leak. See for details:
5718 5719 http://mail.python.org/pipermail/python-list/2002-February/088476.html
5719 5720
5720 5721 2002-05-15 Fernando Perez <fperez@colorado.edu>
5721 5722
5722 5723 * IPython/Magic.py (Magic.magic_psource): made the object
5723 5724 introspection names be more standard: pdoc, pdef, pfile and
5724 5725 psource. They all print/page their output, and it makes
5725 5726 remembering them easier. Kept old names for compatibility as
5726 5727 aliases.
5727 5728
5728 5729 2002-05-14 Fernando Perez <fperez@colorado.edu>
5729 5730
5730 5731 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
5731 5732 what the mouse problem was. The trick is to use gnuplot with temp
5732 5733 files and NOT with pipes (for data communication), because having
5733 5734 both pipes and the mouse on is bad news.
5734 5735
5735 5736 2002-05-13 Fernando Perez <fperez@colorado.edu>
5736 5737
5737 5738 * IPython/Magic.py (Magic._ofind): fixed namespace order search
5738 5739 bug. Information would be reported about builtins even when
5739 5740 user-defined functions overrode them.
5740 5741
5741 5742 2002-05-11 Fernando Perez <fperez@colorado.edu>
5742 5743
5743 5744 * IPython/__init__.py (__all__): removed FlexCompleter from
5744 5745 __all__ so that things don't fail in platforms without readline.
5745 5746
5746 5747 2002-05-10 Fernando Perez <fperez@colorado.edu>
5747 5748
5748 5749 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
5749 5750 it requires Numeric, effectively making Numeric a dependency for
5750 5751 IPython.
5751 5752
5752 5753 * Released 0.2.13
5753 5754
5754 5755 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
5755 5756 profiler interface. Now all the major options from the profiler
5756 5757 module are directly supported in IPython, both for single
5757 5758 expressions (@prun) and for full programs (@run -p).
5758 5759
5759 5760 2002-05-09 Fernando Perez <fperez@colorado.edu>
5760 5761
5761 5762 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
5762 5763 magic properly formatted for screen.
5763 5764
5764 5765 * setup.py (make_shortcut): Changed things to put pdf version in
5765 5766 doc/ instead of doc/manual (had to change lyxport a bit).
5766 5767
5767 5768 * IPython/Magic.py (Profile.string_stats): made profile runs go
5768 5769 through pager (they are long and a pager allows searching, saving,
5769 5770 etc.)
5770 5771
5771 5772 2002-05-08 Fernando Perez <fperez@colorado.edu>
5772 5773
5773 5774 * Released 0.2.12
5774 5775
5775 5776 2002-05-06 Fernando Perez <fperez@colorado.edu>
5776 5777
5777 5778 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
5778 5779 introduced); 'hist n1 n2' was broken.
5779 5780 (Magic.magic_pdb): added optional on/off arguments to @pdb
5780 5781 (Magic.magic_run): added option -i to @run, which executes code in
5781 5782 the IPython namespace instead of a clean one. Also added @irun as
5782 5783 an alias to @run -i.
5783 5784
5784 5785 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5785 5786 fixed (it didn't really do anything, the namespaces were wrong).
5786 5787
5787 5788 * IPython/Debugger.py (__init__): Added workaround for python 2.1
5788 5789
5789 5790 * IPython/__init__.py (__all__): Fixed package namespace, now
5790 5791 'import IPython' does give access to IPython.<all> as
5791 5792 expected. Also renamed __release__ to Release.
5792 5793
5793 5794 * IPython/Debugger.py (__license__): created new Pdb class which
5794 5795 functions like a drop-in for the normal pdb.Pdb but does NOT
5795 5796 import readline by default. This way it doesn't muck up IPython's
5796 5797 readline handling, and now tab-completion finally works in the
5797 5798 debugger -- sort of. It completes things globally visible, but the
5798 5799 completer doesn't track the stack as pdb walks it. That's a bit
5799 5800 tricky, and I'll have to implement it later.
5800 5801
5801 5802 2002-05-05 Fernando Perez <fperez@colorado.edu>
5802 5803
5803 5804 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
5804 5805 magic docstrings when printed via ? (explicit \'s were being
5805 5806 printed).
5806 5807
5807 5808 * IPython/ipmaker.py (make_IPython): fixed namespace
5808 5809 identification bug. Now variables loaded via logs or command-line
5809 5810 files are recognized in the interactive namespace by @who.
5810 5811
5811 5812 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
5812 5813 log replay system stemming from the string form of Structs.
5813 5814
5814 5815 * IPython/Magic.py (Macro.__init__): improved macros to properly
5815 5816 handle magic commands in them.
5816 5817 (Magic.magic_logstart): usernames are now expanded so 'logstart
5817 5818 ~/mylog' now works.
5818 5819
5819 5820 * IPython/iplib.py (complete): fixed bug where paths starting with
5820 5821 '/' would be completed as magic names.
5821 5822
5822 5823 2002-05-04 Fernando Perez <fperez@colorado.edu>
5823 5824
5824 5825 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
5825 5826 allow running full programs under the profiler's control.
5826 5827
5827 5828 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
5828 5829 mode to report exceptions verbosely but without formatting
5829 5830 variables. This addresses the issue of ipython 'freezing' (it's
5830 5831 not frozen, but caught in an expensive formatting loop) when huge
5831 5832 variables are in the context of an exception.
5832 5833 (VerboseTB.text): Added '--->' markers at line where exception was
5833 5834 triggered. Much clearer to read, especially in NoColor modes.
5834 5835
5835 5836 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
5836 5837 implemented in reverse when changing to the new parse_options().
5837 5838
5838 5839 2002-05-03 Fernando Perez <fperez@colorado.edu>
5839 5840
5840 5841 * IPython/Magic.py (Magic.parse_options): new function so that
5841 5842 magics can parse options easier.
5842 5843 (Magic.magic_prun): new function similar to profile.run(),
5843 5844 suggested by Chris Hart.
5844 5845 (Magic.magic_cd): fixed behavior so that it only changes if
5845 5846 directory actually is in history.
5846 5847
5847 5848 * IPython/usage.py (__doc__): added information about potential
5848 5849 slowness of Verbose exception mode when there are huge data
5849 5850 structures to be formatted (thanks to Archie Paulson).
5850 5851
5851 5852 * IPython/ipmaker.py (make_IPython): Changed default logging
5852 5853 (when simply called with -log) to use curr_dir/ipython.log in
5853 5854 rotate mode. Fixed crash which was occuring with -log before
5854 5855 (thanks to Jim Boyle).
5855 5856
5856 5857 2002-05-01 Fernando Perez <fperez@colorado.edu>
5857 5858
5858 5859 * Released 0.2.11 for these fixes (mainly the ultraTB one which
5859 5860 was nasty -- though somewhat of a corner case).
5860 5861
5861 5862 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
5862 5863 text (was a bug).
5863 5864
5864 5865 2002-04-30 Fernando Perez <fperez@colorado.edu>
5865 5866
5866 5867 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
5867 5868 a print after ^D or ^C from the user so that the In[] prompt
5868 5869 doesn't over-run the gnuplot one.
5869 5870
5870 5871 2002-04-29 Fernando Perez <fperez@colorado.edu>
5871 5872
5872 5873 * Released 0.2.10
5873 5874
5874 5875 * IPython/__release__.py (version): get date dynamically.
5875 5876
5876 5877 * Misc. documentation updates thanks to Arnd's comments. Also ran
5877 5878 a full spellcheck on the manual (hadn't been done in a while).
5878 5879
5879 5880 2002-04-27 Fernando Perez <fperez@colorado.edu>
5880 5881
5881 5882 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
5882 5883 starting a log in mid-session would reset the input history list.
5883 5884
5884 5885 2002-04-26 Fernando Perez <fperez@colorado.edu>
5885 5886
5886 5887 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
5887 5888 all files were being included in an update. Now anything in
5888 5889 UserConfig that matches [A-Za-z]*.py will go (this excludes
5889 5890 __init__.py)
5890 5891
5891 5892 2002-04-25 Fernando Perez <fperez@colorado.edu>
5892 5893
5893 5894 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
5894 5895 to __builtins__ so that any form of embedded or imported code can
5895 5896 test for being inside IPython.
5896 5897
5897 5898 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
5898 5899 changed to GnuplotMagic because it's now an importable module,
5899 5900 this makes the name follow that of the standard Gnuplot module.
5900 5901 GnuplotMagic can now be loaded at any time in mid-session.
5901 5902
5902 5903 2002-04-24 Fernando Perez <fperez@colorado.edu>
5903 5904
5904 5905 * IPython/numutils.py: removed SIUnits. It doesn't properly set
5905 5906 the globals (IPython has its own namespace) and the
5906 5907 PhysicalQuantity stuff is much better anyway.
5907 5908
5908 5909 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
5909 5910 embedding example to standard user directory for
5910 5911 distribution. Also put it in the manual.
5911 5912
5912 5913 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
5913 5914 instance as first argument (so it doesn't rely on some obscure
5914 5915 hidden global).
5915 5916
5916 5917 * IPython/UserConfig/ipythonrc.py: put () back in accepted
5917 5918 delimiters. While it prevents ().TAB from working, it allows
5918 5919 completions in open (... expressions. This is by far a more common
5919 5920 case.
5920 5921
5921 5922 2002-04-23 Fernando Perez <fperez@colorado.edu>
5922 5923
5923 5924 * IPython/Extensions/InterpreterPasteInput.py: new
5924 5925 syntax-processing module for pasting lines with >>> or ... at the
5925 5926 start.
5926 5927
5927 5928 * IPython/Extensions/PhysicalQ_Interactive.py
5928 5929 (PhysicalQuantityInteractive.__int__): fixed to work with either
5929 5930 Numeric or math.
5930 5931
5931 5932 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
5932 5933 provided profiles. Now we have:
5933 5934 -math -> math module as * and cmath with its own namespace.
5934 5935 -numeric -> Numeric as *, plus gnuplot & grace
5935 5936 -physics -> same as before
5936 5937
5937 5938 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
5938 5939 user-defined magics wouldn't be found by @magic if they were
5939 5940 defined as class methods. Also cleaned up the namespace search
5940 5941 logic and the string building (to use %s instead of many repeated
5941 5942 string adds).
5942 5943
5943 5944 * IPython/UserConfig/example-magic.py (magic_foo): updated example
5944 5945 of user-defined magics to operate with class methods (cleaner, in
5945 5946 line with the gnuplot code).
5946 5947
5947 5948 2002-04-22 Fernando Perez <fperez@colorado.edu>
5948 5949
5949 5950 * setup.py: updated dependency list so that manual is updated when
5950 5951 all included files change.
5951 5952
5952 5953 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
5953 5954 the delimiter removal option (the fix is ugly right now).
5954 5955
5955 5956 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
5956 5957 all of the math profile (quicker loading, no conflict between
5957 5958 g-9.8 and g-gnuplot).
5958 5959
5959 5960 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
5960 5961 name of post-mortem files to IPython_crash_report.txt.
5961 5962
5962 5963 * Cleanup/update of the docs. Added all the new readline info and
5963 5964 formatted all lists as 'real lists'.
5964 5965
5965 5966 * IPython/ipmaker.py (make_IPython): removed now-obsolete
5966 5967 tab-completion options, since the full readline parse_and_bind is
5967 5968 now accessible.
5968 5969
5969 5970 * IPython/iplib.py (InteractiveShell.init_readline): Changed
5970 5971 handling of readline options. Now users can specify any string to
5971 5972 be passed to parse_and_bind(), as well as the delimiters to be
5972 5973 removed.
5973 5974 (InteractiveShell.__init__): Added __name__ to the global
5974 5975 namespace so that things like Itpl which rely on its existence
5975 5976 don't crash.
5976 5977 (InteractiveShell._prefilter): Defined the default with a _ so
5977 5978 that prefilter() is easier to override, while the default one
5978 5979 remains available.
5979 5980
5980 5981 2002-04-18 Fernando Perez <fperez@colorado.edu>
5981 5982
5982 5983 * Added information about pdb in the docs.
5983 5984
5984 5985 2002-04-17 Fernando Perez <fperez@colorado.edu>
5985 5986
5986 5987 * IPython/ipmaker.py (make_IPython): added rc_override option to
5987 5988 allow passing config options at creation time which may override
5988 5989 anything set in the config files or command line. This is
5989 5990 particularly useful for configuring embedded instances.
5990 5991
5991 5992 2002-04-15 Fernando Perez <fperez@colorado.edu>
5992 5993
5993 5994 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
5994 5995 crash embedded instances because of the input cache falling out of
5995 5996 sync with the output counter.
5996 5997
5997 5998 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
5998 5999 mode which calls pdb after an uncaught exception in IPython itself.
5999 6000
6000 6001 2002-04-14 Fernando Perez <fperez@colorado.edu>
6001 6002
6002 6003 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
6003 6004 readline, fix it back after each call.
6004 6005
6005 6006 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
6006 6007 method to force all access via __call__(), which guarantees that
6007 6008 traceback references are properly deleted.
6008 6009
6009 6010 * IPython/Prompts.py (CachedOutput._display): minor fixes to
6010 6011 improve printing when pprint is in use.
6011 6012
6012 6013 2002-04-13 Fernando Perez <fperez@colorado.edu>
6013 6014
6014 6015 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
6015 6016 exceptions aren't caught anymore. If the user triggers one, he
6016 6017 should know why he's doing it and it should go all the way up,
6017 6018 just like any other exception. So now @abort will fully kill the
6018 6019 embedded interpreter and the embedding code (unless that happens
6019 6020 to catch SystemExit).
6020 6021
6021 6022 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
6022 6023 and a debugger() method to invoke the interactive pdb debugger
6023 6024 after printing exception information. Also added the corresponding
6024 6025 -pdb option and @pdb magic to control this feature, and updated
6025 6026 the docs. After a suggestion from Christopher Hart
6026 6027 (hart-AT-caltech.edu).
6027 6028
6028 6029 2002-04-12 Fernando Perez <fperez@colorado.edu>
6029 6030
6030 6031 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
6031 6032 the exception handlers defined by the user (not the CrashHandler)
6032 6033 so that user exceptions don't trigger an ipython bug report.
6033 6034
6034 6035 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
6035 6036 configurable (it should have always been so).
6036 6037
6037 6038 2002-03-26 Fernando Perez <fperez@colorado.edu>
6038 6039
6039 6040 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
6040 6041 and there to fix embedding namespace issues. This should all be
6041 6042 done in a more elegant way.
6042 6043
6043 6044 2002-03-25 Fernando Perez <fperez@colorado.edu>
6044 6045
6045 6046 * IPython/genutils.py (get_home_dir): Try to make it work under
6046 6047 win9x also.
6047 6048
6048 6049 2002-03-20 Fernando Perez <fperez@colorado.edu>
6049 6050
6050 6051 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
6051 6052 sys.displayhook untouched upon __init__.
6052 6053
6053 6054 2002-03-19 Fernando Perez <fperez@colorado.edu>
6054 6055
6055 6056 * Released 0.2.9 (for embedding bug, basically).
6056 6057
6057 6058 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
6058 6059 exceptions so that enclosing shell's state can be restored.
6059 6060
6060 6061 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
6061 6062 naming conventions in the .ipython/ dir.
6062 6063
6063 6064 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
6064 6065 from delimiters list so filenames with - in them get expanded.
6065 6066
6066 6067 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
6067 6068 sys.displayhook not being properly restored after an embedded call.
6068 6069
6069 6070 2002-03-18 Fernando Perez <fperez@colorado.edu>
6070 6071
6071 6072 * Released 0.2.8
6072 6073
6073 6074 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
6074 6075 some files weren't being included in a -upgrade.
6075 6076 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
6076 6077 on' so that the first tab completes.
6077 6078 (InteractiveShell.handle_magic): fixed bug with spaces around
6078 6079 quotes breaking many magic commands.
6079 6080
6080 6081 * setup.py: added note about ignoring the syntax error messages at
6081 6082 installation.
6082 6083
6083 6084 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
6084 6085 streamlining the gnuplot interface, now there's only one magic @gp.
6085 6086
6086 6087 2002-03-17 Fernando Perez <fperez@colorado.edu>
6087 6088
6088 6089 * IPython/UserConfig/magic_gnuplot.py: new name for the
6089 6090 example-magic_pm.py file. Much enhanced system, now with a shell
6090 6091 for communicating directly with gnuplot, one command at a time.
6091 6092
6092 6093 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
6093 6094 setting __name__=='__main__'.
6094 6095
6095 6096 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
6096 6097 mini-shell for accessing gnuplot from inside ipython. Should
6097 6098 extend it later for grace access too. Inspired by Arnd's
6098 6099 suggestion.
6099 6100
6100 6101 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
6101 6102 calling magic functions with () in their arguments. Thanks to Arnd
6102 6103 Baecker for pointing this to me.
6103 6104
6104 6105 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
6105 6106 infinitely for integer or complex arrays (only worked with floats).
6106 6107
6107 6108 2002-03-16 Fernando Perez <fperez@colorado.edu>
6108 6109
6109 6110 * setup.py: Merged setup and setup_windows into a single script
6110 6111 which properly handles things for windows users.
6111 6112
6112 6113 2002-03-15 Fernando Perez <fperez@colorado.edu>
6113 6114
6114 6115 * Big change to the manual: now the magics are all automatically
6115 6116 documented. This information is generated from their docstrings
6116 6117 and put in a latex file included by the manual lyx file. This way
6117 6118 we get always up to date information for the magics. The manual
6118 6119 now also has proper version information, also auto-synced.
6119 6120
6120 6121 For this to work, an undocumented --magic_docstrings option was added.
6121 6122
6122 6123 2002-03-13 Fernando Perez <fperez@colorado.edu>
6123 6124
6124 6125 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
6125 6126 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
6126 6127
6127 6128 2002-03-12 Fernando Perez <fperez@colorado.edu>
6128 6129
6129 6130 * IPython/ultraTB.py (TermColors): changed color escapes again to
6130 6131 fix the (old, reintroduced) line-wrapping bug. Basically, if
6131 6132 \001..\002 aren't given in the color escapes, lines get wrapped
6132 6133 weirdly. But giving those screws up old xterms and emacs terms. So
6133 6134 I added some logic for emacs terms to be ok, but I can't identify old
6134 6135 xterms separately ($TERM=='xterm' for many terminals, like konsole).
6135 6136
6136 6137 2002-03-10 Fernando Perez <fperez@colorado.edu>
6137 6138
6138 6139 * IPython/usage.py (__doc__): Various documentation cleanups and
6139 6140 updates, both in usage docstrings and in the manual.
6140 6141
6141 6142 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
6142 6143 handling of caching. Set minimum acceptabe value for having a
6143 6144 cache at 20 values.
6144 6145
6145 6146 * IPython/iplib.py (InteractiveShell.user_setup): moved the
6146 6147 install_first_time function to a method, renamed it and added an
6147 6148 'upgrade' mode. Now people can update their config directory with
6148 6149 a simple command line switch (-upgrade, also new).
6149 6150
6150 6151 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
6151 6152 @file (convenient for automagic users under Python >= 2.2).
6152 6153 Removed @files (it seemed more like a plural than an abbrev. of
6153 6154 'file show').
6154 6155
6155 6156 * IPython/iplib.py (install_first_time): Fixed crash if there were
6156 6157 backup files ('~') in .ipython/ install directory.
6157 6158
6158 6159 * IPython/ipmaker.py (make_IPython): fixes for new prompt
6159 6160 system. Things look fine, but these changes are fairly
6160 6161 intrusive. Test them for a few days.
6161 6162
6162 6163 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
6163 6164 the prompts system. Now all in/out prompt strings are user
6164 6165 controllable. This is particularly useful for embedding, as one
6165 6166 can tag embedded instances with particular prompts.
6166 6167
6167 6168 Also removed global use of sys.ps1/2, which now allows nested
6168 6169 embeddings without any problems. Added command-line options for
6169 6170 the prompt strings.
6170 6171
6171 6172 2002-03-08 Fernando Perez <fperez@colorado.edu>
6172 6173
6173 6174 * IPython/UserConfig/example-embed-short.py (ipshell): added
6174 6175 example file with the bare minimum code for embedding.
6175 6176
6176 6177 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
6177 6178 functionality for the embeddable shell to be activated/deactivated
6178 6179 either globally or at each call.
6179 6180
6180 6181 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
6181 6182 rewriting the prompt with '--->' for auto-inputs with proper
6182 6183 coloring. Now the previous UGLY hack in handle_auto() is gone, and
6183 6184 this is handled by the prompts class itself, as it should.
6184 6185
6185 6186 2002-03-05 Fernando Perez <fperez@colorado.edu>
6186 6187
6187 6188 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
6188 6189 @logstart to avoid name clashes with the math log function.
6189 6190
6190 6191 * Big updates to X/Emacs section of the manual.
6191 6192
6192 6193 * Removed ipython_emacs. Milan explained to me how to pass
6193 6194 arguments to ipython through Emacs. Some day I'm going to end up
6194 6195 learning some lisp...
6195 6196
6196 6197 2002-03-04 Fernando Perez <fperez@colorado.edu>
6197 6198
6198 6199 * IPython/ipython_emacs: Created script to be used as the
6199 6200 py-python-command Emacs variable so we can pass IPython
6200 6201 parameters. I can't figure out how to tell Emacs directly to pass
6201 6202 parameters to IPython, so a dummy shell script will do it.
6202 6203
6203 6204 Other enhancements made for things to work better under Emacs'
6204 6205 various types of terminals. Many thanks to Milan Zamazal
6205 6206 <pdm-AT-zamazal.org> for all the suggestions and pointers.
6206 6207
6207 6208 2002-03-01 Fernando Perez <fperez@colorado.edu>
6208 6209
6209 6210 * IPython/ipmaker.py (make_IPython): added a --readline! option so
6210 6211 that loading of readline is now optional. This gives better
6211 6212 control to emacs users.
6212 6213
6213 6214 * IPython/ultraTB.py (__date__): Modified color escape sequences
6214 6215 and now things work fine under xterm and in Emacs' term buffers
6215 6216 (though not shell ones). Well, in emacs you get colors, but all
6216 6217 seem to be 'light' colors (no difference between dark and light
6217 6218 ones). But the garbage chars are gone, and also in xterms. It
6218 6219 seems that now I'm using 'cleaner' ansi sequences.
6219 6220
6220 6221 2002-02-21 Fernando Perez <fperez@colorado.edu>
6221 6222
6222 6223 * Released 0.2.7 (mainly to publish the scoping fix).
6223 6224
6224 6225 * IPython/Logger.py (Logger.logstate): added. A corresponding
6225 6226 @logstate magic was created.
6226 6227
6227 6228 * IPython/Magic.py: fixed nested scoping problem under Python
6228 6229 2.1.x (automagic wasn't working).
6229 6230
6230 6231 2002-02-20 Fernando Perez <fperez@colorado.edu>
6231 6232
6232 6233 * Released 0.2.6.
6233 6234
6234 6235 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
6235 6236 option so that logs can come out without any headers at all.
6236 6237
6237 6238 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
6238 6239 SciPy.
6239 6240
6240 6241 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
6241 6242 that embedded IPython calls don't require vars() to be explicitly
6242 6243 passed. Now they are extracted from the caller's frame (code
6243 6244 snatched from Eric Jones' weave). Added better documentation to
6244 6245 the section on embedding and the example file.
6245 6246
6246 6247 * IPython/genutils.py (page): Changed so that under emacs, it just
6247 6248 prints the string. You can then page up and down in the emacs
6248 6249 buffer itself. This is how the builtin help() works.
6249 6250
6250 6251 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
6251 6252 macro scoping: macros need to be executed in the user's namespace
6252 6253 to work as if they had been typed by the user.
6253 6254
6254 6255 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
6255 6256 execute automatically (no need to type 'exec...'). They then
6256 6257 behave like 'true macros'. The printing system was also modified
6257 6258 for this to work.
6258 6259
6259 6260 2002-02-19 Fernando Perez <fperez@colorado.edu>
6260 6261
6261 6262 * IPython/genutils.py (page_file): new function for paging files
6262 6263 in an OS-independent way. Also necessary for file viewing to work
6263 6264 well inside Emacs buffers.
6264 6265 (page): Added checks for being in an emacs buffer.
6265 6266 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
6266 6267 same bug in iplib.
6267 6268
6268 6269 2002-02-18 Fernando Perez <fperez@colorado.edu>
6269 6270
6270 6271 * IPython/iplib.py (InteractiveShell.init_readline): modified use
6271 6272 of readline so that IPython can work inside an Emacs buffer.
6272 6273
6273 6274 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
6274 6275 method signatures (they weren't really bugs, but it looks cleaner
6275 6276 and keeps PyChecker happy).
6276 6277
6277 6278 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
6278 6279 for implementing various user-defined hooks. Currently only
6279 6280 display is done.
6280 6281
6281 6282 * IPython/Prompts.py (CachedOutput._display): changed display
6282 6283 functions so that they can be dynamically changed by users easily.
6283 6284
6284 6285 * IPython/Extensions/numeric_formats.py (num_display): added an
6285 6286 extension for printing NumPy arrays in flexible manners. It
6286 6287 doesn't do anything yet, but all the structure is in
6287 6288 place. Ultimately the plan is to implement output format control
6288 6289 like in Octave.
6289 6290
6290 6291 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
6291 6292 methods are found at run-time by all the automatic machinery.
6292 6293
6293 6294 2002-02-17 Fernando Perez <fperez@colorado.edu>
6294 6295
6295 6296 * setup_Windows.py (make_shortcut): documented. Cleaned up the
6296 6297 whole file a little.
6297 6298
6298 6299 * ToDo: closed this document. Now there's a new_design.lyx
6299 6300 document for all new ideas. Added making a pdf of it for the
6300 6301 end-user distro.
6301 6302
6302 6303 * IPython/Logger.py (Logger.switch_log): Created this to replace
6303 6304 logon() and logoff(). It also fixes a nasty crash reported by
6304 6305 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
6305 6306
6306 6307 * IPython/iplib.py (complete): got auto-completion to work with
6307 6308 automagic (I had wanted this for a long time).
6308 6309
6309 6310 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
6310 6311 to @file, since file() is now a builtin and clashes with automagic
6311 6312 for @file.
6312 6313
6313 6314 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
6314 6315 of this was previously in iplib, which had grown to more than 2000
6315 6316 lines, way too long. No new functionality, but it makes managing
6316 6317 the code a bit easier.
6317 6318
6318 6319 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
6319 6320 information to crash reports.
6320 6321
6321 6322 2002-02-12 Fernando Perez <fperez@colorado.edu>
6322 6323
6323 6324 * Released 0.2.5.
6324 6325
6325 6326 2002-02-11 Fernando Perez <fperez@colorado.edu>
6326 6327
6327 6328 * Wrote a relatively complete Windows installer. It puts
6328 6329 everything in place, creates Start Menu entries and fixes the
6329 6330 color issues. Nothing fancy, but it works.
6330 6331
6331 6332 2002-02-10 Fernando Perez <fperez@colorado.edu>
6332 6333
6333 6334 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
6334 6335 os.path.expanduser() call so that we can type @run ~/myfile.py and
6335 6336 have thigs work as expected.
6336 6337
6337 6338 * IPython/genutils.py (page): fixed exception handling so things
6338 6339 work both in Unix and Windows correctly. Quitting a pager triggers
6339 6340 an IOError/broken pipe in Unix, and in windows not finding a pager
6340 6341 is also an IOError, so I had to actually look at the return value
6341 6342 of the exception, not just the exception itself. Should be ok now.
6342 6343
6343 6344 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
6344 6345 modified to allow case-insensitive color scheme changes.
6345 6346
6346 6347 2002-02-09 Fernando Perez <fperez@colorado.edu>
6347 6348
6348 6349 * IPython/genutils.py (native_line_ends): new function to leave
6349 6350 user config files with os-native line-endings.
6350 6351
6351 6352 * README and manual updates.
6352 6353
6353 6354 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
6354 6355 instead of StringType to catch Unicode strings.
6355 6356
6356 6357 * IPython/genutils.py (filefind): fixed bug for paths with
6357 6358 embedded spaces (very common in Windows).
6358 6359
6359 6360 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
6360 6361 files under Windows, so that they get automatically associated
6361 6362 with a text editor. Windows makes it a pain to handle
6362 6363 extension-less files.
6363 6364
6364 6365 * IPython/iplib.py (InteractiveShell.init_readline): Made the
6365 6366 warning about readline only occur for Posix. In Windows there's no
6366 6367 way to get readline, so why bother with the warning.
6367 6368
6368 6369 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
6369 6370 for __str__ instead of dir(self), since dir() changed in 2.2.
6370 6371
6371 6372 * Ported to Windows! Tested on XP, I suspect it should work fine
6372 6373 on NT/2000, but I don't think it will work on 98 et al. That
6373 6374 series of Windows is such a piece of junk anyway that I won't try
6374 6375 porting it there. The XP port was straightforward, showed a few
6375 6376 bugs here and there (fixed all), in particular some string
6376 6377 handling stuff which required considering Unicode strings (which
6377 6378 Windows uses). This is good, but hasn't been too tested :) No
6378 6379 fancy installer yet, I'll put a note in the manual so people at
6379 6380 least make manually a shortcut.
6380 6381
6381 6382 * IPython/iplib.py (Magic.magic_colors): Unified the color options
6382 6383 into a single one, "colors". This now controls both prompt and
6383 6384 exception color schemes, and can be changed both at startup
6384 6385 (either via command-line switches or via ipythonrc files) and at
6385 6386 runtime, with @colors.
6386 6387 (Magic.magic_run): renamed @prun to @run and removed the old
6387 6388 @run. The two were too similar to warrant keeping both.
6388 6389
6389 6390 2002-02-03 Fernando Perez <fperez@colorado.edu>
6390 6391
6391 6392 * IPython/iplib.py (install_first_time): Added comment on how to
6392 6393 configure the color options for first-time users. Put a <return>
6393 6394 request at the end so that small-terminal users get a chance to
6394 6395 read the startup info.
6395 6396
6396 6397 2002-01-23 Fernando Perez <fperez@colorado.edu>
6397 6398
6398 6399 * IPython/iplib.py (CachedOutput.update): Changed output memory
6399 6400 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
6400 6401 input history we still use _i. Did this b/c these variable are
6401 6402 very commonly used in interactive work, so the less we need to
6402 6403 type the better off we are.
6403 6404 (Magic.magic_prun): updated @prun to better handle the namespaces
6404 6405 the file will run in, including a fix for __name__ not being set
6405 6406 before.
6406 6407
6407 6408 2002-01-20 Fernando Perez <fperez@colorado.edu>
6408 6409
6409 6410 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
6410 6411 extra garbage for Python 2.2. Need to look more carefully into
6411 6412 this later.
6412 6413
6413 6414 2002-01-19 Fernando Perez <fperez@colorado.edu>
6414 6415
6415 6416 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
6416 6417 display SyntaxError exceptions properly formatted when they occur
6417 6418 (they can be triggered by imported code).
6418 6419
6419 6420 2002-01-18 Fernando Perez <fperez@colorado.edu>
6420 6421
6421 6422 * IPython/iplib.py (InteractiveShell.safe_execfile): now
6422 6423 SyntaxError exceptions are reported nicely formatted, instead of
6423 6424 spitting out only offset information as before.
6424 6425 (Magic.magic_prun): Added the @prun function for executing
6425 6426 programs with command line args inside IPython.
6426 6427
6427 6428 2002-01-16 Fernando Perez <fperez@colorado.edu>
6428 6429
6429 6430 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
6430 6431 to *not* include the last item given in a range. This brings their
6431 6432 behavior in line with Python's slicing:
6432 6433 a[n1:n2] -> a[n1]...a[n2-1]
6433 6434 It may be a bit less convenient, but I prefer to stick to Python's
6434 6435 conventions *everywhere*, so users never have to wonder.
6435 6436 (Magic.magic_macro): Added @macro function to ease the creation of
6436 6437 macros.
6437 6438
6438 6439 2002-01-05 Fernando Perez <fperez@colorado.edu>
6439 6440
6440 6441 * Released 0.2.4.
6441 6442
6442 6443 * IPython/iplib.py (Magic.magic_pdef):
6443 6444 (InteractiveShell.safe_execfile): report magic lines and error
6444 6445 lines without line numbers so one can easily copy/paste them for
6445 6446 re-execution.
6446 6447
6447 6448 * Updated manual with recent changes.
6448 6449
6449 6450 * IPython/iplib.py (Magic.magic_oinfo): added constructor
6450 6451 docstring printing when class? is called. Very handy for knowing
6451 6452 how to create class instances (as long as __init__ is well
6452 6453 documented, of course :)
6453 6454 (Magic.magic_doc): print both class and constructor docstrings.
6454 6455 (Magic.magic_pdef): give constructor info if passed a class and
6455 6456 __call__ info for callable object instances.
6456 6457
6457 6458 2002-01-04 Fernando Perez <fperez@colorado.edu>
6458 6459
6459 6460 * Made deep_reload() off by default. It doesn't always work
6460 6461 exactly as intended, so it's probably safer to have it off. It's
6461 6462 still available as dreload() anyway, so nothing is lost.
6462 6463
6463 6464 2002-01-02 Fernando Perez <fperez@colorado.edu>
6464 6465
6465 6466 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
6466 6467 so I wanted an updated release).
6467 6468
6468 6469 2001-12-27 Fernando Perez <fperez@colorado.edu>
6469 6470
6470 6471 * IPython/iplib.py (InteractiveShell.interact): Added the original
6471 6472 code from 'code.py' for this module in order to change the
6472 6473 handling of a KeyboardInterrupt. This was necessary b/c otherwise
6473 6474 the history cache would break when the user hit Ctrl-C, and
6474 6475 interact() offers no way to add any hooks to it.
6475 6476
6476 6477 2001-12-23 Fernando Perez <fperez@colorado.edu>
6477 6478
6478 6479 * setup.py: added check for 'MANIFEST' before trying to remove
6479 6480 it. Thanks to Sean Reifschneider.
6480 6481
6481 6482 2001-12-22 Fernando Perez <fperez@colorado.edu>
6482 6483
6483 6484 * Released 0.2.2.
6484 6485
6485 6486 * Finished (reasonably) writing the manual. Later will add the
6486 6487 python-standard navigation stylesheets, but for the time being
6487 6488 it's fairly complete. Distribution will include html and pdf
6488 6489 versions.
6489 6490
6490 6491 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
6491 6492 (MayaVi author).
6492 6493
6493 6494 2001-12-21 Fernando Perez <fperez@colorado.edu>
6494 6495
6495 6496 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
6496 6497 good public release, I think (with the manual and the distutils
6497 6498 installer). The manual can use some work, but that can go
6498 6499 slowly. Otherwise I think it's quite nice for end users. Next
6499 6500 summer, rewrite the guts of it...
6500 6501
6501 6502 * Changed format of ipythonrc files to use whitespace as the
6502 6503 separator instead of an explicit '='. Cleaner.
6503 6504
6504 6505 2001-12-20 Fernando Perez <fperez@colorado.edu>
6505 6506
6506 6507 * Started a manual in LyX. For now it's just a quick merge of the
6507 6508 various internal docstrings and READMEs. Later it may grow into a
6508 6509 nice, full-blown manual.
6509 6510
6510 6511 * Set up a distutils based installer. Installation should now be
6511 6512 trivially simple for end-users.
6512 6513
6513 6514 2001-12-11 Fernando Perez <fperez@colorado.edu>
6514 6515
6515 6516 * Released 0.2.0. First public release, announced it at
6516 6517 comp.lang.python. From now on, just bugfixes...
6517 6518
6518 6519 * Went through all the files, set copyright/license notices and
6519 6520 cleaned up things. Ready for release.
6520 6521
6521 6522 2001-12-10 Fernando Perez <fperez@colorado.edu>
6522 6523
6523 6524 * Changed the first-time installer not to use tarfiles. It's more
6524 6525 robust now and less unix-dependent. Also makes it easier for
6525 6526 people to later upgrade versions.
6526 6527
6527 6528 * Changed @exit to @abort to reflect the fact that it's pretty
6528 6529 brutal (a sys.exit()). The difference between @abort and Ctrl-D
6529 6530 becomes significant only when IPyhton is embedded: in that case,
6530 6531 C-D closes IPython only, but @abort kills the enclosing program
6531 6532 too (unless it had called IPython inside a try catching
6532 6533 SystemExit).
6533 6534
6534 6535 * Created Shell module which exposes the actuall IPython Shell
6535 6536 classes, currently the normal and the embeddable one. This at
6536 6537 least offers a stable interface we won't need to change when
6537 6538 (later) the internals are rewritten. That rewrite will be confined
6538 6539 to iplib and ipmaker, but the Shell interface should remain as is.
6539 6540
6540 6541 * Added embed module which offers an embeddable IPShell object,
6541 6542 useful to fire up IPython *inside* a running program. Great for
6542 6543 debugging or dynamical data analysis.
6543 6544
6544 6545 2001-12-08 Fernando Perez <fperez@colorado.edu>
6545 6546
6546 6547 * Fixed small bug preventing seeing info from methods of defined
6547 6548 objects (incorrect namespace in _ofind()).
6548 6549
6549 6550 * Documentation cleanup. Moved the main usage docstrings to a
6550 6551 separate file, usage.py (cleaner to maintain, and hopefully in the
6551 6552 future some perlpod-like way of producing interactive, man and
6552 6553 html docs out of it will be found).
6553 6554
6554 6555 * Added @profile to see your profile at any time.
6555 6556
6556 6557 * Added @p as an alias for 'print'. It's especially convenient if
6557 6558 using automagic ('p x' prints x).
6558 6559
6559 6560 * Small cleanups and fixes after a pychecker run.
6560 6561
6561 6562 * Changed the @cd command to handle @cd - and @cd -<n> for
6562 6563 visiting any directory in _dh.
6563 6564
6564 6565 * Introduced _dh, a history of visited directories. @dhist prints
6565 6566 it out with numbers.
6566 6567
6567 6568 2001-12-07 Fernando Perez <fperez@colorado.edu>
6568 6569
6569 6570 * Released 0.1.22
6570 6571
6571 6572 * Made initialization a bit more robust against invalid color
6572 6573 options in user input (exit, not traceback-crash).
6573 6574
6574 6575 * Changed the bug crash reporter to write the report only in the
6575 6576 user's .ipython directory. That way IPython won't litter people's
6576 6577 hard disks with crash files all over the place. Also print on
6577 6578 screen the necessary mail command.
6578 6579
6579 6580 * With the new ultraTB, implemented LightBG color scheme for light
6580 6581 background terminals. A lot of people like white backgrounds, so I
6581 6582 guess we should at least give them something readable.
6582 6583
6583 6584 2001-12-06 Fernando Perez <fperez@colorado.edu>
6584 6585
6585 6586 * Modified the structure of ultraTB. Now there's a proper class
6586 6587 for tables of color schemes which allow adding schemes easily and
6587 6588 switching the active scheme without creating a new instance every
6588 6589 time (which was ridiculous). The syntax for creating new schemes
6589 6590 is also cleaner. I think ultraTB is finally done, with a clean
6590 6591 class structure. Names are also much cleaner (now there's proper
6591 6592 color tables, no need for every variable to also have 'color' in
6592 6593 its name).
6593 6594
6594 6595 * Broke down genutils into separate files. Now genutils only
6595 6596 contains utility functions, and classes have been moved to their
6596 6597 own files (they had enough independent functionality to warrant
6597 6598 it): ConfigLoader, OutputTrap, Struct.
6598 6599
6599 6600 2001-12-05 Fernando Perez <fperez@colorado.edu>
6600 6601
6601 6602 * IPython turns 21! Released version 0.1.21, as a candidate for
6602 6603 public consumption. If all goes well, release in a few days.
6603 6604
6604 6605 * Fixed path bug (files in Extensions/ directory wouldn't be found
6605 6606 unless IPython/ was explicitly in sys.path).
6606 6607
6607 6608 * Extended the FlexCompleter class as MagicCompleter to allow
6608 6609 completion of @-starting lines.
6609 6610
6610 6611 * Created __release__.py file as a central repository for release
6611 6612 info that other files can read from.
6612 6613
6613 6614 * Fixed small bug in logging: when logging was turned on in
6614 6615 mid-session, old lines with special meanings (!@?) were being
6615 6616 logged without the prepended comment, which is necessary since
6616 6617 they are not truly valid python syntax. This should make session
6617 6618 restores produce less errors.
6618 6619
6619 6620 * The namespace cleanup forced me to make a FlexCompleter class
6620 6621 which is nothing but a ripoff of rlcompleter, but with selectable
6621 6622 namespace (rlcompleter only works in __main__.__dict__). I'll try
6622 6623 to submit a note to the authors to see if this change can be
6623 6624 incorporated in future rlcompleter releases (Dec.6: done)
6624 6625
6625 6626 * More fixes to namespace handling. It was a mess! Now all
6626 6627 explicit references to __main__.__dict__ are gone (except when
6627 6628 really needed) and everything is handled through the namespace
6628 6629 dicts in the IPython instance. We seem to be getting somewhere
6629 6630 with this, finally...
6630 6631
6631 6632 * Small documentation updates.
6632 6633
6633 6634 * Created the Extensions directory under IPython (with an
6634 6635 __init__.py). Put the PhysicalQ stuff there. This directory should
6635 6636 be used for all special-purpose extensions.
6636 6637
6637 6638 * File renaming:
6638 6639 ipythonlib --> ipmaker
6639 6640 ipplib --> iplib
6640 6641 This makes a bit more sense in terms of what these files actually do.
6641 6642
6642 6643 * Moved all the classes and functions in ipythonlib to ipplib, so
6643 6644 now ipythonlib only has make_IPython(). This will ease up its
6644 6645 splitting in smaller functional chunks later.
6645 6646
6646 6647 * Cleaned up (done, I think) output of @whos. Better column
6647 6648 formatting, and now shows str(var) for as much as it can, which is
6648 6649 typically what one gets with a 'print var'.
6649 6650
6650 6651 2001-12-04 Fernando Perez <fperez@colorado.edu>
6651 6652
6652 6653 * Fixed namespace problems. Now builtin/IPyhton/user names get
6653 6654 properly reported in their namespace. Internal namespace handling
6654 6655 is finally getting decent (not perfect yet, but much better than
6655 6656 the ad-hoc mess we had).
6656 6657
6657 6658 * Removed -exit option. If people just want to run a python
6658 6659 script, that's what the normal interpreter is for. Less
6659 6660 unnecessary options, less chances for bugs.
6660 6661
6661 6662 * Added a crash handler which generates a complete post-mortem if
6662 6663 IPython crashes. This will help a lot in tracking bugs down the
6663 6664 road.
6664 6665
6665 6666 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
6666 6667 which were boud to functions being reassigned would bypass the
6667 6668 logger, breaking the sync of _il with the prompt counter. This
6668 6669 would then crash IPython later when a new line was logged.
6669 6670
6670 6671 2001-12-02 Fernando Perez <fperez@colorado.edu>
6671 6672
6672 6673 * Made IPython a package. This means people don't have to clutter
6673 6674 their sys.path with yet another directory. Changed the INSTALL
6674 6675 file accordingly.
6675 6676
6676 6677 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
6677 6678 sorts its output (so @who shows it sorted) and @whos formats the
6678 6679 table according to the width of the first column. Nicer, easier to
6679 6680 read. Todo: write a generic table_format() which takes a list of
6680 6681 lists and prints it nicely formatted, with optional row/column
6681 6682 separators and proper padding and justification.
6682 6683
6683 6684 * Released 0.1.20
6684 6685
6685 6686 * Fixed bug in @log which would reverse the inputcache list (a
6686 6687 copy operation was missing).
6687 6688
6688 6689 * Code cleanup. @config was changed to use page(). Better, since
6689 6690 its output is always quite long.
6690 6691
6691 6692 * Itpl is back as a dependency. I was having too many problems
6692 6693 getting the parametric aliases to work reliably, and it's just
6693 6694 easier to code weird string operations with it than playing %()s
6694 6695 games. It's only ~6k, so I don't think it's too big a deal.
6695 6696
6696 6697 * Found (and fixed) a very nasty bug with history. !lines weren't
6697 6698 getting cached, and the out of sync caches would crash
6698 6699 IPython. Fixed it by reorganizing the prefilter/handlers/logger
6699 6700 division of labor a bit better. Bug fixed, cleaner structure.
6700 6701
6701 6702 2001-12-01 Fernando Perez <fperez@colorado.edu>
6702 6703
6703 6704 * Released 0.1.19
6704 6705
6705 6706 * Added option -n to @hist to prevent line number printing. Much
6706 6707 easier to copy/paste code this way.
6707 6708
6708 6709 * Created global _il to hold the input list. Allows easy
6709 6710 re-execution of blocks of code by slicing it (inspired by Janko's
6710 6711 comment on 'macros').
6711 6712
6712 6713 * Small fixes and doc updates.
6713 6714
6714 6715 * Rewrote @history function (was @h). Renamed it to @hist, @h is
6715 6716 much too fragile with automagic. Handles properly multi-line
6716 6717 statements and takes parameters.
6717 6718
6718 6719 2001-11-30 Fernando Perez <fperez@colorado.edu>
6719 6720
6720 6721 * Version 0.1.18 released.
6721 6722
6722 6723 * Fixed nasty namespace bug in initial module imports.
6723 6724
6724 6725 * Added copyright/license notes to all code files (except
6725 6726 DPyGetOpt). For the time being, LGPL. That could change.
6726 6727
6727 6728 * Rewrote a much nicer README, updated INSTALL, cleaned up
6728 6729 ipythonrc-* samples.
6729 6730
6730 6731 * Overall code/documentation cleanup. Basically ready for
6731 6732 release. Only remaining thing: licence decision (LGPL?).
6732 6733
6733 6734 * Converted load_config to a class, ConfigLoader. Now recursion
6734 6735 control is better organized. Doesn't include the same file twice.
6735 6736
6736 6737 2001-11-29 Fernando Perez <fperez@colorado.edu>
6737 6738
6738 6739 * Got input history working. Changed output history variables from
6739 6740 _p to _o so that _i is for input and _o for output. Just cleaner
6740 6741 convention.
6741 6742
6742 6743 * Implemented parametric aliases. This pretty much allows the
6743 6744 alias system to offer full-blown shell convenience, I think.
6744 6745
6745 6746 * Version 0.1.17 released, 0.1.18 opened.
6746 6747
6747 6748 * dot_ipython/ipythonrc (alias): added documentation.
6748 6749 (xcolor): Fixed small bug (xcolors -> xcolor)
6749 6750
6750 6751 * Changed the alias system. Now alias is a magic command to define
6751 6752 aliases just like the shell. Rationale: the builtin magics should
6752 6753 be there for things deeply connected to IPython's
6753 6754 architecture. And this is a much lighter system for what I think
6754 6755 is the really important feature: allowing users to define quickly
6755 6756 magics that will do shell things for them, so they can customize
6756 6757 IPython easily to match their work habits. If someone is really
6757 6758 desperate to have another name for a builtin alias, they can
6758 6759 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
6759 6760 works.
6760 6761
6761 6762 2001-11-28 Fernando Perez <fperez@colorado.edu>
6762 6763
6763 6764 * Changed @file so that it opens the source file at the proper
6764 6765 line. Since it uses less, if your EDITOR environment is
6765 6766 configured, typing v will immediately open your editor of choice
6766 6767 right at the line where the object is defined. Not as quick as
6767 6768 having a direct @edit command, but for all intents and purposes it
6768 6769 works. And I don't have to worry about writing @edit to deal with
6769 6770 all the editors, less does that.
6770 6771
6771 6772 * Version 0.1.16 released, 0.1.17 opened.
6772 6773
6773 6774 * Fixed some nasty bugs in the page/page_dumb combo that could
6774 6775 crash IPython.
6775 6776
6776 6777 2001-11-27 Fernando Perez <fperez@colorado.edu>
6777 6778
6778 6779 * Version 0.1.15 released, 0.1.16 opened.
6779 6780
6780 6781 * Finally got ? and ?? to work for undefined things: now it's
6781 6782 possible to type {}.get? and get information about the get method
6782 6783 of dicts, or os.path? even if only os is defined (so technically
6783 6784 os.path isn't). Works at any level. For example, after import os,
6784 6785 os?, os.path?, os.path.abspath? all work. This is great, took some
6785 6786 work in _ofind.
6786 6787
6787 6788 * Fixed more bugs with logging. The sanest way to do it was to add
6788 6789 to @log a 'mode' parameter. Killed two in one shot (this mode
6789 6790 option was a request of Janko's). I think it's finally clean
6790 6791 (famous last words).
6791 6792
6792 6793 * Added a page_dumb() pager which does a decent job of paging on
6793 6794 screen, if better things (like less) aren't available. One less
6794 6795 unix dependency (someday maybe somebody will port this to
6795 6796 windows).
6796 6797
6797 6798 * Fixed problem in magic_log: would lock of logging out if log
6798 6799 creation failed (because it would still think it had succeeded).
6799 6800
6800 6801 * Improved the page() function using curses to auto-detect screen
6801 6802 size. Now it can make a much better decision on whether to print
6802 6803 or page a string. Option screen_length was modified: a value 0
6803 6804 means auto-detect, and that's the default now.
6804 6805
6805 6806 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
6806 6807 go out. I'll test it for a few days, then talk to Janko about
6807 6808 licences and announce it.
6808 6809
6809 6810 * Fixed the length of the auto-generated ---> prompt which appears
6810 6811 for auto-parens and auto-quotes. Getting this right isn't trivial,
6811 6812 with all the color escapes, different prompt types and optional
6812 6813 separators. But it seems to be working in all the combinations.
6813 6814
6814 6815 2001-11-26 Fernando Perez <fperez@colorado.edu>
6815 6816
6816 6817 * Wrote a regexp filter to get option types from the option names
6817 6818 string. This eliminates the need to manually keep two duplicate
6818 6819 lists.
6819 6820
6820 6821 * Removed the unneeded check_option_names. Now options are handled
6821 6822 in a much saner manner and it's easy to visually check that things
6822 6823 are ok.
6823 6824
6824 6825 * Updated version numbers on all files I modified to carry a
6825 6826 notice so Janko and Nathan have clear version markers.
6826 6827
6827 6828 * Updated docstring for ultraTB with my changes. I should send
6828 6829 this to Nathan.
6829 6830
6830 6831 * Lots of small fixes. Ran everything through pychecker again.
6831 6832
6832 6833 * Made loading of deep_reload an cmd line option. If it's not too
6833 6834 kosher, now people can just disable it. With -nodeep_reload it's
6834 6835 still available as dreload(), it just won't overwrite reload().
6835 6836
6836 6837 * Moved many options to the no| form (-opt and -noopt
6837 6838 accepted). Cleaner.
6838 6839
6839 6840 * Changed magic_log so that if called with no parameters, it uses
6840 6841 'rotate' mode. That way auto-generated logs aren't automatically
6841 6842 over-written. For normal logs, now a backup is made if it exists
6842 6843 (only 1 level of backups). A new 'backup' mode was added to the
6843 6844 Logger class to support this. This was a request by Janko.
6844 6845
6845 6846 * Added @logoff/@logon to stop/restart an active log.
6846 6847
6847 6848 * Fixed a lot of bugs in log saving/replay. It was pretty
6848 6849 broken. Now special lines (!@,/) appear properly in the command
6849 6850 history after a log replay.
6850 6851
6851 6852 * Tried and failed to implement full session saving via pickle. My
6852 6853 idea was to pickle __main__.__dict__, but modules can't be
6853 6854 pickled. This would be a better alternative to replaying logs, but
6854 6855 seems quite tricky to get to work. Changed -session to be called
6855 6856 -logplay, which more accurately reflects what it does. And if we
6856 6857 ever get real session saving working, -session is now available.
6857 6858
6858 6859 * Implemented color schemes for prompts also. As for tracebacks,
6859 6860 currently only NoColor and Linux are supported. But now the
6860 6861 infrastructure is in place, based on a generic ColorScheme
6861 6862 class. So writing and activating new schemes both for the prompts
6862 6863 and the tracebacks should be straightforward.
6863 6864
6864 6865 * Version 0.1.13 released, 0.1.14 opened.
6865 6866
6866 6867 * Changed handling of options for output cache. Now counter is
6867 6868 hardwired starting at 1 and one specifies the maximum number of
6868 6869 entries *in the outcache* (not the max prompt counter). This is
6869 6870 much better, since many statements won't increase the cache
6870 6871 count. It also eliminated some confusing options, now there's only
6871 6872 one: cache_size.
6872 6873
6873 6874 * Added 'alias' magic function and magic_alias option in the
6874 6875 ipythonrc file. Now the user can easily define whatever names he
6875 6876 wants for the magic functions without having to play weird
6876 6877 namespace games. This gives IPython a real shell-like feel.
6877 6878
6878 6879 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
6879 6880 @ or not).
6880 6881
6881 6882 This was one of the last remaining 'visible' bugs (that I know
6882 6883 of). I think if I can clean up the session loading so it works
6883 6884 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
6884 6885 about licensing).
6885 6886
6886 6887 2001-11-25 Fernando Perez <fperez@colorado.edu>
6887 6888
6888 6889 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
6889 6890 there's a cleaner distinction between what ? and ?? show.
6890 6891
6891 6892 * Added screen_length option. Now the user can define his own
6892 6893 screen size for page() operations.
6893 6894
6894 6895 * Implemented magic shell-like functions with automatic code
6895 6896 generation. Now adding another function is just a matter of adding
6896 6897 an entry to a dict, and the function is dynamically generated at
6897 6898 run-time. Python has some really cool features!
6898 6899
6899 6900 * Renamed many options to cleanup conventions a little. Now all
6900 6901 are lowercase, and only underscores where needed. Also in the code
6901 6902 option name tables are clearer.
6902 6903
6903 6904 * Changed prompts a little. Now input is 'In [n]:' instead of
6904 6905 'In[n]:='. This allows it the numbers to be aligned with the
6905 6906 Out[n] numbers, and removes usage of ':=' which doesn't exist in
6906 6907 Python (it was a Mathematica thing). The '...' continuation prompt
6907 6908 was also changed a little to align better.
6908 6909
6909 6910 * Fixed bug when flushing output cache. Not all _p<n> variables
6910 6911 exist, so their deletion needs to be wrapped in a try:
6911 6912
6912 6913 * Figured out how to properly use inspect.formatargspec() (it
6913 6914 requires the args preceded by *). So I removed all the code from
6914 6915 _get_pdef in Magic, which was just replicating that.
6915 6916
6916 6917 * Added test to prefilter to allow redefining magic function names
6917 6918 as variables. This is ok, since the @ form is always available,
6918 6919 but whe should allow the user to define a variable called 'ls' if
6919 6920 he needs it.
6920 6921
6921 6922 * Moved the ToDo information from README into a separate ToDo.
6922 6923
6923 6924 * General code cleanup and small bugfixes. I think it's close to a
6924 6925 state where it can be released, obviously with a big 'beta'
6925 6926 warning on it.
6926 6927
6927 6928 * Got the magic function split to work. Now all magics are defined
6928 6929 in a separate class. It just organizes things a bit, and now
6929 6930 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
6930 6931 was too long).
6931 6932
6932 6933 * Changed @clear to @reset to avoid potential confusions with
6933 6934 the shell command clear. Also renamed @cl to @clear, which does
6934 6935 exactly what people expect it to from their shell experience.
6935 6936
6936 6937 Added a check to the @reset command (since it's so
6937 6938 destructive, it's probably a good idea to ask for confirmation).
6938 6939 But now reset only works for full namespace resetting. Since the
6939 6940 del keyword is already there for deleting a few specific
6940 6941 variables, I don't see the point of having a redundant magic
6941 6942 function for the same task.
6942 6943
6943 6944 2001-11-24 Fernando Perez <fperez@colorado.edu>
6944 6945
6945 6946 * Updated the builtin docs (esp. the ? ones).
6946 6947
6947 6948 * Ran all the code through pychecker. Not terribly impressed with
6948 6949 it: lots of spurious warnings and didn't really find anything of
6949 6950 substance (just a few modules being imported and not used).
6950 6951
6951 6952 * Implemented the new ultraTB functionality into IPython. New
6952 6953 option: xcolors. This chooses color scheme. xmode now only selects
6953 6954 between Plain and Verbose. Better orthogonality.
6954 6955
6955 6956 * Large rewrite of ultraTB. Much cleaner now, with a separation of
6956 6957 mode and color scheme for the exception handlers. Now it's
6957 6958 possible to have the verbose traceback with no coloring.
6958 6959
6959 6960 2001-11-23 Fernando Perez <fperez@colorado.edu>
6960 6961
6961 6962 * Version 0.1.12 released, 0.1.13 opened.
6962 6963
6963 6964 * Removed option to set auto-quote and auto-paren escapes by
6964 6965 user. The chances of breaking valid syntax are just too high. If
6965 6966 someone *really* wants, they can always dig into the code.
6966 6967
6967 6968 * Made prompt separators configurable.
6968 6969
6969 6970 2001-11-22 Fernando Perez <fperez@colorado.edu>
6970 6971
6971 6972 * Small bugfixes in many places.
6972 6973
6973 6974 * Removed the MyCompleter class from ipplib. It seemed redundant
6974 6975 with the C-p,C-n history search functionality. Less code to
6975 6976 maintain.
6976 6977
6977 6978 * Moved all the original ipython.py code into ipythonlib.py. Right
6978 6979 now it's just one big dump into a function called make_IPython, so
6979 6980 no real modularity has been gained. But at least it makes the
6980 6981 wrapper script tiny, and since ipythonlib is a module, it gets
6981 6982 compiled and startup is much faster.
6982 6983
6983 6984 This is a reasobably 'deep' change, so we should test it for a
6984 6985 while without messing too much more with the code.
6985 6986
6986 6987 2001-11-21 Fernando Perez <fperez@colorado.edu>
6987 6988
6988 6989 * Version 0.1.11 released, 0.1.12 opened for further work.
6989 6990
6990 6991 * Removed dependency on Itpl. It was only needed in one place. It
6991 6992 would be nice if this became part of python, though. It makes life
6992 6993 *a lot* easier in some cases.
6993 6994
6994 6995 * Simplified the prefilter code a bit. Now all handlers are
6995 6996 expected to explicitly return a value (at least a blank string).
6996 6997
6997 6998 * Heavy edits in ipplib. Removed the help system altogether. Now
6998 6999 obj?/?? is used for inspecting objects, a magic @doc prints
6999 7000 docstrings, and full-blown Python help is accessed via the 'help'
7000 7001 keyword. This cleans up a lot of code (less to maintain) and does
7001 7002 the job. Since 'help' is now a standard Python component, might as
7002 7003 well use it and remove duplicate functionality.
7003 7004
7004 7005 Also removed the option to use ipplib as a standalone program. By
7005 7006 now it's too dependent on other parts of IPython to function alone.
7006 7007
7007 7008 * Fixed bug in genutils.pager. It would crash if the pager was
7008 7009 exited immediately after opening (broken pipe).
7009 7010
7010 7011 * Trimmed down the VerboseTB reporting a little. The header is
7011 7012 much shorter now and the repeated exception arguments at the end
7012 7013 have been removed. For interactive use the old header seemed a bit
7013 7014 excessive.
7014 7015
7015 7016 * Fixed small bug in output of @whos for variables with multi-word
7016 7017 types (only first word was displayed).
7017 7018
7018 7019 2001-11-17 Fernando Perez <fperez@colorado.edu>
7019 7020
7020 7021 * Version 0.1.10 released, 0.1.11 opened for further work.
7021 7022
7022 7023 * Modified dirs and friends. dirs now *returns* the stack (not
7023 7024 prints), so one can manipulate it as a variable. Convenient to
7024 7025 travel along many directories.
7025 7026
7026 7027 * Fixed bug in magic_pdef: would only work with functions with
7027 7028 arguments with default values.
7028 7029
7029 7030 2001-11-14 Fernando Perez <fperez@colorado.edu>
7030 7031
7031 7032 * Added the PhysicsInput stuff to dot_ipython so it ships as an
7032 7033 example with IPython. Various other minor fixes and cleanups.
7033 7034
7034 7035 * Version 0.1.9 released, 0.1.10 opened for further work.
7035 7036
7036 7037 * Added sys.path to the list of directories searched in the
7037 7038 execfile= option. It used to be the current directory and the
7038 7039 user's IPYTHONDIR only.
7039 7040
7040 7041 2001-11-13 Fernando Perez <fperez@colorado.edu>
7041 7042
7042 7043 * Reinstated the raw_input/prefilter separation that Janko had
7043 7044 initially. This gives a more convenient setup for extending the
7044 7045 pre-processor from the outside: raw_input always gets a string,
7045 7046 and prefilter has to process it. We can then redefine prefilter
7046 7047 from the outside and implement extensions for special
7047 7048 purposes.
7048 7049
7049 7050 Today I got one for inputting PhysicalQuantity objects
7050 7051 (from Scientific) without needing any function calls at
7051 7052 all. Extremely convenient, and it's all done as a user-level
7052 7053 extension (no IPython code was touched). Now instead of:
7053 7054 a = PhysicalQuantity(4.2,'m/s**2')
7054 7055 one can simply say
7055 7056 a = 4.2 m/s**2
7056 7057 or even
7057 7058 a = 4.2 m/s^2
7058 7059
7059 7060 I use this, but it's also a proof of concept: IPython really is
7060 7061 fully user-extensible, even at the level of the parsing of the
7061 7062 command line. It's not trivial, but it's perfectly doable.
7062 7063
7063 7064 * Added 'add_flip' method to inclusion conflict resolver. Fixes
7064 7065 the problem of modules being loaded in the inverse order in which
7065 7066 they were defined in
7066 7067
7067 7068 * Version 0.1.8 released, 0.1.9 opened for further work.
7068 7069
7069 7070 * Added magics pdef, source and file. They respectively show the
7070 7071 definition line ('prototype' in C), source code and full python
7071 7072 file for any callable object. The object inspector oinfo uses
7072 7073 these to show the same information.
7073 7074
7074 7075 * Version 0.1.7 released, 0.1.8 opened for further work.
7075 7076
7076 7077 * Separated all the magic functions into a class called Magic. The
7077 7078 InteractiveShell class was becoming too big for Xemacs to handle
7078 7079 (de-indenting a line would lock it up for 10 seconds while it
7079 7080 backtracked on the whole class!)
7080 7081
7081 7082 FIXME: didn't work. It can be done, but right now namespaces are
7082 7083 all messed up. Do it later (reverted it for now, so at least
7083 7084 everything works as before).
7084 7085
7085 7086 * Got the object introspection system (magic_oinfo) working! I
7086 7087 think this is pretty much ready for release to Janko, so he can
7087 7088 test it for a while and then announce it. Pretty much 100% of what
7088 7089 I wanted for the 'phase 1' release is ready. Happy, tired.
7089 7090
7090 7091 2001-11-12 Fernando Perez <fperez@colorado.edu>
7091 7092
7092 7093 * Version 0.1.6 released, 0.1.7 opened for further work.
7093 7094
7094 7095 * Fixed bug in printing: it used to test for truth before
7095 7096 printing, so 0 wouldn't print. Now checks for None.
7096 7097
7097 7098 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
7098 7099 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
7099 7100 reaches by hand into the outputcache. Think of a better way to do
7100 7101 this later.
7101 7102
7102 7103 * Various small fixes thanks to Nathan's comments.
7103 7104
7104 7105 * Changed magic_pprint to magic_Pprint. This way it doesn't
7105 7106 collide with pprint() and the name is consistent with the command
7106 7107 line option.
7107 7108
7108 7109 * Changed prompt counter behavior to be fully like
7109 7110 Mathematica's. That is, even input that doesn't return a result
7110 7111 raises the prompt counter. The old behavior was kind of confusing
7111 7112 (getting the same prompt number several times if the operation
7112 7113 didn't return a result).
7113 7114
7114 7115 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
7115 7116
7116 7117 * Fixed -Classic mode (wasn't working anymore).
7117 7118
7118 7119 * Added colored prompts using Nathan's new code. Colors are
7119 7120 currently hardwired, they can be user-configurable. For
7120 7121 developers, they can be chosen in file ipythonlib.py, at the
7121 7122 beginning of the CachedOutput class def.
7122 7123
7123 7124 2001-11-11 Fernando Perez <fperez@colorado.edu>
7124 7125
7125 7126 * Version 0.1.5 released, 0.1.6 opened for further work.
7126 7127
7127 7128 * Changed magic_env to *return* the environment as a dict (not to
7128 7129 print it). This way it prints, but it can also be processed.
7129 7130
7130 7131 * Added Verbose exception reporting to interactive
7131 7132 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
7132 7133 traceback. Had to make some changes to the ultraTB file. This is
7133 7134 probably the last 'big' thing in my mental todo list. This ties
7134 7135 in with the next entry:
7135 7136
7136 7137 * Changed -Xi and -Xf to a single -xmode option. Now all the user
7137 7138 has to specify is Plain, Color or Verbose for all exception
7138 7139 handling.
7139 7140
7140 7141 * Removed ShellServices option. All this can really be done via
7141 7142 the magic system. It's easier to extend, cleaner and has automatic
7142 7143 namespace protection and documentation.
7143 7144
7144 7145 2001-11-09 Fernando Perez <fperez@colorado.edu>
7145 7146
7146 7147 * Fixed bug in output cache flushing (missing parameter to
7147 7148 __init__). Other small bugs fixed (found using pychecker).
7148 7149
7149 7150 * Version 0.1.4 opened for bugfixing.
7150 7151
7151 7152 2001-11-07 Fernando Perez <fperez@colorado.edu>
7152 7153
7153 7154 * Version 0.1.3 released, mainly because of the raw_input bug.
7154 7155
7155 7156 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
7156 7157 and when testing for whether things were callable, a call could
7157 7158 actually be made to certain functions. They would get called again
7158 7159 once 'really' executed, with a resulting double call. A disaster
7159 7160 in many cases (list.reverse() would never work!).
7160 7161
7161 7162 * Removed prefilter() function, moved its code to raw_input (which
7162 7163 after all was just a near-empty caller for prefilter). This saves
7163 7164 a function call on every prompt, and simplifies the class a tiny bit.
7164 7165
7165 7166 * Fix _ip to __ip name in magic example file.
7166 7167
7167 7168 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
7168 7169 work with non-gnu versions of tar.
7169 7170
7170 7171 2001-11-06 Fernando Perez <fperez@colorado.edu>
7171 7172
7172 7173 * Version 0.1.2. Just to keep track of the recent changes.
7173 7174
7174 7175 * Fixed nasty bug in output prompt routine. It used to check 'if
7175 7176 arg != None...'. Problem is, this fails if arg implements a
7176 7177 special comparison (__cmp__) which disallows comparing to
7177 7178 None. Found it when trying to use the PhysicalQuantity module from
7178 7179 ScientificPython.
7179 7180
7180 7181 2001-11-05 Fernando Perez <fperez@colorado.edu>
7181 7182
7182 7183 * Also added dirs. Now the pushd/popd/dirs family functions
7183 7184 basically like the shell, with the added convenience of going home
7184 7185 when called with no args.
7185 7186
7186 7187 * pushd/popd slightly modified to mimic shell behavior more
7187 7188 closely.
7188 7189
7189 7190 * Added env,pushd,popd from ShellServices as magic functions. I
7190 7191 think the cleanest will be to port all desired functions from
7191 7192 ShellServices as magics and remove ShellServices altogether. This
7192 7193 will provide a single, clean way of adding functionality
7193 7194 (shell-type or otherwise) to IP.
7194 7195
7195 7196 2001-11-04 Fernando Perez <fperez@colorado.edu>
7196 7197
7197 7198 * Added .ipython/ directory to sys.path. This way users can keep
7198 7199 customizations there and access them via import.
7199 7200
7200 7201 2001-11-03 Fernando Perez <fperez@colorado.edu>
7201 7202
7202 7203 * Opened version 0.1.1 for new changes.
7203 7204
7204 7205 * Changed version number to 0.1.0: first 'public' release, sent to
7205 7206 Nathan and Janko.
7206 7207
7207 7208 * Lots of small fixes and tweaks.
7208 7209
7209 7210 * Minor changes to whos format. Now strings are shown, snipped if
7210 7211 too long.
7211 7212
7212 7213 * Changed ShellServices to work on __main__ so they show up in @who
7213 7214
7214 7215 * Help also works with ? at the end of a line:
7215 7216 ?sin and sin?
7216 7217 both produce the same effect. This is nice, as often I use the
7217 7218 tab-complete to find the name of a method, but I used to then have
7218 7219 to go to the beginning of the line to put a ? if I wanted more
7219 7220 info. Now I can just add the ? and hit return. Convenient.
7220 7221
7221 7222 2001-11-02 Fernando Perez <fperez@colorado.edu>
7222 7223
7223 7224 * Python version check (>=2.1) added.
7224 7225
7225 7226 * Added LazyPython documentation. At this point the docs are quite
7226 7227 a mess. A cleanup is in order.
7227 7228
7228 7229 * Auto-installer created. For some bizarre reason, the zipfiles
7229 7230 module isn't working on my system. So I made a tar version
7230 7231 (hopefully the command line options in various systems won't kill
7231 7232 me).
7232 7233
7233 7234 * Fixes to Struct in genutils. Now all dictionary-like methods are
7234 7235 protected (reasonably).
7235 7236
7236 7237 * Added pager function to genutils and changed ? to print usage
7237 7238 note through it (it was too long).
7238 7239
7239 7240 * Added the LazyPython functionality. Works great! I changed the
7240 7241 auto-quote escape to ';', it's on home row and next to '. But
7241 7242 both auto-quote and auto-paren (still /) escapes are command-line
7242 7243 parameters.
7243 7244
7244 7245
7245 7246 2001-11-01 Fernando Perez <fperez@colorado.edu>
7246 7247
7247 7248 * Version changed to 0.0.7. Fairly large change: configuration now
7248 7249 is all stored in a directory, by default .ipython. There, all
7249 7250 config files have normal looking names (not .names)
7250 7251
7251 7252 * Version 0.0.6 Released first to Lucas and Archie as a test
7252 7253 run. Since it's the first 'semi-public' release, change version to
7253 7254 > 0.0.6 for any changes now.
7254 7255
7255 7256 * Stuff I had put in the ipplib.py changelog:
7256 7257
7257 7258 Changes to InteractiveShell:
7258 7259
7259 7260 - Made the usage message a parameter.
7260 7261
7261 7262 - Require the name of the shell variable to be given. It's a bit
7262 7263 of a hack, but allows the name 'shell' not to be hardwired in the
7263 7264 magic (@) handler, which is problematic b/c it requires
7264 7265 polluting the global namespace with 'shell'. This in turn is
7265 7266 fragile: if a user redefines a variable called shell, things
7266 7267 break.
7267 7268
7268 7269 - magic @: all functions available through @ need to be defined
7269 7270 as magic_<name>, even though they can be called simply as
7270 7271 @<name>. This allows the special command @magic to gather
7271 7272 information automatically about all existing magic functions,
7272 7273 even if they are run-time user extensions, by parsing the shell
7273 7274 instance __dict__ looking for special magic_ names.
7274 7275
7275 7276 - mainloop: added *two* local namespace parameters. This allows
7276 7277 the class to differentiate between parameters which were there
7277 7278 before and after command line initialization was processed. This
7278 7279 way, later @who can show things loaded at startup by the
7279 7280 user. This trick was necessary to make session saving/reloading
7280 7281 really work: ideally after saving/exiting/reloading a session,
7281 7282 *everything* should look the same, including the output of @who. I
7282 7283 was only able to make this work with this double namespace
7283 7284 trick.
7284 7285
7285 7286 - added a header to the logfile which allows (almost) full
7286 7287 session restoring.
7287 7288
7288 7289 - prepend lines beginning with @ or !, with a and log
7289 7290 them. Why? !lines: may be useful to know what you did @lines:
7290 7291 they may affect session state. So when restoring a session, at
7291 7292 least inform the user of their presence. I couldn't quite get
7292 7293 them to properly re-execute, but at least the user is warned.
7293 7294
7294 7295 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now