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