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