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