##// END OF EJS Templates
- Big iplib cleanups, moved all tab-completion functionality to its own module...
fperez -
Show More
This diff has been collapsed as it changes many lines, (523 lines changed) Show them Hide them
@@ -0,0 +1,523 b''
1 """Word completion for IPython.
2
3 This module is a fork of the rlcompleter module in the Python standard
4 library. The original enhancements made to rlcompleter have been sent
5 upstream and were accepted as of Python 2.3, but we need a lot more
6 functionality specific to IPython, so this module will continue to live as an
7 IPython-specific utility.
8
9 ---------------------------------------------------------------------------
10 Original rlcompleter documentation:
11
12 This requires the latest extension to the readline module (the
13 completes keywords, built-ins and globals in __main__; when completing
14 NAME.NAME..., it evaluates (!) the expression up to the last dot and
15 completes its attributes.
16
17 It's very cool to do "import string" type "string.", hit the
18 completion key (twice), and see the list of names defined by the
19 string module!
20
21 Tip: to use the tab key as the completion key, call
22
23 readline.parse_and_bind("tab: complete")
24
25 Notes:
26
27 - Exceptions raised by the completer function are *ignored* (and
28 generally cause the completion to fail). This is a feature -- since
29 readline sets the tty device in raw (or cbreak) mode, printing a
30 traceback wouldn't work well without some complicated hoopla to save,
31 reset and restore the tty state.
32
33 - The evaluation of the NAME.NAME... form may cause arbitrary
34 application defined code to be executed if an object with a
35 __getattr__ hook is found. Since it is the responsibility of the
36 application (or the user) to enable this feature, I consider this an
37 acceptable risk. More complicated expressions (e.g. function calls or
38 indexing operations) are *not* evaluated.
39
40 - GNU readline is also used by the built-in functions input() and
41 raw_input(), and thus these also benefit/suffer from the completer
42 features. Clearly an interactive application can benefit by
43 specifying its own completer function and using raw_input() for all
44 its input.
45
46 - When the original stdin is not a tty device, GNU readline is never
47 used, and this module (and the readline module) are silently inactive.
48
49 """
50
51 #*****************************************************************************
52 #
53 # Since this file is essentially a minimally modified copy of the rlcompleter
54 # module which is part of the standard Python distribution, I assume that the
55 # proper procedure is to maintain its copyright as belonging to the Python
56 # Software Foundation (in addition to my own, for all new code).
57 #
58 # Copyright (C) 2001 Python Software Foundation, www.python.org
59 # Copyright (C) 2001-2005 Fernando Perez. <fperez@colorado.edu>
60 #
61 # Distributed under the terms of the BSD License. The full license is in
62 # the file COPYING, distributed as part of this software.
63 #
64 #*****************************************************************************
65
66 import __builtin__
67 import __main__
68 import glob
69 import keyword
70 import os
71 import re
72 import readline
73 import sys
74 import types
75
76 from IPython.genutils import shlex_split
77
78 __all__ = ['Completer','IPCompleter']
79
80 def get_class_members(klass):
81 ret = dir(klass)
82 if hasattr(klass,'__bases__'):
83 for base in klass.__bases__:
84 ret.extend(get_class_members(base))
85 return ret
86
87 class Completer:
88 def __init__(self,namespace=None,global_namespace=None):
89 """Create a new completer for the command line.
90
91 Completer([namespace,global_namespace]) -> completer instance.
92
93 If unspecified, the default namespace where completions are performed
94 is __main__ (technically, __main__.__dict__). Namespaces should be
95 given as dictionaries.
96
97 An optional second namespace can be given. This allows the completer
98 to handle cases where both the local and global scopes need to be
99 distinguished.
100
101 Completer instances should be used as the completion mechanism of
102 readline via the set_completer() call:
103
104 readline.set_completer(Completer(my_namespace).complete)
105 """
106
107 if namespace and type(namespace) != types.DictType:
108 raise TypeError,'namespace must be a dictionary'
109
110 if global_namespace and type(global_namespace) != types.DictType:
111 raise TypeError,'global_namespace must be a dictionary'
112
113 # Don't bind to namespace quite yet, but flag whether the user wants a
114 # specific namespace or to use __main__.__dict__. This will allow us
115 # to bind to __main__.__dict__ at completion time, not now.
116 if namespace is None:
117 self.use_main_ns = 1
118 else:
119 self.use_main_ns = 0
120 self.namespace = namespace
121
122 # The global namespace, if given, can be bound directly
123 if global_namespace is None:
124 self.global_namespace = {}
125 else:
126 self.global_namespace = global_namespace
127
128 def complete(self, text, state):
129 """Return the next possible completion for 'text'.
130
131 This is called successively with state == 0, 1, 2, ... until it
132 returns None. The completion should begin with 'text'.
133
134 """
135 if self.use_main_ns:
136 self.namespace = __main__.__dict__
137
138 if state == 0:
139 if "." in text:
140 self.matches = self.attr_matches(text)
141 else:
142 self.matches = self.global_matches(text)
143 try:
144 return self.matches[state]
145 except IndexError:
146 return None
147
148 def global_matches(self, text):
149 """Compute matches when text is a simple name.
150
151 Return a list of all keywords, built-in functions and names currently
152 defined in self.namespace or self.global_namespace that match.
153
154 """
155 matches = []
156 match_append = matches.append
157 n = len(text)
158 for lst in [keyword.kwlist,
159 __builtin__.__dict__.keys(),
160 self.namespace.keys(),
161 self.global_namespace.keys()]:
162 for word in lst:
163 if word[:n] == text and word != "__builtins__":
164 match_append(word)
165 return matches
166
167 def attr_matches(self, text):
168 """Compute matches when text contains a dot.
169
170 Assuming the text is of the form NAME.NAME....[NAME], and is
171 evaluatable in self.namespace or self.global_namespace, it will be
172 evaluated and its attributes (as revealed by dir()) are used as
173 possible completions. (For class instances, class members are are
174 also considered.)
175
176 WARNING: this can still invoke arbitrary C code, if an object
177 with a __getattr__ hook is evaluated.
178
179 """
180 import re
181
182 # Another option, seems to work great. Catches things like ''.<tab>
183 m = re.match(r"(\S+(\.\w+)*)\.(\w*)$", text)
184
185 if not m:
186 return []
187 expr, attr = m.group(1, 3)
188 try:
189 object = eval(expr, self.namespace)
190 except:
191 object = eval(expr, self.global_namespace)
192 words = [w for w in dir(object) if isinstance(w, basestring)]
193 if hasattr(object,'__class__'):
194 words.append('__class__')
195 words.extend(get_class_members(object.__class__))
196 n = len(attr)
197 matches = []
198 for word in words:
199 if word[:n] == attr and word != "__builtins__":
200 matches.append("%s.%s" % (expr, word))
201 return matches
202
203 class IPCompleter(Completer):
204 """Extension of the completer class with IPython-specific features"""
205
206 def __init__(self,shell,namespace=None,global_namespace=None,
207 omit__names=0,alias_table=None):
208 """IPCompleter() -> completer
209
210 Return a completer object suitable for use by the readline library
211 via readline.set_completer().
212
213 Inputs:
214
215 - shell: a pointer to the ipython shell itself. This is needed
216 because this completer knows about magic functions, and those can
217 only be accessed via the ipython instance.
218
219 - namespace: an optional dict where completions are performed.
220
221 - global_namespace: secondary optional dict for completions, to
222 handle cases (such as IPython embedded inside functions) where
223 both Python scopes are visible.
224
225 - The optional omit__names parameter sets the completer to omit the
226 'magic' names (__magicname__) for python objects unless the text
227 to be completed explicitly starts with one or more underscores.
228
229 - If alias_table is supplied, it should be a dictionary of aliases
230 to complete. """
231
232 Completer.__init__(self,namespace,global_namespace)
233 self.magic_prefix = shell.name+'.magic_'
234 self.magic_escape = shell.ESC_MAGIC
235 self.readline = readline
236 delims = self.readline.get_completer_delims()
237 delims = delims.replace(self.magic_escape,'')
238 self.readline.set_completer_delims(delims)
239 self.get_line_buffer = self.readline.get_line_buffer
240 self.omit__names = omit__names
241 self.merge_completions = shell.rc.readline_merge_completions
242
243 if alias_table is None:
244 alias_table = {}
245 self.alias_table = alias_table
246 # Regexp to split filenames with spaces in them
247 self.space_name_re = re.compile(r'([^\\] )')
248 # Hold a local ref. to glob.glob for speed
249 self.glob = glob.glob
250 # Special handling of backslashes needed in win32 platforms
251 if sys.platform == "win32":
252 self.clean_glob = self._clean_glob_win32
253 else:
254 self.clean_glob = self._clean_glob
255 self.matchers = [self.python_matches,
256 self.file_matches,
257 self.alias_matches,
258 self.python_func_kw_matches]
259
260 # Code contributed by Alex Schmolck, for ipython/emacs integration
261 def all_completions(self, text):
262 """Return all possible completions for the benefit of emacs."""
263
264 completions = []
265 comp_append = completions.append
266 try:
267 for i in xrange(sys.maxint):
268 res = self.complete(text, i)
269
270 if not res: break
271
272 comp_append(res)
273 #XXX workaround for ``notDefined.<tab>``
274 except NameError:
275 pass
276 return completions
277 # /end Alex Schmolck code.
278
279 def _clean_glob(self,text):
280 return self.glob("%s*" % text)
281
282 def _clean_glob_win32(self,text):
283 return [f.replace("\\","/")
284 for f in self.glob("%s*" % text)]
285
286 def file_matches(self, text):
287 """Match filneames, expanding ~USER type strings.
288
289 Most of the seemingly convoluted logic in this completer is an
290 attempt to handle filenames with spaces in them. And yet it's not
291 quite perfect, because Python's readline doesn't expose all of the
292 GNU readline details needed for this to be done correctly.
293
294 For a filename with a space in it, the printed completions will be
295 only the parts after what's already been typed (instead of the
296 full completions, as is normally done). I don't think with the
297 current (as of Python 2.3) Python readline it's possible to do
298 better."""
299
300 #print 'Completer->file_matches: <%s>' % text # dbg
301
302 # chars that require escaping with backslash - i.e. chars
303 # that readline treats incorrectly as delimiters, but we
304 # don't want to treat as delimiters in filename matching
305 # when escaped with backslash
306
307 protectables = ' ()[]{}'
308
309 def protect_filename(s):
310 return "".join([(ch in protectables and '\\' + ch or ch)
311 for ch in s])
312
313 lbuf = self.get_line_buffer()[:self.readline.get_endidx()]
314 open_quotes = 0 # track strings with open quotes
315 try:
316 lsplit = shlex_split(lbuf)[-1]
317 except ValueError:
318 # typically an unmatched ", or backslash without escaped char.
319 if lbuf.count('"')==1:
320 open_quotes = 1
321 lsplit = lbuf.split('"')[-1]
322 elif lbuf.count("'")==1:
323 open_quotes = 1
324 lsplit = lbuf.split("'")[-1]
325 else:
326 return None
327 except IndexError:
328 # tab pressed on empty line
329 lsplit = ""
330
331 if lsplit != protect_filename(lsplit):
332 # if protectables are found, do matching on the whole escaped
333 # name
334 has_protectables = 1
335 text0,text = text,lsplit
336 else:
337 has_protectables = 0
338 text = os.path.expanduser(text)
339
340 if text == "":
341 return [protect_filename(f) for f in self.glob("*")]
342
343 m0 = self.clean_glob(text.replace('\\',''))
344 if has_protectables:
345 # If we had protectables, we need to revert our changes to the
346 # beginning of filename so that we don't double-write the part
347 # of the filename we have so far
348 len_lsplit = len(lsplit)
349 matches = [text0 + protect_filename(f[len_lsplit:]) for f in m0]
350 else:
351 if open_quotes:
352 # if we have a string with an open quote, we don't need to
353 # protect the names at all (and we _shouldn't_, as it
354 # would cause bugs when the filesystem call is made).
355 matches = m0
356 else:
357 matches = [protect_filename(f) for f in m0]
358 if len(matches) == 1 and os.path.isdir(matches[0]):
359 # Takes care of links to directories also. Use '/'
360 # explicitly, even under Windows, so that name completions
361 # don't end up escaped.
362 matches[0] += '/'
363 return matches
364
365 def alias_matches(self, text):
366 """Match internal system aliases"""
367 #print 'Completer->alias_matches:',text # dbg
368 text = os.path.expanduser(text)
369 aliases = self.alias_table.keys()
370 if text == "":
371 return aliases
372 else:
373 return [alias for alias in aliases if alias.startswith(text)]
374
375 def python_matches(self,text):
376 """Match attributes or global python names"""
377 #print 'Completer->python_matches' # dbg
378 if "." in text:
379 try:
380 matches = self.attr_matches(text)
381 if text.endswith('.') and self.omit__names:
382 if self.omit__names == 1:
383 # true if txt is _not_ a __ name, false otherwise:
384 no__name = (lambda txt:
385 re.match(r'.*\.__.*?__',txt) is None)
386 else:
387 # true if txt is _not_ a _ name, false otherwise:
388 no__name = (lambda txt:
389 re.match(r'.*\._.*?',txt) is None)
390 matches = filter(no__name, matches)
391 except NameError:
392 # catches <undefined attributes>.<tab>
393 matches = []
394 else:
395 matches = self.global_matches(text)
396 # this is so completion finds magics when automagic is on:
397 if matches == [] and not text.startswith(os.sep):
398 matches = self.attr_matches(self.magic_prefix+text)
399 return matches
400
401 def _default_arguments(self, obj):
402 """Return the list of default arguments of obj if it is callable,
403 or empty list otherwise."""
404
405 if not (inspect.isfunction(obj) or inspect.ismethod(obj)):
406 # for classes, check for __init__,__new__
407 if inspect.isclass(obj):
408 obj = (getattr(obj,'__init__',None) or
409 getattr(obj,'__new__',None))
410 # for all others, check if they are __call__able
411 elif hasattr(obj, '__call__'):
412 obj = obj.__call__
413 # XXX: is there a way to handle the builtins ?
414 try:
415 args,_,_1,defaults = inspect.getargspec(obj)
416 if defaults:
417 return args[-len(defaults):]
418 except TypeError: pass
419 return []
420
421 def python_func_kw_matches(self,text):
422 """Match named parameters (kwargs) of the last open function"""
423
424 if "." in text: # a parameter cannot be dotted
425 return []
426 try: regexp = self.__funcParamsRegex
427 except AttributeError:
428 regexp = self.__funcParamsRegex = re.compile(r'''
429 '.*?' | # single quoted strings or
430 ".*?" | # double quoted strings or
431 \w+ | # identifier
432 \S # other characters
433 ''', re.VERBOSE | re.DOTALL)
434 # 1. find the nearest identifier that comes before an unclosed
435 # parenthesis e.g. for "foo (1+bar(x), pa", the candidate is "foo"
436 tokens = regexp.findall(self.get_line_buffer())
437 tokens.reverse()
438 iterTokens = iter(tokens); openPar = 0
439 for token in iterTokens:
440 if token == ')':
441 openPar -= 1
442 elif token == '(':
443 openPar += 1
444 if openPar > 0:
445 # found the last unclosed parenthesis
446 break
447 else:
448 return []
449 # 2. Concatenate dotted names ("foo.bar" for "foo.bar(x, pa" )
450 ids = []
451 isId = re.compile(r'\w+$').match
452 while True:
453 try:
454 ids.append(iterTokens.next())
455 if not isId(ids[-1]):
456 ids.pop(); break
457 if not iterTokens.next() == '.':
458 break
459 except StopIteration:
460 break
461 # lookup the candidate callable matches either using global_matches
462 # or attr_matches for dotted names
463 if len(ids) == 1:
464 callableMatches = self.global_matches(ids[0])
465 else:
466 callableMatches = self.attr_matches('.'.join(ids[::-1]))
467 argMatches = []
468 for callableMatch in callableMatches:
469 try: namedArgs = self._default_arguments(eval(callableMatch,
470 self.namespace))
471 except: continue
472 for namedArg in namedArgs:
473 if namedArg.startswith(text):
474 argMatches.append("%s=" %namedArg)
475 return argMatches
476
477 def complete(self, text, state):
478 """Return the next possible completion for 'text'.
479
480 This is called successively with state == 0, 1, 2, ... until it
481 returns None. The completion should begin with 'text'. """
482
483 #print '\n*** COMPLETE: <%s> (%s)' % (text,state) # dbg
484
485 # if there is only a tab on a line with only whitespace, instead
486 # of the mostly useless 'do you want to see all million
487 # completions' message, just do the right thing and give the user
488 # his tab! Incidentally, this enables pasting of tabbed text from
489 # an editor (as long as autoindent is off).
490 if not self.get_line_buffer().strip():
491 self.readline.insert_text('\t')
492 return None
493
494 magic_escape = self.magic_escape
495 magic_prefix = self.magic_prefix
496
497 try:
498 if text.startswith(magic_escape):
499 text = text.replace(magic_escape,magic_prefix)
500 elif text.startswith('~'):
501 text = os.path.expanduser(text)
502 if state == 0:
503 # Extend the list of completions with the results of each
504 # matcher, so we return results to the user from all
505 # namespaces.
506 if self.merge_completions:
507 self.matches = []
508 for matcher in self.matchers:
509 self.matches.extend(matcher(text))
510 else:
511 for matcher in self.matchers:
512 self.matches = matcher(text)
513 if self.matches:
514 break
515
516 try:
517 return self.matches[state].replace(magic_prefix,magic_escape)
518 except IndexError:
519 return None
520 except:
521 #import traceback; traceback.print_exc() # dbg
522 # If completion fails, don't annoy the user.
523 return None
This diff has been collapsed as it changes many lines, (518 lines changed) Show them Hide them
@@ -1,2157 +1,1887 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 IPython -- An enhanced Interactive Python
3 IPython -- An enhanced Interactive Python
4
4
5 Requires Python 2.1 or newer.
5 Requires Python 2.1 or newer.
6
6
7 This file contains all the classes and helper functions specific to IPython.
7 This file contains all the classes and helper functions specific to IPython.
8
8
9 $Id: iplib.py 955 2005-12-27 07:50:29Z fperez $
9 $Id: iplib.py 957 2005-12-27 22:33:22Z fperez $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
14 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
14 # Copyright (C) 2001-2005 Fernando Perez. <fperez@colorado.edu>
15 #
15 #
16 # Distributed under the terms of the BSD License. The full license is in
16 # Distributed under the terms of the BSD License. The full license is in
17 # the file COPYING, distributed as part of this software.
17 # the file COPYING, distributed as part of this software.
18 #
18 #
19 # Note: this code originally subclassed code.InteractiveConsole from the
19 # Note: this code originally subclassed code.InteractiveConsole from the
20 # Python standard library. Over time, much of that class has been copied
20 # Python standard library. Over time, all of that class has been copied
21 # verbatim here for modifications which could not be accomplished by
21 # verbatim here for modifications which could not be accomplished by
22 # subclassing. The Python License (sec. 2) allows for this, but it's always
22 # subclassing. At this point, there are no dependencies at all on the code
23 # nice to acknowledge credit where credit is due.
23 # module anymore (it is not even imported). The Python License (sec. 2)
24 # allows for this, but it's always nice to acknowledge credit where credit is
25 # due.
24 #*****************************************************************************
26 #*****************************************************************************
25
27
26 #****************************************************************************
28 #****************************************************************************
27 # Modules and globals
29 # Modules and globals
28
30
29 from __future__ import generators # for 2.2 backwards-compatibility
31 from __future__ import generators # for 2.2 backwards-compatibility
30
32
31 from IPython import Release
33 from IPython import Release
32 __author__ = '%s <%s>\n%s <%s>' % \
34 __author__ = '%s <%s>\n%s <%s>' % \
33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
35 ( Release.authors['Janko'] + Release.authors['Fernando'] )
34 __license__ = Release.license
36 __license__ = Release.license
35 __version__ = Release.version
37 __version__ = Release.version
36
38
37 # Python standard modules
39 # Python standard modules
38 import __main__
40 import __main__
39 import __builtin__
41 import __builtin__
42 import bdb
43 import codeop
44 import cPickle as pickle
40 import exceptions
45 import exceptions
46 import glob
47 import inspect
41 import keyword
48 import keyword
42 import new
49 import new
43 import os, sys, shutil
50 import os
44 import code, glob, types, re
51 import pdb
45 import string, StringIO
52 import pydoc
46 import inspect, pydoc
53 import re
47 import bdb, pdb
54 import shutil
48 import UserList # don't subclass list so this works with Python2.1
55 import string
49 from pprint import pprint, pformat
56 import StringIO
50 import cPickle as pickle
57 import sys
51 import traceback
58 import traceback
52 from codeop import CommandCompiler
59 import types
60
61 from pprint import pprint, pformat
53
62
54 # IPython's own modules
63 # IPython's own modules
55 import IPython
64 import IPython
56 from IPython import OInspect,PyColorize,ultraTB
65 from IPython import OInspect,PyColorize,ultraTB
57 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
66 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
58 from IPython.Logger import Logger
67 from IPython.Logger import Logger
59 from IPython.Magic import Magic,magic2python,shlex_split
68 from IPython.Magic import Magic,magic2python
60 from IPython.usage import cmd_line_usage,interactive_usage
69 from IPython.usage import cmd_line_usage,interactive_usage
61 from IPython.Struct import Struct
70 from IPython.Struct import Struct
62 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
71 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
63 from IPython.FakeModule import FakeModule
72 from IPython.FakeModule import FakeModule
64 from IPython.background_jobs import BackgroundJobManager
73 from IPython.background_jobs import BackgroundJobManager
65 from IPython.PyColorize import Parser
74 from IPython.PyColorize import Parser
66 from IPython.genutils import *
75 from IPython.genutils import *
67
76
68 # Global pointer to the running
77 # Global pointer to the running
69
78
70 # store the builtin raw_input globally, and use this always, in case user code
79 # store the builtin raw_input globally, and use this always, in case user code
71 # overwrites it (like wx.py.PyShell does)
80 # overwrites it (like wx.py.PyShell does)
72 raw_input_original = raw_input
81 raw_input_original = raw_input
73
82
74 #****************************************************************************
83 #****************************************************************************
75 # Some utility function definitions
84 # Some utility function definitions
76
85
77 class Bunch: pass
78
79 def esc_quotes(strng):
86 def esc_quotes(strng):
80 """Return the input string with single and double quotes escaped out"""
87 """Return the input string with single and double quotes escaped out"""
81
88
82 return strng.replace('"','\\"').replace("'","\\'")
89 return strng.replace('"','\\"').replace("'","\\'")
83
90
84 def import_fail_info(mod_name,fns=None):
91 def import_fail_info(mod_name,fns=None):
85 """Inform load failure for a module."""
92 """Inform load failure for a module."""
86
93
87 if fns == None:
94 if fns == None:
88 warn("Loading of %s failed.\n" % (mod_name,))
95 warn("Loading of %s failed.\n" % (mod_name,))
89 else:
96 else:
90 warn("Loading of %s from %s failed.\n" % (fns,mod_name))
97 warn("Loading of %s from %s failed.\n" % (fns,mod_name))
91
98
92 def qw_lol(indata):
99 def qw_lol(indata):
93 """qw_lol('a b') -> [['a','b']],
100 """qw_lol('a b') -> [['a','b']],
94 otherwise it's just a call to qw().
101 otherwise it's just a call to qw().
95
102
96 We need this to make sure the modules_some keys *always* end up as a
103 We need this to make sure the modules_some keys *always* end up as a
97 list of lists."""
104 list of lists."""
98
105
99 if type(indata) in StringTypes:
106 if type(indata) in StringTypes:
100 return [qw(indata)]
107 return [qw(indata)]
101 else:
108 else:
102 return qw(indata)
109 return qw(indata)
103
110
104 def ipmagic(arg_s):
111 def ipmagic(arg_s):
105 """Call a magic function by name.
112 """Call a magic function by name.
106
113
107 Input: a string containing the name of the magic function to call and any
114 Input: a string containing the name of the magic function to call and any
108 additional arguments to be passed to the magic.
115 additional arguments to be passed to the magic.
109
116
110 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
117 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
111 prompt:
118 prompt:
112
119
113 In[1]: %name -opt foo bar
120 In[1]: %name -opt foo bar
114
121
115 To call a magic without arguments, simply use ipmagic('name').
122 To call a magic without arguments, simply use ipmagic('name').
116
123
117 This provides a proper Python function to call IPython's magics in any
124 This provides a proper Python function to call IPython's magics in any
118 valid Python code you can type at the interpreter, including loops and
125 valid Python code you can type at the interpreter, including loops and
119 compound statements. It is added by IPython to the Python builtin
126 compound statements. It is added by IPython to the Python builtin
120 namespace upon initialization."""
127 namespace upon initialization."""
121
128
122 args = arg_s.split(' ',1)
129 args = arg_s.split(' ',1)
123 magic_name = args[0]
130 magic_name = args[0]
124 if magic_name.startswith(__IPYTHON__.ESC_MAGIC):
131 if magic_name.startswith(__IPYTHON__.ESC_MAGIC):
125 magic_name = magic_name[1:]
132 magic_name = magic_name[1:]
126 try:
133 try:
127 magic_args = args[1]
134 magic_args = args[1]
128 except IndexError:
135 except IndexError:
129 magic_args = ''
136 magic_args = ''
130 fn = getattr(__IPYTHON__,'magic_'+magic_name,None)
137 fn = getattr(__IPYTHON__,'magic_'+magic_name,None)
131 if fn is None:
138 if fn is None:
132 error("Magic function `%s` not found." % magic_name)
139 error("Magic function `%s` not found." % magic_name)
133 else:
140 else:
134 magic_args = __IPYTHON__.var_expand(magic_args)
141 magic_args = __IPYTHON__.var_expand(magic_args)
135 return fn(magic_args)
142 return fn(magic_args)
136
143
137 def ipalias(arg_s):
144 def ipalias(arg_s):
138 """Call an alias by name.
145 """Call an alias by name.
139
146
140 Input: a string containing the name of the alias to call and any
147 Input: a string containing the name of the alias to call and any
141 additional arguments to be passed to the magic.
148 additional arguments to be passed to the magic.
142
149
143 ipalias('name -opt foo bar') is equivalent to typing at the ipython
150 ipalias('name -opt foo bar') is equivalent to typing at the ipython
144 prompt:
151 prompt:
145
152
146 In[1]: name -opt foo bar
153 In[1]: name -opt foo bar
147
154
148 To call an alias without arguments, simply use ipalias('name').
155 To call an alias without arguments, simply use ipalias('name').
149
156
150 This provides a proper Python function to call IPython's aliases in any
157 This provides a proper Python function to call IPython's aliases in any
151 valid Python code you can type at the interpreter, including loops and
158 valid Python code you can type at the interpreter, including loops and
152 compound statements. It is added by IPython to the Python builtin
159 compound statements. It is added by IPython to the Python builtin
153 namespace upon initialization."""
160 namespace upon initialization."""
154
161
155 args = arg_s.split(' ',1)
162 args = arg_s.split(' ',1)
156 alias_name = args[0]
163 alias_name = args[0]
157 try:
164 try:
158 alias_args = args[1]
165 alias_args = args[1]
159 except IndexError:
166 except IndexError:
160 alias_args = ''
167 alias_args = ''
161 if alias_name in __IPYTHON__.alias_table:
168 if alias_name in __IPYTHON__.alias_table:
162 __IPYTHON__.call_alias(alias_name,alias_args)
169 __IPYTHON__.call_alias(alias_name,alias_args)
163 else:
170 else:
164 error("Alias `%s` not found." % alias_name)
171 error("Alias `%s` not found." % alias_name)
165
172
166 #-----------------------------------------------------------------------------
173 def softspace(file, newvalue):
167 # Local use classes
174 """Copied from code.py, to remove the dependency"""
168 try:
175 oldvalue = 0
169 from IPython import FlexCompleter
176 try:
170
177 oldvalue = file.softspace
171 class MagicCompleter(FlexCompleter.Completer):
178 except AttributeError:
172 """Extension of the completer class to work on %-prefixed lines."""
179 pass
173
180 try:
174 def __init__(self,shell,namespace=None,global_namespace=None,
181 file.softspace = newvalue
175 omit__names=0,alias_table=None):
182 except (AttributeError, TypeError):
176 """MagicCompleter() -> completer
183 # "attribute-less object" or "read-only attributes"
177
184 pass
178 Return a completer object suitable for use by the readline library
185 return oldvalue
179 via readline.set_completer().
180
181 Inputs:
182
183 - shell: a pointer to the ipython shell itself. This is needed
184 because this completer knows about magic functions, and those can
185 only be accessed via the ipython instance.
186
187 - namespace: an optional dict where completions are performed.
188
189 - global_namespace: secondary optional dict for completions, to
190 handle cases (such as IPython embedded inside functions) where
191 both Python scopes are visible.
192
193 - The optional omit__names parameter sets the completer to omit the
194 'magic' names (__magicname__) for python objects unless the text
195 to be completed explicitly starts with one or more underscores.
196
197 - If alias_table is supplied, it should be a dictionary of aliases
198 to complete. """
199
200 FlexCompleter.Completer.__init__(self,namespace)
201 self.magic_prefix = shell.name+'.magic_'
202 self.magic_escape = shell.ESC_MAGIC
203 self.readline = FlexCompleter.readline
204 delims = self.readline.get_completer_delims()
205 delims = delims.replace(self.magic_escape,'')
206 self.readline.set_completer_delims(delims)
207 self.get_line_buffer = self.readline.get_line_buffer
208 self.omit__names = omit__names
209 self.merge_completions = shell.rc.readline_merge_completions
210
211 if alias_table is None:
212 alias_table = {}
213 self.alias_table = alias_table
214 # Regexp to split filenames with spaces in them
215 self.space_name_re = re.compile(r'([^\\] )')
216 # Hold a local ref. to glob.glob for speed
217 self.glob = glob.glob
218 # Special handling of backslashes needed in win32 platforms
219 if sys.platform == "win32":
220 self.clean_glob = self._clean_glob_win32
221 else:
222 self.clean_glob = self._clean_glob
223 self.matchers = [self.python_matches,
224 self.file_matches,
225 self.alias_matches,
226 self.python_func_kw_matches]
227
228 # Code contributed by Alex Schmolck, for ipython/emacs integration
229 def all_completions(self, text):
230 """Return all possible completions for the benefit of emacs."""
231
232 completions = []
233 comp_append = completions.append
234 try:
235 for i in xrange(sys.maxint):
236 res = self.complete(text, i)
237
238 if not res: break
239
240 comp_append(res)
241 #XXX workaround for ``notDefined.<tab>``
242 except NameError:
243 pass
244 return completions
245 # /end Alex Schmolck code.
246
247 def _clean_glob(self,text):
248 return self.glob("%s*" % text)
249
250 def _clean_glob_win32(self,text):
251 return [f.replace("\\","/")
252 for f in self.glob("%s*" % text)]
253
254 def file_matches(self, text):
255 """Match filneames, expanding ~USER type strings.
256
257 Most of the seemingly convoluted logic in this completer is an
258 attempt to handle filenames with spaces in them. And yet it's not
259 quite perfect, because Python's readline doesn't expose all of the
260 GNU readline details needed for this to be done correctly.
261
262 For a filename with a space in it, the printed completions will be
263 only the parts after what's already been typed (instead of the
264 full completions, as is normally done). I don't think with the
265 current (as of Python 2.3) Python readline it's possible to do
266 better."""
267
268 #print 'Completer->file_matches: <%s>' % text # dbg
269
270 # chars that require escaping with backslash - i.e. chars
271 # that readline treats incorrectly as delimiters, but we
272 # don't want to treat as delimiters in filename matching
273 # when escaped with backslash
274
275 protectables = ' ()[]{}'
276
277 def protect_filename(s):
278 return "".join([(ch in protectables and '\\' + ch or ch)
279 for ch in s])
280
186
281 lbuf = self.get_line_buffer()[:self.readline.get_endidx()]
282 open_quotes = 0 # track strings with open quotes
283 try:
284 lsplit = shlex_split(lbuf)[-1]
285 except ValueError:
286 # typically an unmatched ", or backslash without escaped char.
287 if lbuf.count('"')==1:
288 open_quotes = 1
289 lsplit = lbuf.split('"')[-1]
290 elif lbuf.count("'")==1:
291 open_quotes = 1
292 lsplit = lbuf.split("'")[-1]
293 else:
294 return None
295 except IndexError:
296 # tab pressed on empty line
297 lsplit = ""
298
299 if lsplit != protect_filename(lsplit):
300 # if protectables are found, do matching on the whole escaped
301 # name
302 has_protectables = 1
303 text0,text = text,lsplit
304 else:
305 has_protectables = 0
306 text = os.path.expanduser(text)
307
308 if text == "":
309 return [protect_filename(f) for f in self.glob("*")]
310
311 m0 = self.clean_glob(text.replace('\\',''))
312 if has_protectables:
313 # If we had protectables, we need to revert our changes to the
314 # beginning of filename so that we don't double-write the part
315 # of the filename we have so far
316 len_lsplit = len(lsplit)
317 matches = [text0 + protect_filename(f[len_lsplit:]) for f in m0]
318 else:
319 if open_quotes:
320 # if we have a string with an open quote, we don't need to
321 # protect the names at all (and we _shouldn't_, as it
322 # would cause bugs when the filesystem call is made).
323 matches = m0
324 else:
325 matches = [protect_filename(f) for f in m0]
326 if len(matches) == 1 and os.path.isdir(matches[0]):
327 # Takes care of links to directories also. Use '/'
328 # explicitly, even under Windows, so that name completions
329 # don't end up escaped.
330 matches[0] += '/'
331 return matches
332
333 def alias_matches(self, text):
334 """Match internal system aliases"""
335 #print 'Completer->alias_matches:',text # dbg
336 text = os.path.expanduser(text)
337 aliases = self.alias_table.keys()
338 if text == "":
339 return aliases
340 else:
341 return [alias for alias in aliases if alias.startswith(text)]
342
343 def python_matches(self,text):
344 """Match attributes or global python names"""
345 #print 'Completer->python_matches' # dbg
346 if "." in text:
347 try:
348 matches = self.attr_matches(text)
349 if text.endswith('.') and self.omit__names:
350 if self.omit__names == 1:
351 # true if txt is _not_ a __ name, false otherwise:
352 no__name = (lambda txt:
353 re.match(r'.*\.__.*?__',txt) is None)
354 else:
355 # true if txt is _not_ a _ name, false otherwise:
356 no__name = (lambda txt:
357 re.match(r'.*\._.*?',txt) is None)
358 matches = filter(no__name, matches)
359 except NameError:
360 # catches <undefined attributes>.<tab>
361 matches = []
362 else:
363 matches = self.global_matches(text)
364 # this is so completion finds magics when automagic is on:
365 if matches == [] and not text.startswith(os.sep):
366 matches = self.attr_matches(self.magic_prefix+text)
367 return matches
368
369 def _default_arguments(self, obj):
370 """Return the list of default arguments of obj if it is callable,
371 or empty list otherwise."""
372
373 if not (inspect.isfunction(obj) or inspect.ismethod(obj)):
374 # for classes, check for __init__,__new__
375 if inspect.isclass(obj):
376 obj = (getattr(obj,'__init__',None) or
377 getattr(obj,'__new__',None))
378 # for all others, check if they are __call__able
379 elif hasattr(obj, '__call__'):
380 obj = obj.__call__
381 # XXX: is there a way to handle the builtins ?
382 try:
383 args,_,_1,defaults = inspect.getargspec(obj)
384 if defaults:
385 return args[-len(defaults):]
386 except TypeError: pass
387 return []
388
389 def python_func_kw_matches(self,text):
390 """Match named parameters (kwargs) of the last open function"""
391
392 if "." in text: # a parameter cannot be dotted
393 return []
394 try: regexp = self.__funcParamsRegex
395 except AttributeError:
396 regexp = self.__funcParamsRegex = re.compile(r'''
397 '.*?' | # single quoted strings or
398 ".*?" | # double quoted strings or
399 \w+ | # identifier
400 \S # other characters
401 ''', re.VERBOSE | re.DOTALL)
402 # 1. find the nearest identifier that comes before an unclosed
403 # parenthesis e.g. for "foo (1+bar(x), pa", the candidate is "foo"
404 tokens = regexp.findall(self.get_line_buffer())
405 tokens.reverse()
406 iterTokens = iter(tokens); openPar = 0
407 for token in iterTokens:
408 if token == ')':
409 openPar -= 1
410 elif token == '(':
411 openPar += 1
412 if openPar > 0:
413 # found the last unclosed parenthesis
414 break
415 else:
416 return []
417 # 2. Concatenate any dotted names (e.g. "foo.bar" for "foo.bar(x, pa" )
418 ids = []
419 isId = re.compile(r'\w+$').match
420 while True:
421 try:
422 ids.append(iterTokens.next())
423 if not isId(ids[-1]):
424 ids.pop(); break
425 if not iterTokens.next() == '.':
426 break
427 except StopIteration:
428 break
429 # lookup the candidate callable matches either using global_matches
430 # or attr_matches for dotted names
431 if len(ids) == 1:
432 callableMatches = self.global_matches(ids[0])
433 else:
434 callableMatches = self.attr_matches('.'.join(ids[::-1]))
435 argMatches = []
436 for callableMatch in callableMatches:
437 try: namedArgs = self._default_arguments(eval(callableMatch,
438 self.namespace))
439 except: continue
440 for namedArg in namedArgs:
441 if namedArg.startswith(text):
442 argMatches.append("%s=" %namedArg)
443 return argMatches
444
445 def complete(self, text, state):
446 """Return the next possible completion for 'text'.
447
448 This is called successively with state == 0, 1, 2, ... until it
449 returns None. The completion should begin with 'text'. """
450
451 #print '\n*** COMPLETE: <%s> (%s)' % (text,state) # dbg
452
453 # if there is only a tab on a line with only whitespace, instead
454 # of the mostly useless 'do you want to see all million
455 # completions' message, just do the right thing and give the user
456 # his tab! Incidentally, this enables pasting of tabbed text from
457 # an editor (as long as autoindent is off).
458 if not self.get_line_buffer().strip():
459 self.readline.insert_text('\t')
460 return None
461
462 magic_escape = self.magic_escape
463 magic_prefix = self.magic_prefix
464
465 try:
466 if text.startswith(magic_escape):
467 text = text.replace(magic_escape,magic_prefix)
468 elif text.startswith('~'):
469 text = os.path.expanduser(text)
470 if state == 0:
471 # Extend the list of completions with the results of each
472 # matcher, so we return results to the user from all
473 # namespaces.
474 if self.merge_completions:
475 self.matches = []
476 for matcher in self.matchers:
477 self.matches.extend(matcher(text))
478 else:
479 for matcher in self.matchers:
480 self.matches = matcher(text)
481 if self.matches:
482 break
483
484 try:
485 return self.matches[state].replace(magic_prefix,magic_escape)
486 except IndexError:
487 return None
488 except:
489 # If completion fails, don't annoy the user.
490 return None
491
187
492 except ImportError:
188 #****************************************************************************
493 pass # no readline support
189 # Local use exceptions
190 class SpaceInInput(exceptions.Exception): pass
494
191
495 except KeyError:
192 class IPythonExit(exceptions.Exception): pass
496 pass # Windows doesn't set TERM, it doesn't matter
497
193
194 #****************************************************************************
195 # Local use classes
196 class Bunch: pass
498
197
499 class InputList(UserList.UserList):
198 class InputList(list):
500 """Class to store user input.
199 """Class to store user input.
501
200
502 It's basically a list, but slices return a string instead of a list, thus
201 It's basically a list, but slices return a string instead of a list, thus
503 allowing things like (assuming 'In' is an instance):
202 allowing things like (assuming 'In' is an instance):
504
203
505 exec In[4:7]
204 exec In[4:7]
506
205
507 or
206 or
508
207
509 exec In[5:9] + In[14] + In[21:25]"""
208 exec In[5:9] + In[14] + In[21:25]"""
510
209
511 def __getslice__(self,i,j):
210 def __getslice__(self,i,j):
512 return ''.join(UserList.UserList.__getslice__(self,i,j))
211 return ''.join(list.__getslice__(self,i,j))
513
514 #****************************************************************************
515 # Local use exceptions
516 class SpaceInInput(exceptions.Exception):
517 pass
518
212
519 #****************************************************************************
213 #****************************************************************************
520 # Main IPython class
214 # Main IPython class
521
215 class InteractiveShell(Logger, Magic):
522 class InteractiveShell(code.InteractiveConsole, Logger, Magic):
523 """An enhanced console for Python."""
216 """An enhanced console for Python."""
524
217
525 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
218 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
526 user_ns = None,user_global_ns=None,banner2='',
219 user_ns = None,user_global_ns=None,banner2='',
527 custom_exceptions=((),None),embedded=False):
220 custom_exceptions=((),None),embedded=False):
528
221
529 # Put a reference to self in builtins so that any form of embedded or
222 # Put a reference to self in builtins so that any form of embedded or
530 # imported code can test for being inside IPython.
223 # imported code can test for being inside IPython.
531 __builtin__.__IPYTHON__ = self
224 __builtin__.__IPYTHON__ = self
532
225
533 # And load into builtins ipmagic/ipalias as well
226 # And load into builtins ipmagic/ipalias as well
534 __builtin__.ipmagic = ipmagic
227 __builtin__.ipmagic = ipmagic
535 __builtin__.ipalias = ipalias
228 __builtin__.ipalias = ipalias
536
229
537 # Add to __builtin__ other parts of IPython's public API
230 # Add to __builtin__ other parts of IPython's public API
538 __builtin__.ip_set_hook = self.set_hook
231 __builtin__.ip_set_hook = self.set_hook
539
232
540 # Keep in the builtins a flag for when IPython is active. We set it
233 # Keep in the builtins a flag for when IPython is active. We set it
541 # with setdefault so that multiple nested IPythons don't clobber one
234 # with setdefault so that multiple nested IPythons don't clobber one
542 # another. Each will increase its value by one upon being activated,
235 # another. Each will increase its value by one upon being activated,
543 # which also gives us a way to determine the nesting level.
236 # which also gives us a way to determine the nesting level.
544 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
237 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
545
238
546 # Inform the user of ipython's fast exit magics.
239 # Do the intuitively correct thing for quit/exit: we remove the
547 _exit = ' Use %Exit or %Quit to exit without confirmation.'
240 # builtins if they exist, and our own prefilter routine will handle
548 __builtin__.exit += _exit
241 # these special cases
549 __builtin__.quit += _exit
242 try:
243 del __builtin__.exit, __builtin__.quit
244 except AttributeError:
245 pass
550
246
551 # We need to know whether the instance is meant for embedding, since
247 # We need to know whether the instance is meant for embedding, since
552 # global/local namespaces need to be handled differently in that case
248 # global/local namespaces need to be handled differently in that case
553 self.embedded = embedded
249 self.embedded = embedded
554
250
555 # compiler command
251 # compiler command
556 self.compile = CommandCompiler()
252 self.compile = codeop.CommandCompiler()
557
253
558 # User input buffer
254 # User input buffer
559 self.buffer = []
255 self.buffer = []
560
256
561 # Default name given in compilation of code
257 # Default name given in compilation of code
562 self.filename = '<ipython console>'
258 self.filename = '<ipython console>'
563
259
564 # Create the namespace where the user will operate. user_ns is
260 # Create the namespace where the user will operate. user_ns is
565 # normally the only one used, and it is passed to the exec calls as
261 # normally the only one used, and it is passed to the exec calls as
566 # the locals argument. But we do carry a user_global_ns namespace
262 # the locals argument. But we do carry a user_global_ns namespace
567 # given as the exec 'globals' argument, This is useful in embedding
263 # given as the exec 'globals' argument, This is useful in embedding
568 # situations where the ipython shell opens in a context where the
264 # situations where the ipython shell opens in a context where the
569 # distinction between locals and globals is meaningful.
265 # distinction between locals and globals is meaningful.
570
266
571 # FIXME. For some strange reason, __builtins__ is showing up at user
267 # FIXME. For some strange reason, __builtins__ is showing up at user
572 # level as a dict instead of a module. This is a manual fix, but I
268 # level as a dict instead of a module. This is a manual fix, but I
573 # should really track down where the problem is coming from. Alex
269 # should really track down where the problem is coming from. Alex
574 # Schmolck reported this problem first.
270 # Schmolck reported this problem first.
575
271
576 # A useful post by Alex Martelli on this topic:
272 # A useful post by Alex Martelli on this topic:
577 # Re: inconsistent value from __builtins__
273 # Re: inconsistent value from __builtins__
578 # Von: Alex Martelli <aleaxit@yahoo.com>
274 # Von: Alex Martelli <aleaxit@yahoo.com>
579 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
275 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
580 # Gruppen: comp.lang.python
276 # Gruppen: comp.lang.python
581 # Referenzen: 1
277 # Referenzen: 1
582
278
583 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
279 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
584 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
280 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
585 # > <type 'dict'>
281 # > <type 'dict'>
586 # > >>> print type(__builtins__)
282 # > >>> print type(__builtins__)
587 # > <type 'module'>
283 # > <type 'module'>
588 # > Is this difference in return value intentional?
284 # > Is this difference in return value intentional?
589
285
590 # Well, it's documented that '__builtins__' can be either a dictionary
286 # Well, it's documented that '__builtins__' can be either a dictionary
591 # or a module, and it's been that way for a long time. Whether it's
287 # or a module, and it's been that way for a long time. Whether it's
592 # intentional (or sensible), I don't know. In any case, the idea is that
288 # intentional (or sensible), I don't know. In any case, the idea is
593 # if you need to access the built-in namespace directly, you should start
289 # that if you need to access the built-in namespace directly, you
594 # with "import __builtin__" (note, no 's') which will definitely give you
290 # should start with "import __builtin__" (note, no 's') which will
595 # a module. Yeah, it's somewhat confusing:-(.
291 # definitely give you a module. Yeah, it's somewhat confusing:-(.
596
292
597 if user_ns is None:
293 if user_ns is None:
598 # Set __name__ to __main__ to better match the behavior of the
294 # Set __name__ to __main__ to better match the behavior of the
599 # normal interpreter.
295 # normal interpreter.
600 user_ns = {'__name__' :'__main__',
296 user_ns = {'__name__' :'__main__',
601 '__builtins__' : __builtin__,
297 '__builtins__' : __builtin__,
602 }
298 }
603
299
604 if user_global_ns is None:
300 if user_global_ns is None:
605 user_global_ns = {}
301 user_global_ns = {}
606
302
607 # Assign namespaces
303 # Assign namespaces
608 # This is the namespace where all normal user variables live
304 # This is the namespace where all normal user variables live
609 self.user_ns = user_ns
305 self.user_ns = user_ns
610 # Embedded instances require a separate namespace for globals.
306 # Embedded instances require a separate namespace for globals.
611 # Normally this one is unused by non-embedded instances.
307 # Normally this one is unused by non-embedded instances.
612 self.user_global_ns = user_global_ns
308 self.user_global_ns = user_global_ns
613 # A namespace to keep track of internal data structures to prevent
309 # A namespace to keep track of internal data structures to prevent
614 # them from cluttering user-visible stuff. Will be updated later
310 # them from cluttering user-visible stuff. Will be updated later
615 self.internal_ns = {}
311 self.internal_ns = {}
616
312
617 # Namespace of system aliases. Each entry in the alias
313 # Namespace of system aliases. Each entry in the alias
618 # table must be a 2-tuple of the form (N,name), where N is the number
314 # table must be a 2-tuple of the form (N,name), where N is the number
619 # of positional arguments of the alias.
315 # of positional arguments of the alias.
620 self.alias_table = {}
316 self.alias_table = {}
621
317
622 # A table holding all the namespaces IPython deals with, so that
318 # A table holding all the namespaces IPython deals with, so that
623 # introspection facilities can search easily.
319 # introspection facilities can search easily.
624 self.ns_table = {'user':user_ns,
320 self.ns_table = {'user':user_ns,
625 'user_global':user_global_ns,
321 'user_global':user_global_ns,
626 'alias':self.alias_table,
322 'alias':self.alias_table,
627 'internal':self.internal_ns,
323 'internal':self.internal_ns,
628 'builtin':__builtin__.__dict__
324 'builtin':__builtin__.__dict__
629 }
325 }
630
326
631 # The user namespace MUST have a pointer to the shell itself.
327 # The user namespace MUST have a pointer to the shell itself.
632 self.user_ns[name] = self
328 self.user_ns[name] = self
633
329
634 # We need to insert into sys.modules something that looks like a
330 # We need to insert into sys.modules something that looks like a
635 # module but which accesses the IPython namespace, for shelve and
331 # module but which accesses the IPython namespace, for shelve and
636 # pickle to work interactively. Normally they rely on getting
332 # pickle to work interactively. Normally they rely on getting
637 # everything out of __main__, but for embedding purposes each IPython
333 # everything out of __main__, but for embedding purposes each IPython
638 # instance has its own private namespace, so we can't go shoving
334 # instance has its own private namespace, so we can't go shoving
639 # everything into __main__.
335 # everything into __main__.
640
336
641 # note, however, that we should only do this for non-embedded
337 # note, however, that we should only do this for non-embedded
642 # ipythons, which really mimic the __main__.__dict__ with their own
338 # ipythons, which really mimic the __main__.__dict__ with their own
643 # namespace. Embedded instances, on the other hand, should not do
339 # namespace. Embedded instances, on the other hand, should not do
644 # this because they need to manage the user local/global namespaces
340 # this because they need to manage the user local/global namespaces
645 # only, but they live within a 'normal' __main__ (meaning, they
341 # only, but they live within a 'normal' __main__ (meaning, they
646 # shouldn't overtake the execution environment of the script they're
342 # shouldn't overtake the execution environment of the script they're
647 # embedded in).
343 # embedded in).
648
344
649 if not embedded:
345 if not embedded:
650 try:
346 try:
651 main_name = self.user_ns['__name__']
347 main_name = self.user_ns['__name__']
652 except KeyError:
348 except KeyError:
653 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
349 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
654 else:
350 else:
655 #print "pickle hack in place" # dbg
351 #print "pickle hack in place" # dbg
656 sys.modules[main_name] = FakeModule(self.user_ns)
352 sys.modules[main_name] = FakeModule(self.user_ns)
657
353
658 # List of input with multi-line handling.
354 # List of input with multi-line handling.
659 # Fill its zero entry, user counter starts at 1
355 # Fill its zero entry, user counter starts at 1
660 self.input_hist = InputList(['\n'])
356 self.input_hist = InputList(['\n'])
661
357
662 # list of visited directories
358 # list of visited directories
663 try:
359 try:
664 self.dir_hist = [os.getcwd()]
360 self.dir_hist = [os.getcwd()]
665 except IOError, e:
361 except IOError, e:
666 self.dir_hist = []
362 self.dir_hist = []
667
363
668 # dict of output history
364 # dict of output history
669 self.output_hist = {}
365 self.output_hist = {}
670
366
671 # dict of things NOT to alias (keywords, builtins and some special magics)
367 # dict of things NOT to alias (keywords, builtins and some magics)
672 no_alias = {}
368 no_alias = {}
673 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
369 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
674 for key in keyword.kwlist + no_alias_magics:
370 for key in keyword.kwlist + no_alias_magics:
675 no_alias[key] = 1
371 no_alias[key] = 1
676 no_alias.update(__builtin__.__dict__)
372 no_alias.update(__builtin__.__dict__)
677 self.no_alias = no_alias
373 self.no_alias = no_alias
678
374
679 # make global variables for user access to these
375 # make global variables for user access to these
680 self.user_ns['_ih'] = self.input_hist
376 self.user_ns['_ih'] = self.input_hist
681 self.user_ns['_oh'] = self.output_hist
377 self.user_ns['_oh'] = self.output_hist
682 self.user_ns['_dh'] = self.dir_hist
378 self.user_ns['_dh'] = self.dir_hist
683
379
684 # user aliases to input and output histories
380 # user aliases to input and output histories
685 self.user_ns['In'] = self.input_hist
381 self.user_ns['In'] = self.input_hist
686 self.user_ns['Out'] = self.output_hist
382 self.user_ns['Out'] = self.output_hist
687
383
688 # Store the actual shell's name
384 # Store the actual shell's name
689 self.name = name
385 self.name = name
690
386
691 # Object variable to store code object waiting execution. This is
387 # Object variable to store code object waiting execution. This is
692 # used mainly by the multithreaded shells, but it can come in handy in
388 # used mainly by the multithreaded shells, but it can come in handy in
693 # other situations. No need to use a Queue here, since it's a single
389 # other situations. No need to use a Queue here, since it's a single
694 # item which gets cleared once run.
390 # item which gets cleared once run.
695 self.code_to_run = None
391 self.code_to_run = None
696
392
697 # Job manager (for jobs run as background threads)
393 # Job manager (for jobs run as background threads)
698 self.jobs = BackgroundJobManager()
394 self.jobs = BackgroundJobManager()
699 # Put the job manager into builtins so it's always there.
395 # Put the job manager into builtins so it's always there.
700 __builtin__.jobs = self.jobs
396 __builtin__.jobs = self.jobs
701
397
702 # escapes for automatic behavior on the command line
398 # escapes for automatic behavior on the command line
703 self.ESC_SHELL = '!'
399 self.ESC_SHELL = '!'
704 self.ESC_HELP = '?'
400 self.ESC_HELP = '?'
705 self.ESC_MAGIC = '%'
401 self.ESC_MAGIC = '%'
706 self.ESC_QUOTE = ','
402 self.ESC_QUOTE = ','
707 self.ESC_QUOTE2 = ';'
403 self.ESC_QUOTE2 = ';'
708 self.ESC_PAREN = '/'
404 self.ESC_PAREN = '/'
709
405
710 # And their associated handlers
406 # And their associated handlers
711 self.esc_handlers = {self.ESC_PAREN:self.handle_auto,
407 self.esc_handlers = {self.ESC_PAREN:self.handle_auto,
712 self.ESC_QUOTE:self.handle_auto,
408 self.ESC_QUOTE:self.handle_auto,
713 self.ESC_QUOTE2:self.handle_auto,
409 self.ESC_QUOTE2:self.handle_auto,
714 self.ESC_MAGIC:self.handle_magic,
410 self.ESC_MAGIC:self.handle_magic,
715 self.ESC_HELP:self.handle_help,
411 self.ESC_HELP:self.handle_help,
716 self.ESC_SHELL:self.handle_shell_escape,
412 self.ESC_SHELL:self.handle_shell_escape,
717 }
413 }
718
414
719 # class initializations
415 # class initializations
720 Logger.__init__(self,log_ns = self.user_ns)
416 Logger.__init__(self,log_ns = self.user_ns)
721 Magic.__init__(self,self)
417 Magic.__init__(self,self)
722
418
723 # an ugly hack to get a pointer to the shell, so I can start writing
419 # an ugly hack to get a pointer to the shell, so I can start writing
724 # magic code via this pointer instead of the current mixin salad.
420 # magic code via this pointer instead of the current mixin salad.
725 Magic.set_shell(self,self)
421 Magic.set_shell(self,self)
726
422
727 # Python source parser/formatter for syntax highlighting
423 # Python source parser/formatter for syntax highlighting
728 pyformat = Parser().format
424 pyformat = Parser().format
729 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
425 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
730
426
731 # hooks holds pointers used for user-side customizations
427 # hooks holds pointers used for user-side customizations
732 self.hooks = Struct()
428 self.hooks = Struct()
733
429
734 # Set all default hooks, defined in the IPython.hooks module.
430 # Set all default hooks, defined in the IPython.hooks module.
735 hooks = IPython.hooks
431 hooks = IPython.hooks
736 for hook_name in hooks.__all__:
432 for hook_name in hooks.__all__:
737 self.set_hook(hook_name,getattr(hooks,hook_name))
433 self.set_hook(hook_name,getattr(hooks,hook_name))
738
434
739 # Flag to mark unconditional exit
435 # Flag to mark unconditional exit
740 self.exit_now = False
436 self.exit_now = False
741
437
742 self.usage_min = """\
438 self.usage_min = """\
743 An enhanced console for Python.
439 An enhanced console for Python.
744 Some of its features are:
440 Some of its features are:
745 - Readline support if the readline library is present.
441 - Readline support if the readline library is present.
746 - Tab completion in the local namespace.
442 - Tab completion in the local namespace.
747 - Logging of input, see command-line options.
443 - Logging of input, see command-line options.
748 - System shell escape via ! , eg !ls.
444 - System shell escape via ! , eg !ls.
749 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
445 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
750 - Keeps track of locally defined variables via %who, %whos.
446 - Keeps track of locally defined variables via %who, %whos.
751 - Show object information with a ? eg ?x or x? (use ?? for more info).
447 - Show object information with a ? eg ?x or x? (use ?? for more info).
752 """
448 """
753 if usage: self.usage = usage
449 if usage: self.usage = usage
754 else: self.usage = self.usage_min
450 else: self.usage = self.usage_min
755
451
756 # Storage
452 # Storage
757 self.rc = rc # This will hold all configuration information
453 self.rc = rc # This will hold all configuration information
758 self.inputcache = []
454 self.inputcache = []
759 self._boundcache = []
455 self._boundcache = []
760 self.pager = 'less'
456 self.pager = 'less'
761 # temporary files used for various purposes. Deleted at exit.
457 # temporary files used for various purposes. Deleted at exit.
762 self.tempfiles = []
458 self.tempfiles = []
763
459
764 # Keep track of readline usage (later set by init_readline)
460 # Keep track of readline usage (later set by init_readline)
765 self.has_readline = 0
461 self.has_readline = False
766
462
767 # for pushd/popd management
463 # for pushd/popd management
768 try:
464 try:
769 self.home_dir = get_home_dir()
465 self.home_dir = get_home_dir()
770 except HomeDirError,msg:
466 except HomeDirError,msg:
771 fatal(msg)
467 fatal(msg)
772
468
773 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
469 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
774
470
775 # Functions to call the underlying shell.
471 # Functions to call the underlying shell.
776
472
777 # utility to expand user variables via Itpl
473 # utility to expand user variables via Itpl
778 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
474 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
779 self.user_ns))
475 self.user_ns))
780 # The first is similar to os.system, but it doesn't return a value,
476 # The first is similar to os.system, but it doesn't return a value,
781 # and it allows interpolation of variables in the user's namespace.
477 # and it allows interpolation of variables in the user's namespace.
782 self.system = lambda cmd: shell(self.var_expand(cmd),
478 self.system = lambda cmd: shell(self.var_expand(cmd),
783 header='IPython system call: ',
479 header='IPython system call: ',
784 verbose=self.rc.system_verbose)
480 verbose=self.rc.system_verbose)
785 # These are for getoutput and getoutputerror:
481 # These are for getoutput and getoutputerror:
786 self.getoutput = lambda cmd: \
482 self.getoutput = lambda cmd: \
787 getoutput(self.var_expand(cmd),
483 getoutput(self.var_expand(cmd),
788 header='IPython system call: ',
484 header='IPython system call: ',
789 verbose=self.rc.system_verbose)
485 verbose=self.rc.system_verbose)
790 self.getoutputerror = lambda cmd: \
486 self.getoutputerror = lambda cmd: \
791 getoutputerror(str(ItplNS(cmd.replace('#','\#'),
487 getoutputerror(str(ItplNS(cmd.replace('#','\#'),
792 self.user_ns)),
488 self.user_ns)),
793 header='IPython system call: ',
489 header='IPython system call: ',
794 verbose=self.rc.system_verbose)
490 verbose=self.rc.system_verbose)
795
491
796 # RegExp for splitting line contents into pre-char//first
492 # RegExp for splitting line contents into pre-char//first
797 # word-method//rest. For clarity, each group in on one line.
493 # word-method//rest. For clarity, each group in on one line.
798
494
799 # WARNING: update the regexp if the above escapes are changed, as they
495 # WARNING: update the regexp if the above escapes are changed, as they
800 # are hardwired in.
496 # are hardwired in.
801
497
802 # Don't get carried away with trying to make the autocalling catch too
498 # Don't get carried away with trying to make the autocalling catch too
803 # much: it's better to be conservative rather than to trigger hidden
499 # much: it's better to be conservative rather than to trigger hidden
804 # evals() somewhere and end up causing side effects.
500 # evals() somewhere and end up causing side effects.
805
501
806 self.line_split = re.compile(r'^([\s*,;/])'
502 self.line_split = re.compile(r'^([\s*,;/])'
807 r'([\?\w\.]+\w*\s*)'
503 r'([\?\w\.]+\w*\s*)'
808 r'(\(?.*$)')
504 r'(\(?.*$)')
809
505
810 # Original re, keep around for a while in case changes break something
506 # Original re, keep around for a while in case changes break something
811 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
507 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
812 # r'(\s*[\?\w\.]+\w*\s*)'
508 # r'(\s*[\?\w\.]+\w*\s*)'
813 # r'(\(?.*$)')
509 # r'(\(?.*$)')
814
510
815 # RegExp to identify potential function names
511 # RegExp to identify potential function names
816 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
512 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
817 # RegExp to exclude strings with this start from autocalling
513 # RegExp to exclude strings with this start from autocalling
818 self.re_exclude_auto = re.compile('^[!=()<>,\*/\+-]|^is ')
514 self.re_exclude_auto = re.compile('^[!=()<>,\*/\+-]|^is ')
515
819 # try to catch also methods for stuff in lists/tuples/dicts: off
516 # try to catch also methods for stuff in lists/tuples/dicts: off
820 # (experimental). For this to work, the line_split regexp would need
517 # (experimental). For this to work, the line_split regexp would need
821 # to be modified so it wouldn't break things at '['. That line is
518 # to be modified so it wouldn't break things at '['. That line is
822 # nasty enough that I shouldn't change it until I can test it _well_.
519 # nasty enough that I shouldn't change it until I can test it _well_.
823 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
520 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
824
521
825 # keep track of where we started running (mainly for crash post-mortem)
522 # keep track of where we started running (mainly for crash post-mortem)
826 self.starting_dir = os.getcwd()
523 self.starting_dir = os.getcwd()
827
524
828 # Attributes for Logger mixin class, make defaults here
525 # Attributes for Logger mixin class, make defaults here
829 self._dolog = 0
526 self._dolog = False
830 self.LOG = ''
527 self.LOG = ''
831 self.LOGDEF = '.InteractiveShell.log'
528 self.LOGDEF = '.InteractiveShell.log'
832 self.LOGMODE = 'over'
529 self.LOGMODE = 'over'
833 self.LOGHEAD = Itpl(
530 self.LOGHEAD = Itpl(
834 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
531 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
835 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
532 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
836 #log# opts = $self.rc.opts
533 #log# opts = $self.rc.opts
837 #log# args = $self.rc.args
534 #log# args = $self.rc.args
838 #log# It is safe to make manual edits below here.
535 #log# It is safe to make manual edits below here.
839 #log#-----------------------------------------------------------------------
536 #log#-----------------------------------------------------------------------
840 """)
537 """)
841 # Various switches which can be set
538 # Various switches which can be set
842 self.CACHELENGTH = 5000 # this is cheap, it's just text
539 self.CACHELENGTH = 5000 # this is cheap, it's just text
843 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
540 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
844 self.banner2 = banner2
541 self.banner2 = banner2
845
542
846 # TraceBack handlers:
543 # TraceBack handlers:
847 # Need two, one for syntax errors and one for other exceptions.
544 # Need two, one for syntax errors and one for other exceptions.
848 self.SyntaxTB = ultraTB.ListTB(color_scheme='NoColor')
545 self.SyntaxTB = ultraTB.ListTB(color_scheme='NoColor')
849 # This one is initialized with an offset, meaning we always want to
546 # This one is initialized with an offset, meaning we always want to
850 # remove the topmost item in the traceback, which is our own internal
547 # remove the topmost item in the traceback, which is our own internal
851 # code. Valid modes: ['Plain','Context','Verbose']
548 # code. Valid modes: ['Plain','Context','Verbose']
852 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
549 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
853 color_scheme='NoColor',
550 color_scheme='NoColor',
854 tb_offset = 1)
551 tb_offset = 1)
855 # and add any custom exception handlers the user may have specified
552 # and add any custom exception handlers the user may have specified
856 self.set_custom_exc(*custom_exceptions)
553 self.set_custom_exc(*custom_exceptions)
857
554
858 # Object inspector
555 # Object inspector
859 ins_colors = OInspect.InspectColors
556 ins_colors = OInspect.InspectColors
860 code_colors = PyColorize.ANSICodeColors
557 code_colors = PyColorize.ANSICodeColors
861 self.inspector = OInspect.Inspector(ins_colors,code_colors,'NoColor')
558 self.inspector = OInspect.Inspector(ins_colors,code_colors,'NoColor')
862 self.autoindent = 0
559 self.autoindent = False
863
560
864 # Make some aliases automatically
561 # Make some aliases automatically
865 # Prepare list of shell aliases to auto-define
562 # Prepare list of shell aliases to auto-define
866 if os.name == 'posix':
563 if os.name == 'posix':
867 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
564 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
868 'mv mv -i','rm rm -i','cp cp -i',
565 'mv mv -i','rm rm -i','cp cp -i',
869 'cat cat','less less','clear clear',
566 'cat cat','less less','clear clear',
870 # a better ls
567 # a better ls
871 'ls ls -F',
568 'ls ls -F',
872 # long ls
569 # long ls
873 'll ls -lF',
570 'll ls -lF',
874 # color ls
571 # color ls
875 'lc ls -F -o --color',
572 'lc ls -F -o --color',
876 # ls normal files only
573 # ls normal files only
877 'lf ls -F -o --color %l | grep ^-',
574 'lf ls -F -o --color %l | grep ^-',
878 # ls symbolic links
575 # ls symbolic links
879 'lk ls -F -o --color %l | grep ^l',
576 'lk ls -F -o --color %l | grep ^l',
880 # directories or links to directories,
577 # directories or links to directories,
881 'ldir ls -F -o --color %l | grep /$',
578 'ldir ls -F -o --color %l | grep /$',
882 # things which are executable
579 # things which are executable
883 'lx ls -F -o --color %l | grep ^-..x',
580 'lx ls -F -o --color %l | grep ^-..x',
884 )
581 )
885 elif os.name in ['nt','dos']:
582 elif os.name in ['nt','dos']:
886 auto_alias = ('dir dir /on', 'ls dir /on',
583 auto_alias = ('dir dir /on', 'ls dir /on',
887 'ddir dir /ad /on', 'ldir dir /ad /on',
584 'ddir dir /ad /on', 'ldir dir /ad /on',
888 'mkdir mkdir','rmdir rmdir','echo echo',
585 'mkdir mkdir','rmdir rmdir','echo echo',
889 'ren ren','cls cls','copy copy')
586 'ren ren','cls cls','copy copy')
890 else:
587 else:
891 auto_alias = ()
588 auto_alias = ()
892 self.auto_alias = map(lambda s:s.split(None,1),auto_alias)
589 self.auto_alias = map(lambda s:s.split(None,1),auto_alias)
893 # Call the actual (public) initializer
590 # Call the actual (public) initializer
894 self.init_auto_alias()
591 self.init_auto_alias()
895 # end __init__
592 # end __init__
896
593
897 def set_hook(self,name,hook):
594 def set_hook(self,name,hook):
898 """set_hook(name,hook) -> sets an internal IPython hook.
595 """set_hook(name,hook) -> sets an internal IPython hook.
899
596
900 IPython exposes some of its internal API as user-modifiable hooks. By
597 IPython exposes some of its internal API as user-modifiable hooks. By
901 resetting one of these hooks, you can modify IPython's behavior to
598 resetting one of these hooks, you can modify IPython's behavior to
902 call at runtime your own routines."""
599 call at runtime your own routines."""
903
600
904 # At some point in the future, this should validate the hook before it
601 # At some point in the future, this should validate the hook before it
905 # accepts it. Probably at least check that the hook takes the number
602 # accepts it. Probably at least check that the hook takes the number
906 # of args it's supposed to.
603 # of args it's supposed to.
907 setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
604 setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
908
605
909 def set_custom_exc(self,exc_tuple,handler):
606 def set_custom_exc(self,exc_tuple,handler):
910 """set_custom_exc(exc_tuple,handler)
607 """set_custom_exc(exc_tuple,handler)
911
608
912 Set a custom exception handler, which will be called if any of the
609 Set a custom exception handler, which will be called if any of the
913 exceptions in exc_tuple occur in the mainloop (specifically, in the
610 exceptions in exc_tuple occur in the mainloop (specifically, in the
914 runcode() method.
611 runcode() method.
915
612
916 Inputs:
613 Inputs:
917
614
918 - exc_tuple: a *tuple* of valid exceptions to call the defined
615 - exc_tuple: a *tuple* of valid exceptions to call the defined
919 handler for. It is very important that you use a tuple, and NOT A
616 handler for. It is very important that you use a tuple, and NOT A
920 LIST here, because of the way Python's except statement works. If
617 LIST here, because of the way Python's except statement works. If
921 you only want to trap a single exception, use a singleton tuple:
618 you only want to trap a single exception, use a singleton tuple:
922
619
923 exc_tuple == (MyCustomException,)
620 exc_tuple == (MyCustomException,)
924
621
925 - handler: this must be defined as a function with the following
622 - handler: this must be defined as a function with the following
926 basic interface: def my_handler(self,etype,value,tb).
623 basic interface: def my_handler(self,etype,value,tb).
927
624
928 This will be made into an instance method (via new.instancemethod)
625 This will be made into an instance method (via new.instancemethod)
929 of IPython itself, and it will be called if any of the exceptions
626 of IPython itself, and it will be called if any of the exceptions
930 listed in the exc_tuple are caught. If the handler is None, an
627 listed in the exc_tuple are caught. If the handler is None, an
931 internal basic one is used, which just prints basic info.
628 internal basic one is used, which just prints basic info.
932
629
933 WARNING: by putting in your own exception handler into IPython's main
630 WARNING: by putting in your own exception handler into IPython's main
934 execution loop, you run a very good chance of nasty crashes. This
631 execution loop, you run a very good chance of nasty crashes. This
935 facility should only be used if you really know what you are doing."""
632 facility should only be used if you really know what you are doing."""
936
633
937 assert type(exc_tuple)==type(()) , \
634 assert type(exc_tuple)==type(()) , \
938 "The custom exceptions must be given AS A TUPLE."
635 "The custom exceptions must be given AS A TUPLE."
939
636
940 def dummy_handler(self,etype,value,tb):
637 def dummy_handler(self,etype,value,tb):
941 print '*** Simple custom exception handler ***'
638 print '*** Simple custom exception handler ***'
942 print 'Exception type :',etype
639 print 'Exception type :',etype
943 print 'Exception value:',value
640 print 'Exception value:',value
944 print 'Traceback :',tb
641 print 'Traceback :',tb
945 print 'Source code :','\n'.join(self.buffer)
642 print 'Source code :','\n'.join(self.buffer)
946
643
947 if handler is None: handler = dummy_handler
644 if handler is None: handler = dummy_handler
948
645
949 self.CustomTB = new.instancemethod(handler,self,self.__class__)
646 self.CustomTB = new.instancemethod(handler,self,self.__class__)
950 self.custom_exceptions = exc_tuple
647 self.custom_exceptions = exc_tuple
951
648
952 def set_custom_completer(self,completer,pos=0):
649 def set_custom_completer(self,completer,pos=0):
953 """set_custom_completer(completer,pos=0)
650 """set_custom_completer(completer,pos=0)
954
651
955 Adds a new custom completer function.
652 Adds a new custom completer function.
956
653
957 The position argument (defaults to 0) is the index in the completers
654 The position argument (defaults to 0) is the index in the completers
958 list where you want the completer to be inserted."""
655 list where you want the completer to be inserted."""
959
656
960 newcomp = new.instancemethod(completer,self.Completer,
657 newcomp = new.instancemethod(completer,self.Completer,
961 self.Completer.__class__)
658 self.Completer.__class__)
962 self.Completer.matchers.insert(pos,newcomp)
659 self.Completer.matchers.insert(pos,newcomp)
963
660
964 def complete(self,text):
661 def complete(self,text):
965 """Return a sorted list of all possible completions on text.
662 """Return a sorted list of all possible completions on text.
966
663
967 Inputs:
664 Inputs:
968
665
969 - text: a string of text to be completed on.
666 - text: a string of text to be completed on.
970
667
971 This is a wrapper around the completion mechanism, similar to what
668 This is a wrapper around the completion mechanism, similar to what
972 readline does at the command line when the TAB key is hit. By
669 readline does at the command line when the TAB key is hit. By
973 exposing it as a method, it can be used by other non-readline
670 exposing it as a method, it can be used by other non-readline
974 environments (such as GUIs) for text completion.
671 environments (such as GUIs) for text completion.
975
672
976 Simple usage example:
673 Simple usage example:
977
674
978 In [1]: x = 'hello'
675 In [1]: x = 'hello'
979
676
980 In [2]: __IP.complete('x.l')
677 In [2]: __IP.complete('x.l')
981 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
678 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
982
679
983 complete = self.Completer.complete
680 complete = self.Completer.complete
984 state = 0
681 state = 0
985 # use a dict so we get unique keys, since ipyhton's multiple
682 # use a dict so we get unique keys, since ipyhton's multiple
986 # completers can return duplicates.
683 # completers can return duplicates.
987 comps = {}
684 comps = {}
988 while True:
685 while True:
989 newcomp = complete(text,state)
686 newcomp = complete(text,state)
990 if newcomp is None:
687 if newcomp is None:
991 break
688 break
992 comps[newcomp] = 1
689 comps[newcomp] = 1
993 state += 1
690 state += 1
994 outcomps = comps.keys()
691 outcomps = comps.keys()
995 outcomps.sort()
692 outcomps.sort()
996 return outcomps
693 return outcomps
997
694
998 def set_completer_frame(self, frame):
695 def set_completer_frame(self, frame):
999 if frame:
696 if frame:
1000 self.Completer.namespace = frame.f_locals
697 self.Completer.namespace = frame.f_locals
1001 self.Completer.global_namespace = frame.f_globals
698 self.Completer.global_namespace = frame.f_globals
1002 else:
699 else:
1003 self.Completer.namespace = self.user_ns
700 self.Completer.namespace = self.user_ns
1004 self.Completer.global_namespace = self.user_global_ns
701 self.Completer.global_namespace = self.user_global_ns
1005
702
1006 def post_config_initialization(self):
703 def post_config_initialization(self):
1007 """Post configuration init method
704 """Post configuration init method
1008
705
1009 This is called after the configuration files have been processed to
706 This is called after the configuration files have been processed to
1010 'finalize' the initialization."""
707 'finalize' the initialization."""
1011
708
1012 rc = self.rc
709 rc = self.rc
1013
710
1014 # Load readline proper
711 # Load readline proper
1015 if rc.readline:
712 if rc.readline:
1016 self.init_readline()
713 self.init_readline()
1017
714
1018 # Set user colors (don't do it in the constructor above so that it doesn't
715 # Set user colors (don't do it in the constructor above so that it
1019 # crash if colors option is invalid)
716 # doesn't crash if colors option is invalid)
1020 self.magic_colors(rc.colors)
717 self.magic_colors(rc.colors)
1021
718
1022 # Load user aliases
719 # Load user aliases
1023 for alias in rc.alias:
720 for alias in rc.alias:
1024 self.magic_alias(alias)
721 self.magic_alias(alias)
1025
722
1026 # dynamic data that survives through sessions
723 # dynamic data that survives through sessions
1027 # XXX make the filename a config option?
724 # XXX make the filename a config option?
1028 persist_base = 'persist'
725 persist_base = 'persist'
1029 if rc.profile:
726 if rc.profile:
1030 persist_base += '_%s' % rc.profile
727 persist_base += '_%s' % rc.profile
1031 self.persist_fname = os.path.join(rc.ipythondir,persist_base)
728 self.persist_fname = os.path.join(rc.ipythondir,persist_base)
1032
729
1033 try:
730 try:
1034 self.persist = pickle.load(file(self.persist_fname))
731 self.persist = pickle.load(file(self.persist_fname))
1035 except:
732 except:
1036 self.persist = {}
733 self.persist = {}
1037
734
1038 def init_auto_alias(self):
735 def init_auto_alias(self):
1039 """Define some aliases automatically.
736 """Define some aliases automatically.
1040
737
1041 These are ALL parameter-less aliases"""
738 These are ALL parameter-less aliases"""
1042 for alias,cmd in self.auto_alias:
739 for alias,cmd in self.auto_alias:
1043 self.alias_table[alias] = (0,cmd)
740 self.alias_table[alias] = (0,cmd)
1044
741
1045 def alias_table_validate(self,verbose=0):
742 def alias_table_validate(self,verbose=0):
1046 """Update information about the alias table.
743 """Update information about the alias table.
1047
744
1048 In particular, make sure no Python keywords/builtins are in it."""
745 In particular, make sure no Python keywords/builtins are in it."""
1049
746
1050 no_alias = self.no_alias
747 no_alias = self.no_alias
1051 for k in self.alias_table.keys():
748 for k in self.alias_table.keys():
1052 if k in no_alias:
749 if k in no_alias:
1053 del self.alias_table[k]
750 del self.alias_table[k]
1054 if verbose:
751 if verbose:
1055 print ("Deleting alias <%s>, it's a Python "
752 print ("Deleting alias <%s>, it's a Python "
1056 "keyword or builtin." % k)
753 "keyword or builtin." % k)
1057
754
1058 def set_autoindent(self,value=None):
755 def set_autoindent(self,value=None):
1059 """Set the autoindent flag, checking for readline support.
756 """Set the autoindent flag, checking for readline support.
1060
757
1061 If called with no arguments, it acts as a toggle."""
758 If called with no arguments, it acts as a toggle."""
1062
759
1063 if not self.has_readline:
760 if not self.has_readline:
1064 if os.name == 'posix':
761 if os.name == 'posix':
1065 warn("The auto-indent feature requires the readline library")
762 warn("The auto-indent feature requires the readline library")
1066 self.autoindent = 0
763 self.autoindent = 0
1067 return
764 return
1068 if value is None:
765 if value is None:
1069 self.autoindent = not self.autoindent
766 self.autoindent = not self.autoindent
1070 else:
767 else:
1071 self.autoindent = value
768 self.autoindent = value
1072
769
1073 def rc_set_toggle(self,rc_field,value=None):
770 def rc_set_toggle(self,rc_field,value=None):
1074 """Set or toggle a field in IPython's rc config. structure.
771 """Set or toggle a field in IPython's rc config. structure.
1075
772
1076 If called with no arguments, it acts as a toggle.
773 If called with no arguments, it acts as a toggle.
1077
774
1078 If called with a non-existent field, the resulting AttributeError
775 If called with a non-existent field, the resulting AttributeError
1079 exception will propagate out."""
776 exception will propagate out."""
1080
777
1081 rc_val = getattr(self.rc,rc_field)
778 rc_val = getattr(self.rc,rc_field)
1082 if value is None:
779 if value is None:
1083 value = not rc_val
780 value = not rc_val
1084 setattr(self.rc,rc_field,value)
781 setattr(self.rc,rc_field,value)
1085
782
1086 def user_setup(self,ipythondir,rc_suffix,mode='install'):
783 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1087 """Install the user configuration directory.
784 """Install the user configuration directory.
1088
785
1089 Can be called when running for the first time or to upgrade the user's
786 Can be called when running for the first time or to upgrade the user's
1090 .ipython/ directory with the mode parameter. Valid modes are 'install'
787 .ipython/ directory with the mode parameter. Valid modes are 'install'
1091 and 'upgrade'."""
788 and 'upgrade'."""
1092
789
1093 def wait():
790 def wait():
1094 try:
791 try:
1095 raw_input("Please press <RETURN> to start IPython.")
792 raw_input("Please press <RETURN> to start IPython.")
1096 except EOFError:
793 except EOFError:
1097 print >> Term.cout
794 print >> Term.cout
1098 print '*'*70
795 print '*'*70
1099
796
1100 cwd = os.getcwd() # remember where we started
797 cwd = os.getcwd() # remember where we started
1101 glb = glob.glob
798 glb = glob.glob
1102 print '*'*70
799 print '*'*70
1103 if mode == 'install':
800 if mode == 'install':
1104 print \
801 print \
1105 """Welcome to IPython. I will try to create a personal configuration directory
802 """Welcome to IPython. I will try to create a personal configuration directory
1106 where you can customize many aspects of IPython's functionality in:\n"""
803 where you can customize many aspects of IPython's functionality in:\n"""
1107 else:
804 else:
1108 print 'I am going to upgrade your configuration in:'
805 print 'I am going to upgrade your configuration in:'
1109
806
1110 print ipythondir
807 print ipythondir
1111
808
1112 rcdirend = os.path.join('IPython','UserConfig')
809 rcdirend = os.path.join('IPython','UserConfig')
1113 cfg = lambda d: os.path.join(d,rcdirend)
810 cfg = lambda d: os.path.join(d,rcdirend)
1114 try:
811 try:
1115 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
812 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1116 except IOError:
813 except IOError:
1117 warning = """
814 warning = """
1118 Installation error. IPython's directory was not found.
815 Installation error. IPython's directory was not found.
1119
816
1120 Check the following:
817 Check the following:
1121
818
1122 The ipython/IPython directory should be in a directory belonging to your
819 The ipython/IPython directory should be in a directory belonging to your
1123 PYTHONPATH environment variable (that is, it should be in a directory
820 PYTHONPATH environment variable (that is, it should be in a directory
1124 belonging to sys.path). You can copy it explicitly there or just link to it.
821 belonging to sys.path). You can copy it explicitly there or just link to it.
1125
822
1126 IPython will proceed with builtin defaults.
823 IPython will proceed with builtin defaults.
1127 """
824 """
1128 warn(warning)
825 warn(warning)
1129 wait()
826 wait()
1130 return
827 return
1131
828
1132 if mode == 'install':
829 if mode == 'install':
1133 try:
830 try:
1134 shutil.copytree(rcdir,ipythondir)
831 shutil.copytree(rcdir,ipythondir)
1135 os.chdir(ipythondir)
832 os.chdir(ipythondir)
1136 rc_files = glb("ipythonrc*")
833 rc_files = glb("ipythonrc*")
1137 for rc_file in rc_files:
834 for rc_file in rc_files:
1138 os.rename(rc_file,rc_file+rc_suffix)
835 os.rename(rc_file,rc_file+rc_suffix)
1139 except:
836 except:
1140 warning = """
837 warning = """
1141
838
1142 There was a problem with the installation:
839 There was a problem with the installation:
1143 %s
840 %s
1144 Try to correct it or contact the developers if you think it's a bug.
841 Try to correct it or contact the developers if you think it's a bug.
1145 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
842 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1146 warn(warning)
843 warn(warning)
1147 wait()
844 wait()
1148 return
845 return
1149
846
1150 elif mode == 'upgrade':
847 elif mode == 'upgrade':
1151 try:
848 try:
1152 os.chdir(ipythondir)
849 os.chdir(ipythondir)
1153 except:
850 except:
1154 print """
851 print """
1155 Can not upgrade: changing to directory %s failed. Details:
852 Can not upgrade: changing to directory %s failed. Details:
1156 %s
853 %s
1157 """ % (ipythondir,sys.exc_info()[1])
854 """ % (ipythondir,sys.exc_info()[1])
1158 wait()
855 wait()
1159 return
856 return
1160 else:
857 else:
1161 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
858 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1162 for new_full_path in sources:
859 for new_full_path in sources:
1163 new_filename = os.path.basename(new_full_path)
860 new_filename = os.path.basename(new_full_path)
1164 if new_filename.startswith('ipythonrc'):
861 if new_filename.startswith('ipythonrc'):
1165 new_filename = new_filename + rc_suffix
862 new_filename = new_filename + rc_suffix
1166 # The config directory should only contain files, skip any
863 # The config directory should only contain files, skip any
1167 # directories which may be there (like CVS)
864 # directories which may be there (like CVS)
1168 if os.path.isdir(new_full_path):
865 if os.path.isdir(new_full_path):
1169 continue
866 continue
1170 if os.path.exists(new_filename):
867 if os.path.exists(new_filename):
1171 old_file = new_filename+'.old'
868 old_file = new_filename+'.old'
1172 if os.path.exists(old_file):
869 if os.path.exists(old_file):
1173 os.remove(old_file)
870 os.remove(old_file)
1174 os.rename(new_filename,old_file)
871 os.rename(new_filename,old_file)
1175 shutil.copy(new_full_path,new_filename)
872 shutil.copy(new_full_path,new_filename)
1176 else:
873 else:
1177 raise ValueError,'unrecognized mode for install:',`mode`
874 raise ValueError,'unrecognized mode for install:',`mode`
1178
875
1179 # Fix line-endings to those native to each platform in the config
876 # Fix line-endings to those native to each platform in the config
1180 # directory.
877 # directory.
1181 try:
878 try:
1182 os.chdir(ipythondir)
879 os.chdir(ipythondir)
1183 except:
880 except:
1184 print """
881 print """
1185 Problem: changing to directory %s failed.
882 Problem: changing to directory %s failed.
1186 Details:
883 Details:
1187 %s
884 %s
1188
885
1189 Some configuration files may have incorrect line endings. This should not
886 Some configuration files may have incorrect line endings. This should not
1190 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
887 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1191 wait()
888 wait()
1192 else:
889 else:
1193 for fname in glb('ipythonrc*'):
890 for fname in glb('ipythonrc*'):
1194 try:
891 try:
1195 native_line_ends(fname,backup=0)
892 native_line_ends(fname,backup=0)
1196 except IOError:
893 except IOError:
1197 pass
894 pass
1198
895
1199 if mode == 'install':
896 if mode == 'install':
1200 print """
897 print """
1201 Successful installation!
898 Successful installation!
1202
899
1203 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
900 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1204 IPython manual (there are both HTML and PDF versions supplied with the
901 IPython manual (there are both HTML and PDF versions supplied with the
1205 distribution) to make sure that your system environment is properly configured
902 distribution) to make sure that your system environment is properly configured
1206 to take advantage of IPython's features."""
903 to take advantage of IPython's features."""
1207 else:
904 else:
1208 print """
905 print """
1209 Successful upgrade!
906 Successful upgrade!
1210
907
1211 All files in your directory:
908 All files in your directory:
1212 %(ipythondir)s
909 %(ipythondir)s
1213 which would have been overwritten by the upgrade were backed up with a .old
910 which would have been overwritten by the upgrade were backed up with a .old
1214 extension. If you had made particular customizations in those files you may
911 extension. If you had made particular customizations in those files you may
1215 want to merge them back into the new files.""" % locals()
912 want to merge them back into the new files.""" % locals()
1216 wait()
913 wait()
1217 os.chdir(cwd)
914 os.chdir(cwd)
1218 # end user_setup()
915 # end user_setup()
1219
916
1220 def atexit_operations(self):
917 def atexit_operations(self):
1221 """This will be executed at the time of exit.
918 """This will be executed at the time of exit.
1222
919
1223 Saving of persistent data should be performed here. """
920 Saving of persistent data should be performed here. """
1224
921
1225 # input history
922 # input history
1226 self.savehist()
923 self.savehist()
1227
924
1228 # Cleanup all tempfiles left around
925 # Cleanup all tempfiles left around
1229 for tfile in self.tempfiles:
926 for tfile in self.tempfiles:
1230 try:
927 try:
1231 os.unlink(tfile)
928 os.unlink(tfile)
1232 except OSError:
929 except OSError:
1233 pass
930 pass
1234
931
1235 # save the "persistent data" catch-all dictionary
932 # save the "persistent data" catch-all dictionary
1236 try:
933 try:
1237 pickle.dump(self.persist, open(self.persist_fname,"w"))
934 pickle.dump(self.persist, open(self.persist_fname,"w"))
1238 except:
935 except:
1239 print "*** ERROR *** persistent data saving failed."
936 print "*** ERROR *** persistent data saving failed."
1240
937
1241 def savehist(self):
938 def savehist(self):
1242 """Save input history to a file (via readline library)."""
939 """Save input history to a file (via readline library)."""
1243 try:
940 try:
1244 self.readline.write_history_file(self.histfile)
941 self.readline.write_history_file(self.histfile)
1245 except:
942 except:
1246 print 'Unable to save IPython command history to file: ' + \
943 print 'Unable to save IPython command history to file: ' + \
1247 `self.histfile`
944 `self.histfile`
1248
945
1249 def pre_readline(self):
946 def pre_readline(self):
1250 """readline hook to be used at the start of each line.
947 """readline hook to be used at the start of each line.
1251
948
1252 Currently it handles auto-indent only."""
949 Currently it handles auto-indent only."""
1253
950
1254 self.readline.insert_text(' '* self.readline_indent)
951 self.readline.insert_text(' '* self.readline_indent)
1255
952
1256 def init_readline(self):
953 def init_readline(self):
1257 """Command history completion/saving/reloading."""
954 """Command history completion/saving/reloading."""
1258 try:
955 try:
1259 import readline
956 import readline
1260 self.Completer = MagicCompleter(self,
957 except ImportError:
1261 self.user_ns,
1262 self.user_global_ns,
1263 self.rc.readline_omit__names,
1264 self.alias_table)
1265 except ImportError,NameError:
1266 # If FlexCompleter failed to import, MagicCompleter won't be
1267 # defined. This can happen because of a problem with readline
1268 self.has_readline = 0
958 self.has_readline = 0
959 self.readline = None
1269 # no point in bugging windows users with this every time:
960 # no point in bugging windows users with this every time:
1270 if os.name == 'posix':
961 if os.name == 'posix':
1271 warn('Readline services not available on this platform.')
962 warn('Readline services not available on this platform.')
1272 else:
963 else:
1273 import atexit
964 import atexit
965 from IPython.completer import IPCompleter
966 self.Completer = IPCompleter(self,
967 self.user_ns,
968 self.user_global_ns,
969 self.rc.readline_omit__names,
970 self.alias_table)
1274
971
1275 # Platform-specific configuration
972 # Platform-specific configuration
1276 if os.name == 'nt':
973 if os.name == 'nt':
1277 # readline under Windows modifies the default exit behavior
1278 # from being Ctrl-Z/Return to the Unix Ctrl-D one.
1279 __builtin__.exit = __builtin__.quit = \
1280 ('Use Ctrl-D (i.e. EOF) to exit. '
1281 'Use %Exit or %Quit to exit without confirmation.')
1282 self.readline_startup_hook = readline.set_pre_input_hook
974 self.readline_startup_hook = readline.set_pre_input_hook
1283 else:
975 else:
1284 self.readline_startup_hook = readline.set_startup_hook
976 self.readline_startup_hook = readline.set_startup_hook
1285
977
1286 # Load user's initrc file (readline config)
978 # Load user's initrc file (readline config)
1287 inputrc_name = os.environ.get('INPUTRC')
979 inputrc_name = os.environ.get('INPUTRC')
1288 if inputrc_name is None:
980 if inputrc_name is None:
1289 home_dir = get_home_dir()
981 home_dir = get_home_dir()
1290 if home_dir is not None:
982 if home_dir is not None:
1291 inputrc_name = os.path.join(home_dir,'.inputrc')
983 inputrc_name = os.path.join(home_dir,'.inputrc')
1292 if os.path.isfile(inputrc_name):
984 if os.path.isfile(inputrc_name):
1293 try:
985 try:
1294 readline.read_init_file(inputrc_name)
986 readline.read_init_file(inputrc_name)
1295 except:
987 except:
1296 warn('Problems reading readline initialization file <%s>'
988 warn('Problems reading readline initialization file <%s>'
1297 % inputrc_name)
989 % inputrc_name)
1298
990
1299 self.has_readline = 1
991 self.has_readline = 1
1300 self.readline = readline
992 self.readline = readline
1301 self.readline_indent = 0 # for auto-indenting via readline
993 self.readline_indent = 0 # for auto-indenting via readline
1302 # save this in sys so embedded copies can restore it properly
994 # save this in sys so embedded copies can restore it properly
1303 sys.ipcompleter = self.Completer.complete
995 sys.ipcompleter = self.Completer.complete
1304 readline.set_completer(self.Completer.complete)
996 readline.set_completer(self.Completer.complete)
1305
997
1306 # Configure readline according to user's prefs
998 # Configure readline according to user's prefs
1307 for rlcommand in self.rc.readline_parse_and_bind:
999 for rlcommand in self.rc.readline_parse_and_bind:
1308 readline.parse_and_bind(rlcommand)
1000 readline.parse_and_bind(rlcommand)
1309
1001
1310 # remove some chars from the delimiters list
1002 # remove some chars from the delimiters list
1311 delims = readline.get_completer_delims()
1003 delims = readline.get_completer_delims()
1312 delims = delims.translate(string._idmap,
1004 delims = delims.translate(string._idmap,
1313 self.rc.readline_remove_delims)
1005 self.rc.readline_remove_delims)
1314 readline.set_completer_delims(delims)
1006 readline.set_completer_delims(delims)
1315 # otherwise we end up with a monster history after a while:
1007 # otherwise we end up with a monster history after a while:
1316 readline.set_history_length(1000)
1008 readline.set_history_length(1000)
1317 try:
1009 try:
1318 #print '*** Reading readline history' # dbg
1010 #print '*** Reading readline history' # dbg
1319 readline.read_history_file(self.histfile)
1011 readline.read_history_file(self.histfile)
1320 except IOError:
1012 except IOError:
1321 pass # It doesn't exist yet.
1013 pass # It doesn't exist yet.
1322
1014
1323 atexit.register(self.atexit_operations)
1015 atexit.register(self.atexit_operations)
1324 del atexit
1016 del atexit
1325
1017
1326 # Configure auto-indent for all platforms
1018 # Configure auto-indent for all platforms
1327 self.set_autoindent(self.rc.autoindent)
1019 self.set_autoindent(self.rc.autoindent)
1328
1020
1329 def showsyntaxerror(self, filename=None):
1021 def showsyntaxerror(self, filename=None):
1330 """Display the syntax error that just occurred.
1022 """Display the syntax error that just occurred.
1331
1023
1332 This doesn't display a stack trace because there isn't one.
1024 This doesn't display a stack trace because there isn't one.
1333
1025
1334 If a filename is given, it is stuffed in the exception instead
1026 If a filename is given, it is stuffed in the exception instead
1335 of what was there before (because Python's parser always uses
1027 of what was there before (because Python's parser always uses
1336 "<string>" when reading from a string).
1028 "<string>" when reading from a string).
1337 """
1029 """
1338 type, value, sys.last_traceback = sys.exc_info()
1030 type, value, sys.last_traceback = sys.exc_info()
1339 sys.last_type = type
1031 sys.last_type = type
1340 sys.last_value = value
1032 sys.last_value = value
1341 if filename and type is SyntaxError:
1033 if filename and type is SyntaxError:
1342 # Work hard to stuff the correct filename in the exception
1034 # Work hard to stuff the correct filename in the exception
1343 try:
1035 try:
1344 msg, (dummy_filename, lineno, offset, line) = value
1036 msg, (dummy_filename, lineno, offset, line) = value
1345 except:
1037 except:
1346 # Not the format we expect; leave it alone
1038 # Not the format we expect; leave it alone
1347 pass
1039 pass
1348 else:
1040 else:
1349 # Stuff in the right filename
1041 # Stuff in the right filename
1350 try:
1042 try:
1351 # Assume SyntaxError is a class exception
1043 # Assume SyntaxError is a class exception
1352 value = SyntaxError(msg, (filename, lineno, offset, line))
1044 value = SyntaxError(msg, (filename, lineno, offset, line))
1353 except:
1045 except:
1354 # If that failed, assume SyntaxError is a string
1046 # If that failed, assume SyntaxError is a string
1355 value = msg, (filename, lineno, offset, line)
1047 value = msg, (filename, lineno, offset, line)
1356 self.SyntaxTB(type,value,[])
1048 self.SyntaxTB(type,value,[])
1357
1049
1358 def debugger(self):
1050 def debugger(self):
1359 """Call the pdb debugger."""
1051 """Call the pdb debugger."""
1360
1052
1361 if not self.rc.pdb:
1053 if not self.rc.pdb:
1362 return
1054 return
1363 pdb.pm()
1055 pdb.pm()
1364
1056
1365 def showtraceback(self,exc_tuple = None,filename=None):
1057 def showtraceback(self,exc_tuple = None,filename=None):
1366 """Display the exception that just occurred."""
1058 """Display the exception that just occurred."""
1367
1059
1368 # Though this won't be called by syntax errors in the input line,
1060 # Though this won't be called by syntax errors in the input line,
1369 # there may be SyntaxError cases whith imported code.
1061 # there may be SyntaxError cases whith imported code.
1370 if exc_tuple is None:
1062 if exc_tuple is None:
1371 type, value, tb = sys.exc_info()
1063 type, value, tb = sys.exc_info()
1372 else:
1064 else:
1373 type, value, tb = exc_tuple
1065 type, value, tb = exc_tuple
1374 if type is SyntaxError:
1066 if type is SyntaxError:
1375 self.showsyntaxerror(filename)
1067 self.showsyntaxerror(filename)
1376 else:
1068 else:
1377 sys.last_type = type
1069 sys.last_type = type
1378 sys.last_value = value
1070 sys.last_value = value
1379 sys.last_traceback = tb
1071 sys.last_traceback = tb
1380 self.InteractiveTB()
1072 self.InteractiveTB()
1381 if self.InteractiveTB.call_pdb and self.has_readline:
1073 if self.InteractiveTB.call_pdb and self.has_readline:
1382 # pdb mucks up readline, fix it back
1074 # pdb mucks up readline, fix it back
1383 self.readline.set_completer(self.Completer.complete)
1075 self.readline.set_completer(self.Completer.complete)
1384
1076
1385 def update_cache(self, line):
1077 def update_cache(self, line):
1386 """puts line into cache"""
1078 """puts line into cache"""
1387 self.inputcache.insert(0, line) # This copies the cache every time ... :-(
1079 self.inputcache.insert(0, line) # This copies the cache every time ... :-(
1388 if len(self.inputcache) >= self.CACHELENGTH:
1080 if len(self.inputcache) >= self.CACHELENGTH:
1389 self.inputcache.pop() # This not :-)
1081 self.inputcache.pop() # This doesn't :-)
1390
1082
1391 def mainloop(self,banner=None):
1083 def mainloop(self,banner=None):
1392 """Creates the local namespace and starts the mainloop.
1084 """Creates the local namespace and starts the mainloop.
1393
1085
1394 If an optional banner argument is given, it will override the
1086 If an optional banner argument is given, it will override the
1395 internally created default banner."""
1087 internally created default banner."""
1396
1088
1397 if self.rc.c: # Emulate Python's -c option
1089 if self.rc.c: # Emulate Python's -c option
1398 self.exec_init_cmd()
1090 self.exec_init_cmd()
1399 if banner is None:
1091 if banner is None:
1400 if self.rc.banner:
1092 if self.rc.banner:
1401 banner = self.BANNER+self.banner2
1093 banner = self.BANNER+self.banner2
1402 else:
1094 else:
1403 banner = ''
1095 banner = ''
1404 self.interact(banner)
1096 self.interact(banner)
1405
1097
1406 def exec_init_cmd(self):
1098 def exec_init_cmd(self):
1407 """Execute a command given at the command line.
1099 """Execute a command given at the command line.
1408
1100
1409 This emulates Python's -c option."""
1101 This emulates Python's -c option."""
1410
1102
1411 sys.argv = ['-c']
1103 sys.argv = ['-c']
1412 self.push(self.rc.c)
1104 self.push(self.rc.c)
1413
1105
1414 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1106 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1415 """Embeds IPython into a running python program.
1107 """Embeds IPython into a running python program.
1416
1108
1417 Input:
1109 Input:
1418
1110
1419 - header: An optional header message can be specified.
1111 - header: An optional header message can be specified.
1420
1112
1421 - local_ns, global_ns: working namespaces. If given as None, the
1113 - local_ns, global_ns: working namespaces. If given as None, the
1422 IPython-initialized one is updated with __main__.__dict__, so that
1114 IPython-initialized one is updated with __main__.__dict__, so that
1423 program variables become visible but user-specific configuration
1115 program variables become visible but user-specific configuration
1424 remains possible.
1116 remains possible.
1425
1117
1426 - stack_depth: specifies how many levels in the stack to go to
1118 - stack_depth: specifies how many levels in the stack to go to
1427 looking for namespaces (when local_ns and global_ns are None). This
1119 looking for namespaces (when local_ns and global_ns are None). This
1428 allows an intermediate caller to make sure that this function gets
1120 allows an intermediate caller to make sure that this function gets
1429 the namespace from the intended level in the stack. By default (0)
1121 the namespace from the intended level in the stack. By default (0)
1430 it will get its locals and globals from the immediate caller.
1122 it will get its locals and globals from the immediate caller.
1431
1123
1432 Warning: it's possible to use this in a program which is being run by
1124 Warning: it's possible to use this in a program which is being run by
1433 IPython itself (via %run), but some funny things will happen (a few
1125 IPython itself (via %run), but some funny things will happen (a few
1434 globals get overwritten). In the future this will be cleaned up, as
1126 globals get overwritten). In the future this will be cleaned up, as
1435 there is no fundamental reason why it can't work perfectly."""
1127 there is no fundamental reason why it can't work perfectly."""
1436
1128
1437 # Get locals and globals from caller
1129 # Get locals and globals from caller
1438 if local_ns is None or global_ns is None:
1130 if local_ns is None or global_ns is None:
1439 call_frame = sys._getframe(stack_depth).f_back
1131 call_frame = sys._getframe(stack_depth).f_back
1440
1132
1441 if local_ns is None:
1133 if local_ns is None:
1442 local_ns = call_frame.f_locals
1134 local_ns = call_frame.f_locals
1443 if global_ns is None:
1135 if global_ns is None:
1444 global_ns = call_frame.f_globals
1136 global_ns = call_frame.f_globals
1445
1137
1446 # Update namespaces and fire up interpreter
1138 # Update namespaces and fire up interpreter
1447 self.user_ns = local_ns
1139 self.user_ns = local_ns
1448 self.user_global_ns = global_ns
1140 self.user_global_ns = global_ns
1449
1141
1450 # Patch for global embedding to make sure that things don't overwrite
1142 # Patch for global embedding to make sure that things don't overwrite
1451 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1143 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1452 # FIXME. Test this a bit more carefully (the if.. is new)
1144 # FIXME. Test this a bit more carefully (the if.. is new)
1453 if local_ns is None and global_ns is None:
1145 if local_ns is None and global_ns is None:
1454 self.user_global_ns.update(__main__.__dict__)
1146 self.user_global_ns.update(__main__.__dict__)
1455
1147
1456 # make sure the tab-completer has the correct frame information, so it
1148 # make sure the tab-completer has the correct frame information, so it
1457 # actually completes using the frame's locals/globals
1149 # actually completes using the frame's locals/globals
1458 self.set_completer_frame(call_frame)
1150 self.set_completer_frame(call_frame)
1459
1151
1460 self.interact(header)
1152 self.interact(header)
1461
1153
1462 def interact(self, banner=None):
1154 def interact(self, banner=None):
1463 """Closely emulate the interactive Python console.
1155 """Closely emulate the interactive Python console.
1464
1156
1465 The optional banner argument specify the banner to print
1157 The optional banner argument specify the banner to print
1466 before the first interaction; by default it prints a banner
1158 before the first interaction; by default it prints a banner
1467 similar to the one printed by the real Python interpreter,
1159 similar to the one printed by the real Python interpreter,
1468 followed by the current class name in parentheses (so as not
1160 followed by the current class name in parentheses (so as not
1469 to confuse this with the real interpreter -- since it's so
1161 to confuse this with the real interpreter -- since it's so
1470 close!).
1162 close!).
1471
1163
1472 """
1164 """
1473 cprt = 'Type "copyright", "credits" or "license" for more information.'
1165 cprt = 'Type "copyright", "credits" or "license" for more information.'
1474 if banner is None:
1166 if banner is None:
1475 self.write("Python %s on %s\n%s\n(%s)\n" %
1167 self.write("Python %s on %s\n%s\n(%s)\n" %
1476 (sys.version, sys.platform, cprt,
1168 (sys.version, sys.platform, cprt,
1477 self.__class__.__name__))
1169 self.__class__.__name__))
1478 else:
1170 else:
1479 self.write(banner)
1171 self.write(banner)
1480
1172
1481 more = 0
1173 more = 0
1482
1174
1483 # Mark activity in the builtins
1175 # Mark activity in the builtins
1484 __builtin__.__dict__['__IPYTHON__active'] += 1
1176 __builtin__.__dict__['__IPYTHON__active'] += 1
1485
1177
1486 # compiled regexps for autoindent management
1178 # compiled regexps for autoindent management
1487 ini_spaces_re = re.compile(r'^(\s+)')
1179 ini_spaces_re = re.compile(r'^(\s+)')
1488 dedent_re = re.compile(r'^\s+raise|^\s+return')
1180 dedent_re = re.compile(r'^\s+raise|^\s+return')
1489
1181
1490 # exit_now is set by a call to %Exit or %Quit
1182 # exit_now is set by a call to %Exit or %Quit
1491 while not self.exit_now:
1183 while not self.exit_now:
1492 try:
1184 try:
1493 if more:
1185 if more:
1494 prompt = self.outputcache.prompt2
1186 prompt = self.outputcache.prompt2
1495 if self.autoindent:
1187 if self.autoindent:
1496 self.readline_startup_hook(self.pre_readline)
1188 self.readline_startup_hook(self.pre_readline)
1497 else:
1189 else:
1498 prompt = self.outputcache.prompt1
1190 prompt = self.outputcache.prompt1
1499 try:
1191 try:
1500 line = self.raw_input(prompt,more)
1192 line = self.raw_input(prompt,more)
1501 if self.autoindent:
1193 if self.autoindent:
1502 self.readline_startup_hook(None)
1194 self.readline_startup_hook(None)
1503 except EOFError:
1195 except EOFError:
1504 if self.autoindent:
1196 if self.autoindent:
1505 self.readline_startup_hook(None)
1197 self.readline_startup_hook(None)
1506 self.write("\n")
1198 self.write("\n")
1507 if self.rc.confirm_exit:
1199 self.exit()
1508 if ask_yes_no('Do you really want to exit ([y]/n)?','y'):
1200 except IPythonExit:
1509 break
1201 self.exit()
1510 else:
1511 break
1512 else:
1202 else:
1513 more = self.push(line)
1203 more = self.push(line)
1514 # Auto-indent management
1204 # Auto-indent management
1515 if self.autoindent:
1205 if self.autoindent:
1516 if line:
1206 if line:
1517 ini_spaces = ini_spaces_re.match(line)
1207 ini_spaces = ini_spaces_re.match(line)
1518 if ini_spaces:
1208 if ini_spaces:
1519 nspaces = ini_spaces.end()
1209 nspaces = ini_spaces.end()
1520 else:
1210 else:
1521 nspaces = 0
1211 nspaces = 0
1522 self.readline_indent = nspaces
1212 self.readline_indent = nspaces
1523
1213
1524 if line[-1] == ':':
1214 if line[-1] == ':':
1525 self.readline_indent += 4
1215 self.readline_indent += 4
1526 elif dedent_re.match(line):
1216 elif dedent_re.match(line):
1527 self.readline_indent -= 4
1217 self.readline_indent -= 4
1528 else:
1218 else:
1529 self.readline_indent = 0
1219 self.readline_indent = 0
1530
1220
1531 except KeyboardInterrupt:
1221 except KeyboardInterrupt:
1532 self.write("\nKeyboardInterrupt\n")
1222 self.write("\nKeyboardInterrupt\n")
1533 self.resetbuffer()
1223 self.resetbuffer()
1534 more = 0
1224 more = 0
1535 # keep cache in sync with the prompt counter:
1225 # keep cache in sync with the prompt counter:
1536 self.outputcache.prompt_count -= 1
1226 self.outputcache.prompt_count -= 1
1537
1227
1538 if self.autoindent:
1228 if self.autoindent:
1539 self.readline_indent = 0
1229 self.readline_indent = 0
1540
1230
1541 except bdb.BdbQuit:
1231 except bdb.BdbQuit:
1542 warn("The Python debugger has exited with a BdbQuit exception.\n"
1232 warn("The Python debugger has exited with a BdbQuit exception.\n"
1543 "Because of how pdb handles the stack, it is impossible\n"
1233 "Because of how pdb handles the stack, it is impossible\n"
1544 "for IPython to properly format this particular exception.\n"
1234 "for IPython to properly format this particular exception.\n"
1545 "IPython will resume normal operation.")
1235 "IPython will resume normal operation.")
1546
1236
1547 # We are off again...
1237 # We are off again...
1548 __builtin__.__dict__['__IPYTHON__active'] -= 1
1238 __builtin__.__dict__['__IPYTHON__active'] -= 1
1549
1239
1550 def excepthook(self, type, value, tb):
1240 def excepthook(self, type, value, tb):
1551 """One more defense for GUI apps that call sys.excepthook.
1241 """One more defense for GUI apps that call sys.excepthook.
1552
1242
1553 GUI frameworks like wxPython trap exceptions and call
1243 GUI frameworks like wxPython trap exceptions and call
1554 sys.excepthook themselves. I guess this is a feature that
1244 sys.excepthook themselves. I guess this is a feature that
1555 enables them to keep running after exceptions that would
1245 enables them to keep running after exceptions that would
1556 otherwise kill their mainloop. This is a bother for IPython
1246 otherwise kill their mainloop. This is a bother for IPython
1557 which excepts to catch all of the program exceptions with a try:
1247 which excepts to catch all of the program exceptions with a try:
1558 except: statement.
1248 except: statement.
1559
1249
1560 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1250 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1561 any app directly invokes sys.excepthook, it will look to the user like
1251 any app directly invokes sys.excepthook, it will look to the user like
1562 IPython crashed. In order to work around this, we can disable the
1252 IPython crashed. In order to work around this, we can disable the
1563 CrashHandler and replace it with this excepthook instead, which prints a
1253 CrashHandler and replace it with this excepthook instead, which prints a
1564 regular traceback using our InteractiveTB. In this fashion, apps which
1254 regular traceback using our InteractiveTB. In this fashion, apps which
1565 call sys.excepthook will generate a regular-looking exception from
1255 call sys.excepthook will generate a regular-looking exception from
1566 IPython, and the CrashHandler will only be triggered by real IPython
1256 IPython, and the CrashHandler will only be triggered by real IPython
1567 crashes.
1257 crashes.
1568
1258
1569 This hook should be used sparingly, only in places which are not likely
1259 This hook should be used sparingly, only in places which are not likely
1570 to be true IPython errors.
1260 to be true IPython errors.
1571 """
1261 """
1572
1262
1573 self.InteractiveTB(type, value, tb, tb_offset=0)
1263 self.InteractiveTB(type, value, tb, tb_offset=0)
1574 if self.InteractiveTB.call_pdb and self.has_readline:
1264 if self.InteractiveTB.call_pdb and self.has_readline:
1575 self.readline.set_completer(self.Completer.complete)
1265 self.readline.set_completer(self.Completer.complete)
1576
1266
1577 def call_alias(self,alias,rest=''):
1267 def call_alias(self,alias,rest=''):
1578 """Call an alias given its name and the rest of the line.
1268 """Call an alias given its name and the rest of the line.
1579
1269
1580 This function MUST be given a proper alias, because it doesn't make
1270 This function MUST be given a proper alias, because it doesn't make
1581 any checks when looking up into the alias table. The caller is
1271 any checks when looking up into the alias table. The caller is
1582 responsible for invoking it only with a valid alias."""
1272 responsible for invoking it only with a valid alias."""
1583
1273
1584 #print 'ALIAS: <%s>+<%s>' % (alias,rest) # dbg
1274 #print 'ALIAS: <%s>+<%s>' % (alias,rest) # dbg
1585 nargs,cmd = self.alias_table[alias]
1275 nargs,cmd = self.alias_table[alias]
1586 # Expand the %l special to be the user's input line
1276 # Expand the %l special to be the user's input line
1587 if cmd.find('%l') >= 0:
1277 if cmd.find('%l') >= 0:
1588 cmd = cmd.replace('%l',rest)
1278 cmd = cmd.replace('%l',rest)
1589 rest = ''
1279 rest = ''
1590 if nargs==0:
1280 if nargs==0:
1591 # Simple, argument-less aliases
1281 # Simple, argument-less aliases
1592 cmd = '%s %s' % (cmd,rest)
1282 cmd = '%s %s' % (cmd,rest)
1593 else:
1283 else:
1594 # Handle aliases with positional arguments
1284 # Handle aliases with positional arguments
1595 args = rest.split(None,nargs)
1285 args = rest.split(None,nargs)
1596 if len(args)< nargs:
1286 if len(args)< nargs:
1597 error('Alias <%s> requires %s arguments, %s given.' %
1287 error('Alias <%s> requires %s arguments, %s given.' %
1598 (alias,nargs,len(args)))
1288 (alias,nargs,len(args)))
1599 return
1289 return
1600 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1290 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1601 # Now call the macro, evaluating in the user's namespace
1291 # Now call the macro, evaluating in the user's namespace
1602 try:
1292 try:
1603 self.system(cmd)
1293 self.system(cmd)
1604 except:
1294 except:
1605 self.showtraceback()
1295 self.showtraceback()
1606
1296
1607 def runlines(self,lines):
1297 def runlines(self,lines):
1608 """Run a string of one or more lines of source.
1298 """Run a string of one or more lines of source.
1609
1299
1610 This method is capable of running a string containing multiple source
1300 This method is capable of running a string containing multiple source
1611 lines, as if they had been entered at the IPython prompt. Since it
1301 lines, as if they had been entered at the IPython prompt. Since it
1612 exposes IPython's processing machinery, the given strings can contain
1302 exposes IPython's processing machinery, the given strings can contain
1613 magic calls (%magic), special shell access (!cmd), etc."""
1303 magic calls (%magic), special shell access (!cmd), etc."""
1614
1304
1615 # We must start with a clean buffer, in case this is run from an
1305 # We must start with a clean buffer, in case this is run from an
1616 # interactive IPython session (via a magic, for example).
1306 # interactive IPython session (via a magic, for example).
1617 self.resetbuffer()
1307 self.resetbuffer()
1618 lines = lines.split('\n')
1308 lines = lines.split('\n')
1619 more = 0
1309 more = 0
1620 for line in lines:
1310 for line in lines:
1621 # skip blank lines so we don't mess up the prompt counter, but do
1311 # skip blank lines so we don't mess up the prompt counter, but do
1622 # NOT skip even a blank line if we are in a code block (more is
1312 # NOT skip even a blank line if we are in a code block (more is
1623 # true)
1313 # true)
1624 if line or more:
1314 if line or more:
1625 more = self.push((self.prefilter(line,more)))
1315 more = self.push((self.prefilter(line,more)))
1626 # IPython's runsource returns None if there was an error
1316 # IPython's runsource returns None if there was an error
1627 # compiling the code. This allows us to stop processing right
1317 # compiling the code. This allows us to stop processing right
1628 # away, so the user gets the error message at the right place.
1318 # away, so the user gets the error message at the right place.
1629 if more is None:
1319 if more is None:
1630 break
1320 break
1631 # final newline in case the input didn't have it, so that the code
1321 # final newline in case the input didn't have it, so that the code
1632 # actually does get executed
1322 # actually does get executed
1633 if more:
1323 if more:
1634 self.push('\n')
1324 self.push('\n')
1635
1325
1636 def runsource(self, source, filename="<input>", symbol="single"):
1326 def runsource(self, source, filename="<input>", symbol="single"):
1637 """Compile and run some source in the interpreter.
1327 """Compile and run some source in the interpreter.
1638
1328
1639 Arguments are as for compile_command().
1329 Arguments are as for compile_command().
1640
1330
1641 One several things can happen:
1331 One several things can happen:
1642
1332
1643 1) The input is incorrect; compile_command() raised an
1333 1) The input is incorrect; compile_command() raised an
1644 exception (SyntaxError or OverflowError). A syntax traceback
1334 exception (SyntaxError or OverflowError). A syntax traceback
1645 will be printed by calling the showsyntaxerror() method.
1335 will be printed by calling the showsyntaxerror() method.
1646
1336
1647 2) The input is incomplete, and more input is required;
1337 2) The input is incomplete, and more input is required;
1648 compile_command() returned None. Nothing happens.
1338 compile_command() returned None. Nothing happens.
1649
1339
1650 3) The input is complete; compile_command() returned a code
1340 3) The input is complete; compile_command() returned a code
1651 object. The code is executed by calling self.runcode() (which
1341 object. The code is executed by calling self.runcode() (which
1652 also handles run-time exceptions, except for SystemExit).
1342 also handles run-time exceptions, except for SystemExit).
1653
1343
1654 The return value is:
1344 The return value is:
1655
1345
1656 - True in case 2
1346 - True in case 2
1657
1347
1658 - False in the other cases, unless an exception is raised, where
1348 - False in the other cases, unless an exception is raised, where
1659 None is returned instead. This can be used by external callers to
1349 None is returned instead. This can be used by external callers to
1660 know whether to continue feeding input or not.
1350 know whether to continue feeding input or not.
1661
1351
1662 The return value can be used to decide whether to use sys.ps1 or
1352 The return value can be used to decide whether to use sys.ps1 or
1663 sys.ps2 to prompt the next line."""
1353 sys.ps2 to prompt the next line."""
1664
1354
1665 try:
1355 try:
1666 code = self.compile(source, filename, symbol)
1356 code = self.compile(source, filename, symbol)
1667 except (OverflowError, SyntaxError, ValueError):
1357 except (OverflowError, SyntaxError, ValueError):
1668 # Case 1
1358 # Case 1
1669 self.showsyntaxerror(filename)
1359 self.showsyntaxerror(filename)
1670 return None
1360 return None
1671
1361
1672 if code is None:
1362 if code is None:
1673 # Case 2
1363 # Case 2
1674 return True
1364 return True
1675
1365
1676 # Case 3
1366 # Case 3
1677 # We store the code object so that threaded shells and
1367 # We store the code object so that threaded shells and
1678 # custom exception handlers can access all this info if needed.
1368 # custom exception handlers can access all this info if needed.
1679 # The source corresponding to this can be obtained from the
1369 # The source corresponding to this can be obtained from the
1680 # buffer attribute as '\n'.join(self.buffer).
1370 # buffer attribute as '\n'.join(self.buffer).
1681 self.code_to_run = code
1371 self.code_to_run = code
1682 # now actually execute the code object
1372 # now actually execute the code object
1683 if self.runcode(code) == 0:
1373 if self.runcode(code) == 0:
1684 return False
1374 return False
1685 else:
1375 else:
1686 return None
1376 return None
1687
1377
1688 def runcode(self,code_obj):
1378 def runcode(self,code_obj):
1689 """Execute a code object.
1379 """Execute a code object.
1690
1380
1691 When an exception occurs, self.showtraceback() is called to display a
1381 When an exception occurs, self.showtraceback() is called to display a
1692 traceback.
1382 traceback.
1693
1383
1694 Return value: a flag indicating whether the code to be run completed
1384 Return value: a flag indicating whether the code to be run completed
1695 successfully:
1385 successfully:
1696
1386
1697 - 0: successful execution.
1387 - 0: successful execution.
1698 - 1: an error occurred.
1388 - 1: an error occurred.
1699 """
1389 """
1700
1390
1701 # Set our own excepthook in case the user code tries to call it
1391 # Set our own excepthook in case the user code tries to call it
1702 # directly, so that the IPython crash handler doesn't get triggered
1392 # directly, so that the IPython crash handler doesn't get triggered
1703 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1393 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1704 outflag = 1 # happens in more places, so it's easier as default
1394 outflag = 1 # happens in more places, so it's easier as default
1705 try:
1395 try:
1706 try:
1396 try:
1707 # Embedded instances require separate global/local namespaces
1397 # Embedded instances require separate global/local namespaces
1708 # so they can see both the surrounding (local) namespace and
1398 # so they can see both the surrounding (local) namespace and
1709 # the module-level globals when called inside another function.
1399 # the module-level globals when called inside another function.
1710 if self.embedded:
1400 if self.embedded:
1711 exec code_obj in self.user_global_ns, self.user_ns
1401 exec code_obj in self.user_global_ns, self.user_ns
1712 # Normal (non-embedded) instances should only have a single
1402 # Normal (non-embedded) instances should only have a single
1713 # namespace for user code execution, otherwise functions won't
1403 # namespace for user code execution, otherwise functions won't
1714 # see interactive top-level globals.
1404 # see interactive top-level globals.
1715 else:
1405 else:
1716 exec code_obj in self.user_ns
1406 exec code_obj in self.user_ns
1717 finally:
1407 finally:
1718 # Reset our crash handler in place
1408 # Reset our crash handler in place
1719 sys.excepthook = old_excepthook
1409 sys.excepthook = old_excepthook
1720 except SystemExit:
1410 except SystemExit:
1721 self.resetbuffer()
1411 self.resetbuffer()
1722 self.showtraceback()
1412 self.showtraceback()
1723 warn( __builtin__.exit,level=1)
1413 warn("Type exit or quit to exit IPython "
1414 "(%Exit or %Quit do so unconditionally).",level=1)
1724 except self.custom_exceptions:
1415 except self.custom_exceptions:
1725 etype,value,tb = sys.exc_info()
1416 etype,value,tb = sys.exc_info()
1726 self.CustomTB(etype,value,tb)
1417 self.CustomTB(etype,value,tb)
1727 except:
1418 except:
1728 self.showtraceback()
1419 self.showtraceback()
1729 else:
1420 else:
1730 outflag = 0
1421 outflag = 0
1731 if code.softspace(sys.stdout, 0):
1422 if softspace(sys.stdout, 0):
1732 print
1423 print
1733 # Flush out code object which has been run (and source)
1424 # Flush out code object which has been run (and source)
1734 self.code_to_run = None
1425 self.code_to_run = None
1735 return outflag
1426 return outflag
1427
1428 def push(self, line):
1429 """Push a line to the interpreter.
1430
1431 The line should not have a trailing newline; it may have
1432 internal newlines. The line is appended to a buffer and the
1433 interpreter's runsource() method is called with the
1434 concatenated contents of the buffer as source. If this
1435 indicates that the command was executed or invalid, the buffer
1436 is reset; otherwise, the command is incomplete, and the buffer
1437 is left as it was after the line was appended. The return
1438 value is 1 if more input is required, 0 if the line was dealt
1439 with in some way (this is the same as runsource()).
1440
1441 """
1442 self.buffer.append(line)
1443 source = "\n".join(self.buffer)
1444 more = self.runsource(source, self.filename)
1445 if not more:
1446 self.resetbuffer()
1447 return more
1448
1449 def resetbuffer(self):
1450 """Reset the input buffer."""
1451 self.buffer[:] = []
1736
1452
1737 def raw_input(self,prompt='',continue_prompt=False):
1453 def raw_input(self,prompt='',continue_prompt=False):
1738 """Write a prompt and read a line.
1454 """Write a prompt and read a line.
1739
1455
1740 The returned line does not include the trailing newline.
1456 The returned line does not include the trailing newline.
1741 When the user enters the EOF key sequence, EOFError is raised.
1457 When the user enters the EOF key sequence, EOFError is raised.
1742
1458
1743 Optional inputs:
1459 Optional inputs:
1744
1460
1745 - prompt(''): a string to be printed to prompt the user.
1461 - prompt(''): a string to be printed to prompt the user.
1746
1462
1747 - continue_prompt(False): whether this line is the first one or a
1463 - continue_prompt(False): whether this line is the first one or a
1748 continuation in a sequence of inputs.
1464 continuation in a sequence of inputs.
1749 """
1465 """
1750
1466
1751 line = raw_input_original(prompt)
1467 line = raw_input_original(prompt)
1752 # Try to be reasonably smart about not re-indenting pasted input more
1468 # Try to be reasonably smart about not re-indenting pasted input more
1753 # than necessary. We do this by trimming out the auto-indent initial
1469 # than necessary. We do this by trimming out the auto-indent initial
1754 # spaces, if the user's actual input started itself with whitespace.
1470 # spaces, if the user's actual input started itself with whitespace.
1755 if self.autoindent:
1471 if self.autoindent:
1756 line2 = line[self.readline_indent:]
1472 line2 = line[self.readline_indent:]
1757 if line2[0:1] in (' ','\t'):
1473 if line2[0:1] in (' ','\t'):
1758 line = line2
1474 line = line2
1759 return self.prefilter(line,continue_prompt)
1475 return self.prefilter(line,continue_prompt)
1760
1476
1761 def split_user_input(self,line):
1477 def split_user_input(self,line):
1762 """Split user input into pre-char, function part and rest."""
1478 """Split user input into pre-char, function part and rest."""
1763
1479
1764 lsplit = self.line_split.match(line)
1480 lsplit = self.line_split.match(line)
1765 if lsplit is None: # no regexp match returns None
1481 if lsplit is None: # no regexp match returns None
1766 try:
1482 try:
1767 iFun,theRest = line.split(None,1)
1483 iFun,theRest = line.split(None,1)
1768 except ValueError:
1484 except ValueError:
1769 iFun,theRest = line,''
1485 iFun,theRest = line,''
1770 pre = re.match('^(\s*)(.*)',line).groups()[0]
1486 pre = re.match('^(\s*)(.*)',line).groups()[0]
1771 else:
1487 else:
1772 pre,iFun,theRest = lsplit.groups()
1488 pre,iFun,theRest = lsplit.groups()
1773
1489
1774 #print 'line:<%s>' % line # dbg
1490 #print 'line:<%s>' % line # dbg
1775 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1491 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1776 return pre,iFun.strip(),theRest
1492 return pre,iFun.strip(),theRest
1777
1493
1778 def _prefilter(self, line, continue_prompt):
1494 def _prefilter(self, line, continue_prompt):
1779 """Calls different preprocessors, depending on the form of line."""
1495 """Calls different preprocessors, depending on the form of line."""
1780
1496
1781 # All handlers *must* return a value, even if it's blank ('').
1497 # All handlers *must* return a value, even if it's blank ('').
1782
1498
1783 # Lines are NOT logged here. Handlers should process the line as
1499 # Lines are NOT logged here. Handlers should process the line as
1784 # needed, update the cache AND log it (so that the input cache array
1500 # needed, update the cache AND log it (so that the input cache array
1785 # stays synced).
1501 # stays synced).
1786
1502
1787 # This function is _very_ delicate, and since it's also the one which
1503 # This function is _very_ delicate, and since it's also the one which
1788 # determines IPython's response to user input, it must be as efficient
1504 # determines IPython's response to user input, it must be as efficient
1789 # as possible. For this reason it has _many_ returns in it, trying
1505 # as possible. For this reason it has _many_ returns in it, trying
1790 # always to exit as quickly as it can figure out what it needs to do.
1506 # always to exit as quickly as it can figure out what it needs to do.
1791
1507
1792 # This function is the main responsible for maintaining IPython's
1508 # This function is the main responsible for maintaining IPython's
1793 # behavior respectful of Python's semantics. So be _very_ careful if
1509 # behavior respectful of Python's semantics. So be _very_ careful if
1794 # making changes to anything here.
1510 # making changes to anything here.
1795
1511
1796 #.....................................................................
1512 #.....................................................................
1797 # Code begins
1513 # Code begins
1798
1514
1799 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1515 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1800
1516
1801 # save the line away in case we crash, so the post-mortem handler can
1517 # save the line away in case we crash, so the post-mortem handler can
1802 # record it
1518 # record it
1803 self._last_input_line = line
1519 self._last_input_line = line
1804
1520
1805 #print '***line: <%s>' % line # dbg
1521 #print '***line: <%s>' % line # dbg
1806
1522
1807 # the input history needs to track even empty lines
1523 # the input history needs to track even empty lines
1808 if not line.strip():
1524 if not line.strip():
1809 if not continue_prompt:
1525 if not continue_prompt:
1810 self.outputcache.prompt_count -= 1
1526 self.outputcache.prompt_count -= 1
1811 return self.handle_normal('',continue_prompt)
1527 return self.handle_normal('',continue_prompt)
1812
1528
1813 # print '***cont',continue_prompt # dbg
1529 # print '***cont',continue_prompt # dbg
1814 # special handlers are only allowed for single line statements
1530 # special handlers are only allowed for single line statements
1815 if continue_prompt and not self.rc.multi_line_specials:
1531 if continue_prompt and not self.rc.multi_line_specials:
1816 return self.handle_normal(line,continue_prompt)
1532 return self.handle_normal(line,continue_prompt)
1817
1533
1818 # For the rest, we need the structure of the input
1534 # For the rest, we need the structure of the input
1819 pre,iFun,theRest = self.split_user_input(line)
1535 pre,iFun,theRest = self.split_user_input(line)
1820 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1536 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1821
1537
1822 # First check for explicit escapes in the last/first character
1538 # First check for explicit escapes in the last/first character
1823 handler = None
1539 handler = None
1824 if line[-1] == self.ESC_HELP:
1540 if line[-1] == self.ESC_HELP:
1825 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
1541 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
1826 if handler is None:
1542 if handler is None:
1827 # look at the first character of iFun, NOT of line, so we skip
1543 # look at the first character of iFun, NOT of line, so we skip
1828 # leading whitespace in multiline input
1544 # leading whitespace in multiline input
1829 handler = self.esc_handlers.get(iFun[0:1])
1545 handler = self.esc_handlers.get(iFun[0:1])
1830 if handler is not None:
1546 if handler is not None:
1831 return handler(line,continue_prompt,pre,iFun,theRest)
1547 return handler(line,continue_prompt,pre,iFun,theRest)
1832 # Emacs ipython-mode tags certain input lines
1548 # Emacs ipython-mode tags certain input lines
1833 if line.endswith('# PYTHON-MODE'):
1549 if line.endswith('# PYTHON-MODE'):
1834 return self.handle_emacs(line,continue_prompt)
1550 return self.handle_emacs(line,continue_prompt)
1835
1551
1836 # Next, check if we can automatically execute this thing
1552 # Next, check if we can automatically execute this thing
1837
1553
1838 # Allow ! in multi-line statements if multi_line_specials is on:
1554 # Allow ! in multi-line statements if multi_line_specials is on:
1839 if continue_prompt and self.rc.multi_line_specials and \
1555 if continue_prompt and self.rc.multi_line_specials and \
1840 iFun.startswith(self.ESC_SHELL):
1556 iFun.startswith(self.ESC_SHELL):
1841 return self.handle_shell_escape(line,continue_prompt,
1557 return self.handle_shell_escape(line,continue_prompt,
1842 pre=pre,iFun=iFun,
1558 pre=pre,iFun=iFun,
1843 theRest=theRest)
1559 theRest=theRest)
1844
1560
1845 # Let's try to find if the input line is a magic fn
1561 # Let's try to find if the input line is a magic fn
1846 oinfo = None
1562 oinfo = None
1847 if hasattr(self,'magic_'+iFun):
1563 if hasattr(self,'magic_'+iFun):
1848 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1564 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1849 if oinfo['ismagic']:
1565 if oinfo['ismagic']:
1850 # Be careful not to call magics when a variable assignment is
1566 # Be careful not to call magics when a variable assignment is
1851 # being made (ls='hi', for example)
1567 # being made (ls='hi', for example)
1852 if self.rc.automagic and \
1568 if self.rc.automagic and \
1853 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
1569 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
1854 (self.rc.multi_line_specials or not continue_prompt):
1570 (self.rc.multi_line_specials or not continue_prompt):
1855 return self.handle_magic(line,continue_prompt,
1571 return self.handle_magic(line,continue_prompt,
1856 pre,iFun,theRest)
1572 pre,iFun,theRest)
1857 else:
1573 else:
1858 return self.handle_normal(line,continue_prompt)
1574 return self.handle_normal(line,continue_prompt)
1859
1575
1860 # If the rest of the line begins with an (in)equality, assginment or
1576 # If the rest of the line begins with an (in)equality, assginment or
1861 # function call, we should not call _ofind but simply execute it.
1577 # function call, we should not call _ofind but simply execute it.
1862 # This avoids spurious geattr() accesses on objects upon assignment.
1578 # This avoids spurious geattr() accesses on objects upon assignment.
1863 #
1579 #
1864 # It also allows users to assign to either alias or magic names true
1580 # It also allows users to assign to either alias or magic names true
1865 # python variables (the magic/alias systems always take second seat to
1581 # python variables (the magic/alias systems always take second seat to
1866 # true python code).
1582 # true python code).
1867 if theRest and theRest[0] in '!=()':
1583 if theRest and theRest[0] in '!=()':
1868 return self.handle_normal(line,continue_prompt)
1584 return self.handle_normal(line,continue_prompt)
1869
1585
1870 if oinfo is None:
1586 if oinfo is None:
1871 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1587 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1872
1588
1873 if not oinfo['found']:
1589 if not oinfo['found']:
1590 if iFun in ('quit','exit'):
1591 raise IPythonExit
1874 return self.handle_normal(line,continue_prompt)
1592 return self.handle_normal(line,continue_prompt)
1875 else:
1593 else:
1876 #print 'iFun <%s> rest <%s>' % (iFun,theRest) # dbg
1594 #print 'iFun <%s> rest <%s>' % (iFun,theRest) # dbg
1877 if oinfo['isalias']:
1595 if oinfo['isalias']:
1878 return self.handle_alias(line,continue_prompt,
1596 return self.handle_alias(line,continue_prompt,
1879 pre,iFun,theRest)
1597 pre,iFun,theRest)
1880
1598
1881 if self.rc.autocall and \
1599 if self.rc.autocall and \
1882 not self.re_exclude_auto.match(theRest) and \
1600 not self.re_exclude_auto.match(theRest) and \
1883 self.re_fun_name.match(iFun) and \
1601 self.re_fun_name.match(iFun) and \
1884 callable(oinfo['obj']) :
1602 callable(oinfo['obj']) :
1885 #print 'going auto' # dbg
1603 #print 'going auto' # dbg
1886 return self.handle_auto(line,continue_prompt,pre,iFun,theRest)
1604 return self.handle_auto(line,continue_prompt,pre,iFun,theRest)
1887 else:
1605 else:
1888 #print 'was callable?', callable(oinfo['obj']) # dbg
1606 #print 'was callable?', callable(oinfo['obj']) # dbg
1889 return self.handle_normal(line,continue_prompt)
1607 return self.handle_normal(line,continue_prompt)
1890
1608
1891 # If we get here, we have a normal Python line. Log and return.
1609 # If we get here, we have a normal Python line. Log and return.
1892 return self.handle_normal(line,continue_prompt)
1610 return self.handle_normal(line,continue_prompt)
1893
1611
1894 def _prefilter_dumb(self, line, continue_prompt):
1612 def _prefilter_dumb(self, line, continue_prompt):
1895 """simple prefilter function, for debugging"""
1613 """simple prefilter function, for debugging"""
1896 return self.handle_normal(line,continue_prompt)
1614 return self.handle_normal(line,continue_prompt)
1897
1615
1898 # Set the default prefilter() function (this can be user-overridden)
1616 # Set the default prefilter() function (this can be user-overridden)
1899 prefilter = _prefilter
1617 prefilter = _prefilter
1900
1618
1901 def handle_normal(self,line,continue_prompt=None,
1619 def handle_normal(self,line,continue_prompt=None,
1902 pre=None,iFun=None,theRest=None):
1620 pre=None,iFun=None,theRest=None):
1903 """Handle normal input lines. Use as a template for handlers."""
1621 """Handle normal input lines. Use as a template for handlers."""
1904
1622
1905 self.log(line,continue_prompt)
1623 self.log(line,continue_prompt)
1906 self.update_cache(line)
1624 self.update_cache(line)
1907 return line
1625 return line
1908
1626
1909 def handle_alias(self,line,continue_prompt=None,
1627 def handle_alias(self,line,continue_prompt=None,
1910 pre=None,iFun=None,theRest=None):
1628 pre=None,iFun=None,theRest=None):
1911 """Handle alias input lines. """
1629 """Handle alias input lines. """
1912
1630
1913 theRest = esc_quotes(theRest)
1631 theRest = esc_quotes(theRest)
1914 line_out = "%s%s.call_alias('%s','%s')" % (pre,self.name,iFun,theRest)
1632 line_out = "%s%s.call_alias('%s','%s')" % (pre,self.name,iFun,theRest)
1915 self.log(line_out,continue_prompt)
1633 self.log(line_out,continue_prompt)
1916 self.update_cache(line_out)
1634 self.update_cache(line_out)
1917 return line_out
1635 return line_out
1918
1636
1919 def handle_shell_escape(self, line, continue_prompt=None,
1637 def handle_shell_escape(self, line, continue_prompt=None,
1920 pre=None,iFun=None,theRest=None):
1638 pre=None,iFun=None,theRest=None):
1921 """Execute the line in a shell, empty return value"""
1639 """Execute the line in a shell, empty return value"""
1922
1640
1923 #print 'line in :', `line` # dbg
1641 #print 'line in :', `line` # dbg
1924 # Example of a special handler. Others follow a similar pattern.
1642 # Example of a special handler. Others follow a similar pattern.
1925 if continue_prompt: # multi-line statements
1643 if continue_prompt: # multi-line statements
1926 if iFun.startswith('!!'):
1644 if iFun.startswith('!!'):
1927 print 'SyntaxError: !! is not allowed in multiline statements'
1645 print 'SyntaxError: !! is not allowed in multiline statements'
1928 return pre
1646 return pre
1929 else:
1647 else:
1930 cmd = ("%s %s" % (iFun[1:],theRest)).replace('"','\\"')
1648 cmd = ("%s %s" % (iFun[1:],theRest)).replace('"','\\"')
1931 line_out = '%s%s.system("%s")' % (pre,self.name,cmd)
1649 line_out = '%s%s.system("%s")' % (pre,self.name,cmd)
1932 #line_out = ('%s%s.system(' % (pre,self.name)) + repr(cmd) + ')'
1650 #line_out = ('%s%s.system(' % (pre,self.name)) + repr(cmd) + ')'
1933 else: # single-line input
1651 else: # single-line input
1934 if line.startswith('!!'):
1652 if line.startswith('!!'):
1935 # rewrite iFun/theRest to properly hold the call to %sx and
1653 # rewrite iFun/theRest to properly hold the call to %sx and
1936 # the actual command to be executed, so handle_magic can work
1654 # the actual command to be executed, so handle_magic can work
1937 # correctly
1655 # correctly
1938 theRest = '%s %s' % (iFun[2:],theRest)
1656 theRest = '%s %s' % (iFun[2:],theRest)
1939 iFun = 'sx'
1657 iFun = 'sx'
1940 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,line[2:]),
1658 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,line[2:]),
1941 continue_prompt,pre,iFun,theRest)
1659 continue_prompt,pre,iFun,theRest)
1942 else:
1660 else:
1943 cmd = esc_quotes(line[1:])
1661 cmd = esc_quotes(line[1:])
1944 line_out = '%s.system("%s")' % (self.name,cmd)
1662 line_out = '%s.system("%s")' % (self.name,cmd)
1945 #line_out = ('%s.system(' % self.name) + repr(cmd)+ ')'
1663 #line_out = ('%s.system(' % self.name) + repr(cmd)+ ')'
1946 # update cache/log and return
1664 # update cache/log and return
1947 self.log(line_out,continue_prompt)
1665 self.log(line_out,continue_prompt)
1948 self.update_cache(line_out) # readline cache gets normal line
1666 self.update_cache(line_out) # readline cache gets normal line
1949 #print 'line out r:', `line_out` # dbg
1667 #print 'line out r:', `line_out` # dbg
1950 #print 'line out s:', line_out # dbg
1668 #print 'line out s:', line_out # dbg
1951 return line_out
1669 return line_out
1952
1670
1953 def handle_magic(self, line, continue_prompt=None,
1671 def handle_magic(self, line, continue_prompt=None,
1954 pre=None,iFun=None,theRest=None):
1672 pre=None,iFun=None,theRest=None):
1955 """Execute magic functions.
1673 """Execute magic functions.
1956
1674
1957 Also log them with a prepended # so the log is clean Python."""
1675 Also log them with a prepended # so the log is clean Python."""
1958
1676
1959 cmd = '%sipmagic("%s")' % (pre,esc_quotes('%s %s' % (iFun,theRest)))
1677 cmd = '%sipmagic("%s")' % (pre,esc_quotes('%s %s' % (iFun,theRest)))
1960 self.log(cmd,continue_prompt)
1678 self.log(cmd,continue_prompt)
1961 self.update_cache(line)
1679 self.update_cache(line)
1962 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
1680 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
1963 return cmd
1681 return cmd
1964
1682
1965 def handle_auto(self, line, continue_prompt=None,
1683 def handle_auto(self, line, continue_prompt=None,
1966 pre=None,iFun=None,theRest=None):
1684 pre=None,iFun=None,theRest=None):
1967 """Hande lines which can be auto-executed, quoting if requested."""
1685 """Hande lines which can be auto-executed, quoting if requested."""
1968
1686
1969 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1687 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1970
1688
1971 # This should only be active for single-line input!
1689 # This should only be active for single-line input!
1972 if continue_prompt:
1690 if continue_prompt:
1973 return line
1691 return line
1974
1692
1975 if pre == self.ESC_QUOTE:
1693 if pre == self.ESC_QUOTE:
1976 # Auto-quote splitting on whitespace
1694 # Auto-quote splitting on whitespace
1977 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
1695 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
1978 elif pre == self.ESC_QUOTE2:
1696 elif pre == self.ESC_QUOTE2:
1979 # Auto-quote whole string
1697 # Auto-quote whole string
1980 newcmd = '%s("%s")' % (iFun,theRest)
1698 newcmd = '%s("%s")' % (iFun,theRest)
1981 else:
1699 else:
1982 # Auto-paren
1700 # Auto-paren
1983 if theRest[0:1] in ('=','['):
1701 if theRest[0:1] in ('=','['):
1984 # Don't autocall in these cases. They can be either
1702 # Don't autocall in these cases. They can be either
1985 # rebindings of an existing callable's name, or item access
1703 # rebindings of an existing callable's name, or item access
1986 # for an object which is BOTH callable and implements
1704 # for an object which is BOTH callable and implements
1987 # __getitem__.
1705 # __getitem__.
1988 return '%s %s' % (iFun,theRest)
1706 return '%s %s' % (iFun,theRest)
1989 if theRest.endswith(';'):
1707 if theRest.endswith(';'):
1990 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
1708 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
1991 else:
1709 else:
1992 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
1710 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
1993
1711
1994 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
1712 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
1995 # log what is now valid Python, not the actual user input (without the
1713 # log what is now valid Python, not the actual user input (without the
1996 # final newline)
1714 # final newline)
1997 self.log(newcmd,continue_prompt)
1715 self.log(newcmd,continue_prompt)
1998 return newcmd
1716 return newcmd
1999
1717
2000 def handle_help(self, line, continue_prompt=None,
1718 def handle_help(self, line, continue_prompt=None,
2001 pre=None,iFun=None,theRest=None):
1719 pre=None,iFun=None,theRest=None):
2002 """Try to get some help for the object.
1720 """Try to get some help for the object.
2003
1721
2004 obj? or ?obj -> basic information.
1722 obj? or ?obj -> basic information.
2005 obj?? or ??obj -> more details.
1723 obj?? or ??obj -> more details.
2006 """
1724 """
2007
1725
2008 # We need to make sure that we don't process lines which would be
1726 # We need to make sure that we don't process lines which would be
2009 # otherwise valid python, such as "x=1 # what?"
1727 # otherwise valid python, such as "x=1 # what?"
2010 try:
1728 try:
2011 code.compile_command(line)
1729 codeop.compile_command(line)
2012 except SyntaxError:
1730 except SyntaxError:
2013 # We should only handle as help stuff which is NOT valid syntax
1731 # We should only handle as help stuff which is NOT valid syntax
2014 if line[0]==self.ESC_HELP:
1732 if line[0]==self.ESC_HELP:
2015 line = line[1:]
1733 line = line[1:]
2016 elif line[-1]==self.ESC_HELP:
1734 elif line[-1]==self.ESC_HELP:
2017 line = line[:-1]
1735 line = line[:-1]
2018 self.log('#?'+line)
1736 self.log('#?'+line)
2019 self.update_cache(line)
1737 self.update_cache(line)
2020 if line:
1738 if line:
2021 self.magic_pinfo(line)
1739 self.magic_pinfo(line)
2022 else:
1740 else:
2023 page(self.usage,screen_lines=self.rc.screen_length)
1741 page(self.usage,screen_lines=self.rc.screen_length)
2024 return '' # Empty string is needed here!
1742 return '' # Empty string is needed here!
2025 except:
1743 except:
2026 # Pass any other exceptions through to the normal handler
1744 # Pass any other exceptions through to the normal handler
2027 return self.handle_normal(line,continue_prompt)
1745 return self.handle_normal(line,continue_prompt)
2028 else:
1746 else:
2029 # If the code compiles ok, we should handle it normally
1747 # If the code compiles ok, we should handle it normally
2030 return self.handle_normal(line,continue_prompt)
1748 return self.handle_normal(line,continue_prompt)
2031
1749
2032 def handle_emacs(self,line,continue_prompt=None,
1750 def handle_emacs(self,line,continue_prompt=None,
2033 pre=None,iFun=None,theRest=None):
1751 pre=None,iFun=None,theRest=None):
2034 """Handle input lines marked by python-mode."""
1752 """Handle input lines marked by python-mode."""
2035
1753
2036 # Currently, nothing is done. Later more functionality can be added
1754 # Currently, nothing is done. Later more functionality can be added
2037 # here if needed.
1755 # here if needed.
2038
1756
2039 # The input cache shouldn't be updated
1757 # The input cache shouldn't be updated
2040
1758
2041 return line
1759 return line
2042
1760
2043 def write(self,data):
1761 def write(self,data):
2044 """Write a string to the default output"""
1762 """Write a string to the default output"""
2045 Term.cout.write(data)
1763 Term.cout.write(data)
2046
1764
2047 def write_err(self,data):
1765 def write_err(self,data):
2048 """Write a string to the default error output"""
1766 """Write a string to the default error output"""
2049 Term.cerr.write(data)
1767 Term.cerr.write(data)
2050
1768
1769 def exit(self):
1770 """Handle interactive exit.
1771
1772 This method sets the exit_now attribute."""
1773
1774 if self.rc.confirm_exit:
1775 if ask_yes_no('Do you really want to exit ([y]/n)?','y'):
1776 self.exit_now = True
1777 else:
1778 self.exit_now = True
1779 return self.exit_now
1780
2051 def safe_execfile(self,fname,*where,**kw):
1781 def safe_execfile(self,fname,*where,**kw):
2052 fname = os.path.expanduser(fname)
1782 fname = os.path.expanduser(fname)
2053
1783
2054 # find things also in current directory
1784 # find things also in current directory
2055 dname = os.path.dirname(fname)
1785 dname = os.path.dirname(fname)
2056 if not sys.path.count(dname):
1786 if not sys.path.count(dname):
2057 sys.path.append(dname)
1787 sys.path.append(dname)
2058
1788
2059 try:
1789 try:
2060 xfile = open(fname)
1790 xfile = open(fname)
2061 except:
1791 except:
2062 print >> Term.cerr, \
1792 print >> Term.cerr, \
2063 'Could not open file <%s> for safe execution.' % fname
1793 'Could not open file <%s> for safe execution.' % fname
2064 return None
1794 return None
2065
1795
2066 kw.setdefault('islog',0)
1796 kw.setdefault('islog',0)
2067 kw.setdefault('quiet',1)
1797 kw.setdefault('quiet',1)
2068 kw.setdefault('exit_ignore',0)
1798 kw.setdefault('exit_ignore',0)
2069 first = xfile.readline()
1799 first = xfile.readline()
2070 _LOGHEAD = str(self.LOGHEAD).split('\n',1)[0].strip()
1800 _LOGHEAD = str(self.LOGHEAD).split('\n',1)[0].strip()
2071 xfile.close()
1801 xfile.close()
2072 # line by line execution
1802 # line by line execution
2073 if first.startswith(_LOGHEAD) or kw['islog']:
1803 if first.startswith(_LOGHEAD) or kw['islog']:
2074 print 'Loading log file <%s> one line at a time...' % fname
1804 print 'Loading log file <%s> one line at a time...' % fname
2075 if kw['quiet']:
1805 if kw['quiet']:
2076 stdout_save = sys.stdout
1806 stdout_save = sys.stdout
2077 sys.stdout = StringIO.StringIO()
1807 sys.stdout = StringIO.StringIO()
2078 try:
1808 try:
2079 globs,locs = where[0:2]
1809 globs,locs = where[0:2]
2080 except:
1810 except:
2081 try:
1811 try:
2082 globs = locs = where[0]
1812 globs = locs = where[0]
2083 except:
1813 except:
2084 globs = locs = globals()
1814 globs = locs = globals()
2085 badblocks = []
1815 badblocks = []
2086
1816
2087 # we also need to identify indented blocks of code when replaying
1817 # we also need to identify indented blocks of code when replaying
2088 # logs and put them together before passing them to an exec
1818 # logs and put them together before passing them to an exec
2089 # statement. This takes a bit of regexp and look-ahead work in the
1819 # statement. This takes a bit of regexp and look-ahead work in the
2090 # file. It's easiest if we swallow the whole thing in memory
1820 # file. It's easiest if we swallow the whole thing in memory
2091 # first, and manually walk through the lines list moving the
1821 # first, and manually walk through the lines list moving the
2092 # counter ourselves.
1822 # counter ourselves.
2093 indent_re = re.compile('\s+\S')
1823 indent_re = re.compile('\s+\S')
2094 xfile = open(fname)
1824 xfile = open(fname)
2095 filelines = xfile.readlines()
1825 filelines = xfile.readlines()
2096 xfile.close()
1826 xfile.close()
2097 nlines = len(filelines)
1827 nlines = len(filelines)
2098 lnum = 0
1828 lnum = 0
2099 while lnum < nlines:
1829 while lnum < nlines:
2100 line = filelines[lnum]
1830 line = filelines[lnum]
2101 lnum += 1
1831 lnum += 1
2102 # don't re-insert logger status info into cache
1832 # don't re-insert logger status info into cache
2103 if line.startswith('#log#'):
1833 if line.startswith('#log#'):
2104 continue
1834 continue
2105 elif line.startswith('#%s'% self.ESC_MAGIC):
1835 elif line.startswith('#%s'% self.ESC_MAGIC):
2106 self.update_cache(line[1:])
1836 self.update_cache(line[1:])
2107 line = magic2python(line)
1837 line = magic2python(line)
2108 elif line.startswith('#!'):
1838 elif line.startswith('#!'):
2109 self.update_cache(line[1:])
1839 self.update_cache(line[1:])
2110 else:
1840 else:
2111 # build a block of code (maybe a single line) for execution
1841 # build a block of code (maybe a single line) for execution
2112 block = line
1842 block = line
2113 try:
1843 try:
2114 next = filelines[lnum] # lnum has already incremented
1844 next = filelines[lnum] # lnum has already incremented
2115 except:
1845 except:
2116 next = None
1846 next = None
2117 while next and indent_re.match(next):
1847 while next and indent_re.match(next):
2118 block += next
1848 block += next
2119 lnum += 1
1849 lnum += 1
2120 try:
1850 try:
2121 next = filelines[lnum]
1851 next = filelines[lnum]
2122 except:
1852 except:
2123 next = None
1853 next = None
2124 # now execute the block of one or more lines
1854 # now execute the block of one or more lines
2125 try:
1855 try:
2126 exec block in globs,locs
1856 exec block in globs,locs
2127 self.update_cache(block.rstrip())
1857 self.update_cache(block.rstrip())
2128 except SystemExit:
1858 except SystemExit:
2129 pass
1859 pass
2130 except:
1860 except:
2131 badblocks.append(block.rstrip())
1861 badblocks.append(block.rstrip())
2132 if kw['quiet']: # restore stdout
1862 if kw['quiet']: # restore stdout
2133 sys.stdout.close()
1863 sys.stdout.close()
2134 sys.stdout = stdout_save
1864 sys.stdout = stdout_save
2135 print 'Finished replaying log file <%s>' % fname
1865 print 'Finished replaying log file <%s>' % fname
2136 if badblocks:
1866 if badblocks:
2137 print >> sys.stderr, \
1867 print >> sys.stderr, ('\nThe following lines/blocks in file '
2138 '\nThe following lines/blocks in file <%s> reported errors:' \
1868 '<%s> reported errors:' % fname)
2139 % fname
1869
2140 for badline in badblocks:
1870 for badline in badblocks:
2141 print >> sys.stderr, badline
1871 print >> sys.stderr, badline
2142 else: # regular file execution
1872 else: # regular file execution
2143 try:
1873 try:
2144 execfile(fname,*where)
1874 execfile(fname,*where)
2145 except SyntaxError:
1875 except SyntaxError:
2146 etype, evalue = sys.exc_info()[0:2]
1876 etype, evalue = sys.exc_info()[0:2]
2147 self.SyntaxTB(etype,evalue,[])
1877 self.SyntaxTB(etype,evalue,[])
2148 warn('Failure executing file: <%s>' % fname)
1878 warn('Failure executing file: <%s>' % fname)
2149 except SystemExit,status:
1879 except SystemExit,status:
2150 if not kw['exit_ignore']:
1880 if not kw['exit_ignore']:
2151 self.InteractiveTB()
1881 self.InteractiveTB()
2152 warn('Failure executing file: <%s>' % fname)
1882 warn('Failure executing file: <%s>' % fname)
2153 except:
1883 except:
2154 self.InteractiveTB()
1884 self.InteractiveTB()
2155 warn('Failure executing file: <%s>' % fname)
1885 warn('Failure executing file: <%s>' % fname)
2156
1886
2157 #************************* end of file <iplib.py> *****************************
1887 #************************* end of file <iplib.py> *****************************
@@ -1,4531 +1,4546 b''
1 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
2
2
3 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
4 module to better organize all readline-related functionality.
5 I've deleted FlexCompleter and put all completion clases here.
6
3 * IPython/iplib.py (raw_input): improve indentation management.
7 * IPython/iplib.py (raw_input): improve indentation management.
4 It is now possible to paste indented code with autoindent on, and
8 It is now possible to paste indented code with autoindent on, and
5 the code is interpreted correctly (though it still looks bad on
9 the code is interpreted correctly (though it still looks bad on
6 screen, due to the line-oriented nature of ipython).
10 screen, due to the line-oriented nature of ipython).
7 (MagicCompleter.complete): change behavior so that a TAB key on an
11 (MagicCompleter.complete): change behavior so that a TAB key on an
8 otherwise empty line actually inserts a tab, instead of completing
12 otherwise empty line actually inserts a tab, instead of completing
9 on the entire global namespace. This makes it easier to use the
13 on the entire global namespace. This makes it easier to use the
10 TAB key for indentation. After a request by Hans Meine
14 TAB key for indentation. After a request by Hans Meine
11 <hans_meine-AT-gmx.net>
15 <hans_meine-AT-gmx.net>
16 (_prefilter): add support so that typing plain 'exit' or 'quit'
17 does a sensible thing. Originally I tried to deviate as little as
18 possible from the default python behavior, but even that one may
19 change in this direction (thread on python-dev to that effect).
20 Regardless, ipython should do the right thing even if CPython's
21 '>>>' prompt doesn't.
22 (InteractiveShell): removed subclassing code.InteractiveConsole
23 class. By now we'd overridden just about all of its methods: I've
24 copied the remaining two over, and now ipython is a standalone
25 class. This will provide a clearer picture for the chainsaw
26 branch refactoring.
12
27
13 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
28 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
14
29
15 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
30 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
16 failures for objects which break when dir() is called on them.
31 failures for objects which break when dir() is called on them.
17
32
18 * IPython/FlexCompleter.py (Completer.__init__): Added support for
33 * IPython/FlexCompleter.py (Completer.__init__): Added support for
19 distinct local and global namespaces in the completer API. This
34 distinct local and global namespaces in the completer API. This
20 change allows us top properly handle completion with distinct
35 change allows us top properly handle completion with distinct
21 scopes, including in embedded instances (this had never really
36 scopes, including in embedded instances (this had never really
22 worked correctly).
37 worked correctly).
23
38
24 Note: this introduces a change in the constructor for
39 Note: this introduces a change in the constructor for
25 MagicCompleter, as a new global_namespace parameter is now the
40 MagicCompleter, as a new global_namespace parameter is now the
26 second argument (the others were bumped one position).
41 second argument (the others were bumped one position).
27
42
28 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
43 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
29
44
30 * IPython/iplib.py (embed_mainloop): fix tab-completion in
45 * IPython/iplib.py (embed_mainloop): fix tab-completion in
31 embedded instances (which can be done now thanks to Vivian's
46 embedded instances (which can be done now thanks to Vivian's
32 frame-handling fixes for pdb).
47 frame-handling fixes for pdb).
33 (InteractiveShell.__init__): Fix namespace handling problem in
48 (InteractiveShell.__init__): Fix namespace handling problem in
34 embedded instances. We were overwriting __main__ unconditionally,
49 embedded instances. We were overwriting __main__ unconditionally,
35 and this should only be done for 'full' (non-embedded) IPython;
50 and this should only be done for 'full' (non-embedded) IPython;
36 embedded instances must respect the caller's __main__. Thanks to
51 embedded instances must respect the caller's __main__. Thanks to
37 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
52 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
38
53
39 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
54 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
40
55
41 * setup.py: added download_url to setup(). This registers the
56 * setup.py: added download_url to setup(). This registers the
42 download address at PyPI, which is not only useful to humans
57 download address at PyPI, which is not only useful to humans
43 browsing the site, but is also picked up by setuptools (the Eggs
58 browsing the site, but is also picked up by setuptools (the Eggs
44 machinery). Thanks to Ville and R. Kern for the info/discussion
59 machinery). Thanks to Ville and R. Kern for the info/discussion
45 on this.
60 on this.
46
61
47 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
62 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
48
63
49 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
64 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
50 This brings a lot of nice functionality to the pdb mode, which now
65 This brings a lot of nice functionality to the pdb mode, which now
51 has tab-completion, syntax highlighting, and better stack handling
66 has tab-completion, syntax highlighting, and better stack handling
52 than before. Many thanks to Vivian De Smedt
67 than before. Many thanks to Vivian De Smedt
53 <vivian-AT-vdesmedt.com> for the original patches.
68 <vivian-AT-vdesmedt.com> for the original patches.
54
69
55 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
70 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
56
71
57 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
72 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
58 sequence to consistently accept the banner argument. The
73 sequence to consistently accept the banner argument. The
59 inconsistency was tripping SAGE, thanks to Gary Zablackis
74 inconsistency was tripping SAGE, thanks to Gary Zablackis
60 <gzabl-AT-yahoo.com> for the report.
75 <gzabl-AT-yahoo.com> for the report.
61
76
62 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
77 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
63
78
64 * IPython/iplib.py (InteractiveShell.post_config_initialization):
79 * IPython/iplib.py (InteractiveShell.post_config_initialization):
65 Fix bug where a naked 'alias' call in the ipythonrc file would
80 Fix bug where a naked 'alias' call in the ipythonrc file would
66 cause a crash. Bug reported by Jorgen Stenarson.
81 cause a crash. Bug reported by Jorgen Stenarson.
67
82
68 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
83 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
69
84
70 * IPython/ipmaker.py (make_IPython): cleanups which should improve
85 * IPython/ipmaker.py (make_IPython): cleanups which should improve
71 startup time.
86 startup time.
72
87
73 * IPython/iplib.py (runcode): my globals 'fix' for embedded
88 * IPython/iplib.py (runcode): my globals 'fix' for embedded
74 instances had introduced a bug with globals in normal code. Now
89 instances had introduced a bug with globals in normal code. Now
75 it's working in all cases.
90 it's working in all cases.
76
91
77 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
92 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
78 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
93 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
79 has been introduced to set the default case sensitivity of the
94 has been introduced to set the default case sensitivity of the
80 searches. Users can still select either mode at runtime on a
95 searches. Users can still select either mode at runtime on a
81 per-search basis.
96 per-search basis.
82
97
83 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
98 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
84
99
85 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
100 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
86 attributes in wildcard searches for subclasses. Modified version
101 attributes in wildcard searches for subclasses. Modified version
87 of a patch by Jorgen.
102 of a patch by Jorgen.
88
103
89 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
104 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
90
105
91 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
106 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
92 embedded instances. I added a user_global_ns attribute to the
107 embedded instances. I added a user_global_ns attribute to the
93 InteractiveShell class to handle this.
108 InteractiveShell class to handle this.
94
109
95 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
110 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
96
111
97 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
112 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
98 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
113 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
99 (reported under win32, but may happen also in other platforms).
114 (reported under win32, but may happen also in other platforms).
100 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
115 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
101
116
102 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
117 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
103
118
104 * IPython/Magic.py (magic_psearch): new support for wildcard
119 * IPython/Magic.py (magic_psearch): new support for wildcard
105 patterns. Now, typing ?a*b will list all names which begin with a
120 patterns. Now, typing ?a*b will list all names which begin with a
106 and end in b, for example. The %psearch magic has full
121 and end in b, for example. The %psearch magic has full
107 docstrings. Many thanks to Jörgen Stenarson
122 docstrings. Many thanks to Jörgen Stenarson
108 <jorgen.stenarson-AT-bostream.nu>, author of the patches
123 <jorgen.stenarson-AT-bostream.nu>, author of the patches
109 implementing this functionality.
124 implementing this functionality.
110
125
111 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
126 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
112
127
113 * Manual: fixed long-standing annoyance of double-dashes (as in
128 * Manual: fixed long-standing annoyance of double-dashes (as in
114 --prefix=~, for example) being stripped in the HTML version. This
129 --prefix=~, for example) being stripped in the HTML version. This
115 is a latex2html bug, but a workaround was provided. Many thanks
130 is a latex2html bug, but a workaround was provided. Many thanks
116 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
131 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
117 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
132 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
118 rolling. This seemingly small issue had tripped a number of users
133 rolling. This seemingly small issue had tripped a number of users
119 when first installing, so I'm glad to see it gone.
134 when first installing, so I'm glad to see it gone.
120
135
121 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
136 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
122
137
123 * IPython/Extensions/numeric_formats.py: fix missing import,
138 * IPython/Extensions/numeric_formats.py: fix missing import,
124 reported by Stephen Walton.
139 reported by Stephen Walton.
125
140
126 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
141 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
127
142
128 * IPython/demo.py: finish demo module, fully documented now.
143 * IPython/demo.py: finish demo module, fully documented now.
129
144
130 * IPython/genutils.py (file_read): simple little utility to read a
145 * IPython/genutils.py (file_read): simple little utility to read a
131 file and ensure it's closed afterwards.
146 file and ensure it's closed afterwards.
132
147
133 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
148 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
134
149
135 * IPython/demo.py (Demo.__init__): added support for individually
150 * IPython/demo.py (Demo.__init__): added support for individually
136 tagging blocks for automatic execution.
151 tagging blocks for automatic execution.
137
152
138 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
153 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
139 syntax-highlighted python sources, requested by John.
154 syntax-highlighted python sources, requested by John.
140
155
141 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
156 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
142
157
143 * IPython/demo.py (Demo.again): fix bug where again() blocks after
158 * IPython/demo.py (Demo.again): fix bug where again() blocks after
144 finishing.
159 finishing.
145
160
146 * IPython/genutils.py (shlex_split): moved from Magic to here,
161 * IPython/genutils.py (shlex_split): moved from Magic to here,
147 where all 2.2 compatibility stuff lives. I needed it for demo.py.
162 where all 2.2 compatibility stuff lives. I needed it for demo.py.
148
163
149 * IPython/demo.py (Demo.__init__): added support for silent
164 * IPython/demo.py (Demo.__init__): added support for silent
150 blocks, improved marks as regexps, docstrings written.
165 blocks, improved marks as regexps, docstrings written.
151 (Demo.__init__): better docstring, added support for sys.argv.
166 (Demo.__init__): better docstring, added support for sys.argv.
152
167
153 * IPython/genutils.py (marquee): little utility used by the demo
168 * IPython/genutils.py (marquee): little utility used by the demo
154 code, handy in general.
169 code, handy in general.
155
170
156 * IPython/demo.py (Demo.__init__): new class for interactive
171 * IPython/demo.py (Demo.__init__): new class for interactive
157 demos. Not documented yet, I just wrote it in a hurry for
172 demos. Not documented yet, I just wrote it in a hurry for
158 scipy'05. Will docstring later.
173 scipy'05. Will docstring later.
159
174
160 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
175 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
161
176
162 * IPython/Shell.py (sigint_handler): Drastic simplification which
177 * IPython/Shell.py (sigint_handler): Drastic simplification which
163 also seems to make Ctrl-C work correctly across threads! This is
178 also seems to make Ctrl-C work correctly across threads! This is
164 so simple, that I can't beleive I'd missed it before. Needs more
179 so simple, that I can't beleive I'd missed it before. Needs more
165 testing, though.
180 testing, though.
166 (KBINT): Never mind, revert changes. I'm sure I'd tried something
181 (KBINT): Never mind, revert changes. I'm sure I'd tried something
167 like this before...
182 like this before...
168
183
169 * IPython/genutils.py (get_home_dir): add protection against
184 * IPython/genutils.py (get_home_dir): add protection against
170 non-dirs in win32 registry.
185 non-dirs in win32 registry.
171
186
172 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
187 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
173 bug where dict was mutated while iterating (pysh crash).
188 bug where dict was mutated while iterating (pysh crash).
174
189
175 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
190 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
176
191
177 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
192 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
178 spurious newlines added by this routine. After a report by
193 spurious newlines added by this routine. After a report by
179 F. Mantegazza.
194 F. Mantegazza.
180
195
181 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
196 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
182
197
183 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
198 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
184 calls. These were a leftover from the GTK 1.x days, and can cause
199 calls. These were a leftover from the GTK 1.x days, and can cause
185 problems in certain cases (after a report by John Hunter).
200 problems in certain cases (after a report by John Hunter).
186
201
187 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
202 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
188 os.getcwd() fails at init time. Thanks to patch from David Remahl
203 os.getcwd() fails at init time. Thanks to patch from David Remahl
189 <chmod007-AT-mac.com>.
204 <chmod007-AT-mac.com>.
190 (InteractiveShell.__init__): prevent certain special magics from
205 (InteractiveShell.__init__): prevent certain special magics from
191 being shadowed by aliases. Closes
206 being shadowed by aliases. Closes
192 http://www.scipy.net/roundup/ipython/issue41.
207 http://www.scipy.net/roundup/ipython/issue41.
193
208
194 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
209 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
195
210
196 * IPython/iplib.py (InteractiveShell.complete): Added new
211 * IPython/iplib.py (InteractiveShell.complete): Added new
197 top-level completion method to expose the completion mechanism
212 top-level completion method to expose the completion mechanism
198 beyond readline-based environments.
213 beyond readline-based environments.
199
214
200 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
215 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
201
216
202 * tools/ipsvnc (svnversion): fix svnversion capture.
217 * tools/ipsvnc (svnversion): fix svnversion capture.
203
218
204 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
219 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
205 attribute to self, which was missing. Before, it was set by a
220 attribute to self, which was missing. Before, it was set by a
206 routine which in certain cases wasn't being called, so the
221 routine which in certain cases wasn't being called, so the
207 instance could end up missing the attribute. This caused a crash.
222 instance could end up missing the attribute. This caused a crash.
208 Closes http://www.scipy.net/roundup/ipython/issue40.
223 Closes http://www.scipy.net/roundup/ipython/issue40.
209
224
210 2005-08-16 Fernando Perez <fperez@colorado.edu>
225 2005-08-16 Fernando Perez <fperez@colorado.edu>
211
226
212 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
227 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
213 contains non-string attribute. Closes
228 contains non-string attribute. Closes
214 http://www.scipy.net/roundup/ipython/issue38.
229 http://www.scipy.net/roundup/ipython/issue38.
215
230
216 2005-08-14 Fernando Perez <fperez@colorado.edu>
231 2005-08-14 Fernando Perez <fperez@colorado.edu>
217
232
218 * tools/ipsvnc: Minor improvements, to add changeset info.
233 * tools/ipsvnc: Minor improvements, to add changeset info.
219
234
220 2005-08-12 Fernando Perez <fperez@colorado.edu>
235 2005-08-12 Fernando Perez <fperez@colorado.edu>
221
236
222 * IPython/iplib.py (runsource): remove self.code_to_run_src
237 * IPython/iplib.py (runsource): remove self.code_to_run_src
223 attribute. I realized this is nothing more than
238 attribute. I realized this is nothing more than
224 '\n'.join(self.buffer), and having the same data in two different
239 '\n'.join(self.buffer), and having the same data in two different
225 places is just asking for synchronization bugs. This may impact
240 places is just asking for synchronization bugs. This may impact
226 people who have custom exception handlers, so I need to warn
241 people who have custom exception handlers, so I need to warn
227 ipython-dev about it (F. Mantegazza may use them).
242 ipython-dev about it (F. Mantegazza may use them).
228
243
229 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
244 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
230
245
231 * IPython/genutils.py: fix 2.2 compatibility (generators)
246 * IPython/genutils.py: fix 2.2 compatibility (generators)
232
247
233 2005-07-18 Fernando Perez <fperez@colorado.edu>
248 2005-07-18 Fernando Perez <fperez@colorado.edu>
234
249
235 * IPython/genutils.py (get_home_dir): fix to help users with
250 * IPython/genutils.py (get_home_dir): fix to help users with
236 invalid $HOME under win32.
251 invalid $HOME under win32.
237
252
238 2005-07-17 Fernando Perez <fperez@colorado.edu>
253 2005-07-17 Fernando Perez <fperez@colorado.edu>
239
254
240 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
255 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
241 some old hacks and clean up a bit other routines; code should be
256 some old hacks and clean up a bit other routines; code should be
242 simpler and a bit faster.
257 simpler and a bit faster.
243
258
244 * IPython/iplib.py (interact): removed some last-resort attempts
259 * IPython/iplib.py (interact): removed some last-resort attempts
245 to survive broken stdout/stderr. That code was only making it
260 to survive broken stdout/stderr. That code was only making it
246 harder to abstract out the i/o (necessary for gui integration),
261 harder to abstract out the i/o (necessary for gui integration),
247 and the crashes it could prevent were extremely rare in practice
262 and the crashes it could prevent were extremely rare in practice
248 (besides being fully user-induced in a pretty violent manner).
263 (besides being fully user-induced in a pretty violent manner).
249
264
250 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
265 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
251 Nothing major yet, but the code is simpler to read; this should
266 Nothing major yet, but the code is simpler to read; this should
252 make it easier to do more serious modifications in the future.
267 make it easier to do more serious modifications in the future.
253
268
254 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
269 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
255 which broke in .15 (thanks to a report by Ville).
270 which broke in .15 (thanks to a report by Ville).
256
271
257 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
272 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
258 be quite correct, I know next to nothing about unicode). This
273 be quite correct, I know next to nothing about unicode). This
259 will allow unicode strings to be used in prompts, amongst other
274 will allow unicode strings to be used in prompts, amongst other
260 cases. It also will prevent ipython from crashing when unicode
275 cases. It also will prevent ipython from crashing when unicode
261 shows up unexpectedly in many places. If ascii encoding fails, we
276 shows up unexpectedly in many places. If ascii encoding fails, we
262 assume utf_8. Currently the encoding is not a user-visible
277 assume utf_8. Currently the encoding is not a user-visible
263 setting, though it could be made so if there is demand for it.
278 setting, though it could be made so if there is demand for it.
264
279
265 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
280 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
266
281
267 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
282 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
268
283
269 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
284 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
270
285
271 * IPython/genutils.py: Add 2.2 compatibility here, so all other
286 * IPython/genutils.py: Add 2.2 compatibility here, so all other
272 code can work transparently for 2.2/2.3.
287 code can work transparently for 2.2/2.3.
273
288
274 2005-07-16 Fernando Perez <fperez@colorado.edu>
289 2005-07-16 Fernando Perez <fperez@colorado.edu>
275
290
276 * IPython/ultraTB.py (ExceptionColors): Make a global variable
291 * IPython/ultraTB.py (ExceptionColors): Make a global variable
277 out of the color scheme table used for coloring exception
292 out of the color scheme table used for coloring exception
278 tracebacks. This allows user code to add new schemes at runtime.
293 tracebacks. This allows user code to add new schemes at runtime.
279 This is a minimally modified version of the patch at
294 This is a minimally modified version of the patch at
280 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
295 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
281 for the contribution.
296 for the contribution.
282
297
283 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
298 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
284 slightly modified version of the patch in
299 slightly modified version of the patch in
285 http://www.scipy.net/roundup/ipython/issue34, which also allows me
300 http://www.scipy.net/roundup/ipython/issue34, which also allows me
286 to remove the previous try/except solution (which was costlier).
301 to remove the previous try/except solution (which was costlier).
287 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
302 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
288
303
289 2005-06-08 Fernando Perez <fperez@colorado.edu>
304 2005-06-08 Fernando Perez <fperez@colorado.edu>
290
305
291 * IPython/iplib.py (write/write_err): Add methods to abstract all
306 * IPython/iplib.py (write/write_err): Add methods to abstract all
292 I/O a bit more.
307 I/O a bit more.
293
308
294 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
309 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
295 warning, reported by Aric Hagberg, fix by JD Hunter.
310 warning, reported by Aric Hagberg, fix by JD Hunter.
296
311
297 2005-06-02 *** Released version 0.6.15
312 2005-06-02 *** Released version 0.6.15
298
313
299 2005-06-01 Fernando Perez <fperez@colorado.edu>
314 2005-06-01 Fernando Perez <fperez@colorado.edu>
300
315
301 * IPython/iplib.py (MagicCompleter.file_matches): Fix
316 * IPython/iplib.py (MagicCompleter.file_matches): Fix
302 tab-completion of filenames within open-quoted strings. Note that
317 tab-completion of filenames within open-quoted strings. Note that
303 this requires that in ~/.ipython/ipythonrc, users change the
318 this requires that in ~/.ipython/ipythonrc, users change the
304 readline delimiters configuration to read:
319 readline delimiters configuration to read:
305
320
306 readline_remove_delims -/~
321 readline_remove_delims -/~
307
322
308
323
309 2005-05-31 *** Released version 0.6.14
324 2005-05-31 *** Released version 0.6.14
310
325
311 2005-05-29 Fernando Perez <fperez@colorado.edu>
326 2005-05-29 Fernando Perez <fperez@colorado.edu>
312
327
313 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
328 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
314 with files not on the filesystem. Reported by Eliyahu Sandler
329 with files not on the filesystem. Reported by Eliyahu Sandler
315 <eli@gondolin.net>
330 <eli@gondolin.net>
316
331
317 2005-05-22 Fernando Perez <fperez@colorado.edu>
332 2005-05-22 Fernando Perez <fperez@colorado.edu>
318
333
319 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
334 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
320 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
335 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
321
336
322 2005-05-19 Fernando Perez <fperez@colorado.edu>
337 2005-05-19 Fernando Perez <fperez@colorado.edu>
323
338
324 * IPython/iplib.py (safe_execfile): close a file which could be
339 * IPython/iplib.py (safe_execfile): close a file which could be
325 left open (causing problems in win32, which locks open files).
340 left open (causing problems in win32, which locks open files).
326 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
341 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
327
342
328 2005-05-18 Fernando Perez <fperez@colorado.edu>
343 2005-05-18 Fernando Perez <fperez@colorado.edu>
329
344
330 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
345 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
331 keyword arguments correctly to safe_execfile().
346 keyword arguments correctly to safe_execfile().
332
347
333 2005-05-13 Fernando Perez <fperez@colorado.edu>
348 2005-05-13 Fernando Perez <fperez@colorado.edu>
334
349
335 * ipython.1: Added info about Qt to manpage, and threads warning
350 * ipython.1: Added info about Qt to manpage, and threads warning
336 to usage page (invoked with --help).
351 to usage page (invoked with --help).
337
352
338 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
353 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
339 new matcher (it goes at the end of the priority list) to do
354 new matcher (it goes at the end of the priority list) to do
340 tab-completion on named function arguments. Submitted by George
355 tab-completion on named function arguments. Submitted by George
341 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
356 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
342 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
357 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
343 for more details.
358 for more details.
344
359
345 * IPython/Magic.py (magic_run): Added new -e flag to ignore
360 * IPython/Magic.py (magic_run): Added new -e flag to ignore
346 SystemExit exceptions in the script being run. Thanks to a report
361 SystemExit exceptions in the script being run. Thanks to a report
347 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
362 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
348 producing very annoying behavior when running unit tests.
363 producing very annoying behavior when running unit tests.
349
364
350 2005-05-12 Fernando Perez <fperez@colorado.edu>
365 2005-05-12 Fernando Perez <fperez@colorado.edu>
351
366
352 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
367 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
353 which I'd broken (again) due to a changed regexp. In the process,
368 which I'd broken (again) due to a changed regexp. In the process,
354 added ';' as an escape to auto-quote the whole line without
369 added ';' as an escape to auto-quote the whole line without
355 splitting its arguments. Thanks to a report by Jerry McRae
370 splitting its arguments. Thanks to a report by Jerry McRae
356 <qrs0xyc02-AT-sneakemail.com>.
371 <qrs0xyc02-AT-sneakemail.com>.
357
372
358 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
373 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
359 possible crashes caused by a TokenError. Reported by Ed Schofield
374 possible crashes caused by a TokenError. Reported by Ed Schofield
360 <schofield-AT-ftw.at>.
375 <schofield-AT-ftw.at>.
361
376
362 2005-05-06 Fernando Perez <fperez@colorado.edu>
377 2005-05-06 Fernando Perez <fperez@colorado.edu>
363
378
364 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
379 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
365
380
366 2005-04-29 Fernando Perez <fperez@colorado.edu>
381 2005-04-29 Fernando Perez <fperez@colorado.edu>
367
382
368 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
383 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
369 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
384 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
370 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
385 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
371 which provides support for Qt interactive usage (similar to the
386 which provides support for Qt interactive usage (similar to the
372 existing one for WX and GTK). This had been often requested.
387 existing one for WX and GTK). This had been often requested.
373
388
374 2005-04-14 *** Released version 0.6.13
389 2005-04-14 *** Released version 0.6.13
375
390
376 2005-04-08 Fernando Perez <fperez@colorado.edu>
391 2005-04-08 Fernando Perez <fperez@colorado.edu>
377
392
378 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
393 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
379 from _ofind, which gets called on almost every input line. Now,
394 from _ofind, which gets called on almost every input line. Now,
380 we only try to get docstrings if they are actually going to be
395 we only try to get docstrings if they are actually going to be
381 used (the overhead of fetching unnecessary docstrings can be
396 used (the overhead of fetching unnecessary docstrings can be
382 noticeable for certain objects, such as Pyro proxies).
397 noticeable for certain objects, such as Pyro proxies).
383
398
384 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
399 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
385 for completers. For some reason I had been passing them the state
400 for completers. For some reason I had been passing them the state
386 variable, which completers never actually need, and was in
401 variable, which completers never actually need, and was in
387 conflict with the rlcompleter API. Custom completers ONLY need to
402 conflict with the rlcompleter API. Custom completers ONLY need to
388 take the text parameter.
403 take the text parameter.
389
404
390 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
405 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
391 work correctly in pysh. I've also moved all the logic which used
406 work correctly in pysh. I've also moved all the logic which used
392 to be in pysh.py here, which will prevent problems with future
407 to be in pysh.py here, which will prevent problems with future
393 upgrades. However, this time I must warn users to update their
408 upgrades. However, this time I must warn users to update their
394 pysh profile to include the line
409 pysh profile to include the line
395
410
396 import_all IPython.Extensions.InterpreterExec
411 import_all IPython.Extensions.InterpreterExec
397
412
398 because otherwise things won't work for them. They MUST also
413 because otherwise things won't work for them. They MUST also
399 delete pysh.py and the line
414 delete pysh.py and the line
400
415
401 execfile pysh.py
416 execfile pysh.py
402
417
403 from their ipythonrc-pysh.
418 from their ipythonrc-pysh.
404
419
405 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
420 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
406 robust in the face of objects whose dir() returns non-strings
421 robust in the face of objects whose dir() returns non-strings
407 (which it shouldn't, but some broken libs like ITK do). Thanks to
422 (which it shouldn't, but some broken libs like ITK do). Thanks to
408 a patch by John Hunter (implemented differently, though). Also
423 a patch by John Hunter (implemented differently, though). Also
409 minor improvements by using .extend instead of + on lists.
424 minor improvements by using .extend instead of + on lists.
410
425
411 * pysh.py:
426 * pysh.py:
412
427
413 2005-04-06 Fernando Perez <fperez@colorado.edu>
428 2005-04-06 Fernando Perez <fperez@colorado.edu>
414
429
415 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
430 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
416 by default, so that all users benefit from it. Those who don't
431 by default, so that all users benefit from it. Those who don't
417 want it can still turn it off.
432 want it can still turn it off.
418
433
419 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
434 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
420 config file, I'd forgotten about this, so users were getting it
435 config file, I'd forgotten about this, so users were getting it
421 off by default.
436 off by default.
422
437
423 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
438 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
424 consistency. Now magics can be called in multiline statements,
439 consistency. Now magics can be called in multiline statements,
425 and python variables can be expanded in magic calls via $var.
440 and python variables can be expanded in magic calls via $var.
426 This makes the magic system behave just like aliases or !system
441 This makes the magic system behave just like aliases or !system
427 calls.
442 calls.
428
443
429 2005-03-28 Fernando Perez <fperez@colorado.edu>
444 2005-03-28 Fernando Perez <fperez@colorado.edu>
430
445
431 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
446 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
432 expensive string additions for building command. Add support for
447 expensive string additions for building command. Add support for
433 trailing ';' when autocall is used.
448 trailing ';' when autocall is used.
434
449
435 2005-03-26 Fernando Perez <fperez@colorado.edu>
450 2005-03-26 Fernando Perez <fperez@colorado.edu>
436
451
437 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
452 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
438 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
453 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
439 ipython.el robust against prompts with any number of spaces
454 ipython.el robust against prompts with any number of spaces
440 (including 0) after the ':' character.
455 (including 0) after the ':' character.
441
456
442 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
457 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
443 continuation prompt, which misled users to think the line was
458 continuation prompt, which misled users to think the line was
444 already indented. Closes debian Bug#300847, reported to me by
459 already indented. Closes debian Bug#300847, reported to me by
445 Norbert Tretkowski <tretkowski-AT-inittab.de>.
460 Norbert Tretkowski <tretkowski-AT-inittab.de>.
446
461
447 2005-03-23 Fernando Perez <fperez@colorado.edu>
462 2005-03-23 Fernando Perez <fperez@colorado.edu>
448
463
449 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
464 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
450 properly aligned if they have embedded newlines.
465 properly aligned if they have embedded newlines.
451
466
452 * IPython/iplib.py (runlines): Add a public method to expose
467 * IPython/iplib.py (runlines): Add a public method to expose
453 IPython's code execution machinery, so that users can run strings
468 IPython's code execution machinery, so that users can run strings
454 as if they had been typed at the prompt interactively.
469 as if they had been typed at the prompt interactively.
455 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
470 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
456 methods which can call the system shell, but with python variable
471 methods which can call the system shell, but with python variable
457 expansion. The three such methods are: __IPYTHON__.system,
472 expansion. The three such methods are: __IPYTHON__.system,
458 .getoutput and .getoutputerror. These need to be documented in a
473 .getoutput and .getoutputerror. These need to be documented in a
459 'public API' section (to be written) of the manual.
474 'public API' section (to be written) of the manual.
460
475
461 2005-03-20 Fernando Perez <fperez@colorado.edu>
476 2005-03-20 Fernando Perez <fperez@colorado.edu>
462
477
463 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
478 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
464 for custom exception handling. This is quite powerful, and it
479 for custom exception handling. This is quite powerful, and it
465 allows for user-installable exception handlers which can trap
480 allows for user-installable exception handlers which can trap
466 custom exceptions at runtime and treat them separately from
481 custom exceptions at runtime and treat them separately from
467 IPython's default mechanisms. At the request of Frédéric
482 IPython's default mechanisms. At the request of Frédéric
468 Mantegazza <mantegazza-AT-ill.fr>.
483 Mantegazza <mantegazza-AT-ill.fr>.
469 (InteractiveShell.set_custom_completer): public API function to
484 (InteractiveShell.set_custom_completer): public API function to
470 add new completers at runtime.
485 add new completers at runtime.
471
486
472 2005-03-19 Fernando Perez <fperez@colorado.edu>
487 2005-03-19 Fernando Perez <fperez@colorado.edu>
473
488
474 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
489 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
475 allow objects which provide their docstrings via non-standard
490 allow objects which provide their docstrings via non-standard
476 mechanisms (like Pyro proxies) to still be inspected by ipython's
491 mechanisms (like Pyro proxies) to still be inspected by ipython's
477 ? system.
492 ? system.
478
493
479 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
494 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
480 automatic capture system. I tried quite hard to make it work
495 automatic capture system. I tried quite hard to make it work
481 reliably, and simply failed. I tried many combinations with the
496 reliably, and simply failed. I tried many combinations with the
482 subprocess module, but eventually nothing worked in all needed
497 subprocess module, but eventually nothing worked in all needed
483 cases (not blocking stdin for the child, duplicating stdout
498 cases (not blocking stdin for the child, duplicating stdout
484 without blocking, etc). The new %sc/%sx still do capture to these
499 without blocking, etc). The new %sc/%sx still do capture to these
485 magical list/string objects which make shell use much more
500 magical list/string objects which make shell use much more
486 conveninent, so not all is lost.
501 conveninent, so not all is lost.
487
502
488 XXX - FIX MANUAL for the change above!
503 XXX - FIX MANUAL for the change above!
489
504
490 (runsource): I copied code.py's runsource() into ipython to modify
505 (runsource): I copied code.py's runsource() into ipython to modify
491 it a bit. Now the code object and source to be executed are
506 it a bit. Now the code object and source to be executed are
492 stored in ipython. This makes this info accessible to third-party
507 stored in ipython. This makes this info accessible to third-party
493 tools, like custom exception handlers. After a request by Frédéric
508 tools, like custom exception handlers. After a request by Frédéric
494 Mantegazza <mantegazza-AT-ill.fr>.
509 Mantegazza <mantegazza-AT-ill.fr>.
495
510
496 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
511 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
497 history-search via readline (like C-p/C-n). I'd wanted this for a
512 history-search via readline (like C-p/C-n). I'd wanted this for a
498 long time, but only recently found out how to do it. For users
513 long time, but only recently found out how to do it. For users
499 who already have their ipythonrc files made and want this, just
514 who already have their ipythonrc files made and want this, just
500 add:
515 add:
501
516
502 readline_parse_and_bind "\e[A": history-search-backward
517 readline_parse_and_bind "\e[A": history-search-backward
503 readline_parse_and_bind "\e[B": history-search-forward
518 readline_parse_and_bind "\e[B": history-search-forward
504
519
505 2005-03-18 Fernando Perez <fperez@colorado.edu>
520 2005-03-18 Fernando Perez <fperez@colorado.edu>
506
521
507 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
522 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
508 LSString and SList classes which allow transparent conversions
523 LSString and SList classes which allow transparent conversions
509 between list mode and whitespace-separated string.
524 between list mode and whitespace-separated string.
510 (magic_r): Fix recursion problem in %r.
525 (magic_r): Fix recursion problem in %r.
511
526
512 * IPython/genutils.py (LSString): New class to be used for
527 * IPython/genutils.py (LSString): New class to be used for
513 automatic storage of the results of all alias/system calls in _o
528 automatic storage of the results of all alias/system calls in _o
514 and _e (stdout/err). These provide a .l/.list attribute which
529 and _e (stdout/err). These provide a .l/.list attribute which
515 does automatic splitting on newlines. This means that for most
530 does automatic splitting on newlines. This means that for most
516 uses, you'll never need to do capturing of output with %sc/%sx
531 uses, you'll never need to do capturing of output with %sc/%sx
517 anymore, since ipython keeps this always done for you. Note that
532 anymore, since ipython keeps this always done for you. Note that
518 only the LAST results are stored, the _o/e variables are
533 only the LAST results are stored, the _o/e variables are
519 overwritten on each call. If you need to save their contents
534 overwritten on each call. If you need to save their contents
520 further, simply bind them to any other name.
535 further, simply bind them to any other name.
521
536
522 2005-03-17 Fernando Perez <fperez@colorado.edu>
537 2005-03-17 Fernando Perez <fperez@colorado.edu>
523
538
524 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
539 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
525 prompt namespace handling.
540 prompt namespace handling.
526
541
527 2005-03-16 Fernando Perez <fperez@colorado.edu>
542 2005-03-16 Fernando Perez <fperez@colorado.edu>
528
543
529 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
544 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
530 classic prompts to be '>>> ' (final space was missing, and it
545 classic prompts to be '>>> ' (final space was missing, and it
531 trips the emacs python mode).
546 trips the emacs python mode).
532 (BasePrompt.__str__): Added safe support for dynamic prompt
547 (BasePrompt.__str__): Added safe support for dynamic prompt
533 strings. Now you can set your prompt string to be '$x', and the
548 strings. Now you can set your prompt string to be '$x', and the
534 value of x will be printed from your interactive namespace. The
549 value of x will be printed from your interactive namespace. The
535 interpolation syntax includes the full Itpl support, so
550 interpolation syntax includes the full Itpl support, so
536 ${foo()+x+bar()} is a valid prompt string now, and the function
551 ${foo()+x+bar()} is a valid prompt string now, and the function
537 calls will be made at runtime.
552 calls will be made at runtime.
538
553
539 2005-03-15 Fernando Perez <fperez@colorado.edu>
554 2005-03-15 Fernando Perez <fperez@colorado.edu>
540
555
541 * IPython/Magic.py (magic_history): renamed %hist to %history, to
556 * IPython/Magic.py (magic_history): renamed %hist to %history, to
542 avoid name clashes in pylab. %hist still works, it just forwards
557 avoid name clashes in pylab. %hist still works, it just forwards
543 the call to %history.
558 the call to %history.
544
559
545 2005-03-02 *** Released version 0.6.12
560 2005-03-02 *** Released version 0.6.12
546
561
547 2005-03-02 Fernando Perez <fperez@colorado.edu>
562 2005-03-02 Fernando Perez <fperez@colorado.edu>
548
563
549 * IPython/iplib.py (handle_magic): log magic calls properly as
564 * IPython/iplib.py (handle_magic): log magic calls properly as
550 ipmagic() function calls.
565 ipmagic() function calls.
551
566
552 * IPython/Magic.py (magic_time): Improved %time to support
567 * IPython/Magic.py (magic_time): Improved %time to support
553 statements and provide wall-clock as well as CPU time.
568 statements and provide wall-clock as well as CPU time.
554
569
555 2005-02-27 Fernando Perez <fperez@colorado.edu>
570 2005-02-27 Fernando Perez <fperez@colorado.edu>
556
571
557 * IPython/hooks.py: New hooks module, to expose user-modifiable
572 * IPython/hooks.py: New hooks module, to expose user-modifiable
558 IPython functionality in a clean manner. For now only the editor
573 IPython functionality in a clean manner. For now only the editor
559 hook is actually written, and other thigns which I intend to turn
574 hook is actually written, and other thigns which I intend to turn
560 into proper hooks aren't yet there. The display and prefilter
575 into proper hooks aren't yet there. The display and prefilter
561 stuff, for example, should be hooks. But at least now the
576 stuff, for example, should be hooks. But at least now the
562 framework is in place, and the rest can be moved here with more
577 framework is in place, and the rest can be moved here with more
563 time later. IPython had had a .hooks variable for a long time for
578 time later. IPython had had a .hooks variable for a long time for
564 this purpose, but I'd never actually used it for anything.
579 this purpose, but I'd never actually used it for anything.
565
580
566 2005-02-26 Fernando Perez <fperez@colorado.edu>
581 2005-02-26 Fernando Perez <fperez@colorado.edu>
567
582
568 * IPython/ipmaker.py (make_IPython): make the default ipython
583 * IPython/ipmaker.py (make_IPython): make the default ipython
569 directory be called _ipython under win32, to follow more the
584 directory be called _ipython under win32, to follow more the
570 naming peculiarities of that platform (where buggy software like
585 naming peculiarities of that platform (where buggy software like
571 Visual Sourcesafe breaks with .named directories). Reported by
586 Visual Sourcesafe breaks with .named directories). Reported by
572 Ville Vainio.
587 Ville Vainio.
573
588
574 2005-02-23 Fernando Perez <fperez@colorado.edu>
589 2005-02-23 Fernando Perez <fperez@colorado.edu>
575
590
576 * IPython/iplib.py (InteractiveShell.__init__): removed a few
591 * IPython/iplib.py (InteractiveShell.__init__): removed a few
577 auto_aliases for win32 which were causing problems. Users can
592 auto_aliases for win32 which were causing problems. Users can
578 define the ones they personally like.
593 define the ones they personally like.
579
594
580 2005-02-21 Fernando Perez <fperez@colorado.edu>
595 2005-02-21 Fernando Perez <fperez@colorado.edu>
581
596
582 * IPython/Magic.py (magic_time): new magic to time execution of
597 * IPython/Magic.py (magic_time): new magic to time execution of
583 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
598 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
584
599
585 2005-02-19 Fernando Perez <fperez@colorado.edu>
600 2005-02-19 Fernando Perez <fperez@colorado.edu>
586
601
587 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
602 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
588 into keys (for prompts, for example).
603 into keys (for prompts, for example).
589
604
590 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
605 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
591 prompts in case users want them. This introduces a small behavior
606 prompts in case users want them. This introduces a small behavior
592 change: ipython does not automatically add a space to all prompts
607 change: ipython does not automatically add a space to all prompts
593 anymore. To get the old prompts with a space, users should add it
608 anymore. To get the old prompts with a space, users should add it
594 manually to their ipythonrc file, so for example prompt_in1 should
609 manually to their ipythonrc file, so for example prompt_in1 should
595 now read 'In [\#]: ' instead of 'In [\#]:'.
610 now read 'In [\#]: ' instead of 'In [\#]:'.
596 (BasePrompt.__init__): New option prompts_pad_left (only in rc
611 (BasePrompt.__init__): New option prompts_pad_left (only in rc
597 file) to control left-padding of secondary prompts.
612 file) to control left-padding of secondary prompts.
598
613
599 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
614 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
600 the profiler can't be imported. Fix for Debian, which removed
615 the profiler can't be imported. Fix for Debian, which removed
601 profile.py because of License issues. I applied a slightly
616 profile.py because of License issues. I applied a slightly
602 modified version of the original Debian patch at
617 modified version of the original Debian patch at
603 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
618 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
604
619
605 2005-02-17 Fernando Perez <fperez@colorado.edu>
620 2005-02-17 Fernando Perez <fperez@colorado.edu>
606
621
607 * IPython/genutils.py (native_line_ends): Fix bug which would
622 * IPython/genutils.py (native_line_ends): Fix bug which would
608 cause improper line-ends under win32 b/c I was not opening files
623 cause improper line-ends under win32 b/c I was not opening files
609 in binary mode. Bug report and fix thanks to Ville.
624 in binary mode. Bug report and fix thanks to Ville.
610
625
611 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
626 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
612 trying to catch spurious foo[1] autocalls. My fix actually broke
627 trying to catch spurious foo[1] autocalls. My fix actually broke
613 ',/' autoquote/call with explicit escape (bad regexp).
628 ',/' autoquote/call with explicit escape (bad regexp).
614
629
615 2005-02-15 *** Released version 0.6.11
630 2005-02-15 *** Released version 0.6.11
616
631
617 2005-02-14 Fernando Perez <fperez@colorado.edu>
632 2005-02-14 Fernando Perez <fperez@colorado.edu>
618
633
619 * IPython/background_jobs.py: New background job management
634 * IPython/background_jobs.py: New background job management
620 subsystem. This is implemented via a new set of classes, and
635 subsystem. This is implemented via a new set of classes, and
621 IPython now provides a builtin 'jobs' object for background job
636 IPython now provides a builtin 'jobs' object for background job
622 execution. A convenience %bg magic serves as a lightweight
637 execution. A convenience %bg magic serves as a lightweight
623 frontend for starting the more common type of calls. This was
638 frontend for starting the more common type of calls. This was
624 inspired by discussions with B. Granger and the BackgroundCommand
639 inspired by discussions with B. Granger and the BackgroundCommand
625 class described in the book Python Scripting for Computational
640 class described in the book Python Scripting for Computational
626 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
641 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
627 (although ultimately no code from this text was used, as IPython's
642 (although ultimately no code from this text was used, as IPython's
628 system is a separate implementation).
643 system is a separate implementation).
629
644
630 * IPython/iplib.py (MagicCompleter.python_matches): add new option
645 * IPython/iplib.py (MagicCompleter.python_matches): add new option
631 to control the completion of single/double underscore names
646 to control the completion of single/double underscore names
632 separately. As documented in the example ipytonrc file, the
647 separately. As documented in the example ipytonrc file, the
633 readline_omit__names variable can now be set to 2, to omit even
648 readline_omit__names variable can now be set to 2, to omit even
634 single underscore names. Thanks to a patch by Brian Wong
649 single underscore names. Thanks to a patch by Brian Wong
635 <BrianWong-AT-AirgoNetworks.Com>.
650 <BrianWong-AT-AirgoNetworks.Com>.
636 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
651 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
637 be autocalled as foo([1]) if foo were callable. A problem for
652 be autocalled as foo([1]) if foo were callable. A problem for
638 things which are both callable and implement __getitem__.
653 things which are both callable and implement __getitem__.
639 (init_readline): Fix autoindentation for win32. Thanks to a patch
654 (init_readline): Fix autoindentation for win32. Thanks to a patch
640 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
655 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
641
656
642 2005-02-12 Fernando Perez <fperez@colorado.edu>
657 2005-02-12 Fernando Perez <fperez@colorado.edu>
643
658
644 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
659 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
645 which I had written long ago to sort out user error messages which
660 which I had written long ago to sort out user error messages which
646 may occur during startup. This seemed like a good idea initially,
661 may occur during startup. This seemed like a good idea initially,
647 but it has proven a disaster in retrospect. I don't want to
662 but it has proven a disaster in retrospect. I don't want to
648 change much code for now, so my fix is to set the internal 'debug'
663 change much code for now, so my fix is to set the internal 'debug'
649 flag to true everywhere, whose only job was precisely to control
664 flag to true everywhere, whose only job was precisely to control
650 this subsystem. This closes issue 28 (as well as avoiding all
665 this subsystem. This closes issue 28 (as well as avoiding all
651 sorts of strange hangups which occur from time to time).
666 sorts of strange hangups which occur from time to time).
652
667
653 2005-02-07 Fernando Perez <fperez@colorado.edu>
668 2005-02-07 Fernando Perez <fperez@colorado.edu>
654
669
655 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
670 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
656 previous call produced a syntax error.
671 previous call produced a syntax error.
657
672
658 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
673 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
659 classes without constructor.
674 classes without constructor.
660
675
661 2005-02-06 Fernando Perez <fperez@colorado.edu>
676 2005-02-06 Fernando Perez <fperez@colorado.edu>
662
677
663 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
678 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
664 completions with the results of each matcher, so we return results
679 completions with the results of each matcher, so we return results
665 to the user from all namespaces. This breaks with ipython
680 to the user from all namespaces. This breaks with ipython
666 tradition, but I think it's a nicer behavior. Now you get all
681 tradition, but I think it's a nicer behavior. Now you get all
667 possible completions listed, from all possible namespaces (python,
682 possible completions listed, from all possible namespaces (python,
668 filesystem, magics...) After a request by John Hunter
683 filesystem, magics...) After a request by John Hunter
669 <jdhunter-AT-nitace.bsd.uchicago.edu>.
684 <jdhunter-AT-nitace.bsd.uchicago.edu>.
670
685
671 2005-02-05 Fernando Perez <fperez@colorado.edu>
686 2005-02-05 Fernando Perez <fperez@colorado.edu>
672
687
673 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
688 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
674 the call had quote characters in it (the quotes were stripped).
689 the call had quote characters in it (the quotes were stripped).
675
690
676 2005-01-31 Fernando Perez <fperez@colorado.edu>
691 2005-01-31 Fernando Perez <fperez@colorado.edu>
677
692
678 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
693 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
679 Itpl.itpl() to make the code more robust against psyco
694 Itpl.itpl() to make the code more robust against psyco
680 optimizations.
695 optimizations.
681
696
682 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
697 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
683 of causing an exception. Quicker, cleaner.
698 of causing an exception. Quicker, cleaner.
684
699
685 2005-01-28 Fernando Perez <fperez@colorado.edu>
700 2005-01-28 Fernando Perez <fperez@colorado.edu>
686
701
687 * scripts/ipython_win_post_install.py (install): hardcode
702 * scripts/ipython_win_post_install.py (install): hardcode
688 sys.prefix+'python.exe' as the executable path. It turns out that
703 sys.prefix+'python.exe' as the executable path. It turns out that
689 during the post-installation run, sys.executable resolves to the
704 during the post-installation run, sys.executable resolves to the
690 name of the binary installer! I should report this as a distutils
705 name of the binary installer! I should report this as a distutils
691 bug, I think. I updated the .10 release with this tiny fix, to
706 bug, I think. I updated the .10 release with this tiny fix, to
692 avoid annoying the lists further.
707 avoid annoying the lists further.
693
708
694 2005-01-27 *** Released version 0.6.10
709 2005-01-27 *** Released version 0.6.10
695
710
696 2005-01-27 Fernando Perez <fperez@colorado.edu>
711 2005-01-27 Fernando Perez <fperez@colorado.edu>
697
712
698 * IPython/numutils.py (norm): Added 'inf' as optional name for
713 * IPython/numutils.py (norm): Added 'inf' as optional name for
699 L-infinity norm, included references to mathworld.com for vector
714 L-infinity norm, included references to mathworld.com for vector
700 norm definitions.
715 norm definitions.
701 (amin/amax): added amin/amax for array min/max. Similar to what
716 (amin/amax): added amin/amax for array min/max. Similar to what
702 pylab ships with after the recent reorganization of names.
717 pylab ships with after the recent reorganization of names.
703 (spike/spike_odd): removed deprecated spike/spike_odd functions.
718 (spike/spike_odd): removed deprecated spike/spike_odd functions.
704
719
705 * ipython.el: committed Alex's recent fixes and improvements.
720 * ipython.el: committed Alex's recent fixes and improvements.
706 Tested with python-mode from CVS, and it looks excellent. Since
721 Tested with python-mode from CVS, and it looks excellent. Since
707 python-mode hasn't released anything in a while, I'm temporarily
722 python-mode hasn't released anything in a while, I'm temporarily
708 putting a copy of today's CVS (v 4.70) of python-mode in:
723 putting a copy of today's CVS (v 4.70) of python-mode in:
709 http://ipython.scipy.org/tmp/python-mode.el
724 http://ipython.scipy.org/tmp/python-mode.el
710
725
711 * scripts/ipython_win_post_install.py (install): Win32 fix to use
726 * scripts/ipython_win_post_install.py (install): Win32 fix to use
712 sys.executable for the executable name, instead of assuming it's
727 sys.executable for the executable name, instead of assuming it's
713 called 'python.exe' (the post-installer would have produced broken
728 called 'python.exe' (the post-installer would have produced broken
714 setups on systems with a differently named python binary).
729 setups on systems with a differently named python binary).
715
730
716 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
731 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
717 references to os.linesep, to make the code more
732 references to os.linesep, to make the code more
718 platform-independent. This is also part of the win32 coloring
733 platform-independent. This is also part of the win32 coloring
719 fixes.
734 fixes.
720
735
721 * IPython/genutils.py (page_dumb): Remove attempts to chop long
736 * IPython/genutils.py (page_dumb): Remove attempts to chop long
722 lines, which actually cause coloring bugs because the length of
737 lines, which actually cause coloring bugs because the length of
723 the line is very difficult to correctly compute with embedded
738 the line is very difficult to correctly compute with embedded
724 escapes. This was the source of all the coloring problems under
739 escapes. This was the source of all the coloring problems under
725 Win32. I think that _finally_, Win32 users have a properly
740 Win32. I think that _finally_, Win32 users have a properly
726 working ipython in all respects. This would never have happened
741 working ipython in all respects. This would never have happened
727 if not for Gary Bishop and Viktor Ransmayr's great help and work.
742 if not for Gary Bishop and Viktor Ransmayr's great help and work.
728
743
729 2005-01-26 *** Released version 0.6.9
744 2005-01-26 *** Released version 0.6.9
730
745
731 2005-01-25 Fernando Perez <fperez@colorado.edu>
746 2005-01-25 Fernando Perez <fperez@colorado.edu>
732
747
733 * setup.py: finally, we have a true Windows installer, thanks to
748 * setup.py: finally, we have a true Windows installer, thanks to
734 the excellent work of Viktor Ransmayr
749 the excellent work of Viktor Ransmayr
735 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
750 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
736 Windows users. The setup routine is quite a bit cleaner thanks to
751 Windows users. The setup routine is quite a bit cleaner thanks to
737 this, and the post-install script uses the proper functions to
752 this, and the post-install script uses the proper functions to
738 allow a clean de-installation using the standard Windows Control
753 allow a clean de-installation using the standard Windows Control
739 Panel.
754 Panel.
740
755
741 * IPython/genutils.py (get_home_dir): changed to use the $HOME
756 * IPython/genutils.py (get_home_dir): changed to use the $HOME
742 environment variable under all OSes (including win32) if
757 environment variable under all OSes (including win32) if
743 available. This will give consistency to win32 users who have set
758 available. This will give consistency to win32 users who have set
744 this variable for any reason. If os.environ['HOME'] fails, the
759 this variable for any reason. If os.environ['HOME'] fails, the
745 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
760 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
746
761
747 2005-01-24 Fernando Perez <fperez@colorado.edu>
762 2005-01-24 Fernando Perez <fperez@colorado.edu>
748
763
749 * IPython/numutils.py (empty_like): add empty_like(), similar to
764 * IPython/numutils.py (empty_like): add empty_like(), similar to
750 zeros_like() but taking advantage of the new empty() Numeric routine.
765 zeros_like() but taking advantage of the new empty() Numeric routine.
751
766
752 2005-01-23 *** Released version 0.6.8
767 2005-01-23 *** Released version 0.6.8
753
768
754 2005-01-22 Fernando Perez <fperez@colorado.edu>
769 2005-01-22 Fernando Perez <fperez@colorado.edu>
755
770
756 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
771 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
757 automatic show() calls. After discussing things with JDH, it
772 automatic show() calls. After discussing things with JDH, it
758 turns out there are too many corner cases where this can go wrong.
773 turns out there are too many corner cases where this can go wrong.
759 It's best not to try to be 'too smart', and simply have ipython
774 It's best not to try to be 'too smart', and simply have ipython
760 reproduce as much as possible the default behavior of a normal
775 reproduce as much as possible the default behavior of a normal
761 python shell.
776 python shell.
762
777
763 * IPython/iplib.py (InteractiveShell.__init__): Modified the
778 * IPython/iplib.py (InteractiveShell.__init__): Modified the
764 line-splitting regexp and _prefilter() to avoid calling getattr()
779 line-splitting regexp and _prefilter() to avoid calling getattr()
765 on assignments. This closes
780 on assignments. This closes
766 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
781 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
767 readline uses getattr(), so a simple <TAB> keypress is still
782 readline uses getattr(), so a simple <TAB> keypress is still
768 enough to trigger getattr() calls on an object.
783 enough to trigger getattr() calls on an object.
769
784
770 2005-01-21 Fernando Perez <fperez@colorado.edu>
785 2005-01-21 Fernando Perez <fperez@colorado.edu>
771
786
772 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
787 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
773 docstring under pylab so it doesn't mask the original.
788 docstring under pylab so it doesn't mask the original.
774
789
775 2005-01-21 *** Released version 0.6.7
790 2005-01-21 *** Released version 0.6.7
776
791
777 2005-01-21 Fernando Perez <fperez@colorado.edu>
792 2005-01-21 Fernando Perez <fperez@colorado.edu>
778
793
779 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
794 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
780 signal handling for win32 users in multithreaded mode.
795 signal handling for win32 users in multithreaded mode.
781
796
782 2005-01-17 Fernando Perez <fperez@colorado.edu>
797 2005-01-17 Fernando Perez <fperez@colorado.edu>
783
798
784 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
799 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
785 instances with no __init__. After a crash report by Norbert Nemec
800 instances with no __init__. After a crash report by Norbert Nemec
786 <Norbert-AT-nemec-online.de>.
801 <Norbert-AT-nemec-online.de>.
787
802
788 2005-01-14 Fernando Perez <fperez@colorado.edu>
803 2005-01-14 Fernando Perez <fperez@colorado.edu>
789
804
790 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
805 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
791 names for verbose exceptions, when multiple dotted names and the
806 names for verbose exceptions, when multiple dotted names and the
792 'parent' object were present on the same line.
807 'parent' object were present on the same line.
793
808
794 2005-01-11 Fernando Perez <fperez@colorado.edu>
809 2005-01-11 Fernando Perez <fperez@colorado.edu>
795
810
796 * IPython/genutils.py (flag_calls): new utility to trap and flag
811 * IPython/genutils.py (flag_calls): new utility to trap and flag
797 calls in functions. I need it to clean up matplotlib support.
812 calls in functions. I need it to clean up matplotlib support.
798 Also removed some deprecated code in genutils.
813 Also removed some deprecated code in genutils.
799
814
800 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
815 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
801 that matplotlib scripts called with %run, which don't call show()
816 that matplotlib scripts called with %run, which don't call show()
802 themselves, still have their plotting windows open.
817 themselves, still have their plotting windows open.
803
818
804 2005-01-05 Fernando Perez <fperez@colorado.edu>
819 2005-01-05 Fernando Perez <fperez@colorado.edu>
805
820
806 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
821 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
807 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
822 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
808
823
809 2004-12-19 Fernando Perez <fperez@colorado.edu>
824 2004-12-19 Fernando Perez <fperez@colorado.edu>
810
825
811 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
826 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
812 parent_runcode, which was an eyesore. The same result can be
827 parent_runcode, which was an eyesore. The same result can be
813 obtained with Python's regular superclass mechanisms.
828 obtained with Python's regular superclass mechanisms.
814
829
815 2004-12-17 Fernando Perez <fperez@colorado.edu>
830 2004-12-17 Fernando Perez <fperez@colorado.edu>
816
831
817 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
832 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
818 reported by Prabhu.
833 reported by Prabhu.
819 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
834 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
820 sys.stderr) instead of explicitly calling sys.stderr. This helps
835 sys.stderr) instead of explicitly calling sys.stderr. This helps
821 maintain our I/O abstractions clean, for future GUI embeddings.
836 maintain our I/O abstractions clean, for future GUI embeddings.
822
837
823 * IPython/genutils.py (info): added new utility for sys.stderr
838 * IPython/genutils.py (info): added new utility for sys.stderr
824 unified info message handling (thin wrapper around warn()).
839 unified info message handling (thin wrapper around warn()).
825
840
826 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
841 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
827 composite (dotted) names on verbose exceptions.
842 composite (dotted) names on verbose exceptions.
828 (VerboseTB.nullrepr): harden against another kind of errors which
843 (VerboseTB.nullrepr): harden against another kind of errors which
829 Python's inspect module can trigger, and which were crashing
844 Python's inspect module can trigger, and which were crashing
830 IPython. Thanks to a report by Marco Lombardi
845 IPython. Thanks to a report by Marco Lombardi
831 <mlombard-AT-ma010192.hq.eso.org>.
846 <mlombard-AT-ma010192.hq.eso.org>.
832
847
833 2004-12-13 *** Released version 0.6.6
848 2004-12-13 *** Released version 0.6.6
834
849
835 2004-12-12 Fernando Perez <fperez@colorado.edu>
850 2004-12-12 Fernando Perez <fperez@colorado.edu>
836
851
837 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
852 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
838 generated by pygtk upon initialization if it was built without
853 generated by pygtk upon initialization if it was built without
839 threads (for matplotlib users). After a crash reported by
854 threads (for matplotlib users). After a crash reported by
840 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
855 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
841
856
842 * IPython/ipmaker.py (make_IPython): fix small bug in the
857 * IPython/ipmaker.py (make_IPython): fix small bug in the
843 import_some parameter for multiple imports.
858 import_some parameter for multiple imports.
844
859
845 * IPython/iplib.py (ipmagic): simplified the interface of
860 * IPython/iplib.py (ipmagic): simplified the interface of
846 ipmagic() to take a single string argument, just as it would be
861 ipmagic() to take a single string argument, just as it would be
847 typed at the IPython cmd line.
862 typed at the IPython cmd line.
848 (ipalias): Added new ipalias() with an interface identical to
863 (ipalias): Added new ipalias() with an interface identical to
849 ipmagic(). This completes exposing a pure python interface to the
864 ipmagic(). This completes exposing a pure python interface to the
850 alias and magic system, which can be used in loops or more complex
865 alias and magic system, which can be used in loops or more complex
851 code where IPython's automatic line mangling is not active.
866 code where IPython's automatic line mangling is not active.
852
867
853 * IPython/genutils.py (timing): changed interface of timing to
868 * IPython/genutils.py (timing): changed interface of timing to
854 simply run code once, which is the most common case. timings()
869 simply run code once, which is the most common case. timings()
855 remains unchanged, for the cases where you want multiple runs.
870 remains unchanged, for the cases where you want multiple runs.
856
871
857 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
872 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
858 bug where Python2.2 crashes with exec'ing code which does not end
873 bug where Python2.2 crashes with exec'ing code which does not end
859 in a single newline. Python 2.3 is OK, so I hadn't noticed this
874 in a single newline. Python 2.3 is OK, so I hadn't noticed this
860 before.
875 before.
861
876
862 2004-12-10 Fernando Perez <fperez@colorado.edu>
877 2004-12-10 Fernando Perez <fperez@colorado.edu>
863
878
864 * IPython/Magic.py (Magic.magic_prun): changed name of option from
879 * IPython/Magic.py (Magic.magic_prun): changed name of option from
865 -t to -T, to accomodate the new -t flag in %run (the %run and
880 -t to -T, to accomodate the new -t flag in %run (the %run and
866 %prun options are kind of intermixed, and it's not easy to change
881 %prun options are kind of intermixed, and it's not easy to change
867 this with the limitations of python's getopt).
882 this with the limitations of python's getopt).
868
883
869 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
884 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
870 the execution of scripts. It's not as fine-tuned as timeit.py,
885 the execution of scripts. It's not as fine-tuned as timeit.py,
871 but it works from inside ipython (and under 2.2, which lacks
886 but it works from inside ipython (and under 2.2, which lacks
872 timeit.py). Optionally a number of runs > 1 can be given for
887 timeit.py). Optionally a number of runs > 1 can be given for
873 timing very short-running code.
888 timing very short-running code.
874
889
875 * IPython/genutils.py (uniq_stable): new routine which returns a
890 * IPython/genutils.py (uniq_stable): new routine which returns a
876 list of unique elements in any iterable, but in stable order of
891 list of unique elements in any iterable, but in stable order of
877 appearance. I needed this for the ultraTB fixes, and it's a handy
892 appearance. I needed this for the ultraTB fixes, and it's a handy
878 utility.
893 utility.
879
894
880 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
895 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
881 dotted names in Verbose exceptions. This had been broken since
896 dotted names in Verbose exceptions. This had been broken since
882 the very start, now x.y will properly be printed in a Verbose
897 the very start, now x.y will properly be printed in a Verbose
883 traceback, instead of x being shown and y appearing always as an
898 traceback, instead of x being shown and y appearing always as an
884 'undefined global'. Getting this to work was a bit tricky,
899 'undefined global'. Getting this to work was a bit tricky,
885 because by default python tokenizers are stateless. Saved by
900 because by default python tokenizers are stateless. Saved by
886 python's ability to easily add a bit of state to an arbitrary
901 python's ability to easily add a bit of state to an arbitrary
887 function (without needing to build a full-blown callable object).
902 function (without needing to build a full-blown callable object).
888
903
889 Also big cleanup of this code, which had horrendous runtime
904 Also big cleanup of this code, which had horrendous runtime
890 lookups of zillions of attributes for colorization. Moved all
905 lookups of zillions of attributes for colorization. Moved all
891 this code into a few templates, which make it cleaner and quicker.
906 this code into a few templates, which make it cleaner and quicker.
892
907
893 Printout quality was also improved for Verbose exceptions: one
908 Printout quality was also improved for Verbose exceptions: one
894 variable per line, and memory addresses are printed (this can be
909 variable per line, and memory addresses are printed (this can be
895 quite handy in nasty debugging situations, which is what Verbose
910 quite handy in nasty debugging situations, which is what Verbose
896 is for).
911 is for).
897
912
898 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
913 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
899 the command line as scripts to be loaded by embedded instances.
914 the command line as scripts to be loaded by embedded instances.
900 Doing so has the potential for an infinite recursion if there are
915 Doing so has the potential for an infinite recursion if there are
901 exceptions thrown in the process. This fixes a strange crash
916 exceptions thrown in the process. This fixes a strange crash
902 reported by Philippe MULLER <muller-AT-irit.fr>.
917 reported by Philippe MULLER <muller-AT-irit.fr>.
903
918
904 2004-12-09 Fernando Perez <fperez@colorado.edu>
919 2004-12-09 Fernando Perez <fperez@colorado.edu>
905
920
906 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
921 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
907 to reflect new names in matplotlib, which now expose the
922 to reflect new names in matplotlib, which now expose the
908 matlab-compatible interface via a pylab module instead of the
923 matlab-compatible interface via a pylab module instead of the
909 'matlab' name. The new code is backwards compatible, so users of
924 'matlab' name. The new code is backwards compatible, so users of
910 all matplotlib versions are OK. Patch by J. Hunter.
925 all matplotlib versions are OK. Patch by J. Hunter.
911
926
912 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
927 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
913 of __init__ docstrings for instances (class docstrings are already
928 of __init__ docstrings for instances (class docstrings are already
914 automatically printed). Instances with customized docstrings
929 automatically printed). Instances with customized docstrings
915 (indep. of the class) are also recognized and all 3 separate
930 (indep. of the class) are also recognized and all 3 separate
916 docstrings are printed (instance, class, constructor). After some
931 docstrings are printed (instance, class, constructor). After some
917 comments/suggestions by J. Hunter.
932 comments/suggestions by J. Hunter.
918
933
919 2004-12-05 Fernando Perez <fperez@colorado.edu>
934 2004-12-05 Fernando Perez <fperez@colorado.edu>
920
935
921 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
936 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
922 warnings when tab-completion fails and triggers an exception.
937 warnings when tab-completion fails and triggers an exception.
923
938
924 2004-12-03 Fernando Perez <fperez@colorado.edu>
939 2004-12-03 Fernando Perez <fperez@colorado.edu>
925
940
926 * IPython/Magic.py (magic_prun): Fix bug where an exception would
941 * IPython/Magic.py (magic_prun): Fix bug where an exception would
927 be triggered when using 'run -p'. An incorrect option flag was
942 be triggered when using 'run -p'. An incorrect option flag was
928 being set ('d' instead of 'D').
943 being set ('d' instead of 'D').
929 (manpage): fix missing escaped \- sign.
944 (manpage): fix missing escaped \- sign.
930
945
931 2004-11-30 *** Released version 0.6.5
946 2004-11-30 *** Released version 0.6.5
932
947
933 2004-11-30 Fernando Perez <fperez@colorado.edu>
948 2004-11-30 Fernando Perez <fperez@colorado.edu>
934
949
935 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
950 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
936 setting with -d option.
951 setting with -d option.
937
952
938 * setup.py (docfiles): Fix problem where the doc glob I was using
953 * setup.py (docfiles): Fix problem where the doc glob I was using
939 was COMPLETELY BROKEN. It was giving the right files by pure
954 was COMPLETELY BROKEN. It was giving the right files by pure
940 accident, but failed once I tried to include ipython.el. Note:
955 accident, but failed once I tried to include ipython.el. Note:
941 glob() does NOT allow you to do exclusion on multiple endings!
956 glob() does NOT allow you to do exclusion on multiple endings!
942
957
943 2004-11-29 Fernando Perez <fperez@colorado.edu>
958 2004-11-29 Fernando Perez <fperez@colorado.edu>
944
959
945 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
960 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
946 the manpage as the source. Better formatting & consistency.
961 the manpage as the source. Better formatting & consistency.
947
962
948 * IPython/Magic.py (magic_run): Added new -d option, to run
963 * IPython/Magic.py (magic_run): Added new -d option, to run
949 scripts under the control of the python pdb debugger. Note that
964 scripts under the control of the python pdb debugger. Note that
950 this required changing the %prun option -d to -D, to avoid a clash
965 this required changing the %prun option -d to -D, to avoid a clash
951 (since %run must pass options to %prun, and getopt is too dumb to
966 (since %run must pass options to %prun, and getopt is too dumb to
952 handle options with string values with embedded spaces). Thanks
967 handle options with string values with embedded spaces). Thanks
953 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
968 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
954 (magic_who_ls): added type matching to %who and %whos, so that one
969 (magic_who_ls): added type matching to %who and %whos, so that one
955 can filter their output to only include variables of certain
970 can filter their output to only include variables of certain
956 types. Another suggestion by Matthew.
971 types. Another suggestion by Matthew.
957 (magic_whos): Added memory summaries in kb and Mb for arrays.
972 (magic_whos): Added memory summaries in kb and Mb for arrays.
958 (magic_who): Improve formatting (break lines every 9 vars).
973 (magic_who): Improve formatting (break lines every 9 vars).
959
974
960 2004-11-28 Fernando Perez <fperez@colorado.edu>
975 2004-11-28 Fernando Perez <fperez@colorado.edu>
961
976
962 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
977 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
963 cache when empty lines were present.
978 cache when empty lines were present.
964
979
965 2004-11-24 Fernando Perez <fperez@colorado.edu>
980 2004-11-24 Fernando Perez <fperez@colorado.edu>
966
981
967 * IPython/usage.py (__doc__): document the re-activated threading
982 * IPython/usage.py (__doc__): document the re-activated threading
968 options for WX and GTK.
983 options for WX and GTK.
969
984
970 2004-11-23 Fernando Perez <fperez@colorado.edu>
985 2004-11-23 Fernando Perez <fperez@colorado.edu>
971
986
972 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
987 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
973 the -wthread and -gthread options, along with a new -tk one to try
988 the -wthread and -gthread options, along with a new -tk one to try
974 and coordinate Tk threading with wx/gtk. The tk support is very
989 and coordinate Tk threading with wx/gtk. The tk support is very
975 platform dependent, since it seems to require Tcl and Tk to be
990 platform dependent, since it seems to require Tcl and Tk to be
976 built with threads (Fedora1/2 appears NOT to have it, but in
991 built with threads (Fedora1/2 appears NOT to have it, but in
977 Prabhu's Debian boxes it works OK). But even with some Tk
992 Prabhu's Debian boxes it works OK). But even with some Tk
978 limitations, this is a great improvement.
993 limitations, this is a great improvement.
979
994
980 * IPython/Prompts.py (prompt_specials_color): Added \t for time
995 * IPython/Prompts.py (prompt_specials_color): Added \t for time
981 info in user prompts. Patch by Prabhu.
996 info in user prompts. Patch by Prabhu.
982
997
983 2004-11-18 Fernando Perez <fperez@colorado.edu>
998 2004-11-18 Fernando Perez <fperez@colorado.edu>
984
999
985 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1000 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
986 EOFErrors and bail, to avoid infinite loops if a non-terminating
1001 EOFErrors and bail, to avoid infinite loops if a non-terminating
987 file is fed into ipython. Patch submitted in issue 19 by user,
1002 file is fed into ipython. Patch submitted in issue 19 by user,
988 many thanks.
1003 many thanks.
989
1004
990 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1005 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
991 autoquote/parens in continuation prompts, which can cause lots of
1006 autoquote/parens in continuation prompts, which can cause lots of
992 problems. Closes roundup issue 20.
1007 problems. Closes roundup issue 20.
993
1008
994 2004-11-17 Fernando Perez <fperez@colorado.edu>
1009 2004-11-17 Fernando Perez <fperez@colorado.edu>
995
1010
996 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1011 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
997 reported as debian bug #280505. I'm not sure my local changelog
1012 reported as debian bug #280505. I'm not sure my local changelog
998 entry has the proper debian format (Jack?).
1013 entry has the proper debian format (Jack?).
999
1014
1000 2004-11-08 *** Released version 0.6.4
1015 2004-11-08 *** Released version 0.6.4
1001
1016
1002 2004-11-08 Fernando Perez <fperez@colorado.edu>
1017 2004-11-08 Fernando Perez <fperez@colorado.edu>
1003
1018
1004 * IPython/iplib.py (init_readline): Fix exit message for Windows
1019 * IPython/iplib.py (init_readline): Fix exit message for Windows
1005 when readline is active. Thanks to a report by Eric Jones
1020 when readline is active. Thanks to a report by Eric Jones
1006 <eric-AT-enthought.com>.
1021 <eric-AT-enthought.com>.
1007
1022
1008 2004-11-07 Fernando Perez <fperez@colorado.edu>
1023 2004-11-07 Fernando Perez <fperez@colorado.edu>
1009
1024
1010 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1025 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1011 sometimes seen by win2k/cygwin users.
1026 sometimes seen by win2k/cygwin users.
1012
1027
1013 2004-11-06 Fernando Perez <fperez@colorado.edu>
1028 2004-11-06 Fernando Perez <fperez@colorado.edu>
1014
1029
1015 * IPython/iplib.py (interact): Change the handling of %Exit from
1030 * IPython/iplib.py (interact): Change the handling of %Exit from
1016 trying to propagate a SystemExit to an internal ipython flag.
1031 trying to propagate a SystemExit to an internal ipython flag.
1017 This is less elegant than using Python's exception mechanism, but
1032 This is less elegant than using Python's exception mechanism, but
1018 I can't get that to work reliably with threads, so under -pylab
1033 I can't get that to work reliably with threads, so under -pylab
1019 %Exit was hanging IPython. Cross-thread exception handling is
1034 %Exit was hanging IPython. Cross-thread exception handling is
1020 really a bitch. Thaks to a bug report by Stephen Walton
1035 really a bitch. Thaks to a bug report by Stephen Walton
1021 <stephen.walton-AT-csun.edu>.
1036 <stephen.walton-AT-csun.edu>.
1022
1037
1023 2004-11-04 Fernando Perez <fperez@colorado.edu>
1038 2004-11-04 Fernando Perez <fperez@colorado.edu>
1024
1039
1025 * IPython/iplib.py (raw_input_original): store a pointer to the
1040 * IPython/iplib.py (raw_input_original): store a pointer to the
1026 true raw_input to harden against code which can modify it
1041 true raw_input to harden against code which can modify it
1027 (wx.py.PyShell does this and would otherwise crash ipython).
1042 (wx.py.PyShell does this and would otherwise crash ipython).
1028 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1043 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1029
1044
1030 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1045 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1031 Ctrl-C problem, which does not mess up the input line.
1046 Ctrl-C problem, which does not mess up the input line.
1032
1047
1033 2004-11-03 Fernando Perez <fperez@colorado.edu>
1048 2004-11-03 Fernando Perez <fperez@colorado.edu>
1034
1049
1035 * IPython/Release.py: Changed licensing to BSD, in all files.
1050 * IPython/Release.py: Changed licensing to BSD, in all files.
1036 (name): lowercase name for tarball/RPM release.
1051 (name): lowercase name for tarball/RPM release.
1037
1052
1038 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1053 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1039 use throughout ipython.
1054 use throughout ipython.
1040
1055
1041 * IPython/Magic.py (Magic._ofind): Switch to using the new
1056 * IPython/Magic.py (Magic._ofind): Switch to using the new
1042 OInspect.getdoc() function.
1057 OInspect.getdoc() function.
1043
1058
1044 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1059 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1045 of the line currently being canceled via Ctrl-C. It's extremely
1060 of the line currently being canceled via Ctrl-C. It's extremely
1046 ugly, but I don't know how to do it better (the problem is one of
1061 ugly, but I don't know how to do it better (the problem is one of
1047 handling cross-thread exceptions).
1062 handling cross-thread exceptions).
1048
1063
1049 2004-10-28 Fernando Perez <fperez@colorado.edu>
1064 2004-10-28 Fernando Perez <fperez@colorado.edu>
1050
1065
1051 * IPython/Shell.py (signal_handler): add signal handlers to trap
1066 * IPython/Shell.py (signal_handler): add signal handlers to trap
1052 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1067 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1053 report by Francesc Alted.
1068 report by Francesc Alted.
1054
1069
1055 2004-10-21 Fernando Perez <fperez@colorado.edu>
1070 2004-10-21 Fernando Perez <fperez@colorado.edu>
1056
1071
1057 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1072 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1058 to % for pysh syntax extensions.
1073 to % for pysh syntax extensions.
1059
1074
1060 2004-10-09 Fernando Perez <fperez@colorado.edu>
1075 2004-10-09 Fernando Perez <fperez@colorado.edu>
1061
1076
1062 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1077 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1063 arrays to print a more useful summary, without calling str(arr).
1078 arrays to print a more useful summary, without calling str(arr).
1064 This avoids the problem of extremely lengthy computations which
1079 This avoids the problem of extremely lengthy computations which
1065 occur if arr is large, and appear to the user as a system lockup
1080 occur if arr is large, and appear to the user as a system lockup
1066 with 100% cpu activity. After a suggestion by Kristian Sandberg
1081 with 100% cpu activity. After a suggestion by Kristian Sandberg
1067 <Kristian.Sandberg@colorado.edu>.
1082 <Kristian.Sandberg@colorado.edu>.
1068 (Magic.__init__): fix bug in global magic escapes not being
1083 (Magic.__init__): fix bug in global magic escapes not being
1069 correctly set.
1084 correctly set.
1070
1085
1071 2004-10-08 Fernando Perez <fperez@colorado.edu>
1086 2004-10-08 Fernando Perez <fperez@colorado.edu>
1072
1087
1073 * IPython/Magic.py (__license__): change to absolute imports of
1088 * IPython/Magic.py (__license__): change to absolute imports of
1074 ipython's own internal packages, to start adapting to the absolute
1089 ipython's own internal packages, to start adapting to the absolute
1075 import requirement of PEP-328.
1090 import requirement of PEP-328.
1076
1091
1077 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
1092 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
1078 files, and standardize author/license marks through the Release
1093 files, and standardize author/license marks through the Release
1079 module instead of having per/file stuff (except for files with
1094 module instead of having per/file stuff (except for files with
1080 particular licenses, like the MIT/PSF-licensed codes).
1095 particular licenses, like the MIT/PSF-licensed codes).
1081
1096
1082 * IPython/Debugger.py: remove dead code for python 2.1
1097 * IPython/Debugger.py: remove dead code for python 2.1
1083
1098
1084 2004-10-04 Fernando Perez <fperez@colorado.edu>
1099 2004-10-04 Fernando Perez <fperez@colorado.edu>
1085
1100
1086 * IPython/iplib.py (ipmagic): New function for accessing magics
1101 * IPython/iplib.py (ipmagic): New function for accessing magics
1087 via a normal python function call.
1102 via a normal python function call.
1088
1103
1089 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
1104 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
1090 from '@' to '%', to accomodate the new @decorator syntax of python
1105 from '@' to '%', to accomodate the new @decorator syntax of python
1091 2.4.
1106 2.4.
1092
1107
1093 2004-09-29 Fernando Perez <fperez@colorado.edu>
1108 2004-09-29 Fernando Perez <fperez@colorado.edu>
1094
1109
1095 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
1110 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
1096 matplotlib.use to prevent running scripts which try to switch
1111 matplotlib.use to prevent running scripts which try to switch
1097 interactive backends from within ipython. This will just crash
1112 interactive backends from within ipython. This will just crash
1098 the python interpreter, so we can't allow it (but a detailed error
1113 the python interpreter, so we can't allow it (but a detailed error
1099 is given to the user).
1114 is given to the user).
1100
1115
1101 2004-09-28 Fernando Perez <fperez@colorado.edu>
1116 2004-09-28 Fernando Perez <fperez@colorado.edu>
1102
1117
1103 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1118 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1104 matplotlib-related fixes so that using @run with non-matplotlib
1119 matplotlib-related fixes so that using @run with non-matplotlib
1105 scripts doesn't pop up spurious plot windows. This requires
1120 scripts doesn't pop up spurious plot windows. This requires
1106 matplotlib >= 0.63, where I had to make some changes as well.
1121 matplotlib >= 0.63, where I had to make some changes as well.
1107
1122
1108 * IPython/ipmaker.py (make_IPython): update version requirement to
1123 * IPython/ipmaker.py (make_IPython): update version requirement to
1109 python 2.2.
1124 python 2.2.
1110
1125
1111 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1126 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1112 banner arg for embedded customization.
1127 banner arg for embedded customization.
1113
1128
1114 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1129 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1115 explicit uses of __IP as the IPython's instance name. Now things
1130 explicit uses of __IP as the IPython's instance name. Now things
1116 are properly handled via the shell.name value. The actual code
1131 are properly handled via the shell.name value. The actual code
1117 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1132 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1118 is much better than before. I'll clean things completely when the
1133 is much better than before. I'll clean things completely when the
1119 magic stuff gets a real overhaul.
1134 magic stuff gets a real overhaul.
1120
1135
1121 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1136 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1122 minor changes to debian dir.
1137 minor changes to debian dir.
1123
1138
1124 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1139 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1125 pointer to the shell itself in the interactive namespace even when
1140 pointer to the shell itself in the interactive namespace even when
1126 a user-supplied dict is provided. This is needed for embedding
1141 a user-supplied dict is provided. This is needed for embedding
1127 purposes (found by tests with Michel Sanner).
1142 purposes (found by tests with Michel Sanner).
1128
1143
1129 2004-09-27 Fernando Perez <fperez@colorado.edu>
1144 2004-09-27 Fernando Perez <fperez@colorado.edu>
1130
1145
1131 * IPython/UserConfig/ipythonrc: remove []{} from
1146 * IPython/UserConfig/ipythonrc: remove []{} from
1132 readline_remove_delims, so that things like [modname.<TAB> do
1147 readline_remove_delims, so that things like [modname.<TAB> do
1133 proper completion. This disables [].TAB, but that's a less common
1148 proper completion. This disables [].TAB, but that's a less common
1134 case than module names in list comprehensions, for example.
1149 case than module names in list comprehensions, for example.
1135 Thanks to a report by Andrea Riciputi.
1150 Thanks to a report by Andrea Riciputi.
1136
1151
1137 2004-09-09 Fernando Perez <fperez@colorado.edu>
1152 2004-09-09 Fernando Perez <fperez@colorado.edu>
1138
1153
1139 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1154 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1140 blocking problems in win32 and osx. Fix by John.
1155 blocking problems in win32 and osx. Fix by John.
1141
1156
1142 2004-09-08 Fernando Perez <fperez@colorado.edu>
1157 2004-09-08 Fernando Perez <fperez@colorado.edu>
1143
1158
1144 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1159 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1145 for Win32 and OSX. Fix by John Hunter.
1160 for Win32 and OSX. Fix by John Hunter.
1146
1161
1147 2004-08-30 *** Released version 0.6.3
1162 2004-08-30 *** Released version 0.6.3
1148
1163
1149 2004-08-30 Fernando Perez <fperez@colorado.edu>
1164 2004-08-30 Fernando Perez <fperez@colorado.edu>
1150
1165
1151 * setup.py (isfile): Add manpages to list of dependent files to be
1166 * setup.py (isfile): Add manpages to list of dependent files to be
1152 updated.
1167 updated.
1153
1168
1154 2004-08-27 Fernando Perez <fperez@colorado.edu>
1169 2004-08-27 Fernando Perez <fperez@colorado.edu>
1155
1170
1156 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1171 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1157 for now. They don't really work with standalone WX/GTK code
1172 for now. They don't really work with standalone WX/GTK code
1158 (though matplotlib IS working fine with both of those backends).
1173 (though matplotlib IS working fine with both of those backends).
1159 This will neeed much more testing. I disabled most things with
1174 This will neeed much more testing. I disabled most things with
1160 comments, so turning it back on later should be pretty easy.
1175 comments, so turning it back on later should be pretty easy.
1161
1176
1162 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1177 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1163 autocalling of expressions like r'foo', by modifying the line
1178 autocalling of expressions like r'foo', by modifying the line
1164 split regexp. Closes
1179 split regexp. Closes
1165 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1180 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1166 Riley <ipythonbugs-AT-sabi.net>.
1181 Riley <ipythonbugs-AT-sabi.net>.
1167 (InteractiveShell.mainloop): honor --nobanner with banner
1182 (InteractiveShell.mainloop): honor --nobanner with banner
1168 extensions.
1183 extensions.
1169
1184
1170 * IPython/Shell.py: Significant refactoring of all classes, so
1185 * IPython/Shell.py: Significant refactoring of all classes, so
1171 that we can really support ALL matplotlib backends and threading
1186 that we can really support ALL matplotlib backends and threading
1172 models (John spotted a bug with Tk which required this). Now we
1187 models (John spotted a bug with Tk which required this). Now we
1173 should support single-threaded, WX-threads and GTK-threads, both
1188 should support single-threaded, WX-threads and GTK-threads, both
1174 for generic code and for matplotlib.
1189 for generic code and for matplotlib.
1175
1190
1176 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1191 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1177 -pylab, to simplify things for users. Will also remove the pylab
1192 -pylab, to simplify things for users. Will also remove the pylab
1178 profile, since now all of matplotlib configuration is directly
1193 profile, since now all of matplotlib configuration is directly
1179 handled here. This also reduces startup time.
1194 handled here. This also reduces startup time.
1180
1195
1181 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1196 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1182 shell wasn't being correctly called. Also in IPShellWX.
1197 shell wasn't being correctly called. Also in IPShellWX.
1183
1198
1184 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1199 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1185 fine-tune banner.
1200 fine-tune banner.
1186
1201
1187 * IPython/numutils.py (spike): Deprecate these spike functions,
1202 * IPython/numutils.py (spike): Deprecate these spike functions,
1188 delete (long deprecated) gnuplot_exec handler.
1203 delete (long deprecated) gnuplot_exec handler.
1189
1204
1190 2004-08-26 Fernando Perez <fperez@colorado.edu>
1205 2004-08-26 Fernando Perez <fperez@colorado.edu>
1191
1206
1192 * ipython.1: Update for threading options, plus some others which
1207 * ipython.1: Update for threading options, plus some others which
1193 were missing.
1208 were missing.
1194
1209
1195 * IPython/ipmaker.py (__call__): Added -wthread option for
1210 * IPython/ipmaker.py (__call__): Added -wthread option for
1196 wxpython thread handling. Make sure threading options are only
1211 wxpython thread handling. Make sure threading options are only
1197 valid at the command line.
1212 valid at the command line.
1198
1213
1199 * scripts/ipython: moved shell selection into a factory function
1214 * scripts/ipython: moved shell selection into a factory function
1200 in Shell.py, to keep the starter script to a minimum.
1215 in Shell.py, to keep the starter script to a minimum.
1201
1216
1202 2004-08-25 Fernando Perez <fperez@colorado.edu>
1217 2004-08-25 Fernando Perez <fperez@colorado.edu>
1203
1218
1204 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1219 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1205 John. Along with some recent changes he made to matplotlib, the
1220 John. Along with some recent changes he made to matplotlib, the
1206 next versions of both systems should work very well together.
1221 next versions of both systems should work very well together.
1207
1222
1208 2004-08-24 Fernando Perez <fperez@colorado.edu>
1223 2004-08-24 Fernando Perez <fperez@colorado.edu>
1209
1224
1210 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1225 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1211 tried to switch the profiling to using hotshot, but I'm getting
1226 tried to switch the profiling to using hotshot, but I'm getting
1212 strange errors from prof.runctx() there. I may be misreading the
1227 strange errors from prof.runctx() there. I may be misreading the
1213 docs, but it looks weird. For now the profiling code will
1228 docs, but it looks weird. For now the profiling code will
1214 continue to use the standard profiler.
1229 continue to use the standard profiler.
1215
1230
1216 2004-08-23 Fernando Perez <fperez@colorado.edu>
1231 2004-08-23 Fernando Perez <fperez@colorado.edu>
1217
1232
1218 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1233 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1219 threaded shell, by John Hunter. It's not quite ready yet, but
1234 threaded shell, by John Hunter. It's not quite ready yet, but
1220 close.
1235 close.
1221
1236
1222 2004-08-22 Fernando Perez <fperez@colorado.edu>
1237 2004-08-22 Fernando Perez <fperez@colorado.edu>
1223
1238
1224 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1239 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1225 in Magic and ultraTB.
1240 in Magic and ultraTB.
1226
1241
1227 * ipython.1: document threading options in manpage.
1242 * ipython.1: document threading options in manpage.
1228
1243
1229 * scripts/ipython: Changed name of -thread option to -gthread,
1244 * scripts/ipython: Changed name of -thread option to -gthread,
1230 since this is GTK specific. I want to leave the door open for a
1245 since this is GTK specific. I want to leave the door open for a
1231 -wthread option for WX, which will most likely be necessary. This
1246 -wthread option for WX, which will most likely be necessary. This
1232 change affects usage and ipmaker as well.
1247 change affects usage and ipmaker as well.
1233
1248
1234 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1249 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1235 handle the matplotlib shell issues. Code by John Hunter
1250 handle the matplotlib shell issues. Code by John Hunter
1236 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1251 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1237 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1252 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1238 broken (and disabled for end users) for now, but it puts the
1253 broken (and disabled for end users) for now, but it puts the
1239 infrastructure in place.
1254 infrastructure in place.
1240
1255
1241 2004-08-21 Fernando Perez <fperez@colorado.edu>
1256 2004-08-21 Fernando Perez <fperez@colorado.edu>
1242
1257
1243 * ipythonrc-pylab: Add matplotlib support.
1258 * ipythonrc-pylab: Add matplotlib support.
1244
1259
1245 * matplotlib_config.py: new files for matplotlib support, part of
1260 * matplotlib_config.py: new files for matplotlib support, part of
1246 the pylab profile.
1261 the pylab profile.
1247
1262
1248 * IPython/usage.py (__doc__): documented the threading options.
1263 * IPython/usage.py (__doc__): documented the threading options.
1249
1264
1250 2004-08-20 Fernando Perez <fperez@colorado.edu>
1265 2004-08-20 Fernando Perez <fperez@colorado.edu>
1251
1266
1252 * ipython: Modified the main calling routine to handle the -thread
1267 * ipython: Modified the main calling routine to handle the -thread
1253 and -mpthread options. This needs to be done as a top-level hack,
1268 and -mpthread options. This needs to be done as a top-level hack,
1254 because it determines which class to instantiate for IPython
1269 because it determines which class to instantiate for IPython
1255 itself.
1270 itself.
1256
1271
1257 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1272 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1258 classes to support multithreaded GTK operation without blocking,
1273 classes to support multithreaded GTK operation without blocking,
1259 and matplotlib with all backends. This is a lot of still very
1274 and matplotlib with all backends. This is a lot of still very
1260 experimental code, and threads are tricky. So it may still have a
1275 experimental code, and threads are tricky. So it may still have a
1261 few rough edges... This code owes a lot to
1276 few rough edges... This code owes a lot to
1262 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1277 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1263 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1278 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1264 to John Hunter for all the matplotlib work.
1279 to John Hunter for all the matplotlib work.
1265
1280
1266 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1281 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1267 options for gtk thread and matplotlib support.
1282 options for gtk thread and matplotlib support.
1268
1283
1269 2004-08-16 Fernando Perez <fperez@colorado.edu>
1284 2004-08-16 Fernando Perez <fperez@colorado.edu>
1270
1285
1271 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1286 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1272 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1287 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1273 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1288 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1274
1289
1275 2004-08-11 Fernando Perez <fperez@colorado.edu>
1290 2004-08-11 Fernando Perez <fperez@colorado.edu>
1276
1291
1277 * setup.py (isfile): Fix build so documentation gets updated for
1292 * setup.py (isfile): Fix build so documentation gets updated for
1278 rpms (it was only done for .tgz builds).
1293 rpms (it was only done for .tgz builds).
1279
1294
1280 2004-08-10 Fernando Perez <fperez@colorado.edu>
1295 2004-08-10 Fernando Perez <fperez@colorado.edu>
1281
1296
1282 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1297 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1283
1298
1284 * iplib.py : Silence syntax error exceptions in tab-completion.
1299 * iplib.py : Silence syntax error exceptions in tab-completion.
1285
1300
1286 2004-08-05 Fernando Perez <fperez@colorado.edu>
1301 2004-08-05 Fernando Perez <fperez@colorado.edu>
1287
1302
1288 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1303 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1289 'color off' mark for continuation prompts. This was causing long
1304 'color off' mark for continuation prompts. This was causing long
1290 continuation lines to mis-wrap.
1305 continuation lines to mis-wrap.
1291
1306
1292 2004-08-01 Fernando Perez <fperez@colorado.edu>
1307 2004-08-01 Fernando Perez <fperez@colorado.edu>
1293
1308
1294 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1309 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1295 for building ipython to be a parameter. All this is necessary
1310 for building ipython to be a parameter. All this is necessary
1296 right now to have a multithreaded version, but this insane
1311 right now to have a multithreaded version, but this insane
1297 non-design will be cleaned up soon. For now, it's a hack that
1312 non-design will be cleaned up soon. For now, it's a hack that
1298 works.
1313 works.
1299
1314
1300 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1315 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1301 args in various places. No bugs so far, but it's a dangerous
1316 args in various places. No bugs so far, but it's a dangerous
1302 practice.
1317 practice.
1303
1318
1304 2004-07-31 Fernando Perez <fperez@colorado.edu>
1319 2004-07-31 Fernando Perez <fperez@colorado.edu>
1305
1320
1306 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1321 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1307 fix completion of files with dots in their names under most
1322 fix completion of files with dots in their names under most
1308 profiles (pysh was OK because the completion order is different).
1323 profiles (pysh was OK because the completion order is different).
1309
1324
1310 2004-07-27 Fernando Perez <fperez@colorado.edu>
1325 2004-07-27 Fernando Perez <fperez@colorado.edu>
1311
1326
1312 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1327 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1313 keywords manually, b/c the one in keyword.py was removed in python
1328 keywords manually, b/c the one in keyword.py was removed in python
1314 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1329 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1315 This is NOT a bug under python 2.3 and earlier.
1330 This is NOT a bug under python 2.3 and earlier.
1316
1331
1317 2004-07-26 Fernando Perez <fperez@colorado.edu>
1332 2004-07-26 Fernando Perez <fperez@colorado.edu>
1318
1333
1319 * IPython/ultraTB.py (VerboseTB.text): Add another
1334 * IPython/ultraTB.py (VerboseTB.text): Add another
1320 linecache.checkcache() call to try to prevent inspect.py from
1335 linecache.checkcache() call to try to prevent inspect.py from
1321 crashing under python 2.3. I think this fixes
1336 crashing under python 2.3. I think this fixes
1322 http://www.scipy.net/roundup/ipython/issue17.
1337 http://www.scipy.net/roundup/ipython/issue17.
1323
1338
1324 2004-07-26 *** Released version 0.6.2
1339 2004-07-26 *** Released version 0.6.2
1325
1340
1326 2004-07-26 Fernando Perez <fperez@colorado.edu>
1341 2004-07-26 Fernando Perez <fperez@colorado.edu>
1327
1342
1328 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1343 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1329 fail for any number.
1344 fail for any number.
1330 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1345 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1331 empty bookmarks.
1346 empty bookmarks.
1332
1347
1333 2004-07-26 *** Released version 0.6.1
1348 2004-07-26 *** Released version 0.6.1
1334
1349
1335 2004-07-26 Fernando Perez <fperez@colorado.edu>
1350 2004-07-26 Fernando Perez <fperez@colorado.edu>
1336
1351
1337 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1352 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1338
1353
1339 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1354 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1340 escaping '()[]{}' in filenames.
1355 escaping '()[]{}' in filenames.
1341
1356
1342 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1357 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1343 Python 2.2 users who lack a proper shlex.split.
1358 Python 2.2 users who lack a proper shlex.split.
1344
1359
1345 2004-07-19 Fernando Perez <fperez@colorado.edu>
1360 2004-07-19 Fernando Perez <fperez@colorado.edu>
1346
1361
1347 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1362 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1348 for reading readline's init file. I follow the normal chain:
1363 for reading readline's init file. I follow the normal chain:
1349 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1364 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1350 report by Mike Heeter. This closes
1365 report by Mike Heeter. This closes
1351 http://www.scipy.net/roundup/ipython/issue16.
1366 http://www.scipy.net/roundup/ipython/issue16.
1352
1367
1353 2004-07-18 Fernando Perez <fperez@colorado.edu>
1368 2004-07-18 Fernando Perez <fperez@colorado.edu>
1354
1369
1355 * IPython/iplib.py (__init__): Add better handling of '\' under
1370 * IPython/iplib.py (__init__): Add better handling of '\' under
1356 Win32 for filenames. After a patch by Ville.
1371 Win32 for filenames. After a patch by Ville.
1357
1372
1358 2004-07-17 Fernando Perez <fperez@colorado.edu>
1373 2004-07-17 Fernando Perez <fperez@colorado.edu>
1359
1374
1360 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1375 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1361 autocalling would be triggered for 'foo is bar' if foo is
1376 autocalling would be triggered for 'foo is bar' if foo is
1362 callable. I also cleaned up the autocall detection code to use a
1377 callable. I also cleaned up the autocall detection code to use a
1363 regexp, which is faster. Bug reported by Alexander Schmolck.
1378 regexp, which is faster. Bug reported by Alexander Schmolck.
1364
1379
1365 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1380 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1366 '?' in them would confuse the help system. Reported by Alex
1381 '?' in them would confuse the help system. Reported by Alex
1367 Schmolck.
1382 Schmolck.
1368
1383
1369 2004-07-16 Fernando Perez <fperez@colorado.edu>
1384 2004-07-16 Fernando Perez <fperez@colorado.edu>
1370
1385
1371 * IPython/GnuplotInteractive.py (__all__): added plot2.
1386 * IPython/GnuplotInteractive.py (__all__): added plot2.
1372
1387
1373 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1388 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1374 plotting dictionaries, lists or tuples of 1d arrays.
1389 plotting dictionaries, lists or tuples of 1d arrays.
1375
1390
1376 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1391 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1377 optimizations.
1392 optimizations.
1378
1393
1379 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1394 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1380 the information which was there from Janko's original IPP code:
1395 the information which was there from Janko's original IPP code:
1381
1396
1382 03.05.99 20:53 porto.ifm.uni-kiel.de
1397 03.05.99 20:53 porto.ifm.uni-kiel.de
1383 --Started changelog.
1398 --Started changelog.
1384 --make clear do what it say it does
1399 --make clear do what it say it does
1385 --added pretty output of lines from inputcache
1400 --added pretty output of lines from inputcache
1386 --Made Logger a mixin class, simplifies handling of switches
1401 --Made Logger a mixin class, simplifies handling of switches
1387 --Added own completer class. .string<TAB> expands to last history
1402 --Added own completer class. .string<TAB> expands to last history
1388 line which starts with string. The new expansion is also present
1403 line which starts with string. The new expansion is also present
1389 with Ctrl-r from the readline library. But this shows, who this
1404 with Ctrl-r from the readline library. But this shows, who this
1390 can be done for other cases.
1405 can be done for other cases.
1391 --Added convention that all shell functions should accept a
1406 --Added convention that all shell functions should accept a
1392 parameter_string This opens the door for different behaviour for
1407 parameter_string This opens the door for different behaviour for
1393 each function. @cd is a good example of this.
1408 each function. @cd is a good example of this.
1394
1409
1395 04.05.99 12:12 porto.ifm.uni-kiel.de
1410 04.05.99 12:12 porto.ifm.uni-kiel.de
1396 --added logfile rotation
1411 --added logfile rotation
1397 --added new mainloop method which freezes first the namespace
1412 --added new mainloop method which freezes first the namespace
1398
1413
1399 07.05.99 21:24 porto.ifm.uni-kiel.de
1414 07.05.99 21:24 porto.ifm.uni-kiel.de
1400 --added the docreader classes. Now there is a help system.
1415 --added the docreader classes. Now there is a help system.
1401 -This is only a first try. Currently it's not easy to put new
1416 -This is only a first try. Currently it's not easy to put new
1402 stuff in the indices. But this is the way to go. Info would be
1417 stuff in the indices. But this is the way to go. Info would be
1403 better, but HTML is every where and not everybody has an info
1418 better, but HTML is every where and not everybody has an info
1404 system installed and it's not so easy to change html-docs to info.
1419 system installed and it's not so easy to change html-docs to info.
1405 --added global logfile option
1420 --added global logfile option
1406 --there is now a hook for object inspection method pinfo needs to
1421 --there is now a hook for object inspection method pinfo needs to
1407 be provided for this. Can be reached by two '??'.
1422 be provided for this. Can be reached by two '??'.
1408
1423
1409 08.05.99 20:51 porto.ifm.uni-kiel.de
1424 08.05.99 20:51 porto.ifm.uni-kiel.de
1410 --added a README
1425 --added a README
1411 --bug in rc file. Something has changed so functions in the rc
1426 --bug in rc file. Something has changed so functions in the rc
1412 file need to reference the shell and not self. Not clear if it's a
1427 file need to reference the shell and not self. Not clear if it's a
1413 bug or feature.
1428 bug or feature.
1414 --changed rc file for new behavior
1429 --changed rc file for new behavior
1415
1430
1416 2004-07-15 Fernando Perez <fperez@colorado.edu>
1431 2004-07-15 Fernando Perez <fperez@colorado.edu>
1417
1432
1418 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1433 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1419 cache was falling out of sync in bizarre manners when multi-line
1434 cache was falling out of sync in bizarre manners when multi-line
1420 input was present. Minor optimizations and cleanup.
1435 input was present. Minor optimizations and cleanup.
1421
1436
1422 (Logger): Remove old Changelog info for cleanup. This is the
1437 (Logger): Remove old Changelog info for cleanup. This is the
1423 information which was there from Janko's original code:
1438 information which was there from Janko's original code:
1424
1439
1425 Changes to Logger: - made the default log filename a parameter
1440 Changes to Logger: - made the default log filename a parameter
1426
1441
1427 - put a check for lines beginning with !@? in log(). Needed
1442 - put a check for lines beginning with !@? in log(). Needed
1428 (even if the handlers properly log their lines) for mid-session
1443 (even if the handlers properly log their lines) for mid-session
1429 logging activation to work properly. Without this, lines logged
1444 logging activation to work properly. Without this, lines logged
1430 in mid session, which get read from the cache, would end up
1445 in mid session, which get read from the cache, would end up
1431 'bare' (with !@? in the open) in the log. Now they are caught
1446 'bare' (with !@? in the open) in the log. Now they are caught
1432 and prepended with a #.
1447 and prepended with a #.
1433
1448
1434 * IPython/iplib.py (InteractiveShell.init_readline): added check
1449 * IPython/iplib.py (InteractiveShell.init_readline): added check
1435 in case MagicCompleter fails to be defined, so we don't crash.
1450 in case MagicCompleter fails to be defined, so we don't crash.
1436
1451
1437 2004-07-13 Fernando Perez <fperez@colorado.edu>
1452 2004-07-13 Fernando Perez <fperez@colorado.edu>
1438
1453
1439 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1454 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1440 of EPS if the requested filename ends in '.eps'.
1455 of EPS if the requested filename ends in '.eps'.
1441
1456
1442 2004-07-04 Fernando Perez <fperez@colorado.edu>
1457 2004-07-04 Fernando Perez <fperez@colorado.edu>
1443
1458
1444 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1459 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1445 escaping of quotes when calling the shell.
1460 escaping of quotes when calling the shell.
1446
1461
1447 2004-07-02 Fernando Perez <fperez@colorado.edu>
1462 2004-07-02 Fernando Perez <fperez@colorado.edu>
1448
1463
1449 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1464 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1450 gettext not working because we were clobbering '_'. Fixes
1465 gettext not working because we were clobbering '_'. Fixes
1451 http://www.scipy.net/roundup/ipython/issue6.
1466 http://www.scipy.net/roundup/ipython/issue6.
1452
1467
1453 2004-07-01 Fernando Perez <fperez@colorado.edu>
1468 2004-07-01 Fernando Perez <fperez@colorado.edu>
1454
1469
1455 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1470 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1456 into @cd. Patch by Ville.
1471 into @cd. Patch by Ville.
1457
1472
1458 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1473 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1459 new function to store things after ipmaker runs. Patch by Ville.
1474 new function to store things after ipmaker runs. Patch by Ville.
1460 Eventually this will go away once ipmaker is removed and the class
1475 Eventually this will go away once ipmaker is removed and the class
1461 gets cleaned up, but for now it's ok. Key functionality here is
1476 gets cleaned up, but for now it's ok. Key functionality here is
1462 the addition of the persistent storage mechanism, a dict for
1477 the addition of the persistent storage mechanism, a dict for
1463 keeping data across sessions (for now just bookmarks, but more can
1478 keeping data across sessions (for now just bookmarks, but more can
1464 be implemented later).
1479 be implemented later).
1465
1480
1466 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1481 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1467 persistent across sections. Patch by Ville, I modified it
1482 persistent across sections. Patch by Ville, I modified it
1468 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1483 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1469 added a '-l' option to list all bookmarks.
1484 added a '-l' option to list all bookmarks.
1470
1485
1471 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1486 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1472 center for cleanup. Registered with atexit.register(). I moved
1487 center for cleanup. Registered with atexit.register(). I moved
1473 here the old exit_cleanup(). After a patch by Ville.
1488 here the old exit_cleanup(). After a patch by Ville.
1474
1489
1475 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1490 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1476 characters in the hacked shlex_split for python 2.2.
1491 characters in the hacked shlex_split for python 2.2.
1477
1492
1478 * IPython/iplib.py (file_matches): more fixes to filenames with
1493 * IPython/iplib.py (file_matches): more fixes to filenames with
1479 whitespace in them. It's not perfect, but limitations in python's
1494 whitespace in them. It's not perfect, but limitations in python's
1480 readline make it impossible to go further.
1495 readline make it impossible to go further.
1481
1496
1482 2004-06-29 Fernando Perez <fperez@colorado.edu>
1497 2004-06-29 Fernando Perez <fperez@colorado.edu>
1483
1498
1484 * IPython/iplib.py (file_matches): escape whitespace correctly in
1499 * IPython/iplib.py (file_matches): escape whitespace correctly in
1485 filename completions. Bug reported by Ville.
1500 filename completions. Bug reported by Ville.
1486
1501
1487 2004-06-28 Fernando Perez <fperez@colorado.edu>
1502 2004-06-28 Fernando Perez <fperez@colorado.edu>
1488
1503
1489 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1504 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1490 the history file will be called 'history-PROFNAME' (or just
1505 the history file will be called 'history-PROFNAME' (or just
1491 'history' if no profile is loaded). I was getting annoyed at
1506 'history' if no profile is loaded). I was getting annoyed at
1492 getting my Numerical work history clobbered by pysh sessions.
1507 getting my Numerical work history clobbered by pysh sessions.
1493
1508
1494 * IPython/iplib.py (InteractiveShell.__init__): Internal
1509 * IPython/iplib.py (InteractiveShell.__init__): Internal
1495 getoutputerror() function so that we can honor the system_verbose
1510 getoutputerror() function so that we can honor the system_verbose
1496 flag for _all_ system calls. I also added escaping of #
1511 flag for _all_ system calls. I also added escaping of #
1497 characters here to avoid confusing Itpl.
1512 characters here to avoid confusing Itpl.
1498
1513
1499 * IPython/Magic.py (shlex_split): removed call to shell in
1514 * IPython/Magic.py (shlex_split): removed call to shell in
1500 parse_options and replaced it with shlex.split(). The annoying
1515 parse_options and replaced it with shlex.split(). The annoying
1501 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1516 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1502 to backport it from 2.3, with several frail hacks (the shlex
1517 to backport it from 2.3, with several frail hacks (the shlex
1503 module is rather limited in 2.2). Thanks to a suggestion by Ville
1518 module is rather limited in 2.2). Thanks to a suggestion by Ville
1504 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1519 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1505 problem.
1520 problem.
1506
1521
1507 (Magic.magic_system_verbose): new toggle to print the actual
1522 (Magic.magic_system_verbose): new toggle to print the actual
1508 system calls made by ipython. Mainly for debugging purposes.
1523 system calls made by ipython. Mainly for debugging purposes.
1509
1524
1510 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1525 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1511 doesn't support persistence. Reported (and fix suggested) by
1526 doesn't support persistence. Reported (and fix suggested) by
1512 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1527 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1513
1528
1514 2004-06-26 Fernando Perez <fperez@colorado.edu>
1529 2004-06-26 Fernando Perez <fperez@colorado.edu>
1515
1530
1516 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1531 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1517 continue prompts.
1532 continue prompts.
1518
1533
1519 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1534 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1520 function (basically a big docstring) and a few more things here to
1535 function (basically a big docstring) and a few more things here to
1521 speedup startup. pysh.py is now very lightweight. We want because
1536 speedup startup. pysh.py is now very lightweight. We want because
1522 it gets execfile'd, while InterpreterExec gets imported, so
1537 it gets execfile'd, while InterpreterExec gets imported, so
1523 byte-compilation saves time.
1538 byte-compilation saves time.
1524
1539
1525 2004-06-25 Fernando Perez <fperez@colorado.edu>
1540 2004-06-25 Fernando Perez <fperez@colorado.edu>
1526
1541
1527 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1542 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1528 -NUM', which was recently broken.
1543 -NUM', which was recently broken.
1529
1544
1530 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1545 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1531 in multi-line input (but not !!, which doesn't make sense there).
1546 in multi-line input (but not !!, which doesn't make sense there).
1532
1547
1533 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1548 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1534 It's just too useful, and people can turn it off in the less
1549 It's just too useful, and people can turn it off in the less
1535 common cases where it's a problem.
1550 common cases where it's a problem.
1536
1551
1537 2004-06-24 Fernando Perez <fperez@colorado.edu>
1552 2004-06-24 Fernando Perez <fperez@colorado.edu>
1538
1553
1539 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1554 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1540 special syntaxes (like alias calling) is now allied in multi-line
1555 special syntaxes (like alias calling) is now allied in multi-line
1541 input. This is still _very_ experimental, but it's necessary for
1556 input. This is still _very_ experimental, but it's necessary for
1542 efficient shell usage combining python looping syntax with system
1557 efficient shell usage combining python looping syntax with system
1543 calls. For now it's restricted to aliases, I don't think it
1558 calls. For now it's restricted to aliases, I don't think it
1544 really even makes sense to have this for magics.
1559 really even makes sense to have this for magics.
1545
1560
1546 2004-06-23 Fernando Perez <fperez@colorado.edu>
1561 2004-06-23 Fernando Perez <fperez@colorado.edu>
1547
1562
1548 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1563 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1549 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1564 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1550
1565
1551 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1566 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1552 extensions under Windows (after code sent by Gary Bishop). The
1567 extensions under Windows (after code sent by Gary Bishop). The
1553 extensions considered 'executable' are stored in IPython's rc
1568 extensions considered 'executable' are stored in IPython's rc
1554 structure as win_exec_ext.
1569 structure as win_exec_ext.
1555
1570
1556 * IPython/genutils.py (shell): new function, like system() but
1571 * IPython/genutils.py (shell): new function, like system() but
1557 without return value. Very useful for interactive shell work.
1572 without return value. Very useful for interactive shell work.
1558
1573
1559 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1574 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1560 delete aliases.
1575 delete aliases.
1561
1576
1562 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1577 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1563 sure that the alias table doesn't contain python keywords.
1578 sure that the alias table doesn't contain python keywords.
1564
1579
1565 2004-06-21 Fernando Perez <fperez@colorado.edu>
1580 2004-06-21 Fernando Perez <fperez@colorado.edu>
1566
1581
1567 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1582 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1568 non-existent items are found in $PATH. Reported by Thorsten.
1583 non-existent items are found in $PATH. Reported by Thorsten.
1569
1584
1570 2004-06-20 Fernando Perez <fperez@colorado.edu>
1585 2004-06-20 Fernando Perez <fperez@colorado.edu>
1571
1586
1572 * IPython/iplib.py (complete): modified the completer so that the
1587 * IPython/iplib.py (complete): modified the completer so that the
1573 order of priorities can be easily changed at runtime.
1588 order of priorities can be easily changed at runtime.
1574
1589
1575 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1590 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1576 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1591 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1577
1592
1578 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1593 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1579 expand Python variables prepended with $ in all system calls. The
1594 expand Python variables prepended with $ in all system calls. The
1580 same was done to InteractiveShell.handle_shell_escape. Now all
1595 same was done to InteractiveShell.handle_shell_escape. Now all
1581 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1596 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1582 expansion of python variables and expressions according to the
1597 expansion of python variables and expressions according to the
1583 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1598 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1584
1599
1585 Though PEP-215 has been rejected, a similar (but simpler) one
1600 Though PEP-215 has been rejected, a similar (but simpler) one
1586 seems like it will go into Python 2.4, PEP-292 -
1601 seems like it will go into Python 2.4, PEP-292 -
1587 http://www.python.org/peps/pep-0292.html.
1602 http://www.python.org/peps/pep-0292.html.
1588
1603
1589 I'll keep the full syntax of PEP-215, since IPython has since the
1604 I'll keep the full syntax of PEP-215, since IPython has since the
1590 start used Ka-Ping Yee's reference implementation discussed there
1605 start used Ka-Ping Yee's reference implementation discussed there
1591 (Itpl), and I actually like the powerful semantics it offers.
1606 (Itpl), and I actually like the powerful semantics it offers.
1592
1607
1593 In order to access normal shell variables, the $ has to be escaped
1608 In order to access normal shell variables, the $ has to be escaped
1594 via an extra $. For example:
1609 via an extra $. For example:
1595
1610
1596 In [7]: PATH='a python variable'
1611 In [7]: PATH='a python variable'
1597
1612
1598 In [8]: !echo $PATH
1613 In [8]: !echo $PATH
1599 a python variable
1614 a python variable
1600
1615
1601 In [9]: !echo $$PATH
1616 In [9]: !echo $$PATH
1602 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1617 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1603
1618
1604 (Magic.parse_options): escape $ so the shell doesn't evaluate
1619 (Magic.parse_options): escape $ so the shell doesn't evaluate
1605 things prematurely.
1620 things prematurely.
1606
1621
1607 * IPython/iplib.py (InteractiveShell.call_alias): added the
1622 * IPython/iplib.py (InteractiveShell.call_alias): added the
1608 ability for aliases to expand python variables via $.
1623 ability for aliases to expand python variables via $.
1609
1624
1610 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1625 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1611 system, now there's a @rehash/@rehashx pair of magics. These work
1626 system, now there's a @rehash/@rehashx pair of magics. These work
1612 like the csh rehash command, and can be invoked at any time. They
1627 like the csh rehash command, and can be invoked at any time. They
1613 build a table of aliases to everything in the user's $PATH
1628 build a table of aliases to everything in the user's $PATH
1614 (@rehash uses everything, @rehashx is slower but only adds
1629 (@rehash uses everything, @rehashx is slower but only adds
1615 executable files). With this, the pysh.py-based shell profile can
1630 executable files). With this, the pysh.py-based shell profile can
1616 now simply call rehash upon startup, and full access to all
1631 now simply call rehash upon startup, and full access to all
1617 programs in the user's path is obtained.
1632 programs in the user's path is obtained.
1618
1633
1619 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1634 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1620 functionality is now fully in place. I removed the old dynamic
1635 functionality is now fully in place. I removed the old dynamic
1621 code generation based approach, in favor of a much lighter one
1636 code generation based approach, in favor of a much lighter one
1622 based on a simple dict. The advantage is that this allows me to
1637 based on a simple dict. The advantage is that this allows me to
1623 now have thousands of aliases with negligible cost (unthinkable
1638 now have thousands of aliases with negligible cost (unthinkable
1624 with the old system).
1639 with the old system).
1625
1640
1626 2004-06-19 Fernando Perez <fperez@colorado.edu>
1641 2004-06-19 Fernando Perez <fperez@colorado.edu>
1627
1642
1628 * IPython/iplib.py (__init__): extended MagicCompleter class to
1643 * IPython/iplib.py (__init__): extended MagicCompleter class to
1629 also complete (last in priority) on user aliases.
1644 also complete (last in priority) on user aliases.
1630
1645
1631 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1646 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1632 call to eval.
1647 call to eval.
1633 (ItplNS.__init__): Added a new class which functions like Itpl,
1648 (ItplNS.__init__): Added a new class which functions like Itpl,
1634 but allows configuring the namespace for the evaluation to occur
1649 but allows configuring the namespace for the evaluation to occur
1635 in.
1650 in.
1636
1651
1637 2004-06-18 Fernando Perez <fperez@colorado.edu>
1652 2004-06-18 Fernando Perez <fperez@colorado.edu>
1638
1653
1639 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1654 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1640 better message when 'exit' or 'quit' are typed (a common newbie
1655 better message when 'exit' or 'quit' are typed (a common newbie
1641 confusion).
1656 confusion).
1642
1657
1643 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1658 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1644 check for Windows users.
1659 check for Windows users.
1645
1660
1646 * IPython/iplib.py (InteractiveShell.user_setup): removed
1661 * IPython/iplib.py (InteractiveShell.user_setup): removed
1647 disabling of colors for Windows. I'll test at runtime and issue a
1662 disabling of colors for Windows. I'll test at runtime and issue a
1648 warning if Gary's readline isn't found, as to nudge users to
1663 warning if Gary's readline isn't found, as to nudge users to
1649 download it.
1664 download it.
1650
1665
1651 2004-06-16 Fernando Perez <fperez@colorado.edu>
1666 2004-06-16 Fernando Perez <fperez@colorado.edu>
1652
1667
1653 * IPython/genutils.py (Stream.__init__): changed to print errors
1668 * IPython/genutils.py (Stream.__init__): changed to print errors
1654 to sys.stderr. I had a circular dependency here. Now it's
1669 to sys.stderr. I had a circular dependency here. Now it's
1655 possible to run ipython as IDLE's shell (consider this pre-alpha,
1670 possible to run ipython as IDLE's shell (consider this pre-alpha,
1656 since true stdout things end up in the starting terminal instead
1671 since true stdout things end up in the starting terminal instead
1657 of IDLE's out).
1672 of IDLE's out).
1658
1673
1659 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1674 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1660 users who haven't # updated their prompt_in2 definitions. Remove
1675 users who haven't # updated their prompt_in2 definitions. Remove
1661 eventually.
1676 eventually.
1662 (multiple_replace): added credit to original ASPN recipe.
1677 (multiple_replace): added credit to original ASPN recipe.
1663
1678
1664 2004-06-15 Fernando Perez <fperez@colorado.edu>
1679 2004-06-15 Fernando Perez <fperez@colorado.edu>
1665
1680
1666 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1681 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1667 list of auto-defined aliases.
1682 list of auto-defined aliases.
1668
1683
1669 2004-06-13 Fernando Perez <fperez@colorado.edu>
1684 2004-06-13 Fernando Perez <fperez@colorado.edu>
1670
1685
1671 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1686 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1672 install was really requested (so setup.py can be used for other
1687 install was really requested (so setup.py can be used for other
1673 things under Windows).
1688 things under Windows).
1674
1689
1675 2004-06-10 Fernando Perez <fperez@colorado.edu>
1690 2004-06-10 Fernando Perez <fperez@colorado.edu>
1676
1691
1677 * IPython/Logger.py (Logger.create_log): Manually remove any old
1692 * IPython/Logger.py (Logger.create_log): Manually remove any old
1678 backup, since os.remove may fail under Windows. Fixes bug
1693 backup, since os.remove may fail under Windows. Fixes bug
1679 reported by Thorsten.
1694 reported by Thorsten.
1680
1695
1681 2004-06-09 Fernando Perez <fperez@colorado.edu>
1696 2004-06-09 Fernando Perez <fperez@colorado.edu>
1682
1697
1683 * examples/example-embed.py: fixed all references to %n (replaced
1698 * examples/example-embed.py: fixed all references to %n (replaced
1684 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1699 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1685 for all examples and the manual as well.
1700 for all examples and the manual as well.
1686
1701
1687 2004-06-08 Fernando Perez <fperez@colorado.edu>
1702 2004-06-08 Fernando Perez <fperez@colorado.edu>
1688
1703
1689 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1704 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1690 alignment and color management. All 3 prompt subsystems now
1705 alignment and color management. All 3 prompt subsystems now
1691 inherit from BasePrompt.
1706 inherit from BasePrompt.
1692
1707
1693 * tools/release: updates for windows installer build and tag rpms
1708 * tools/release: updates for windows installer build and tag rpms
1694 with python version (since paths are fixed).
1709 with python version (since paths are fixed).
1695
1710
1696 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1711 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1697 which will become eventually obsolete. Also fixed the default
1712 which will become eventually obsolete. Also fixed the default
1698 prompt_in2 to use \D, so at least new users start with the correct
1713 prompt_in2 to use \D, so at least new users start with the correct
1699 defaults.
1714 defaults.
1700 WARNING: Users with existing ipythonrc files will need to apply
1715 WARNING: Users with existing ipythonrc files will need to apply
1701 this fix manually!
1716 this fix manually!
1702
1717
1703 * setup.py: make windows installer (.exe). This is finally the
1718 * setup.py: make windows installer (.exe). This is finally the
1704 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1719 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1705 which I hadn't included because it required Python 2.3 (or recent
1720 which I hadn't included because it required Python 2.3 (or recent
1706 distutils).
1721 distutils).
1707
1722
1708 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1723 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1709 usage of new '\D' escape.
1724 usage of new '\D' escape.
1710
1725
1711 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1726 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1712 lacks os.getuid())
1727 lacks os.getuid())
1713 (CachedOutput.set_colors): Added the ability to turn coloring
1728 (CachedOutput.set_colors): Added the ability to turn coloring
1714 on/off with @colors even for manually defined prompt colors. It
1729 on/off with @colors even for manually defined prompt colors. It
1715 uses a nasty global, but it works safely and via the generic color
1730 uses a nasty global, but it works safely and via the generic color
1716 handling mechanism.
1731 handling mechanism.
1717 (Prompt2.__init__): Introduced new escape '\D' for continuation
1732 (Prompt2.__init__): Introduced new escape '\D' for continuation
1718 prompts. It represents the counter ('\#') as dots.
1733 prompts. It represents the counter ('\#') as dots.
1719 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1734 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1720 need to update their ipythonrc files and replace '%n' with '\D' in
1735 need to update their ipythonrc files and replace '%n' with '\D' in
1721 their prompt_in2 settings everywhere. Sorry, but there's
1736 their prompt_in2 settings everywhere. Sorry, but there's
1722 otherwise no clean way to get all prompts to properly align. The
1737 otherwise no clean way to get all prompts to properly align. The
1723 ipythonrc shipped with IPython has been updated.
1738 ipythonrc shipped with IPython has been updated.
1724
1739
1725 2004-06-07 Fernando Perez <fperez@colorado.edu>
1740 2004-06-07 Fernando Perez <fperez@colorado.edu>
1726
1741
1727 * setup.py (isfile): Pass local_icons option to latex2html, so the
1742 * setup.py (isfile): Pass local_icons option to latex2html, so the
1728 resulting HTML file is self-contained. Thanks to
1743 resulting HTML file is self-contained. Thanks to
1729 dryice-AT-liu.com.cn for the tip.
1744 dryice-AT-liu.com.cn for the tip.
1730
1745
1731 * pysh.py: I created a new profile 'shell', which implements a
1746 * pysh.py: I created a new profile 'shell', which implements a
1732 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1747 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1733 system shell, nor will it become one anytime soon. It's mainly
1748 system shell, nor will it become one anytime soon. It's mainly
1734 meant to illustrate the use of the new flexible bash-like prompts.
1749 meant to illustrate the use of the new flexible bash-like prompts.
1735 I guess it could be used by hardy souls for true shell management,
1750 I guess it could be used by hardy souls for true shell management,
1736 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
1751 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
1737 profile. This uses the InterpreterExec extension provided by
1752 profile. This uses the InterpreterExec extension provided by
1738 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
1753 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
1739
1754
1740 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
1755 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
1741 auto-align itself with the length of the previous input prompt
1756 auto-align itself with the length of the previous input prompt
1742 (taking into account the invisible color escapes).
1757 (taking into account the invisible color escapes).
1743 (CachedOutput.__init__): Large restructuring of this class. Now
1758 (CachedOutput.__init__): Large restructuring of this class. Now
1744 all three prompts (primary1, primary2, output) are proper objects,
1759 all three prompts (primary1, primary2, output) are proper objects,
1745 managed by the 'parent' CachedOutput class. The code is still a
1760 managed by the 'parent' CachedOutput class. The code is still a
1746 bit hackish (all prompts share state via a pointer to the cache),
1761 bit hackish (all prompts share state via a pointer to the cache),
1747 but it's overall far cleaner than before.
1762 but it's overall far cleaner than before.
1748
1763
1749 * IPython/genutils.py (getoutputerror): modified to add verbose,
1764 * IPython/genutils.py (getoutputerror): modified to add verbose,
1750 debug and header options. This makes the interface of all getout*
1765 debug and header options. This makes the interface of all getout*
1751 functions uniform.
1766 functions uniform.
1752 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
1767 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
1753
1768
1754 * IPython/Magic.py (Magic.default_option): added a function to
1769 * IPython/Magic.py (Magic.default_option): added a function to
1755 allow registering default options for any magic command. This
1770 allow registering default options for any magic command. This
1756 makes it easy to have profiles which customize the magics globally
1771 makes it easy to have profiles which customize the magics globally
1757 for a certain use. The values set through this function are
1772 for a certain use. The values set through this function are
1758 picked up by the parse_options() method, which all magics should
1773 picked up by the parse_options() method, which all magics should
1759 use to parse their options.
1774 use to parse their options.
1760
1775
1761 * IPython/genutils.py (warn): modified the warnings framework to
1776 * IPython/genutils.py (warn): modified the warnings framework to
1762 use the Term I/O class. I'm trying to slowly unify all of
1777 use the Term I/O class. I'm trying to slowly unify all of
1763 IPython's I/O operations to pass through Term.
1778 IPython's I/O operations to pass through Term.
1764
1779
1765 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
1780 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
1766 the secondary prompt to correctly match the length of the primary
1781 the secondary prompt to correctly match the length of the primary
1767 one for any prompt. Now multi-line code will properly line up
1782 one for any prompt. Now multi-line code will properly line up
1768 even for path dependent prompts, such as the new ones available
1783 even for path dependent prompts, such as the new ones available
1769 via the prompt_specials.
1784 via the prompt_specials.
1770
1785
1771 2004-06-06 Fernando Perez <fperez@colorado.edu>
1786 2004-06-06 Fernando Perez <fperez@colorado.edu>
1772
1787
1773 * IPython/Prompts.py (prompt_specials): Added the ability to have
1788 * IPython/Prompts.py (prompt_specials): Added the ability to have
1774 bash-like special sequences in the prompts, which get
1789 bash-like special sequences in the prompts, which get
1775 automatically expanded. Things like hostname, current working
1790 automatically expanded. Things like hostname, current working
1776 directory and username are implemented already, but it's easy to
1791 directory and username are implemented already, but it's easy to
1777 add more in the future. Thanks to a patch by W.J. van der Laan
1792 add more in the future. Thanks to a patch by W.J. van der Laan
1778 <gnufnork-AT-hetdigitalegat.nl>
1793 <gnufnork-AT-hetdigitalegat.nl>
1779 (prompt_specials): Added color support for prompt strings, so
1794 (prompt_specials): Added color support for prompt strings, so
1780 users can define arbitrary color setups for their prompts.
1795 users can define arbitrary color setups for their prompts.
1781
1796
1782 2004-06-05 Fernando Perez <fperez@colorado.edu>
1797 2004-06-05 Fernando Perez <fperez@colorado.edu>
1783
1798
1784 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
1799 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
1785 code to load Gary Bishop's readline and configure it
1800 code to load Gary Bishop's readline and configure it
1786 automatically. Thanks to Gary for help on this.
1801 automatically. Thanks to Gary for help on this.
1787
1802
1788 2004-06-01 Fernando Perez <fperez@colorado.edu>
1803 2004-06-01 Fernando Perez <fperez@colorado.edu>
1789
1804
1790 * IPython/Logger.py (Logger.create_log): fix bug for logging
1805 * IPython/Logger.py (Logger.create_log): fix bug for logging
1791 with no filename (previous fix was incomplete).
1806 with no filename (previous fix was incomplete).
1792
1807
1793 2004-05-25 Fernando Perez <fperez@colorado.edu>
1808 2004-05-25 Fernando Perez <fperez@colorado.edu>
1794
1809
1795 * IPython/Magic.py (Magic.parse_options): fix bug where naked
1810 * IPython/Magic.py (Magic.parse_options): fix bug where naked
1796 parens would get passed to the shell.
1811 parens would get passed to the shell.
1797
1812
1798 2004-05-20 Fernando Perez <fperez@colorado.edu>
1813 2004-05-20 Fernando Perez <fperez@colorado.edu>
1799
1814
1800 * IPython/Magic.py (Magic.magic_prun): changed default profile
1815 * IPython/Magic.py (Magic.magic_prun): changed default profile
1801 sort order to 'time' (the more common profiling need).
1816 sort order to 'time' (the more common profiling need).
1802
1817
1803 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
1818 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
1804 so that source code shown is guaranteed in sync with the file on
1819 so that source code shown is guaranteed in sync with the file on
1805 disk (also changed in psource). Similar fix to the one for
1820 disk (also changed in psource). Similar fix to the one for
1806 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
1821 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
1807 <yann.ledu-AT-noos.fr>.
1822 <yann.ledu-AT-noos.fr>.
1808
1823
1809 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
1824 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
1810 with a single option would not be correctly parsed. Closes
1825 with a single option would not be correctly parsed. Closes
1811 http://www.scipy.net/roundup/ipython/issue14. This bug had been
1826 http://www.scipy.net/roundup/ipython/issue14. This bug had been
1812 introduced in 0.6.0 (on 2004-05-06).
1827 introduced in 0.6.0 (on 2004-05-06).
1813
1828
1814 2004-05-13 *** Released version 0.6.0
1829 2004-05-13 *** Released version 0.6.0
1815
1830
1816 2004-05-13 Fernando Perez <fperez@colorado.edu>
1831 2004-05-13 Fernando Perez <fperez@colorado.edu>
1817
1832
1818 * debian/: Added debian/ directory to CVS, so that debian support
1833 * debian/: Added debian/ directory to CVS, so that debian support
1819 is publicly accessible. The debian package is maintained by Jack
1834 is publicly accessible. The debian package is maintained by Jack
1820 Moffit <jack-AT-xiph.org>.
1835 Moffit <jack-AT-xiph.org>.
1821
1836
1822 * Documentation: included the notes about an ipython-based system
1837 * Documentation: included the notes about an ipython-based system
1823 shell (the hypothetical 'pysh') into the new_design.pdf document,
1838 shell (the hypothetical 'pysh') into the new_design.pdf document,
1824 so that these ideas get distributed to users along with the
1839 so that these ideas get distributed to users along with the
1825 official documentation.
1840 official documentation.
1826
1841
1827 2004-05-10 Fernando Perez <fperez@colorado.edu>
1842 2004-05-10 Fernando Perez <fperez@colorado.edu>
1828
1843
1829 * IPython/Logger.py (Logger.create_log): fix recently introduced
1844 * IPython/Logger.py (Logger.create_log): fix recently introduced
1830 bug (misindented line) where logstart would fail when not given an
1845 bug (misindented line) where logstart would fail when not given an
1831 explicit filename.
1846 explicit filename.
1832
1847
1833 2004-05-09 Fernando Perez <fperez@colorado.edu>
1848 2004-05-09 Fernando Perez <fperez@colorado.edu>
1834
1849
1835 * IPython/Magic.py (Magic.parse_options): skip system call when
1850 * IPython/Magic.py (Magic.parse_options): skip system call when
1836 there are no options to look for. Faster, cleaner for the common
1851 there are no options to look for. Faster, cleaner for the common
1837 case.
1852 case.
1838
1853
1839 * Documentation: many updates to the manual: describing Windows
1854 * Documentation: many updates to the manual: describing Windows
1840 support better, Gnuplot updates, credits, misc small stuff. Also
1855 support better, Gnuplot updates, credits, misc small stuff. Also
1841 updated the new_design doc a bit.
1856 updated the new_design doc a bit.
1842
1857
1843 2004-05-06 *** Released version 0.6.0.rc1
1858 2004-05-06 *** Released version 0.6.0.rc1
1844
1859
1845 2004-05-06 Fernando Perez <fperez@colorado.edu>
1860 2004-05-06 Fernando Perez <fperez@colorado.edu>
1846
1861
1847 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
1862 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
1848 operations to use the vastly more efficient list/''.join() method.
1863 operations to use the vastly more efficient list/''.join() method.
1849 (FormattedTB.text): Fix
1864 (FormattedTB.text): Fix
1850 http://www.scipy.net/roundup/ipython/issue12 - exception source
1865 http://www.scipy.net/roundup/ipython/issue12 - exception source
1851 extract not updated after reload. Thanks to Mike Salib
1866 extract not updated after reload. Thanks to Mike Salib
1852 <msalib-AT-mit.edu> for pinning the source of the problem.
1867 <msalib-AT-mit.edu> for pinning the source of the problem.
1853 Fortunately, the solution works inside ipython and doesn't require
1868 Fortunately, the solution works inside ipython and doesn't require
1854 any changes to python proper.
1869 any changes to python proper.
1855
1870
1856 * IPython/Magic.py (Magic.parse_options): Improved to process the
1871 * IPython/Magic.py (Magic.parse_options): Improved to process the
1857 argument list as a true shell would (by actually using the
1872 argument list as a true shell would (by actually using the
1858 underlying system shell). This way, all @magics automatically get
1873 underlying system shell). This way, all @magics automatically get
1859 shell expansion for variables. Thanks to a comment by Alex
1874 shell expansion for variables. Thanks to a comment by Alex
1860 Schmolck.
1875 Schmolck.
1861
1876
1862 2004-04-04 Fernando Perez <fperez@colorado.edu>
1877 2004-04-04 Fernando Perez <fperez@colorado.edu>
1863
1878
1864 * IPython/iplib.py (InteractiveShell.interact): Added a special
1879 * IPython/iplib.py (InteractiveShell.interact): Added a special
1865 trap for a debugger quit exception, which is basically impossible
1880 trap for a debugger quit exception, which is basically impossible
1866 to handle by normal mechanisms, given what pdb does to the stack.
1881 to handle by normal mechanisms, given what pdb does to the stack.
1867 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
1882 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
1868
1883
1869 2004-04-03 Fernando Perez <fperez@colorado.edu>
1884 2004-04-03 Fernando Perez <fperez@colorado.edu>
1870
1885
1871 * IPython/genutils.py (Term): Standardized the names of the Term
1886 * IPython/genutils.py (Term): Standardized the names of the Term
1872 class streams to cin/cout/cerr, following C++ naming conventions
1887 class streams to cin/cout/cerr, following C++ naming conventions
1873 (I can't use in/out/err because 'in' is not a valid attribute
1888 (I can't use in/out/err because 'in' is not a valid attribute
1874 name).
1889 name).
1875
1890
1876 * IPython/iplib.py (InteractiveShell.interact): don't increment
1891 * IPython/iplib.py (InteractiveShell.interact): don't increment
1877 the prompt if there's no user input. By Daniel 'Dang' Griffith
1892 the prompt if there's no user input. By Daniel 'Dang' Griffith
1878 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
1893 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
1879 Francois Pinard.
1894 Francois Pinard.
1880
1895
1881 2004-04-02 Fernando Perez <fperez@colorado.edu>
1896 2004-04-02 Fernando Perez <fperez@colorado.edu>
1882
1897
1883 * IPython/genutils.py (Stream.__init__): Modified to survive at
1898 * IPython/genutils.py (Stream.__init__): Modified to survive at
1884 least importing in contexts where stdin/out/err aren't true file
1899 least importing in contexts where stdin/out/err aren't true file
1885 objects, such as PyCrust (they lack fileno() and mode). However,
1900 objects, such as PyCrust (they lack fileno() and mode). However,
1886 the recovery facilities which rely on these things existing will
1901 the recovery facilities which rely on these things existing will
1887 not work.
1902 not work.
1888
1903
1889 2004-04-01 Fernando Perez <fperez@colorado.edu>
1904 2004-04-01 Fernando Perez <fperez@colorado.edu>
1890
1905
1891 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
1906 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
1892 use the new getoutputerror() function, so it properly
1907 use the new getoutputerror() function, so it properly
1893 distinguishes stdout/err.
1908 distinguishes stdout/err.
1894
1909
1895 * IPython/genutils.py (getoutputerror): added a function to
1910 * IPython/genutils.py (getoutputerror): added a function to
1896 capture separately the standard output and error of a command.
1911 capture separately the standard output and error of a command.
1897 After a comment from dang on the mailing lists. This code is
1912 After a comment from dang on the mailing lists. This code is
1898 basically a modified version of commands.getstatusoutput(), from
1913 basically a modified version of commands.getstatusoutput(), from
1899 the standard library.
1914 the standard library.
1900
1915
1901 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
1916 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
1902 '!!' as a special syntax (shorthand) to access @sx.
1917 '!!' as a special syntax (shorthand) to access @sx.
1903
1918
1904 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
1919 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
1905 command and return its output as a list split on '\n'.
1920 command and return its output as a list split on '\n'.
1906
1921
1907 2004-03-31 Fernando Perez <fperez@colorado.edu>
1922 2004-03-31 Fernando Perez <fperez@colorado.edu>
1908
1923
1909 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
1924 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
1910 method to dictionaries used as FakeModule instances if they lack
1925 method to dictionaries used as FakeModule instances if they lack
1911 it. At least pydoc in python2.3 breaks for runtime-defined
1926 it. At least pydoc in python2.3 breaks for runtime-defined
1912 functions without this hack. At some point I need to _really_
1927 functions without this hack. At some point I need to _really_
1913 understand what FakeModule is doing, because it's a gross hack.
1928 understand what FakeModule is doing, because it's a gross hack.
1914 But it solves Arnd's problem for now...
1929 But it solves Arnd's problem for now...
1915
1930
1916 2004-02-27 Fernando Perez <fperez@colorado.edu>
1931 2004-02-27 Fernando Perez <fperez@colorado.edu>
1917
1932
1918 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
1933 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
1919 mode would behave erratically. Also increased the number of
1934 mode would behave erratically. Also increased the number of
1920 possible logs in rotate mod to 999. Thanks to Rod Holland
1935 possible logs in rotate mod to 999. Thanks to Rod Holland
1921 <rhh@StructureLABS.com> for the report and fixes.
1936 <rhh@StructureLABS.com> for the report and fixes.
1922
1937
1923 2004-02-26 Fernando Perez <fperez@colorado.edu>
1938 2004-02-26 Fernando Perez <fperez@colorado.edu>
1924
1939
1925 * IPython/genutils.py (page): Check that the curses module really
1940 * IPython/genutils.py (page): Check that the curses module really
1926 has the initscr attribute before trying to use it. For some
1941 has the initscr attribute before trying to use it. For some
1927 reason, the Solaris curses module is missing this. I think this
1942 reason, the Solaris curses module is missing this. I think this
1928 should be considered a Solaris python bug, but I'm not sure.
1943 should be considered a Solaris python bug, but I'm not sure.
1929
1944
1930 2004-01-17 Fernando Perez <fperez@colorado.edu>
1945 2004-01-17 Fernando Perez <fperez@colorado.edu>
1931
1946
1932 * IPython/genutils.py (Stream.__init__): Changes to try to make
1947 * IPython/genutils.py (Stream.__init__): Changes to try to make
1933 ipython robust against stdin/out/err being closed by the user.
1948 ipython robust against stdin/out/err being closed by the user.
1934 This is 'user error' (and blocks a normal python session, at least
1949 This is 'user error' (and blocks a normal python session, at least
1935 the stdout case). However, Ipython should be able to survive such
1950 the stdout case). However, Ipython should be able to survive such
1936 instances of abuse as gracefully as possible. To simplify the
1951 instances of abuse as gracefully as possible. To simplify the
1937 coding and maintain compatibility with Gary Bishop's Term
1952 coding and maintain compatibility with Gary Bishop's Term
1938 contributions, I've made use of classmethods for this. I think
1953 contributions, I've made use of classmethods for this. I think
1939 this introduces a dependency on python 2.2.
1954 this introduces a dependency on python 2.2.
1940
1955
1941 2004-01-13 Fernando Perez <fperez@colorado.edu>
1956 2004-01-13 Fernando Perez <fperez@colorado.edu>
1942
1957
1943 * IPython/numutils.py (exp_safe): simplified the code a bit and
1958 * IPython/numutils.py (exp_safe): simplified the code a bit and
1944 removed the need for importing the kinds module altogether.
1959 removed the need for importing the kinds module altogether.
1945
1960
1946 2004-01-06 Fernando Perez <fperez@colorado.edu>
1961 2004-01-06 Fernando Perez <fperez@colorado.edu>
1947
1962
1948 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
1963 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
1949 a magic function instead, after some community feedback. No
1964 a magic function instead, after some community feedback. No
1950 special syntax will exist for it, but its name is deliberately
1965 special syntax will exist for it, but its name is deliberately
1951 very short.
1966 very short.
1952
1967
1953 2003-12-20 Fernando Perez <fperez@colorado.edu>
1968 2003-12-20 Fernando Perez <fperez@colorado.edu>
1954
1969
1955 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
1970 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
1956 new functionality, to automagically assign the result of a shell
1971 new functionality, to automagically assign the result of a shell
1957 command to a variable. I'll solicit some community feedback on
1972 command to a variable. I'll solicit some community feedback on
1958 this before making it permanent.
1973 this before making it permanent.
1959
1974
1960 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
1975 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
1961 requested about callables for which inspect couldn't obtain a
1976 requested about callables for which inspect couldn't obtain a
1962 proper argspec. Thanks to a crash report sent by Etienne
1977 proper argspec. Thanks to a crash report sent by Etienne
1963 Posthumus <etienne-AT-apple01.cs.vu.nl>.
1978 Posthumus <etienne-AT-apple01.cs.vu.nl>.
1964
1979
1965 2003-12-09 Fernando Perez <fperez@colorado.edu>
1980 2003-12-09 Fernando Perez <fperez@colorado.edu>
1966
1981
1967 * IPython/genutils.py (page): patch for the pager to work across
1982 * IPython/genutils.py (page): patch for the pager to work across
1968 various versions of Windows. By Gary Bishop.
1983 various versions of Windows. By Gary Bishop.
1969
1984
1970 2003-12-04 Fernando Perez <fperez@colorado.edu>
1985 2003-12-04 Fernando Perez <fperez@colorado.edu>
1971
1986
1972 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
1987 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
1973 Gnuplot.py version 1.7, whose internal names changed quite a bit.
1988 Gnuplot.py version 1.7, whose internal names changed quite a bit.
1974 While I tested this and it looks ok, there may still be corner
1989 While I tested this and it looks ok, there may still be corner
1975 cases I've missed.
1990 cases I've missed.
1976
1991
1977 2003-12-01 Fernando Perez <fperez@colorado.edu>
1992 2003-12-01 Fernando Perez <fperez@colorado.edu>
1978
1993
1979 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
1994 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
1980 where a line like 'p,q=1,2' would fail because the automagic
1995 where a line like 'p,q=1,2' would fail because the automagic
1981 system would be triggered for @p.
1996 system would be triggered for @p.
1982
1997
1983 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
1998 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
1984 cleanups, code unmodified.
1999 cleanups, code unmodified.
1985
2000
1986 * IPython/genutils.py (Term): added a class for IPython to handle
2001 * IPython/genutils.py (Term): added a class for IPython to handle
1987 output. In most cases it will just be a proxy for stdout/err, but
2002 output. In most cases it will just be a proxy for stdout/err, but
1988 having this allows modifications to be made for some platforms,
2003 having this allows modifications to be made for some platforms,
1989 such as handling color escapes under Windows. All of this code
2004 such as handling color escapes under Windows. All of this code
1990 was contributed by Gary Bishop, with minor modifications by me.
2005 was contributed by Gary Bishop, with minor modifications by me.
1991 The actual changes affect many files.
2006 The actual changes affect many files.
1992
2007
1993 2003-11-30 Fernando Perez <fperez@colorado.edu>
2008 2003-11-30 Fernando Perez <fperez@colorado.edu>
1994
2009
1995 * IPython/iplib.py (file_matches): new completion code, courtesy
2010 * IPython/iplib.py (file_matches): new completion code, courtesy
1996 of Jeff Collins. This enables filename completion again under
2011 of Jeff Collins. This enables filename completion again under
1997 python 2.3, which disabled it at the C level.
2012 python 2.3, which disabled it at the C level.
1998
2013
1999 2003-11-11 Fernando Perez <fperez@colorado.edu>
2014 2003-11-11 Fernando Perez <fperez@colorado.edu>
2000
2015
2001 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2016 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2002 for Numeric.array(map(...)), but often convenient.
2017 for Numeric.array(map(...)), but often convenient.
2003
2018
2004 2003-11-05 Fernando Perez <fperez@colorado.edu>
2019 2003-11-05 Fernando Perez <fperez@colorado.edu>
2005
2020
2006 * IPython/numutils.py (frange): Changed a call from int() to
2021 * IPython/numutils.py (frange): Changed a call from int() to
2007 int(round()) to prevent a problem reported with arange() in the
2022 int(round()) to prevent a problem reported with arange() in the
2008 numpy list.
2023 numpy list.
2009
2024
2010 2003-10-06 Fernando Perez <fperez@colorado.edu>
2025 2003-10-06 Fernando Perez <fperez@colorado.edu>
2011
2026
2012 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2027 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2013 prevent crashes if sys lacks an argv attribute (it happens with
2028 prevent crashes if sys lacks an argv attribute (it happens with
2014 embedded interpreters which build a bare-bones sys module).
2029 embedded interpreters which build a bare-bones sys module).
2015 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2030 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2016
2031
2017 2003-09-24 Fernando Perez <fperez@colorado.edu>
2032 2003-09-24 Fernando Perez <fperez@colorado.edu>
2018
2033
2019 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2034 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2020 to protect against poorly written user objects where __getattr__
2035 to protect against poorly written user objects where __getattr__
2021 raises exceptions other than AttributeError. Thanks to a bug
2036 raises exceptions other than AttributeError. Thanks to a bug
2022 report by Oliver Sander <osander-AT-gmx.de>.
2037 report by Oliver Sander <osander-AT-gmx.de>.
2023
2038
2024 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2039 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2025 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2040 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2026
2041
2027 2003-09-09 Fernando Perez <fperez@colorado.edu>
2042 2003-09-09 Fernando Perez <fperez@colorado.edu>
2028
2043
2029 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2044 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2030 unpacking a list whith a callable as first element would
2045 unpacking a list whith a callable as first element would
2031 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2046 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2032 Collins.
2047 Collins.
2033
2048
2034 2003-08-25 *** Released version 0.5.0
2049 2003-08-25 *** Released version 0.5.0
2035
2050
2036 2003-08-22 Fernando Perez <fperez@colorado.edu>
2051 2003-08-22 Fernando Perez <fperez@colorado.edu>
2037
2052
2038 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2053 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2039 improperly defined user exceptions. Thanks to feedback from Mark
2054 improperly defined user exceptions. Thanks to feedback from Mark
2040 Russell <mrussell-AT-verio.net>.
2055 Russell <mrussell-AT-verio.net>.
2041
2056
2042 2003-08-20 Fernando Perez <fperez@colorado.edu>
2057 2003-08-20 Fernando Perez <fperez@colorado.edu>
2043
2058
2044 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2059 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2045 printing so that it would print multi-line string forms starting
2060 printing so that it would print multi-line string forms starting
2046 with a new line. This way the formatting is better respected for
2061 with a new line. This way the formatting is better respected for
2047 objects which work hard to make nice string forms.
2062 objects which work hard to make nice string forms.
2048
2063
2049 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2064 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2050 autocall would overtake data access for objects with both
2065 autocall would overtake data access for objects with both
2051 __getitem__ and __call__.
2066 __getitem__ and __call__.
2052
2067
2053 2003-08-19 *** Released version 0.5.0-rc1
2068 2003-08-19 *** Released version 0.5.0-rc1
2054
2069
2055 2003-08-19 Fernando Perez <fperez@colorado.edu>
2070 2003-08-19 Fernando Perez <fperez@colorado.edu>
2056
2071
2057 * IPython/deep_reload.py (load_tail): single tiny change here
2072 * IPython/deep_reload.py (load_tail): single tiny change here
2058 seems to fix the long-standing bug of dreload() failing to work
2073 seems to fix the long-standing bug of dreload() failing to work
2059 for dotted names. But this module is pretty tricky, so I may have
2074 for dotted names. But this module is pretty tricky, so I may have
2060 missed some subtlety. Needs more testing!.
2075 missed some subtlety. Needs more testing!.
2061
2076
2062 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2077 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2063 exceptions which have badly implemented __str__ methods.
2078 exceptions which have badly implemented __str__ methods.
2064 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2079 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2065 which I've been getting reports about from Python 2.3 users. I
2080 which I've been getting reports about from Python 2.3 users. I
2066 wish I had a simple test case to reproduce the problem, so I could
2081 wish I had a simple test case to reproduce the problem, so I could
2067 either write a cleaner workaround or file a bug report if
2082 either write a cleaner workaround or file a bug report if
2068 necessary.
2083 necessary.
2069
2084
2070 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2085 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2071 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2086 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2072 a bug report by Tjabo Kloppenburg.
2087 a bug report by Tjabo Kloppenburg.
2073
2088
2074 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
2089 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
2075 crashes. Wrapped the pdb call in a blanket try/except, since pdb
2090 crashes. Wrapped the pdb call in a blanket try/except, since pdb
2076 seems rather unstable. Thanks to a bug report by Tjabo
2091 seems rather unstable. Thanks to a bug report by Tjabo
2077 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
2092 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
2078
2093
2079 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
2094 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
2080 this out soon because of the critical fixes in the inner loop for
2095 this out soon because of the critical fixes in the inner loop for
2081 generators.
2096 generators.
2082
2097
2083 * IPython/Magic.py (Magic.getargspec): removed. This (and
2098 * IPython/Magic.py (Magic.getargspec): removed. This (and
2084 _get_def) have been obsoleted by OInspect for a long time, I
2099 _get_def) have been obsoleted by OInspect for a long time, I
2085 hadn't noticed that they were dead code.
2100 hadn't noticed that they were dead code.
2086 (Magic._ofind): restored _ofind functionality for a few literals
2101 (Magic._ofind): restored _ofind functionality for a few literals
2087 (those in ["''",'""','[]','{}','()']). But it won't work anymore
2102 (those in ["''",'""','[]','{}','()']). But it won't work anymore
2088 for things like "hello".capitalize?, since that would require a
2103 for things like "hello".capitalize?, since that would require a
2089 potentially dangerous eval() again.
2104 potentially dangerous eval() again.
2090
2105
2091 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
2106 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
2092 logic a bit more to clean up the escapes handling and minimize the
2107 logic a bit more to clean up the escapes handling and minimize the
2093 use of _ofind to only necessary cases. The interactive 'feel' of
2108 use of _ofind to only necessary cases. The interactive 'feel' of
2094 IPython should have improved quite a bit with the changes in
2109 IPython should have improved quite a bit with the changes in
2095 _prefilter and _ofind (besides being far safer than before).
2110 _prefilter and _ofind (besides being far safer than before).
2096
2111
2097 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
2112 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
2098 obscure, never reported). Edit would fail to find the object to
2113 obscure, never reported). Edit would fail to find the object to
2099 edit under some circumstances.
2114 edit under some circumstances.
2100 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
2115 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
2101 which were causing double-calling of generators. Those eval calls
2116 which were causing double-calling of generators. Those eval calls
2102 were _very_ dangerous, since code with side effects could be
2117 were _very_ dangerous, since code with side effects could be
2103 triggered. As they say, 'eval is evil'... These were the
2118 triggered. As they say, 'eval is evil'... These were the
2104 nastiest evals in IPython. Besides, _ofind is now far simpler,
2119 nastiest evals in IPython. Besides, _ofind is now far simpler,
2105 and it should also be quite a bit faster. Its use of inspect is
2120 and it should also be quite a bit faster. Its use of inspect is
2106 also safer, so perhaps some of the inspect-related crashes I've
2121 also safer, so perhaps some of the inspect-related crashes I've
2107 seen lately with Python 2.3 might be taken care of. That will
2122 seen lately with Python 2.3 might be taken care of. That will
2108 need more testing.
2123 need more testing.
2109
2124
2110 2003-08-17 Fernando Perez <fperez@colorado.edu>
2125 2003-08-17 Fernando Perez <fperez@colorado.edu>
2111
2126
2112 * IPython/iplib.py (InteractiveShell._prefilter): significant
2127 * IPython/iplib.py (InteractiveShell._prefilter): significant
2113 simplifications to the logic for handling user escapes. Faster
2128 simplifications to the logic for handling user escapes. Faster
2114 and simpler code.
2129 and simpler code.
2115
2130
2116 2003-08-14 Fernando Perez <fperez@colorado.edu>
2131 2003-08-14 Fernando Perez <fperez@colorado.edu>
2117
2132
2118 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2133 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2119 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2134 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2120 but it should be quite a bit faster. And the recursive version
2135 but it should be quite a bit faster. And the recursive version
2121 generated O(log N) intermediate storage for all rank>1 arrays,
2136 generated O(log N) intermediate storage for all rank>1 arrays,
2122 even if they were contiguous.
2137 even if they were contiguous.
2123 (l1norm): Added this function.
2138 (l1norm): Added this function.
2124 (norm): Added this function for arbitrary norms (including
2139 (norm): Added this function for arbitrary norms (including
2125 l-infinity). l1 and l2 are still special cases for convenience
2140 l-infinity). l1 and l2 are still special cases for convenience
2126 and speed.
2141 and speed.
2127
2142
2128 2003-08-03 Fernando Perez <fperez@colorado.edu>
2143 2003-08-03 Fernando Perez <fperez@colorado.edu>
2129
2144
2130 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2145 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2131 exceptions, which now raise PendingDeprecationWarnings in Python
2146 exceptions, which now raise PendingDeprecationWarnings in Python
2132 2.3. There were some in Magic and some in Gnuplot2.
2147 2.3. There were some in Magic and some in Gnuplot2.
2133
2148
2134 2003-06-30 Fernando Perez <fperez@colorado.edu>
2149 2003-06-30 Fernando Perez <fperez@colorado.edu>
2135
2150
2136 * IPython/genutils.py (page): modified to call curses only for
2151 * IPython/genutils.py (page): modified to call curses only for
2137 terminals where TERM=='xterm'. After problems under many other
2152 terminals where TERM=='xterm'. After problems under many other
2138 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2153 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2139
2154
2140 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2155 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2141 would be triggered when readline was absent. This was just an old
2156 would be triggered when readline was absent. This was just an old
2142 debugging statement I'd forgotten to take out.
2157 debugging statement I'd forgotten to take out.
2143
2158
2144 2003-06-20 Fernando Perez <fperez@colorado.edu>
2159 2003-06-20 Fernando Perez <fperez@colorado.edu>
2145
2160
2146 * IPython/genutils.py (clock): modified to return only user time
2161 * IPython/genutils.py (clock): modified to return only user time
2147 (not counting system time), after a discussion on scipy. While
2162 (not counting system time), after a discussion on scipy. While
2148 system time may be a useful quantity occasionally, it may much
2163 system time may be a useful quantity occasionally, it may much
2149 more easily be skewed by occasional swapping or other similar
2164 more easily be skewed by occasional swapping or other similar
2150 activity.
2165 activity.
2151
2166
2152 2003-06-05 Fernando Perez <fperez@colorado.edu>
2167 2003-06-05 Fernando Perez <fperez@colorado.edu>
2153
2168
2154 * IPython/numutils.py (identity): new function, for building
2169 * IPython/numutils.py (identity): new function, for building
2155 arbitrary rank Kronecker deltas (mostly backwards compatible with
2170 arbitrary rank Kronecker deltas (mostly backwards compatible with
2156 Numeric.identity)
2171 Numeric.identity)
2157
2172
2158 2003-06-03 Fernando Perez <fperez@colorado.edu>
2173 2003-06-03 Fernando Perez <fperez@colorado.edu>
2159
2174
2160 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2175 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2161 arguments passed to magics with spaces, to allow trailing '\' to
2176 arguments passed to magics with spaces, to allow trailing '\' to
2162 work normally (mainly for Windows users).
2177 work normally (mainly for Windows users).
2163
2178
2164 2003-05-29 Fernando Perez <fperez@colorado.edu>
2179 2003-05-29 Fernando Perez <fperez@colorado.edu>
2165
2180
2166 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2181 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2167 instead of pydoc.help. This fixes a bizarre behavior where
2182 instead of pydoc.help. This fixes a bizarre behavior where
2168 printing '%s' % locals() would trigger the help system. Now
2183 printing '%s' % locals() would trigger the help system. Now
2169 ipython behaves like normal python does.
2184 ipython behaves like normal python does.
2170
2185
2171 Note that if one does 'from pydoc import help', the bizarre
2186 Note that if one does 'from pydoc import help', the bizarre
2172 behavior returns, but this will also happen in normal python, so
2187 behavior returns, but this will also happen in normal python, so
2173 it's not an ipython bug anymore (it has to do with how pydoc.help
2188 it's not an ipython bug anymore (it has to do with how pydoc.help
2174 is implemented).
2189 is implemented).
2175
2190
2176 2003-05-22 Fernando Perez <fperez@colorado.edu>
2191 2003-05-22 Fernando Perez <fperez@colorado.edu>
2177
2192
2178 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2193 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2179 return [] instead of None when nothing matches, also match to end
2194 return [] instead of None when nothing matches, also match to end
2180 of line. Patch by Gary Bishop.
2195 of line. Patch by Gary Bishop.
2181
2196
2182 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2197 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2183 protection as before, for files passed on the command line. This
2198 protection as before, for files passed on the command line. This
2184 prevents the CrashHandler from kicking in if user files call into
2199 prevents the CrashHandler from kicking in if user files call into
2185 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2200 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2186 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2201 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2187
2202
2188 2003-05-20 *** Released version 0.4.0
2203 2003-05-20 *** Released version 0.4.0
2189
2204
2190 2003-05-20 Fernando Perez <fperez@colorado.edu>
2205 2003-05-20 Fernando Perez <fperez@colorado.edu>
2191
2206
2192 * setup.py: added support for manpages. It's a bit hackish b/c of
2207 * setup.py: added support for manpages. It's a bit hackish b/c of
2193 a bug in the way the bdist_rpm distutils target handles gzipped
2208 a bug in the way the bdist_rpm distutils target handles gzipped
2194 manpages, but it works. After a patch by Jack.
2209 manpages, but it works. After a patch by Jack.
2195
2210
2196 2003-05-19 Fernando Perez <fperez@colorado.edu>
2211 2003-05-19 Fernando Perez <fperez@colorado.edu>
2197
2212
2198 * IPython/numutils.py: added a mockup of the kinds module, since
2213 * IPython/numutils.py: added a mockup of the kinds module, since
2199 it was recently removed from Numeric. This way, numutils will
2214 it was recently removed from Numeric. This way, numutils will
2200 work for all users even if they are missing kinds.
2215 work for all users even if they are missing kinds.
2201
2216
2202 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2217 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2203 failure, which can occur with SWIG-wrapped extensions. After a
2218 failure, which can occur with SWIG-wrapped extensions. After a
2204 crash report from Prabhu.
2219 crash report from Prabhu.
2205
2220
2206 2003-05-16 Fernando Perez <fperez@colorado.edu>
2221 2003-05-16 Fernando Perez <fperez@colorado.edu>
2207
2222
2208 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2223 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2209 protect ipython from user code which may call directly
2224 protect ipython from user code which may call directly
2210 sys.excepthook (this looks like an ipython crash to the user, even
2225 sys.excepthook (this looks like an ipython crash to the user, even
2211 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2226 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2212 This is especially important to help users of WxWindows, but may
2227 This is especially important to help users of WxWindows, but may
2213 also be useful in other cases.
2228 also be useful in other cases.
2214
2229
2215 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2230 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2216 an optional tb_offset to be specified, and to preserve exception
2231 an optional tb_offset to be specified, and to preserve exception
2217 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2232 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2218
2233
2219 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2234 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2220
2235
2221 2003-05-15 Fernando Perez <fperez@colorado.edu>
2236 2003-05-15 Fernando Perez <fperez@colorado.edu>
2222
2237
2223 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2238 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2224 installing for a new user under Windows.
2239 installing for a new user under Windows.
2225
2240
2226 2003-05-12 Fernando Perez <fperez@colorado.edu>
2241 2003-05-12 Fernando Perez <fperez@colorado.edu>
2227
2242
2228 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2243 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2229 handler for Emacs comint-based lines. Currently it doesn't do
2244 handler for Emacs comint-based lines. Currently it doesn't do
2230 much (but importantly, it doesn't update the history cache). In
2245 much (but importantly, it doesn't update the history cache). In
2231 the future it may be expanded if Alex needs more functionality
2246 the future it may be expanded if Alex needs more functionality
2232 there.
2247 there.
2233
2248
2234 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2249 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2235 info to crash reports.
2250 info to crash reports.
2236
2251
2237 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2252 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2238 just like Python's -c. Also fixed crash with invalid -color
2253 just like Python's -c. Also fixed crash with invalid -color
2239 option value at startup. Thanks to Will French
2254 option value at startup. Thanks to Will French
2240 <wfrench-AT-bestweb.net> for the bug report.
2255 <wfrench-AT-bestweb.net> for the bug report.
2241
2256
2242 2003-05-09 Fernando Perez <fperez@colorado.edu>
2257 2003-05-09 Fernando Perez <fperez@colorado.edu>
2243
2258
2244 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2259 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2245 to EvalDict (it's a mapping, after all) and simplified its code
2260 to EvalDict (it's a mapping, after all) and simplified its code
2246 quite a bit, after a nice discussion on c.l.py where Gustavo
2261 quite a bit, after a nice discussion on c.l.py where Gustavo
2247 Córdova <gcordova-AT-sismex.com> suggested the new version.
2262 Córdova <gcordova-AT-sismex.com> suggested the new version.
2248
2263
2249 2003-04-30 Fernando Perez <fperez@colorado.edu>
2264 2003-04-30 Fernando Perez <fperez@colorado.edu>
2250
2265
2251 * IPython/genutils.py (timings_out): modified it to reduce its
2266 * IPython/genutils.py (timings_out): modified it to reduce its
2252 overhead in the common reps==1 case.
2267 overhead in the common reps==1 case.
2253
2268
2254 2003-04-29 Fernando Perez <fperez@colorado.edu>
2269 2003-04-29 Fernando Perez <fperez@colorado.edu>
2255
2270
2256 * IPython/genutils.py (timings_out): Modified to use the resource
2271 * IPython/genutils.py (timings_out): Modified to use the resource
2257 module, which avoids the wraparound problems of time.clock().
2272 module, which avoids the wraparound problems of time.clock().
2258
2273
2259 2003-04-17 *** Released version 0.2.15pre4
2274 2003-04-17 *** Released version 0.2.15pre4
2260
2275
2261 2003-04-17 Fernando Perez <fperez@colorado.edu>
2276 2003-04-17 Fernando Perez <fperez@colorado.edu>
2262
2277
2263 * setup.py (scriptfiles): Split windows-specific stuff over to a
2278 * setup.py (scriptfiles): Split windows-specific stuff over to a
2264 separate file, in an attempt to have a Windows GUI installer.
2279 separate file, in an attempt to have a Windows GUI installer.
2265 That didn't work, but part of the groundwork is done.
2280 That didn't work, but part of the groundwork is done.
2266
2281
2267 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2282 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2268 indent/unindent with 4 spaces. Particularly useful in combination
2283 indent/unindent with 4 spaces. Particularly useful in combination
2269 with the new auto-indent option.
2284 with the new auto-indent option.
2270
2285
2271 2003-04-16 Fernando Perez <fperez@colorado.edu>
2286 2003-04-16 Fernando Perez <fperez@colorado.edu>
2272
2287
2273 * IPython/Magic.py: various replacements of self.rc for
2288 * IPython/Magic.py: various replacements of self.rc for
2274 self.shell.rc. A lot more remains to be done to fully disentangle
2289 self.shell.rc. A lot more remains to be done to fully disentangle
2275 this class from the main Shell class.
2290 this class from the main Shell class.
2276
2291
2277 * IPython/GnuplotRuntime.py: added checks for mouse support so
2292 * IPython/GnuplotRuntime.py: added checks for mouse support so
2278 that we don't try to enable it if the current gnuplot doesn't
2293 that we don't try to enable it if the current gnuplot doesn't
2279 really support it. Also added checks so that we don't try to
2294 really support it. Also added checks so that we don't try to
2280 enable persist under Windows (where Gnuplot doesn't recognize the
2295 enable persist under Windows (where Gnuplot doesn't recognize the
2281 option).
2296 option).
2282
2297
2283 * IPython/iplib.py (InteractiveShell.interact): Added optional
2298 * IPython/iplib.py (InteractiveShell.interact): Added optional
2284 auto-indenting code, after a patch by King C. Shu
2299 auto-indenting code, after a patch by King C. Shu
2285 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2300 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2286 get along well with pasting indented code. If I ever figure out
2301 get along well with pasting indented code. If I ever figure out
2287 how to make that part go well, it will become on by default.
2302 how to make that part go well, it will become on by default.
2288
2303
2289 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2304 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2290 crash ipython if there was an unmatched '%' in the user's prompt
2305 crash ipython if there was an unmatched '%' in the user's prompt
2291 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2306 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2292
2307
2293 * IPython/iplib.py (InteractiveShell.interact): removed the
2308 * IPython/iplib.py (InteractiveShell.interact): removed the
2294 ability to ask the user whether he wants to crash or not at the
2309 ability to ask the user whether he wants to crash or not at the
2295 'last line' exception handler. Calling functions at that point
2310 'last line' exception handler. Calling functions at that point
2296 changes the stack, and the error reports would have incorrect
2311 changes the stack, and the error reports would have incorrect
2297 tracebacks.
2312 tracebacks.
2298
2313
2299 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2314 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2300 pass through a peger a pretty-printed form of any object. After a
2315 pass through a peger a pretty-printed form of any object. After a
2301 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2316 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2302
2317
2303 2003-04-14 Fernando Perez <fperez@colorado.edu>
2318 2003-04-14 Fernando Perez <fperez@colorado.edu>
2304
2319
2305 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2320 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2306 all files in ~ would be modified at first install (instead of
2321 all files in ~ would be modified at first install (instead of
2307 ~/.ipython). This could be potentially disastrous, as the
2322 ~/.ipython). This could be potentially disastrous, as the
2308 modification (make line-endings native) could damage binary files.
2323 modification (make line-endings native) could damage binary files.
2309
2324
2310 2003-04-10 Fernando Perez <fperez@colorado.edu>
2325 2003-04-10 Fernando Perez <fperez@colorado.edu>
2311
2326
2312 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2327 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2313 handle only lines which are invalid python. This now means that
2328 handle only lines which are invalid python. This now means that
2314 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2329 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2315 for the bug report.
2330 for the bug report.
2316
2331
2317 2003-04-01 Fernando Perez <fperez@colorado.edu>
2332 2003-04-01 Fernando Perez <fperez@colorado.edu>
2318
2333
2319 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2334 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2320 where failing to set sys.last_traceback would crash pdb.pm().
2335 where failing to set sys.last_traceback would crash pdb.pm().
2321 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2336 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2322 report.
2337 report.
2323
2338
2324 2003-03-25 Fernando Perez <fperez@colorado.edu>
2339 2003-03-25 Fernando Perez <fperez@colorado.edu>
2325
2340
2326 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2341 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2327 before printing it (it had a lot of spurious blank lines at the
2342 before printing it (it had a lot of spurious blank lines at the
2328 end).
2343 end).
2329
2344
2330 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2345 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2331 output would be sent 21 times! Obviously people don't use this
2346 output would be sent 21 times! Obviously people don't use this
2332 too often, or I would have heard about it.
2347 too often, or I would have heard about it.
2333
2348
2334 2003-03-24 Fernando Perez <fperez@colorado.edu>
2349 2003-03-24 Fernando Perez <fperez@colorado.edu>
2335
2350
2336 * setup.py (scriptfiles): renamed the data_files parameter from
2351 * setup.py (scriptfiles): renamed the data_files parameter from
2337 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2352 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2338 for the patch.
2353 for the patch.
2339
2354
2340 2003-03-20 Fernando Perez <fperez@colorado.edu>
2355 2003-03-20 Fernando Perez <fperez@colorado.edu>
2341
2356
2342 * IPython/genutils.py (error): added error() and fatal()
2357 * IPython/genutils.py (error): added error() and fatal()
2343 functions.
2358 functions.
2344
2359
2345 2003-03-18 *** Released version 0.2.15pre3
2360 2003-03-18 *** Released version 0.2.15pre3
2346
2361
2347 2003-03-18 Fernando Perez <fperez@colorado.edu>
2362 2003-03-18 Fernando Perez <fperez@colorado.edu>
2348
2363
2349 * setupext/install_data_ext.py
2364 * setupext/install_data_ext.py
2350 (install_data_ext.initialize_options): Class contributed by Jack
2365 (install_data_ext.initialize_options): Class contributed by Jack
2351 Moffit for fixing the old distutils hack. He is sending this to
2366 Moffit for fixing the old distutils hack. He is sending this to
2352 the distutils folks so in the future we may not need it as a
2367 the distutils folks so in the future we may not need it as a
2353 private fix.
2368 private fix.
2354
2369
2355 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2370 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2356 changes for Debian packaging. See his patch for full details.
2371 changes for Debian packaging. See his patch for full details.
2357 The old distutils hack of making the ipythonrc* files carry a
2372 The old distutils hack of making the ipythonrc* files carry a
2358 bogus .py extension is gone, at last. Examples were moved to a
2373 bogus .py extension is gone, at last. Examples were moved to a
2359 separate subdir under doc/, and the separate executable scripts
2374 separate subdir under doc/, and the separate executable scripts
2360 now live in their own directory. Overall a great cleanup. The
2375 now live in their own directory. Overall a great cleanup. The
2361 manual was updated to use the new files, and setup.py has been
2376 manual was updated to use the new files, and setup.py has been
2362 fixed for this setup.
2377 fixed for this setup.
2363
2378
2364 * IPython/PyColorize.py (Parser.usage): made non-executable and
2379 * IPython/PyColorize.py (Parser.usage): made non-executable and
2365 created a pycolor wrapper around it to be included as a script.
2380 created a pycolor wrapper around it to be included as a script.
2366
2381
2367 2003-03-12 *** Released version 0.2.15pre2
2382 2003-03-12 *** Released version 0.2.15pre2
2368
2383
2369 2003-03-12 Fernando Perez <fperez@colorado.edu>
2384 2003-03-12 Fernando Perez <fperez@colorado.edu>
2370
2385
2371 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2386 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2372 long-standing problem with garbage characters in some terminals.
2387 long-standing problem with garbage characters in some terminals.
2373 The issue was really that the \001 and \002 escapes must _only_ be
2388 The issue was really that the \001 and \002 escapes must _only_ be
2374 passed to input prompts (which call readline), but _never_ to
2389 passed to input prompts (which call readline), but _never_ to
2375 normal text to be printed on screen. I changed ColorANSI to have
2390 normal text to be printed on screen. I changed ColorANSI to have
2376 two classes: TermColors and InputTermColors, each with the
2391 two classes: TermColors and InputTermColors, each with the
2377 appropriate escapes for input prompts or normal text. The code in
2392 appropriate escapes for input prompts or normal text. The code in
2378 Prompts.py got slightly more complicated, but this very old and
2393 Prompts.py got slightly more complicated, but this very old and
2379 annoying bug is finally fixed.
2394 annoying bug is finally fixed.
2380
2395
2381 All the credit for nailing down the real origin of this problem
2396 All the credit for nailing down the real origin of this problem
2382 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2397 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2383 *Many* thanks to him for spending quite a bit of effort on this.
2398 *Many* thanks to him for spending quite a bit of effort on this.
2384
2399
2385 2003-03-05 *** Released version 0.2.15pre1
2400 2003-03-05 *** Released version 0.2.15pre1
2386
2401
2387 2003-03-03 Fernando Perez <fperez@colorado.edu>
2402 2003-03-03 Fernando Perez <fperez@colorado.edu>
2388
2403
2389 * IPython/FakeModule.py: Moved the former _FakeModule to a
2404 * IPython/FakeModule.py: Moved the former _FakeModule to a
2390 separate file, because it's also needed by Magic (to fix a similar
2405 separate file, because it's also needed by Magic (to fix a similar
2391 pickle-related issue in @run).
2406 pickle-related issue in @run).
2392
2407
2393 2003-03-02 Fernando Perez <fperez@colorado.edu>
2408 2003-03-02 Fernando Perez <fperez@colorado.edu>
2394
2409
2395 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2410 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2396 the autocall option at runtime.
2411 the autocall option at runtime.
2397 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2412 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2398 across Magic.py to start separating Magic from InteractiveShell.
2413 across Magic.py to start separating Magic from InteractiveShell.
2399 (Magic._ofind): Fixed to return proper namespace for dotted
2414 (Magic._ofind): Fixed to return proper namespace for dotted
2400 names. Before, a dotted name would always return 'not currently
2415 names. Before, a dotted name would always return 'not currently
2401 defined', because it would find the 'parent'. s.x would be found,
2416 defined', because it would find the 'parent'. s.x would be found,
2402 but since 'x' isn't defined by itself, it would get confused.
2417 but since 'x' isn't defined by itself, it would get confused.
2403 (Magic.magic_run): Fixed pickling problems reported by Ralf
2418 (Magic.magic_run): Fixed pickling problems reported by Ralf
2404 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2419 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2405 that I'd used when Mike Heeter reported similar issues at the
2420 that I'd used when Mike Heeter reported similar issues at the
2406 top-level, but now for @run. It boils down to injecting the
2421 top-level, but now for @run. It boils down to injecting the
2407 namespace where code is being executed with something that looks
2422 namespace where code is being executed with something that looks
2408 enough like a module to fool pickle.dump(). Since a pickle stores
2423 enough like a module to fool pickle.dump(). Since a pickle stores
2409 a named reference to the importing module, we need this for
2424 a named reference to the importing module, we need this for
2410 pickles to save something sensible.
2425 pickles to save something sensible.
2411
2426
2412 * IPython/ipmaker.py (make_IPython): added an autocall option.
2427 * IPython/ipmaker.py (make_IPython): added an autocall option.
2413
2428
2414 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2429 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2415 the auto-eval code. Now autocalling is an option, and the code is
2430 the auto-eval code. Now autocalling is an option, and the code is
2416 also vastly safer. There is no more eval() involved at all.
2431 also vastly safer. There is no more eval() involved at all.
2417
2432
2418 2003-03-01 Fernando Perez <fperez@colorado.edu>
2433 2003-03-01 Fernando Perez <fperez@colorado.edu>
2419
2434
2420 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2435 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2421 dict with named keys instead of a tuple.
2436 dict with named keys instead of a tuple.
2422
2437
2423 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2438 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2424
2439
2425 * setup.py (make_shortcut): Fixed message about directories
2440 * setup.py (make_shortcut): Fixed message about directories
2426 created during Windows installation (the directories were ok, just
2441 created during Windows installation (the directories were ok, just
2427 the printed message was misleading). Thanks to Chris Liechti
2442 the printed message was misleading). Thanks to Chris Liechti
2428 <cliechti-AT-gmx.net> for the heads up.
2443 <cliechti-AT-gmx.net> for the heads up.
2429
2444
2430 2003-02-21 Fernando Perez <fperez@colorado.edu>
2445 2003-02-21 Fernando Perez <fperez@colorado.edu>
2431
2446
2432 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2447 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2433 of ValueError exception when checking for auto-execution. This
2448 of ValueError exception when checking for auto-execution. This
2434 one is raised by things like Numeric arrays arr.flat when the
2449 one is raised by things like Numeric arrays arr.flat when the
2435 array is non-contiguous.
2450 array is non-contiguous.
2436
2451
2437 2003-01-31 Fernando Perez <fperez@colorado.edu>
2452 2003-01-31 Fernando Perez <fperez@colorado.edu>
2438
2453
2439 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2454 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2440 not return any value at all (even though the command would get
2455 not return any value at all (even though the command would get
2441 executed).
2456 executed).
2442 (xsys): Flush stdout right after printing the command to ensure
2457 (xsys): Flush stdout right after printing the command to ensure
2443 proper ordering of commands and command output in the total
2458 proper ordering of commands and command output in the total
2444 output.
2459 output.
2445 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2460 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2446 system/getoutput as defaults. The old ones are kept for
2461 system/getoutput as defaults. The old ones are kept for
2447 compatibility reasons, so no code which uses this library needs
2462 compatibility reasons, so no code which uses this library needs
2448 changing.
2463 changing.
2449
2464
2450 2003-01-27 *** Released version 0.2.14
2465 2003-01-27 *** Released version 0.2.14
2451
2466
2452 2003-01-25 Fernando Perez <fperez@colorado.edu>
2467 2003-01-25 Fernando Perez <fperez@colorado.edu>
2453
2468
2454 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2469 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2455 functions defined in previous edit sessions could not be re-edited
2470 functions defined in previous edit sessions could not be re-edited
2456 (because the temp files were immediately removed). Now temp files
2471 (because the temp files were immediately removed). Now temp files
2457 are removed only at IPython's exit.
2472 are removed only at IPython's exit.
2458 (Magic.magic_run): Improved @run to perform shell-like expansions
2473 (Magic.magic_run): Improved @run to perform shell-like expansions
2459 on its arguments (~users and $VARS). With this, @run becomes more
2474 on its arguments (~users and $VARS). With this, @run becomes more
2460 like a normal command-line.
2475 like a normal command-line.
2461
2476
2462 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2477 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2463 bugs related to embedding and cleaned up that code. A fairly
2478 bugs related to embedding and cleaned up that code. A fairly
2464 important one was the impossibility to access the global namespace
2479 important one was the impossibility to access the global namespace
2465 through the embedded IPython (only local variables were visible).
2480 through the embedded IPython (only local variables were visible).
2466
2481
2467 2003-01-14 Fernando Perez <fperez@colorado.edu>
2482 2003-01-14 Fernando Perez <fperez@colorado.edu>
2468
2483
2469 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2484 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2470 auto-calling to be a bit more conservative. Now it doesn't get
2485 auto-calling to be a bit more conservative. Now it doesn't get
2471 triggered if any of '!=()<>' are in the rest of the input line, to
2486 triggered if any of '!=()<>' are in the rest of the input line, to
2472 allow comparing callables. Thanks to Alex for the heads up.
2487 allow comparing callables. Thanks to Alex for the heads up.
2473
2488
2474 2003-01-07 Fernando Perez <fperez@colorado.edu>
2489 2003-01-07 Fernando Perez <fperez@colorado.edu>
2475
2490
2476 * IPython/genutils.py (page): fixed estimation of the number of
2491 * IPython/genutils.py (page): fixed estimation of the number of
2477 lines in a string to be paged to simply count newlines. This
2492 lines in a string to be paged to simply count newlines. This
2478 prevents over-guessing due to embedded escape sequences. A better
2493 prevents over-guessing due to embedded escape sequences. A better
2479 long-term solution would involve stripping out the control chars
2494 long-term solution would involve stripping out the control chars
2480 for the count, but it's potentially so expensive I just don't
2495 for the count, but it's potentially so expensive I just don't
2481 think it's worth doing.
2496 think it's worth doing.
2482
2497
2483 2002-12-19 *** Released version 0.2.14pre50
2498 2002-12-19 *** Released version 0.2.14pre50
2484
2499
2485 2002-12-19 Fernando Perez <fperez@colorado.edu>
2500 2002-12-19 Fernando Perez <fperez@colorado.edu>
2486
2501
2487 * tools/release (version): Changed release scripts to inform
2502 * tools/release (version): Changed release scripts to inform
2488 Andrea and build a NEWS file with a list of recent changes.
2503 Andrea and build a NEWS file with a list of recent changes.
2489
2504
2490 * IPython/ColorANSI.py (__all__): changed terminal detection
2505 * IPython/ColorANSI.py (__all__): changed terminal detection
2491 code. Seems to work better for xterms without breaking
2506 code. Seems to work better for xterms without breaking
2492 konsole. Will need more testing to determine if WinXP and Mac OSX
2507 konsole. Will need more testing to determine if WinXP and Mac OSX
2493 also work ok.
2508 also work ok.
2494
2509
2495 2002-12-18 *** Released version 0.2.14pre49
2510 2002-12-18 *** Released version 0.2.14pre49
2496
2511
2497 2002-12-18 Fernando Perez <fperez@colorado.edu>
2512 2002-12-18 Fernando Perez <fperez@colorado.edu>
2498
2513
2499 * Docs: added new info about Mac OSX, from Andrea.
2514 * Docs: added new info about Mac OSX, from Andrea.
2500
2515
2501 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2516 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2502 allow direct plotting of python strings whose format is the same
2517 allow direct plotting of python strings whose format is the same
2503 of gnuplot data files.
2518 of gnuplot data files.
2504
2519
2505 2002-12-16 Fernando Perez <fperez@colorado.edu>
2520 2002-12-16 Fernando Perez <fperez@colorado.edu>
2506
2521
2507 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2522 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2508 value of exit question to be acknowledged.
2523 value of exit question to be acknowledged.
2509
2524
2510 2002-12-03 Fernando Perez <fperez@colorado.edu>
2525 2002-12-03 Fernando Perez <fperez@colorado.edu>
2511
2526
2512 * IPython/ipmaker.py: removed generators, which had been added
2527 * IPython/ipmaker.py: removed generators, which had been added
2513 by mistake in an earlier debugging run. This was causing trouble
2528 by mistake in an earlier debugging run. This was causing trouble
2514 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2529 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2515 for pointing this out.
2530 for pointing this out.
2516
2531
2517 2002-11-17 Fernando Perez <fperez@colorado.edu>
2532 2002-11-17 Fernando Perez <fperez@colorado.edu>
2518
2533
2519 * Manual: updated the Gnuplot section.
2534 * Manual: updated the Gnuplot section.
2520
2535
2521 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2536 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2522 a much better split of what goes in Runtime and what goes in
2537 a much better split of what goes in Runtime and what goes in
2523 Interactive.
2538 Interactive.
2524
2539
2525 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2540 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2526 being imported from iplib.
2541 being imported from iplib.
2527
2542
2528 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2543 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2529 for command-passing. Now the global Gnuplot instance is called
2544 for command-passing. Now the global Gnuplot instance is called
2530 'gp' instead of 'g', which was really a far too fragile and
2545 'gp' instead of 'g', which was really a far too fragile and
2531 common name.
2546 common name.
2532
2547
2533 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2548 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2534 bounding boxes generated by Gnuplot for square plots.
2549 bounding boxes generated by Gnuplot for square plots.
2535
2550
2536 * IPython/genutils.py (popkey): new function added. I should
2551 * IPython/genutils.py (popkey): new function added. I should
2537 suggest this on c.l.py as a dict method, it seems useful.
2552 suggest this on c.l.py as a dict method, it seems useful.
2538
2553
2539 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2554 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2540 to transparently handle PostScript generation. MUCH better than
2555 to transparently handle PostScript generation. MUCH better than
2541 the previous plot_eps/replot_eps (which I removed now). The code
2556 the previous plot_eps/replot_eps (which I removed now). The code
2542 is also fairly clean and well documented now (including
2557 is also fairly clean and well documented now (including
2543 docstrings).
2558 docstrings).
2544
2559
2545 2002-11-13 Fernando Perez <fperez@colorado.edu>
2560 2002-11-13 Fernando Perez <fperez@colorado.edu>
2546
2561
2547 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2562 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2548 (inconsistent with options).
2563 (inconsistent with options).
2549
2564
2550 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2565 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2551 manually disabled, I don't know why. Fixed it.
2566 manually disabled, I don't know why. Fixed it.
2552 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2567 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2553 eps output.
2568 eps output.
2554
2569
2555 2002-11-12 Fernando Perez <fperez@colorado.edu>
2570 2002-11-12 Fernando Perez <fperez@colorado.edu>
2556
2571
2557 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2572 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2558 don't propagate up to caller. Fixes crash reported by François
2573 don't propagate up to caller. Fixes crash reported by François
2559 Pinard.
2574 Pinard.
2560
2575
2561 2002-11-09 Fernando Perez <fperez@colorado.edu>
2576 2002-11-09 Fernando Perez <fperez@colorado.edu>
2562
2577
2563 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2578 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2564 history file for new users.
2579 history file for new users.
2565 (make_IPython): fixed bug where initial install would leave the
2580 (make_IPython): fixed bug where initial install would leave the
2566 user running in the .ipython dir.
2581 user running in the .ipython dir.
2567 (make_IPython): fixed bug where config dir .ipython would be
2582 (make_IPython): fixed bug where config dir .ipython would be
2568 created regardless of the given -ipythondir option. Thanks to Cory
2583 created regardless of the given -ipythondir option. Thanks to Cory
2569 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2584 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2570
2585
2571 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2586 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2572 type confirmations. Will need to use it in all of IPython's code
2587 type confirmations. Will need to use it in all of IPython's code
2573 consistently.
2588 consistently.
2574
2589
2575 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2590 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2576 context to print 31 lines instead of the default 5. This will make
2591 context to print 31 lines instead of the default 5. This will make
2577 the crash reports extremely detailed in case the problem is in
2592 the crash reports extremely detailed in case the problem is in
2578 libraries I don't have access to.
2593 libraries I don't have access to.
2579
2594
2580 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2595 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2581 line of defense' code to still crash, but giving users fair
2596 line of defense' code to still crash, but giving users fair
2582 warning. I don't want internal errors to go unreported: if there's
2597 warning. I don't want internal errors to go unreported: if there's
2583 an internal problem, IPython should crash and generate a full
2598 an internal problem, IPython should crash and generate a full
2584 report.
2599 report.
2585
2600
2586 2002-11-08 Fernando Perez <fperez@colorado.edu>
2601 2002-11-08 Fernando Perez <fperez@colorado.edu>
2587
2602
2588 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2603 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2589 otherwise uncaught exceptions which can appear if people set
2604 otherwise uncaught exceptions which can appear if people set
2590 sys.stdout to something badly broken. Thanks to a crash report
2605 sys.stdout to something badly broken. Thanks to a crash report
2591 from henni-AT-mail.brainbot.com.
2606 from henni-AT-mail.brainbot.com.
2592
2607
2593 2002-11-04 Fernando Perez <fperez@colorado.edu>
2608 2002-11-04 Fernando Perez <fperez@colorado.edu>
2594
2609
2595 * IPython/iplib.py (InteractiveShell.interact): added
2610 * IPython/iplib.py (InteractiveShell.interact): added
2596 __IPYTHON__active to the builtins. It's a flag which goes on when
2611 __IPYTHON__active to the builtins. It's a flag which goes on when
2597 the interaction starts and goes off again when it stops. This
2612 the interaction starts and goes off again when it stops. This
2598 allows embedding code to detect being inside IPython. Before this
2613 allows embedding code to detect being inside IPython. Before this
2599 was done via __IPYTHON__, but that only shows that an IPython
2614 was done via __IPYTHON__, but that only shows that an IPython
2600 instance has been created.
2615 instance has been created.
2601
2616
2602 * IPython/Magic.py (Magic.magic_env): I realized that in a
2617 * IPython/Magic.py (Magic.magic_env): I realized that in a
2603 UserDict, instance.data holds the data as a normal dict. So I
2618 UserDict, instance.data holds the data as a normal dict. So I
2604 modified @env to return os.environ.data instead of rebuilding a
2619 modified @env to return os.environ.data instead of rebuilding a
2605 dict by hand.
2620 dict by hand.
2606
2621
2607 2002-11-02 Fernando Perez <fperez@colorado.edu>
2622 2002-11-02 Fernando Perez <fperez@colorado.edu>
2608
2623
2609 * IPython/genutils.py (warn): changed so that level 1 prints no
2624 * IPython/genutils.py (warn): changed so that level 1 prints no
2610 header. Level 2 is now the default (with 'WARNING' header, as
2625 header. Level 2 is now the default (with 'WARNING' header, as
2611 before). I think I tracked all places where changes were needed in
2626 before). I think I tracked all places where changes were needed in
2612 IPython, but outside code using the old level numbering may have
2627 IPython, but outside code using the old level numbering may have
2613 broken.
2628 broken.
2614
2629
2615 * IPython/iplib.py (InteractiveShell.runcode): added this to
2630 * IPython/iplib.py (InteractiveShell.runcode): added this to
2616 handle the tracebacks in SystemExit traps correctly. The previous
2631 handle the tracebacks in SystemExit traps correctly. The previous
2617 code (through interact) was printing more of the stack than
2632 code (through interact) was printing more of the stack than
2618 necessary, showing IPython internal code to the user.
2633 necessary, showing IPython internal code to the user.
2619
2634
2620 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2635 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2621 default. Now that the default at the confirmation prompt is yes,
2636 default. Now that the default at the confirmation prompt is yes,
2622 it's not so intrusive. François' argument that ipython sessions
2637 it's not so intrusive. François' argument that ipython sessions
2623 tend to be complex enough not to lose them from an accidental C-d,
2638 tend to be complex enough not to lose them from an accidental C-d,
2624 is a valid one.
2639 is a valid one.
2625
2640
2626 * IPython/iplib.py (InteractiveShell.interact): added a
2641 * IPython/iplib.py (InteractiveShell.interact): added a
2627 showtraceback() call to the SystemExit trap, and modified the exit
2642 showtraceback() call to the SystemExit trap, and modified the exit
2628 confirmation to have yes as the default.
2643 confirmation to have yes as the default.
2629
2644
2630 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2645 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2631 this file. It's been gone from the code for a long time, this was
2646 this file. It's been gone from the code for a long time, this was
2632 simply leftover junk.
2647 simply leftover junk.
2633
2648
2634 2002-11-01 Fernando Perez <fperez@colorado.edu>
2649 2002-11-01 Fernando Perez <fperez@colorado.edu>
2635
2650
2636 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2651 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2637 added. If set, IPython now traps EOF and asks for
2652 added. If set, IPython now traps EOF and asks for
2638 confirmation. After a request by François Pinard.
2653 confirmation. After a request by François Pinard.
2639
2654
2640 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2655 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2641 of @abort, and with a new (better) mechanism for handling the
2656 of @abort, and with a new (better) mechanism for handling the
2642 exceptions.
2657 exceptions.
2643
2658
2644 2002-10-27 Fernando Perez <fperez@colorado.edu>
2659 2002-10-27 Fernando Perez <fperez@colorado.edu>
2645
2660
2646 * IPython/usage.py (__doc__): updated the --help information and
2661 * IPython/usage.py (__doc__): updated the --help information and
2647 the ipythonrc file to indicate that -log generates
2662 the ipythonrc file to indicate that -log generates
2648 ./ipython.log. Also fixed the corresponding info in @logstart.
2663 ./ipython.log. Also fixed the corresponding info in @logstart.
2649 This and several other fixes in the manuals thanks to reports by
2664 This and several other fixes in the manuals thanks to reports by
2650 François Pinard <pinard-AT-iro.umontreal.ca>.
2665 François Pinard <pinard-AT-iro.umontreal.ca>.
2651
2666
2652 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2667 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2653 refer to @logstart (instead of @log, which doesn't exist).
2668 refer to @logstart (instead of @log, which doesn't exist).
2654
2669
2655 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2670 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2656 AttributeError crash. Thanks to Christopher Armstrong
2671 AttributeError crash. Thanks to Christopher Armstrong
2657 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2672 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2658 introduced recently (in 0.2.14pre37) with the fix to the eval
2673 introduced recently (in 0.2.14pre37) with the fix to the eval
2659 problem mentioned below.
2674 problem mentioned below.
2660
2675
2661 2002-10-17 Fernando Perez <fperez@colorado.edu>
2676 2002-10-17 Fernando Perez <fperez@colorado.edu>
2662
2677
2663 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2678 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2664 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2679 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2665
2680
2666 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2681 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2667 this function to fix a problem reported by Alex Schmolck. He saw
2682 this function to fix a problem reported by Alex Schmolck. He saw
2668 it with list comprehensions and generators, which were getting
2683 it with list comprehensions and generators, which were getting
2669 called twice. The real problem was an 'eval' call in testing for
2684 called twice. The real problem was an 'eval' call in testing for
2670 automagic which was evaluating the input line silently.
2685 automagic which was evaluating the input line silently.
2671
2686
2672 This is a potentially very nasty bug, if the input has side
2687 This is a potentially very nasty bug, if the input has side
2673 effects which must not be repeated. The code is much cleaner now,
2688 effects which must not be repeated. The code is much cleaner now,
2674 without any blanket 'except' left and with a regexp test for
2689 without any blanket 'except' left and with a regexp test for
2675 actual function names.
2690 actual function names.
2676
2691
2677 But an eval remains, which I'm not fully comfortable with. I just
2692 But an eval remains, which I'm not fully comfortable with. I just
2678 don't know how to find out if an expression could be a callable in
2693 don't know how to find out if an expression could be a callable in
2679 the user's namespace without doing an eval on the string. However
2694 the user's namespace without doing an eval on the string. However
2680 that string is now much more strictly checked so that no code
2695 that string is now much more strictly checked so that no code
2681 slips by, so the eval should only happen for things that can
2696 slips by, so the eval should only happen for things that can
2682 really be only function/method names.
2697 really be only function/method names.
2683
2698
2684 2002-10-15 Fernando Perez <fperez@colorado.edu>
2699 2002-10-15 Fernando Perez <fperez@colorado.edu>
2685
2700
2686 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2701 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2687 OSX information to main manual, removed README_Mac_OSX file from
2702 OSX information to main manual, removed README_Mac_OSX file from
2688 distribution. Also updated credits for recent additions.
2703 distribution. Also updated credits for recent additions.
2689
2704
2690 2002-10-10 Fernando Perez <fperez@colorado.edu>
2705 2002-10-10 Fernando Perez <fperez@colorado.edu>
2691
2706
2692 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2707 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2693 terminal-related issues. Many thanks to Andrea Riciputi
2708 terminal-related issues. Many thanks to Andrea Riciputi
2694 <andrea.riciputi-AT-libero.it> for writing it.
2709 <andrea.riciputi-AT-libero.it> for writing it.
2695
2710
2696 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2711 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2697 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2712 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2698
2713
2699 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2714 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2700 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2715 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2701 <syver-en-AT-online.no> who both submitted patches for this problem.
2716 <syver-en-AT-online.no> who both submitted patches for this problem.
2702
2717
2703 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2718 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2704 global embedding to make sure that things don't overwrite user
2719 global embedding to make sure that things don't overwrite user
2705 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2720 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2706
2721
2707 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2722 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2708 compatibility. Thanks to Hayden Callow
2723 compatibility. Thanks to Hayden Callow
2709 <h.callow-AT-elec.canterbury.ac.nz>
2724 <h.callow-AT-elec.canterbury.ac.nz>
2710
2725
2711 2002-10-04 Fernando Perez <fperez@colorado.edu>
2726 2002-10-04 Fernando Perez <fperez@colorado.edu>
2712
2727
2713 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2728 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2714 Gnuplot.File objects.
2729 Gnuplot.File objects.
2715
2730
2716 2002-07-23 Fernando Perez <fperez@colorado.edu>
2731 2002-07-23 Fernando Perez <fperez@colorado.edu>
2717
2732
2718 * IPython/genutils.py (timing): Added timings() and timing() for
2733 * IPython/genutils.py (timing): Added timings() and timing() for
2719 quick access to the most commonly needed data, the execution
2734 quick access to the most commonly needed data, the execution
2720 times. Old timing() renamed to timings_out().
2735 times. Old timing() renamed to timings_out().
2721
2736
2722 2002-07-18 Fernando Perez <fperez@colorado.edu>
2737 2002-07-18 Fernando Perez <fperez@colorado.edu>
2723
2738
2724 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2739 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2725 bug with nested instances disrupting the parent's tab completion.
2740 bug with nested instances disrupting the parent's tab completion.
2726
2741
2727 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2742 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2728 all_completions code to begin the emacs integration.
2743 all_completions code to begin the emacs integration.
2729
2744
2730 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2745 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2731 argument to allow titling individual arrays when plotting.
2746 argument to allow titling individual arrays when plotting.
2732
2747
2733 2002-07-15 Fernando Perez <fperez@colorado.edu>
2748 2002-07-15 Fernando Perez <fperez@colorado.edu>
2734
2749
2735 * setup.py (make_shortcut): changed to retrieve the value of
2750 * setup.py (make_shortcut): changed to retrieve the value of
2736 'Program Files' directory from the registry (this value changes in
2751 'Program Files' directory from the registry (this value changes in
2737 non-english versions of Windows). Thanks to Thomas Fanslau
2752 non-english versions of Windows). Thanks to Thomas Fanslau
2738 <tfanslau-AT-gmx.de> for the report.
2753 <tfanslau-AT-gmx.de> for the report.
2739
2754
2740 2002-07-10 Fernando Perez <fperez@colorado.edu>
2755 2002-07-10 Fernando Perez <fperez@colorado.edu>
2741
2756
2742 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
2757 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
2743 a bug in pdb, which crashes if a line with only whitespace is
2758 a bug in pdb, which crashes if a line with only whitespace is
2744 entered. Bug report submitted to sourceforge.
2759 entered. Bug report submitted to sourceforge.
2745
2760
2746 2002-07-09 Fernando Perez <fperez@colorado.edu>
2761 2002-07-09 Fernando Perez <fperez@colorado.edu>
2747
2762
2748 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
2763 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
2749 reporting exceptions (it's a bug in inspect.py, I just set a
2764 reporting exceptions (it's a bug in inspect.py, I just set a
2750 workaround).
2765 workaround).
2751
2766
2752 2002-07-08 Fernando Perez <fperez@colorado.edu>
2767 2002-07-08 Fernando Perez <fperez@colorado.edu>
2753
2768
2754 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
2769 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
2755 __IPYTHON__ in __builtins__ to show up in user_ns.
2770 __IPYTHON__ in __builtins__ to show up in user_ns.
2756
2771
2757 2002-07-03 Fernando Perez <fperez@colorado.edu>
2772 2002-07-03 Fernando Perez <fperez@colorado.edu>
2758
2773
2759 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
2774 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
2760 name from @gp_set_instance to @gp_set_default.
2775 name from @gp_set_instance to @gp_set_default.
2761
2776
2762 * IPython/ipmaker.py (make_IPython): default editor value set to
2777 * IPython/ipmaker.py (make_IPython): default editor value set to
2763 '0' (a string), to match the rc file. Otherwise will crash when
2778 '0' (a string), to match the rc file. Otherwise will crash when
2764 .strip() is called on it.
2779 .strip() is called on it.
2765
2780
2766
2781
2767 2002-06-28 Fernando Perez <fperez@colorado.edu>
2782 2002-06-28 Fernando Perez <fperez@colorado.edu>
2768
2783
2769 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
2784 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
2770 of files in current directory when a file is executed via
2785 of files in current directory when a file is executed via
2771 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
2786 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
2772
2787
2773 * setup.py (manfiles): fix for rpm builds, submitted by RA
2788 * setup.py (manfiles): fix for rpm builds, submitted by RA
2774 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
2789 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
2775
2790
2776 * IPython/ipmaker.py (make_IPython): fixed lookup of default
2791 * IPython/ipmaker.py (make_IPython): fixed lookup of default
2777 editor when set to '0'. Problem was, '0' evaluates to True (it's a
2792 editor when set to '0'. Problem was, '0' evaluates to True (it's a
2778 string!). A. Schmolck caught this one.
2793 string!). A. Schmolck caught this one.
2779
2794
2780 2002-06-27 Fernando Perez <fperez@colorado.edu>
2795 2002-06-27 Fernando Perez <fperez@colorado.edu>
2781
2796
2782 * IPython/ipmaker.py (make_IPython): fixed bug when running user
2797 * IPython/ipmaker.py (make_IPython): fixed bug when running user
2783 defined files at the cmd line. __name__ wasn't being set to
2798 defined files at the cmd line. __name__ wasn't being set to
2784 __main__.
2799 __main__.
2785
2800
2786 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
2801 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
2787 regular lists and tuples besides Numeric arrays.
2802 regular lists and tuples besides Numeric arrays.
2788
2803
2789 * IPython/Prompts.py (CachedOutput.__call__): Added output
2804 * IPython/Prompts.py (CachedOutput.__call__): Added output
2790 supression for input ending with ';'. Similar to Mathematica and
2805 supression for input ending with ';'. Similar to Mathematica and
2791 Matlab. The _* vars and Out[] list are still updated, just like
2806 Matlab. The _* vars and Out[] list are still updated, just like
2792 Mathematica behaves.
2807 Mathematica behaves.
2793
2808
2794 2002-06-25 Fernando Perez <fperez@colorado.edu>
2809 2002-06-25 Fernando Perez <fperez@colorado.edu>
2795
2810
2796 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
2811 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
2797 .ini extensions for profiels under Windows.
2812 .ini extensions for profiels under Windows.
2798
2813
2799 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
2814 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
2800 string form. Fix contributed by Alexander Schmolck
2815 string form. Fix contributed by Alexander Schmolck
2801 <a.schmolck-AT-gmx.net>
2816 <a.schmolck-AT-gmx.net>
2802
2817
2803 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
2818 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
2804 pre-configured Gnuplot instance.
2819 pre-configured Gnuplot instance.
2805
2820
2806 2002-06-21 Fernando Perez <fperez@colorado.edu>
2821 2002-06-21 Fernando Perez <fperez@colorado.edu>
2807
2822
2808 * IPython/numutils.py (exp_safe): new function, works around the
2823 * IPython/numutils.py (exp_safe): new function, works around the
2809 underflow problems in Numeric.
2824 underflow problems in Numeric.
2810 (log2): New fn. Safe log in base 2: returns exact integer answer
2825 (log2): New fn. Safe log in base 2: returns exact integer answer
2811 for exact integer powers of 2.
2826 for exact integer powers of 2.
2812
2827
2813 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
2828 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
2814 properly.
2829 properly.
2815
2830
2816 2002-06-20 Fernando Perez <fperez@colorado.edu>
2831 2002-06-20 Fernando Perez <fperez@colorado.edu>
2817
2832
2818 * IPython/genutils.py (timing): new function like
2833 * IPython/genutils.py (timing): new function like
2819 Mathematica's. Similar to time_test, but returns more info.
2834 Mathematica's. Similar to time_test, but returns more info.
2820
2835
2821 2002-06-18 Fernando Perez <fperez@colorado.edu>
2836 2002-06-18 Fernando Perez <fperez@colorado.edu>
2822
2837
2823 * IPython/Magic.py (Magic.magic_save): modified @save and @r
2838 * IPython/Magic.py (Magic.magic_save): modified @save and @r
2824 according to Mike Heeter's suggestions.
2839 according to Mike Heeter's suggestions.
2825
2840
2826 2002-06-16 Fernando Perez <fperez@colorado.edu>
2841 2002-06-16 Fernando Perez <fperez@colorado.edu>
2827
2842
2828 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
2843 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
2829 system. GnuplotMagic is gone as a user-directory option. New files
2844 system. GnuplotMagic is gone as a user-directory option. New files
2830 make it easier to use all the gnuplot stuff both from external
2845 make it easier to use all the gnuplot stuff both from external
2831 programs as well as from IPython. Had to rewrite part of
2846 programs as well as from IPython. Had to rewrite part of
2832 hardcopy() b/c of a strange bug: often the ps files simply don't
2847 hardcopy() b/c of a strange bug: often the ps files simply don't
2833 get created, and require a repeat of the command (often several
2848 get created, and require a repeat of the command (often several
2834 times).
2849 times).
2835
2850
2836 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
2851 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
2837 resolve output channel at call time, so that if sys.stderr has
2852 resolve output channel at call time, so that if sys.stderr has
2838 been redirected by user this gets honored.
2853 been redirected by user this gets honored.
2839
2854
2840 2002-06-13 Fernando Perez <fperez@colorado.edu>
2855 2002-06-13 Fernando Perez <fperez@colorado.edu>
2841
2856
2842 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
2857 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
2843 IPShell. Kept a copy with the old names to avoid breaking people's
2858 IPShell. Kept a copy with the old names to avoid breaking people's
2844 embedded code.
2859 embedded code.
2845
2860
2846 * IPython/ipython: simplified it to the bare minimum after
2861 * IPython/ipython: simplified it to the bare minimum after
2847 Holger's suggestions. Added info about how to use it in
2862 Holger's suggestions. Added info about how to use it in
2848 PYTHONSTARTUP.
2863 PYTHONSTARTUP.
2849
2864
2850 * IPython/Shell.py (IPythonShell): changed the options passing
2865 * IPython/Shell.py (IPythonShell): changed the options passing
2851 from a string with funky %s replacements to a straight list. Maybe
2866 from a string with funky %s replacements to a straight list. Maybe
2852 a bit more typing, but it follows sys.argv conventions, so there's
2867 a bit more typing, but it follows sys.argv conventions, so there's
2853 less special-casing to remember.
2868 less special-casing to remember.
2854
2869
2855 2002-06-12 Fernando Perez <fperez@colorado.edu>
2870 2002-06-12 Fernando Perez <fperez@colorado.edu>
2856
2871
2857 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
2872 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
2858 command. Thanks to a suggestion by Mike Heeter.
2873 command. Thanks to a suggestion by Mike Heeter.
2859 (Magic.magic_pfile): added behavior to look at filenames if given
2874 (Magic.magic_pfile): added behavior to look at filenames if given
2860 arg is not a defined object.
2875 arg is not a defined object.
2861 (Magic.magic_save): New @save function to save code snippets. Also
2876 (Magic.magic_save): New @save function to save code snippets. Also
2862 a Mike Heeter idea.
2877 a Mike Heeter idea.
2863
2878
2864 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
2879 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
2865 plot() and replot(). Much more convenient now, especially for
2880 plot() and replot(). Much more convenient now, especially for
2866 interactive use.
2881 interactive use.
2867
2882
2868 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
2883 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
2869 filenames.
2884 filenames.
2870
2885
2871 2002-06-02 Fernando Perez <fperez@colorado.edu>
2886 2002-06-02 Fernando Perez <fperez@colorado.edu>
2872
2887
2873 * IPython/Struct.py (Struct.__init__): modified to admit
2888 * IPython/Struct.py (Struct.__init__): modified to admit
2874 initialization via another struct.
2889 initialization via another struct.
2875
2890
2876 * IPython/genutils.py (SystemExec.__init__): New stateful
2891 * IPython/genutils.py (SystemExec.__init__): New stateful
2877 interface to xsys and bq. Useful for writing system scripts.
2892 interface to xsys and bq. Useful for writing system scripts.
2878
2893
2879 2002-05-30 Fernando Perez <fperez@colorado.edu>
2894 2002-05-30 Fernando Perez <fperez@colorado.edu>
2880
2895
2881 * MANIFEST.in: Changed docfile selection to exclude all the lyx
2896 * MANIFEST.in: Changed docfile selection to exclude all the lyx
2882 documents. This will make the user download smaller (it's getting
2897 documents. This will make the user download smaller (it's getting
2883 too big).
2898 too big).
2884
2899
2885 2002-05-29 Fernando Perez <fperez@colorado.edu>
2900 2002-05-29 Fernando Perez <fperez@colorado.edu>
2886
2901
2887 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
2902 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
2888 fix problems with shelve and pickle. Seems to work, but I don't
2903 fix problems with shelve and pickle. Seems to work, but I don't
2889 know if corner cases break it. Thanks to Mike Heeter
2904 know if corner cases break it. Thanks to Mike Heeter
2890 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
2905 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
2891
2906
2892 2002-05-24 Fernando Perez <fperez@colorado.edu>
2907 2002-05-24 Fernando Perez <fperez@colorado.edu>
2893
2908
2894 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
2909 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
2895 macros having broken.
2910 macros having broken.
2896
2911
2897 2002-05-21 Fernando Perez <fperez@colorado.edu>
2912 2002-05-21 Fernando Perez <fperez@colorado.edu>
2898
2913
2899 * IPython/Magic.py (Magic.magic_logstart): fixed recently
2914 * IPython/Magic.py (Magic.magic_logstart): fixed recently
2900 introduced logging bug: all history before logging started was
2915 introduced logging bug: all history before logging started was
2901 being written one character per line! This came from the redesign
2916 being written one character per line! This came from the redesign
2902 of the input history as a special list which slices to strings,
2917 of the input history as a special list which slices to strings,
2903 not to lists.
2918 not to lists.
2904
2919
2905 2002-05-20 Fernando Perez <fperez@colorado.edu>
2920 2002-05-20 Fernando Perez <fperez@colorado.edu>
2906
2921
2907 * IPython/Prompts.py (CachedOutput.__init__): made the color table
2922 * IPython/Prompts.py (CachedOutput.__init__): made the color table
2908 be an attribute of all classes in this module. The design of these
2923 be an attribute of all classes in this module. The design of these
2909 classes needs some serious overhauling.
2924 classes needs some serious overhauling.
2910
2925
2911 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
2926 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
2912 which was ignoring '_' in option names.
2927 which was ignoring '_' in option names.
2913
2928
2914 * IPython/ultraTB.py (FormattedTB.__init__): Changed
2929 * IPython/ultraTB.py (FormattedTB.__init__): Changed
2915 'Verbose_novars' to 'Context' and made it the new default. It's a
2930 'Verbose_novars' to 'Context' and made it the new default. It's a
2916 bit more readable and also safer than verbose.
2931 bit more readable and also safer than verbose.
2917
2932
2918 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
2933 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
2919 triple-quoted strings.
2934 triple-quoted strings.
2920
2935
2921 * IPython/OInspect.py (__all__): new module exposing the object
2936 * IPython/OInspect.py (__all__): new module exposing the object
2922 introspection facilities. Now the corresponding magics are dummy
2937 introspection facilities. Now the corresponding magics are dummy
2923 wrappers around this. Having this module will make it much easier
2938 wrappers around this. Having this module will make it much easier
2924 to put these functions into our modified pdb.
2939 to put these functions into our modified pdb.
2925 This new object inspector system uses the new colorizing module,
2940 This new object inspector system uses the new colorizing module,
2926 so source code and other things are nicely syntax highlighted.
2941 so source code and other things are nicely syntax highlighted.
2927
2942
2928 2002-05-18 Fernando Perez <fperez@colorado.edu>
2943 2002-05-18 Fernando Perez <fperez@colorado.edu>
2929
2944
2930 * IPython/ColorANSI.py: Split the coloring tools into a separate
2945 * IPython/ColorANSI.py: Split the coloring tools into a separate
2931 module so I can use them in other code easier (they were part of
2946 module so I can use them in other code easier (they were part of
2932 ultraTB).
2947 ultraTB).
2933
2948
2934 2002-05-17 Fernando Perez <fperez@colorado.edu>
2949 2002-05-17 Fernando Perez <fperez@colorado.edu>
2935
2950
2936 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
2951 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
2937 fixed it to set the global 'g' also to the called instance, as
2952 fixed it to set the global 'g' also to the called instance, as
2938 long as 'g' was still a gnuplot instance (so it doesn't overwrite
2953 long as 'g' was still a gnuplot instance (so it doesn't overwrite
2939 user's 'g' variables).
2954 user's 'g' variables).
2940
2955
2941 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
2956 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
2942 global variables (aliases to _ih,_oh) so that users which expect
2957 global variables (aliases to _ih,_oh) so that users which expect
2943 In[5] or Out[7] to work aren't unpleasantly surprised.
2958 In[5] or Out[7] to work aren't unpleasantly surprised.
2944 (InputList.__getslice__): new class to allow executing slices of
2959 (InputList.__getslice__): new class to allow executing slices of
2945 input history directly. Very simple class, complements the use of
2960 input history directly. Very simple class, complements the use of
2946 macros.
2961 macros.
2947
2962
2948 2002-05-16 Fernando Perez <fperez@colorado.edu>
2963 2002-05-16 Fernando Perez <fperez@colorado.edu>
2949
2964
2950 * setup.py (docdirbase): make doc directory be just doc/IPython
2965 * setup.py (docdirbase): make doc directory be just doc/IPython
2951 without version numbers, it will reduce clutter for users.
2966 without version numbers, it will reduce clutter for users.
2952
2967
2953 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
2968 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
2954 execfile call to prevent possible memory leak. See for details:
2969 execfile call to prevent possible memory leak. See for details:
2955 http://mail.python.org/pipermail/python-list/2002-February/088476.html
2970 http://mail.python.org/pipermail/python-list/2002-February/088476.html
2956
2971
2957 2002-05-15 Fernando Perez <fperez@colorado.edu>
2972 2002-05-15 Fernando Perez <fperez@colorado.edu>
2958
2973
2959 * IPython/Magic.py (Magic.magic_psource): made the object
2974 * IPython/Magic.py (Magic.magic_psource): made the object
2960 introspection names be more standard: pdoc, pdef, pfile and
2975 introspection names be more standard: pdoc, pdef, pfile and
2961 psource. They all print/page their output, and it makes
2976 psource. They all print/page their output, and it makes
2962 remembering them easier. Kept old names for compatibility as
2977 remembering them easier. Kept old names for compatibility as
2963 aliases.
2978 aliases.
2964
2979
2965 2002-05-14 Fernando Perez <fperez@colorado.edu>
2980 2002-05-14 Fernando Perez <fperez@colorado.edu>
2966
2981
2967 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
2982 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
2968 what the mouse problem was. The trick is to use gnuplot with temp
2983 what the mouse problem was. The trick is to use gnuplot with temp
2969 files and NOT with pipes (for data communication), because having
2984 files and NOT with pipes (for data communication), because having
2970 both pipes and the mouse on is bad news.
2985 both pipes and the mouse on is bad news.
2971
2986
2972 2002-05-13 Fernando Perez <fperez@colorado.edu>
2987 2002-05-13 Fernando Perez <fperez@colorado.edu>
2973
2988
2974 * IPython/Magic.py (Magic._ofind): fixed namespace order search
2989 * IPython/Magic.py (Magic._ofind): fixed namespace order search
2975 bug. Information would be reported about builtins even when
2990 bug. Information would be reported about builtins even when
2976 user-defined functions overrode them.
2991 user-defined functions overrode them.
2977
2992
2978 2002-05-11 Fernando Perez <fperez@colorado.edu>
2993 2002-05-11 Fernando Perez <fperez@colorado.edu>
2979
2994
2980 * IPython/__init__.py (__all__): removed FlexCompleter from
2995 * IPython/__init__.py (__all__): removed FlexCompleter from
2981 __all__ so that things don't fail in platforms without readline.
2996 __all__ so that things don't fail in platforms without readline.
2982
2997
2983 2002-05-10 Fernando Perez <fperez@colorado.edu>
2998 2002-05-10 Fernando Perez <fperez@colorado.edu>
2984
2999
2985 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3000 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
2986 it requires Numeric, effectively making Numeric a dependency for
3001 it requires Numeric, effectively making Numeric a dependency for
2987 IPython.
3002 IPython.
2988
3003
2989 * Released 0.2.13
3004 * Released 0.2.13
2990
3005
2991 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3006 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
2992 profiler interface. Now all the major options from the profiler
3007 profiler interface. Now all the major options from the profiler
2993 module are directly supported in IPython, both for single
3008 module are directly supported in IPython, both for single
2994 expressions (@prun) and for full programs (@run -p).
3009 expressions (@prun) and for full programs (@run -p).
2995
3010
2996 2002-05-09 Fernando Perez <fperez@colorado.edu>
3011 2002-05-09 Fernando Perez <fperez@colorado.edu>
2997
3012
2998 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3013 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
2999 magic properly formatted for screen.
3014 magic properly formatted for screen.
3000
3015
3001 * setup.py (make_shortcut): Changed things to put pdf version in
3016 * setup.py (make_shortcut): Changed things to put pdf version in
3002 doc/ instead of doc/manual (had to change lyxport a bit).
3017 doc/ instead of doc/manual (had to change lyxport a bit).
3003
3018
3004 * IPython/Magic.py (Profile.string_stats): made profile runs go
3019 * IPython/Magic.py (Profile.string_stats): made profile runs go
3005 through pager (they are long and a pager allows searching, saving,
3020 through pager (they are long and a pager allows searching, saving,
3006 etc.)
3021 etc.)
3007
3022
3008 2002-05-08 Fernando Perez <fperez@colorado.edu>
3023 2002-05-08 Fernando Perez <fperez@colorado.edu>
3009
3024
3010 * Released 0.2.12
3025 * Released 0.2.12
3011
3026
3012 2002-05-06 Fernando Perez <fperez@colorado.edu>
3027 2002-05-06 Fernando Perez <fperez@colorado.edu>
3013
3028
3014 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3029 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3015 introduced); 'hist n1 n2' was broken.
3030 introduced); 'hist n1 n2' was broken.
3016 (Magic.magic_pdb): added optional on/off arguments to @pdb
3031 (Magic.magic_pdb): added optional on/off arguments to @pdb
3017 (Magic.magic_run): added option -i to @run, which executes code in
3032 (Magic.magic_run): added option -i to @run, which executes code in
3018 the IPython namespace instead of a clean one. Also added @irun as
3033 the IPython namespace instead of a clean one. Also added @irun as
3019 an alias to @run -i.
3034 an alias to @run -i.
3020
3035
3021 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3036 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3022 fixed (it didn't really do anything, the namespaces were wrong).
3037 fixed (it didn't really do anything, the namespaces were wrong).
3023
3038
3024 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3039 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3025
3040
3026 * IPython/__init__.py (__all__): Fixed package namespace, now
3041 * IPython/__init__.py (__all__): Fixed package namespace, now
3027 'import IPython' does give access to IPython.<all> as
3042 'import IPython' does give access to IPython.<all> as
3028 expected. Also renamed __release__ to Release.
3043 expected. Also renamed __release__ to Release.
3029
3044
3030 * IPython/Debugger.py (__license__): created new Pdb class which
3045 * IPython/Debugger.py (__license__): created new Pdb class which
3031 functions like a drop-in for the normal pdb.Pdb but does NOT
3046 functions like a drop-in for the normal pdb.Pdb but does NOT
3032 import readline by default. This way it doesn't muck up IPython's
3047 import readline by default. This way it doesn't muck up IPython's
3033 readline handling, and now tab-completion finally works in the
3048 readline handling, and now tab-completion finally works in the
3034 debugger -- sort of. It completes things globally visible, but the
3049 debugger -- sort of. It completes things globally visible, but the
3035 completer doesn't track the stack as pdb walks it. That's a bit
3050 completer doesn't track the stack as pdb walks it. That's a bit
3036 tricky, and I'll have to implement it later.
3051 tricky, and I'll have to implement it later.
3037
3052
3038 2002-05-05 Fernando Perez <fperez@colorado.edu>
3053 2002-05-05 Fernando Perez <fperez@colorado.edu>
3039
3054
3040 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3055 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3041 magic docstrings when printed via ? (explicit \'s were being
3056 magic docstrings when printed via ? (explicit \'s were being
3042 printed).
3057 printed).
3043
3058
3044 * IPython/ipmaker.py (make_IPython): fixed namespace
3059 * IPython/ipmaker.py (make_IPython): fixed namespace
3045 identification bug. Now variables loaded via logs or command-line
3060 identification bug. Now variables loaded via logs or command-line
3046 files are recognized in the interactive namespace by @who.
3061 files are recognized in the interactive namespace by @who.
3047
3062
3048 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3063 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3049 log replay system stemming from the string form of Structs.
3064 log replay system stemming from the string form of Structs.
3050
3065
3051 * IPython/Magic.py (Macro.__init__): improved macros to properly
3066 * IPython/Magic.py (Macro.__init__): improved macros to properly
3052 handle magic commands in them.
3067 handle magic commands in them.
3053 (Magic.magic_logstart): usernames are now expanded so 'logstart
3068 (Magic.magic_logstart): usernames are now expanded so 'logstart
3054 ~/mylog' now works.
3069 ~/mylog' now works.
3055
3070
3056 * IPython/iplib.py (complete): fixed bug where paths starting with
3071 * IPython/iplib.py (complete): fixed bug where paths starting with
3057 '/' would be completed as magic names.
3072 '/' would be completed as magic names.
3058
3073
3059 2002-05-04 Fernando Perez <fperez@colorado.edu>
3074 2002-05-04 Fernando Perez <fperez@colorado.edu>
3060
3075
3061 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3076 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3062 allow running full programs under the profiler's control.
3077 allow running full programs under the profiler's control.
3063
3078
3064 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3079 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3065 mode to report exceptions verbosely but without formatting
3080 mode to report exceptions verbosely but without formatting
3066 variables. This addresses the issue of ipython 'freezing' (it's
3081 variables. This addresses the issue of ipython 'freezing' (it's
3067 not frozen, but caught in an expensive formatting loop) when huge
3082 not frozen, but caught in an expensive formatting loop) when huge
3068 variables are in the context of an exception.
3083 variables are in the context of an exception.
3069 (VerboseTB.text): Added '--->' markers at line where exception was
3084 (VerboseTB.text): Added '--->' markers at line where exception was
3070 triggered. Much clearer to read, especially in NoColor modes.
3085 triggered. Much clearer to read, especially in NoColor modes.
3071
3086
3072 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3087 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3073 implemented in reverse when changing to the new parse_options().
3088 implemented in reverse when changing to the new parse_options().
3074
3089
3075 2002-05-03 Fernando Perez <fperez@colorado.edu>
3090 2002-05-03 Fernando Perez <fperez@colorado.edu>
3076
3091
3077 * IPython/Magic.py (Magic.parse_options): new function so that
3092 * IPython/Magic.py (Magic.parse_options): new function so that
3078 magics can parse options easier.
3093 magics can parse options easier.
3079 (Magic.magic_prun): new function similar to profile.run(),
3094 (Magic.magic_prun): new function similar to profile.run(),
3080 suggested by Chris Hart.
3095 suggested by Chris Hart.
3081 (Magic.magic_cd): fixed behavior so that it only changes if
3096 (Magic.magic_cd): fixed behavior so that it only changes if
3082 directory actually is in history.
3097 directory actually is in history.
3083
3098
3084 * IPython/usage.py (__doc__): added information about potential
3099 * IPython/usage.py (__doc__): added information about potential
3085 slowness of Verbose exception mode when there are huge data
3100 slowness of Verbose exception mode when there are huge data
3086 structures to be formatted (thanks to Archie Paulson).
3101 structures to be formatted (thanks to Archie Paulson).
3087
3102
3088 * IPython/ipmaker.py (make_IPython): Changed default logging
3103 * IPython/ipmaker.py (make_IPython): Changed default logging
3089 (when simply called with -log) to use curr_dir/ipython.log in
3104 (when simply called with -log) to use curr_dir/ipython.log in
3090 rotate mode. Fixed crash which was occuring with -log before
3105 rotate mode. Fixed crash which was occuring with -log before
3091 (thanks to Jim Boyle).
3106 (thanks to Jim Boyle).
3092
3107
3093 2002-05-01 Fernando Perez <fperez@colorado.edu>
3108 2002-05-01 Fernando Perez <fperez@colorado.edu>
3094
3109
3095 * Released 0.2.11 for these fixes (mainly the ultraTB one which
3110 * Released 0.2.11 for these fixes (mainly the ultraTB one which
3096 was nasty -- though somewhat of a corner case).
3111 was nasty -- though somewhat of a corner case).
3097
3112
3098 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
3113 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
3099 text (was a bug).
3114 text (was a bug).
3100
3115
3101 2002-04-30 Fernando Perez <fperez@colorado.edu>
3116 2002-04-30 Fernando Perez <fperez@colorado.edu>
3102
3117
3103 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3118 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3104 a print after ^D or ^C from the user so that the In[] prompt
3119 a print after ^D or ^C from the user so that the In[] prompt
3105 doesn't over-run the gnuplot one.
3120 doesn't over-run the gnuplot one.
3106
3121
3107 2002-04-29 Fernando Perez <fperez@colorado.edu>
3122 2002-04-29 Fernando Perez <fperez@colorado.edu>
3108
3123
3109 * Released 0.2.10
3124 * Released 0.2.10
3110
3125
3111 * IPython/__release__.py (version): get date dynamically.
3126 * IPython/__release__.py (version): get date dynamically.
3112
3127
3113 * Misc. documentation updates thanks to Arnd's comments. Also ran
3128 * Misc. documentation updates thanks to Arnd's comments. Also ran
3114 a full spellcheck on the manual (hadn't been done in a while).
3129 a full spellcheck on the manual (hadn't been done in a while).
3115
3130
3116 2002-04-27 Fernando Perez <fperez@colorado.edu>
3131 2002-04-27 Fernando Perez <fperez@colorado.edu>
3117
3132
3118 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3133 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3119 starting a log in mid-session would reset the input history list.
3134 starting a log in mid-session would reset the input history list.
3120
3135
3121 2002-04-26 Fernando Perez <fperez@colorado.edu>
3136 2002-04-26 Fernando Perez <fperez@colorado.edu>
3122
3137
3123 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3138 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3124 all files were being included in an update. Now anything in
3139 all files were being included in an update. Now anything in
3125 UserConfig that matches [A-Za-z]*.py will go (this excludes
3140 UserConfig that matches [A-Za-z]*.py will go (this excludes
3126 __init__.py)
3141 __init__.py)
3127
3142
3128 2002-04-25 Fernando Perez <fperez@colorado.edu>
3143 2002-04-25 Fernando Perez <fperez@colorado.edu>
3129
3144
3130 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3145 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3131 to __builtins__ so that any form of embedded or imported code can
3146 to __builtins__ so that any form of embedded or imported code can
3132 test for being inside IPython.
3147 test for being inside IPython.
3133
3148
3134 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3149 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3135 changed to GnuplotMagic because it's now an importable module,
3150 changed to GnuplotMagic because it's now an importable module,
3136 this makes the name follow that of the standard Gnuplot module.
3151 this makes the name follow that of the standard Gnuplot module.
3137 GnuplotMagic can now be loaded at any time in mid-session.
3152 GnuplotMagic can now be loaded at any time in mid-session.
3138
3153
3139 2002-04-24 Fernando Perez <fperez@colorado.edu>
3154 2002-04-24 Fernando Perez <fperez@colorado.edu>
3140
3155
3141 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3156 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3142 the globals (IPython has its own namespace) and the
3157 the globals (IPython has its own namespace) and the
3143 PhysicalQuantity stuff is much better anyway.
3158 PhysicalQuantity stuff is much better anyway.
3144
3159
3145 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3160 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3146 embedding example to standard user directory for
3161 embedding example to standard user directory for
3147 distribution. Also put it in the manual.
3162 distribution. Also put it in the manual.
3148
3163
3149 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3164 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3150 instance as first argument (so it doesn't rely on some obscure
3165 instance as first argument (so it doesn't rely on some obscure
3151 hidden global).
3166 hidden global).
3152
3167
3153 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3168 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3154 delimiters. While it prevents ().TAB from working, it allows
3169 delimiters. While it prevents ().TAB from working, it allows
3155 completions in open (... expressions. This is by far a more common
3170 completions in open (... expressions. This is by far a more common
3156 case.
3171 case.
3157
3172
3158 2002-04-23 Fernando Perez <fperez@colorado.edu>
3173 2002-04-23 Fernando Perez <fperez@colorado.edu>
3159
3174
3160 * IPython/Extensions/InterpreterPasteInput.py: new
3175 * IPython/Extensions/InterpreterPasteInput.py: new
3161 syntax-processing module for pasting lines with >>> or ... at the
3176 syntax-processing module for pasting lines with >>> or ... at the
3162 start.
3177 start.
3163
3178
3164 * IPython/Extensions/PhysicalQ_Interactive.py
3179 * IPython/Extensions/PhysicalQ_Interactive.py
3165 (PhysicalQuantityInteractive.__int__): fixed to work with either
3180 (PhysicalQuantityInteractive.__int__): fixed to work with either
3166 Numeric or math.
3181 Numeric or math.
3167
3182
3168 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3183 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3169 provided profiles. Now we have:
3184 provided profiles. Now we have:
3170 -math -> math module as * and cmath with its own namespace.
3185 -math -> math module as * and cmath with its own namespace.
3171 -numeric -> Numeric as *, plus gnuplot & grace
3186 -numeric -> Numeric as *, plus gnuplot & grace
3172 -physics -> same as before
3187 -physics -> same as before
3173
3188
3174 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3189 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3175 user-defined magics wouldn't be found by @magic if they were
3190 user-defined magics wouldn't be found by @magic if they were
3176 defined as class methods. Also cleaned up the namespace search
3191 defined as class methods. Also cleaned up the namespace search
3177 logic and the string building (to use %s instead of many repeated
3192 logic and the string building (to use %s instead of many repeated
3178 string adds).
3193 string adds).
3179
3194
3180 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3195 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3181 of user-defined magics to operate with class methods (cleaner, in
3196 of user-defined magics to operate with class methods (cleaner, in
3182 line with the gnuplot code).
3197 line with the gnuplot code).
3183
3198
3184 2002-04-22 Fernando Perez <fperez@colorado.edu>
3199 2002-04-22 Fernando Perez <fperez@colorado.edu>
3185
3200
3186 * setup.py: updated dependency list so that manual is updated when
3201 * setup.py: updated dependency list so that manual is updated when
3187 all included files change.
3202 all included files change.
3188
3203
3189 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3204 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3190 the delimiter removal option (the fix is ugly right now).
3205 the delimiter removal option (the fix is ugly right now).
3191
3206
3192 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3207 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3193 all of the math profile (quicker loading, no conflict between
3208 all of the math profile (quicker loading, no conflict between
3194 g-9.8 and g-gnuplot).
3209 g-9.8 and g-gnuplot).
3195
3210
3196 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3211 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3197 name of post-mortem files to IPython_crash_report.txt.
3212 name of post-mortem files to IPython_crash_report.txt.
3198
3213
3199 * Cleanup/update of the docs. Added all the new readline info and
3214 * Cleanup/update of the docs. Added all the new readline info and
3200 formatted all lists as 'real lists'.
3215 formatted all lists as 'real lists'.
3201
3216
3202 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3217 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3203 tab-completion options, since the full readline parse_and_bind is
3218 tab-completion options, since the full readline parse_and_bind is
3204 now accessible.
3219 now accessible.
3205
3220
3206 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3221 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3207 handling of readline options. Now users can specify any string to
3222 handling of readline options. Now users can specify any string to
3208 be passed to parse_and_bind(), as well as the delimiters to be
3223 be passed to parse_and_bind(), as well as the delimiters to be
3209 removed.
3224 removed.
3210 (InteractiveShell.__init__): Added __name__ to the global
3225 (InteractiveShell.__init__): Added __name__ to the global
3211 namespace so that things like Itpl which rely on its existence
3226 namespace so that things like Itpl which rely on its existence
3212 don't crash.
3227 don't crash.
3213 (InteractiveShell._prefilter): Defined the default with a _ so
3228 (InteractiveShell._prefilter): Defined the default with a _ so
3214 that prefilter() is easier to override, while the default one
3229 that prefilter() is easier to override, while the default one
3215 remains available.
3230 remains available.
3216
3231
3217 2002-04-18 Fernando Perez <fperez@colorado.edu>
3232 2002-04-18 Fernando Perez <fperez@colorado.edu>
3218
3233
3219 * Added information about pdb in the docs.
3234 * Added information about pdb in the docs.
3220
3235
3221 2002-04-17 Fernando Perez <fperez@colorado.edu>
3236 2002-04-17 Fernando Perez <fperez@colorado.edu>
3222
3237
3223 * IPython/ipmaker.py (make_IPython): added rc_override option to
3238 * IPython/ipmaker.py (make_IPython): added rc_override option to
3224 allow passing config options at creation time which may override
3239 allow passing config options at creation time which may override
3225 anything set in the config files or command line. This is
3240 anything set in the config files or command line. This is
3226 particularly useful for configuring embedded instances.
3241 particularly useful for configuring embedded instances.
3227
3242
3228 2002-04-15 Fernando Perez <fperez@colorado.edu>
3243 2002-04-15 Fernando Perez <fperez@colorado.edu>
3229
3244
3230 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3245 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3231 crash embedded instances because of the input cache falling out of
3246 crash embedded instances because of the input cache falling out of
3232 sync with the output counter.
3247 sync with the output counter.
3233
3248
3234 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3249 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3235 mode which calls pdb after an uncaught exception in IPython itself.
3250 mode which calls pdb after an uncaught exception in IPython itself.
3236
3251
3237 2002-04-14 Fernando Perez <fperez@colorado.edu>
3252 2002-04-14 Fernando Perez <fperez@colorado.edu>
3238
3253
3239 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3254 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3240 readline, fix it back after each call.
3255 readline, fix it back after each call.
3241
3256
3242 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3257 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3243 method to force all access via __call__(), which guarantees that
3258 method to force all access via __call__(), which guarantees that
3244 traceback references are properly deleted.
3259 traceback references are properly deleted.
3245
3260
3246 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3261 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3247 improve printing when pprint is in use.
3262 improve printing when pprint is in use.
3248
3263
3249 2002-04-13 Fernando Perez <fperez@colorado.edu>
3264 2002-04-13 Fernando Perez <fperez@colorado.edu>
3250
3265
3251 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3266 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3252 exceptions aren't caught anymore. If the user triggers one, he
3267 exceptions aren't caught anymore. If the user triggers one, he
3253 should know why he's doing it and it should go all the way up,
3268 should know why he's doing it and it should go all the way up,
3254 just like any other exception. So now @abort will fully kill the
3269 just like any other exception. So now @abort will fully kill the
3255 embedded interpreter and the embedding code (unless that happens
3270 embedded interpreter and the embedding code (unless that happens
3256 to catch SystemExit).
3271 to catch SystemExit).
3257
3272
3258 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3273 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3259 and a debugger() method to invoke the interactive pdb debugger
3274 and a debugger() method to invoke the interactive pdb debugger
3260 after printing exception information. Also added the corresponding
3275 after printing exception information. Also added the corresponding
3261 -pdb option and @pdb magic to control this feature, and updated
3276 -pdb option and @pdb magic to control this feature, and updated
3262 the docs. After a suggestion from Christopher Hart
3277 the docs. After a suggestion from Christopher Hart
3263 (hart-AT-caltech.edu).
3278 (hart-AT-caltech.edu).
3264
3279
3265 2002-04-12 Fernando Perez <fperez@colorado.edu>
3280 2002-04-12 Fernando Perez <fperez@colorado.edu>
3266
3281
3267 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3282 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3268 the exception handlers defined by the user (not the CrashHandler)
3283 the exception handlers defined by the user (not the CrashHandler)
3269 so that user exceptions don't trigger an ipython bug report.
3284 so that user exceptions don't trigger an ipython bug report.
3270
3285
3271 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3286 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3272 configurable (it should have always been so).
3287 configurable (it should have always been so).
3273
3288
3274 2002-03-26 Fernando Perez <fperez@colorado.edu>
3289 2002-03-26 Fernando Perez <fperez@colorado.edu>
3275
3290
3276 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3291 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3277 and there to fix embedding namespace issues. This should all be
3292 and there to fix embedding namespace issues. This should all be
3278 done in a more elegant way.
3293 done in a more elegant way.
3279
3294
3280 2002-03-25 Fernando Perez <fperez@colorado.edu>
3295 2002-03-25 Fernando Perez <fperez@colorado.edu>
3281
3296
3282 * IPython/genutils.py (get_home_dir): Try to make it work under
3297 * IPython/genutils.py (get_home_dir): Try to make it work under
3283 win9x also.
3298 win9x also.
3284
3299
3285 2002-03-20 Fernando Perez <fperez@colorado.edu>
3300 2002-03-20 Fernando Perez <fperez@colorado.edu>
3286
3301
3287 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3302 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3288 sys.displayhook untouched upon __init__.
3303 sys.displayhook untouched upon __init__.
3289
3304
3290 2002-03-19 Fernando Perez <fperez@colorado.edu>
3305 2002-03-19 Fernando Perez <fperez@colorado.edu>
3291
3306
3292 * Released 0.2.9 (for embedding bug, basically).
3307 * Released 0.2.9 (for embedding bug, basically).
3293
3308
3294 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3309 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3295 exceptions so that enclosing shell's state can be restored.
3310 exceptions so that enclosing shell's state can be restored.
3296
3311
3297 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3312 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3298 naming conventions in the .ipython/ dir.
3313 naming conventions in the .ipython/ dir.
3299
3314
3300 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3315 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3301 from delimiters list so filenames with - in them get expanded.
3316 from delimiters list so filenames with - in them get expanded.
3302
3317
3303 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3318 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3304 sys.displayhook not being properly restored after an embedded call.
3319 sys.displayhook not being properly restored after an embedded call.
3305
3320
3306 2002-03-18 Fernando Perez <fperez@colorado.edu>
3321 2002-03-18 Fernando Perez <fperez@colorado.edu>
3307
3322
3308 * Released 0.2.8
3323 * Released 0.2.8
3309
3324
3310 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3325 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3311 some files weren't being included in a -upgrade.
3326 some files weren't being included in a -upgrade.
3312 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3327 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3313 on' so that the first tab completes.
3328 on' so that the first tab completes.
3314 (InteractiveShell.handle_magic): fixed bug with spaces around
3329 (InteractiveShell.handle_magic): fixed bug with spaces around
3315 quotes breaking many magic commands.
3330 quotes breaking many magic commands.
3316
3331
3317 * setup.py: added note about ignoring the syntax error messages at
3332 * setup.py: added note about ignoring the syntax error messages at
3318 installation.
3333 installation.
3319
3334
3320 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3335 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3321 streamlining the gnuplot interface, now there's only one magic @gp.
3336 streamlining the gnuplot interface, now there's only one magic @gp.
3322
3337
3323 2002-03-17 Fernando Perez <fperez@colorado.edu>
3338 2002-03-17 Fernando Perez <fperez@colorado.edu>
3324
3339
3325 * IPython/UserConfig/magic_gnuplot.py: new name for the
3340 * IPython/UserConfig/magic_gnuplot.py: new name for the
3326 example-magic_pm.py file. Much enhanced system, now with a shell
3341 example-magic_pm.py file. Much enhanced system, now with a shell
3327 for communicating directly with gnuplot, one command at a time.
3342 for communicating directly with gnuplot, one command at a time.
3328
3343
3329 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3344 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3330 setting __name__=='__main__'.
3345 setting __name__=='__main__'.
3331
3346
3332 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3347 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3333 mini-shell for accessing gnuplot from inside ipython. Should
3348 mini-shell for accessing gnuplot from inside ipython. Should
3334 extend it later for grace access too. Inspired by Arnd's
3349 extend it later for grace access too. Inspired by Arnd's
3335 suggestion.
3350 suggestion.
3336
3351
3337 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3352 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3338 calling magic functions with () in their arguments. Thanks to Arnd
3353 calling magic functions with () in their arguments. Thanks to Arnd
3339 Baecker for pointing this to me.
3354 Baecker for pointing this to me.
3340
3355
3341 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3356 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3342 infinitely for integer or complex arrays (only worked with floats).
3357 infinitely for integer or complex arrays (only worked with floats).
3343
3358
3344 2002-03-16 Fernando Perez <fperez@colorado.edu>
3359 2002-03-16 Fernando Perez <fperez@colorado.edu>
3345
3360
3346 * setup.py: Merged setup and setup_windows into a single script
3361 * setup.py: Merged setup and setup_windows into a single script
3347 which properly handles things for windows users.
3362 which properly handles things for windows users.
3348
3363
3349 2002-03-15 Fernando Perez <fperez@colorado.edu>
3364 2002-03-15 Fernando Perez <fperez@colorado.edu>
3350
3365
3351 * Big change to the manual: now the magics are all automatically
3366 * Big change to the manual: now the magics are all automatically
3352 documented. This information is generated from their docstrings
3367 documented. This information is generated from their docstrings
3353 and put in a latex file included by the manual lyx file. This way
3368 and put in a latex file included by the manual lyx file. This way
3354 we get always up to date information for the magics. The manual
3369 we get always up to date information for the magics. The manual
3355 now also has proper version information, also auto-synced.
3370 now also has proper version information, also auto-synced.
3356
3371
3357 For this to work, an undocumented --magic_docstrings option was added.
3372 For this to work, an undocumented --magic_docstrings option was added.
3358
3373
3359 2002-03-13 Fernando Perez <fperez@colorado.edu>
3374 2002-03-13 Fernando Perez <fperez@colorado.edu>
3360
3375
3361 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3376 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3362 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3377 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3363
3378
3364 2002-03-12 Fernando Perez <fperez@colorado.edu>
3379 2002-03-12 Fernando Perez <fperez@colorado.edu>
3365
3380
3366 * IPython/ultraTB.py (TermColors): changed color escapes again to
3381 * IPython/ultraTB.py (TermColors): changed color escapes again to
3367 fix the (old, reintroduced) line-wrapping bug. Basically, if
3382 fix the (old, reintroduced) line-wrapping bug. Basically, if
3368 \001..\002 aren't given in the color escapes, lines get wrapped
3383 \001..\002 aren't given in the color escapes, lines get wrapped
3369 weirdly. But giving those screws up old xterms and emacs terms. So
3384 weirdly. But giving those screws up old xterms and emacs terms. So
3370 I added some logic for emacs terms to be ok, but I can't identify old
3385 I added some logic for emacs terms to be ok, but I can't identify old
3371 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3386 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3372
3387
3373 2002-03-10 Fernando Perez <fperez@colorado.edu>
3388 2002-03-10 Fernando Perez <fperez@colorado.edu>
3374
3389
3375 * IPython/usage.py (__doc__): Various documentation cleanups and
3390 * IPython/usage.py (__doc__): Various documentation cleanups and
3376 updates, both in usage docstrings and in the manual.
3391 updates, both in usage docstrings and in the manual.
3377
3392
3378 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3393 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3379 handling of caching. Set minimum acceptabe value for having a
3394 handling of caching. Set minimum acceptabe value for having a
3380 cache at 20 values.
3395 cache at 20 values.
3381
3396
3382 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3397 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3383 install_first_time function to a method, renamed it and added an
3398 install_first_time function to a method, renamed it and added an
3384 'upgrade' mode. Now people can update their config directory with
3399 'upgrade' mode. Now people can update their config directory with
3385 a simple command line switch (-upgrade, also new).
3400 a simple command line switch (-upgrade, also new).
3386
3401
3387 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3402 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3388 @file (convenient for automagic users under Python >= 2.2).
3403 @file (convenient for automagic users under Python >= 2.2).
3389 Removed @files (it seemed more like a plural than an abbrev. of
3404 Removed @files (it seemed more like a plural than an abbrev. of
3390 'file show').
3405 'file show').
3391
3406
3392 * IPython/iplib.py (install_first_time): Fixed crash if there were
3407 * IPython/iplib.py (install_first_time): Fixed crash if there were
3393 backup files ('~') in .ipython/ install directory.
3408 backup files ('~') in .ipython/ install directory.
3394
3409
3395 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3410 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3396 system. Things look fine, but these changes are fairly
3411 system. Things look fine, but these changes are fairly
3397 intrusive. Test them for a few days.
3412 intrusive. Test them for a few days.
3398
3413
3399 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3414 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3400 the prompts system. Now all in/out prompt strings are user
3415 the prompts system. Now all in/out prompt strings are user
3401 controllable. This is particularly useful for embedding, as one
3416 controllable. This is particularly useful for embedding, as one
3402 can tag embedded instances with particular prompts.
3417 can tag embedded instances with particular prompts.
3403
3418
3404 Also removed global use of sys.ps1/2, which now allows nested
3419 Also removed global use of sys.ps1/2, which now allows nested
3405 embeddings without any problems. Added command-line options for
3420 embeddings without any problems. Added command-line options for
3406 the prompt strings.
3421 the prompt strings.
3407
3422
3408 2002-03-08 Fernando Perez <fperez@colorado.edu>
3423 2002-03-08 Fernando Perez <fperez@colorado.edu>
3409
3424
3410 * IPython/UserConfig/example-embed-short.py (ipshell): added
3425 * IPython/UserConfig/example-embed-short.py (ipshell): added
3411 example file with the bare minimum code for embedding.
3426 example file with the bare minimum code for embedding.
3412
3427
3413 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3428 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3414 functionality for the embeddable shell to be activated/deactivated
3429 functionality for the embeddable shell to be activated/deactivated
3415 either globally or at each call.
3430 either globally or at each call.
3416
3431
3417 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3432 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3418 rewriting the prompt with '--->' for auto-inputs with proper
3433 rewriting the prompt with '--->' for auto-inputs with proper
3419 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3434 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3420 this is handled by the prompts class itself, as it should.
3435 this is handled by the prompts class itself, as it should.
3421
3436
3422 2002-03-05 Fernando Perez <fperez@colorado.edu>
3437 2002-03-05 Fernando Perez <fperez@colorado.edu>
3423
3438
3424 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3439 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3425 @logstart to avoid name clashes with the math log function.
3440 @logstart to avoid name clashes with the math log function.
3426
3441
3427 * Big updates to X/Emacs section of the manual.
3442 * Big updates to X/Emacs section of the manual.
3428
3443
3429 * Removed ipython_emacs. Milan explained to me how to pass
3444 * Removed ipython_emacs. Milan explained to me how to pass
3430 arguments to ipython through Emacs. Some day I'm going to end up
3445 arguments to ipython through Emacs. Some day I'm going to end up
3431 learning some lisp...
3446 learning some lisp...
3432
3447
3433 2002-03-04 Fernando Perez <fperez@colorado.edu>
3448 2002-03-04 Fernando Perez <fperez@colorado.edu>
3434
3449
3435 * IPython/ipython_emacs: Created script to be used as the
3450 * IPython/ipython_emacs: Created script to be used as the
3436 py-python-command Emacs variable so we can pass IPython
3451 py-python-command Emacs variable so we can pass IPython
3437 parameters. I can't figure out how to tell Emacs directly to pass
3452 parameters. I can't figure out how to tell Emacs directly to pass
3438 parameters to IPython, so a dummy shell script will do it.
3453 parameters to IPython, so a dummy shell script will do it.
3439
3454
3440 Other enhancements made for things to work better under Emacs'
3455 Other enhancements made for things to work better under Emacs'
3441 various types of terminals. Many thanks to Milan Zamazal
3456 various types of terminals. Many thanks to Milan Zamazal
3442 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3457 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3443
3458
3444 2002-03-01 Fernando Perez <fperez@colorado.edu>
3459 2002-03-01 Fernando Perez <fperez@colorado.edu>
3445
3460
3446 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3461 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3447 that loading of readline is now optional. This gives better
3462 that loading of readline is now optional. This gives better
3448 control to emacs users.
3463 control to emacs users.
3449
3464
3450 * IPython/ultraTB.py (__date__): Modified color escape sequences
3465 * IPython/ultraTB.py (__date__): Modified color escape sequences
3451 and now things work fine under xterm and in Emacs' term buffers
3466 and now things work fine under xterm and in Emacs' term buffers
3452 (though not shell ones). Well, in emacs you get colors, but all
3467 (though not shell ones). Well, in emacs you get colors, but all
3453 seem to be 'light' colors (no difference between dark and light
3468 seem to be 'light' colors (no difference between dark and light
3454 ones). But the garbage chars are gone, and also in xterms. It
3469 ones). But the garbage chars are gone, and also in xterms. It
3455 seems that now I'm using 'cleaner' ansi sequences.
3470 seems that now I'm using 'cleaner' ansi sequences.
3456
3471
3457 2002-02-21 Fernando Perez <fperez@colorado.edu>
3472 2002-02-21 Fernando Perez <fperez@colorado.edu>
3458
3473
3459 * Released 0.2.7 (mainly to publish the scoping fix).
3474 * Released 0.2.7 (mainly to publish the scoping fix).
3460
3475
3461 * IPython/Logger.py (Logger.logstate): added. A corresponding
3476 * IPython/Logger.py (Logger.logstate): added. A corresponding
3462 @logstate magic was created.
3477 @logstate magic was created.
3463
3478
3464 * IPython/Magic.py: fixed nested scoping problem under Python
3479 * IPython/Magic.py: fixed nested scoping problem under Python
3465 2.1.x (automagic wasn't working).
3480 2.1.x (automagic wasn't working).
3466
3481
3467 2002-02-20 Fernando Perez <fperez@colorado.edu>
3482 2002-02-20 Fernando Perez <fperez@colorado.edu>
3468
3483
3469 * Released 0.2.6.
3484 * Released 0.2.6.
3470
3485
3471 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3486 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3472 option so that logs can come out without any headers at all.
3487 option so that logs can come out without any headers at all.
3473
3488
3474 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3489 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3475 SciPy.
3490 SciPy.
3476
3491
3477 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3492 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3478 that embedded IPython calls don't require vars() to be explicitly
3493 that embedded IPython calls don't require vars() to be explicitly
3479 passed. Now they are extracted from the caller's frame (code
3494 passed. Now they are extracted from the caller's frame (code
3480 snatched from Eric Jones' weave). Added better documentation to
3495 snatched from Eric Jones' weave). Added better documentation to
3481 the section on embedding and the example file.
3496 the section on embedding and the example file.
3482
3497
3483 * IPython/genutils.py (page): Changed so that under emacs, it just
3498 * IPython/genutils.py (page): Changed so that under emacs, it just
3484 prints the string. You can then page up and down in the emacs
3499 prints the string. You can then page up and down in the emacs
3485 buffer itself. This is how the builtin help() works.
3500 buffer itself. This is how the builtin help() works.
3486
3501
3487 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3502 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3488 macro scoping: macros need to be executed in the user's namespace
3503 macro scoping: macros need to be executed in the user's namespace
3489 to work as if they had been typed by the user.
3504 to work as if they had been typed by the user.
3490
3505
3491 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3506 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3492 execute automatically (no need to type 'exec...'). They then
3507 execute automatically (no need to type 'exec...'). They then
3493 behave like 'true macros'. The printing system was also modified
3508 behave like 'true macros'. The printing system was also modified
3494 for this to work.
3509 for this to work.
3495
3510
3496 2002-02-19 Fernando Perez <fperez@colorado.edu>
3511 2002-02-19 Fernando Perez <fperez@colorado.edu>
3497
3512
3498 * IPython/genutils.py (page_file): new function for paging files
3513 * IPython/genutils.py (page_file): new function for paging files
3499 in an OS-independent way. Also necessary for file viewing to work
3514 in an OS-independent way. Also necessary for file viewing to work
3500 well inside Emacs buffers.
3515 well inside Emacs buffers.
3501 (page): Added checks for being in an emacs buffer.
3516 (page): Added checks for being in an emacs buffer.
3502 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3517 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3503 same bug in iplib.
3518 same bug in iplib.
3504
3519
3505 2002-02-18 Fernando Perez <fperez@colorado.edu>
3520 2002-02-18 Fernando Perez <fperez@colorado.edu>
3506
3521
3507 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3522 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3508 of readline so that IPython can work inside an Emacs buffer.
3523 of readline so that IPython can work inside an Emacs buffer.
3509
3524
3510 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3525 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3511 method signatures (they weren't really bugs, but it looks cleaner
3526 method signatures (they weren't really bugs, but it looks cleaner
3512 and keeps PyChecker happy).
3527 and keeps PyChecker happy).
3513
3528
3514 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3529 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3515 for implementing various user-defined hooks. Currently only
3530 for implementing various user-defined hooks. Currently only
3516 display is done.
3531 display is done.
3517
3532
3518 * IPython/Prompts.py (CachedOutput._display): changed display
3533 * IPython/Prompts.py (CachedOutput._display): changed display
3519 functions so that they can be dynamically changed by users easily.
3534 functions so that they can be dynamically changed by users easily.
3520
3535
3521 * IPython/Extensions/numeric_formats.py (num_display): added an
3536 * IPython/Extensions/numeric_formats.py (num_display): added an
3522 extension for printing NumPy arrays in flexible manners. It
3537 extension for printing NumPy arrays in flexible manners. It
3523 doesn't do anything yet, but all the structure is in
3538 doesn't do anything yet, but all the structure is in
3524 place. Ultimately the plan is to implement output format control
3539 place. Ultimately the plan is to implement output format control
3525 like in Octave.
3540 like in Octave.
3526
3541
3527 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3542 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3528 methods are found at run-time by all the automatic machinery.
3543 methods are found at run-time by all the automatic machinery.
3529
3544
3530 2002-02-17 Fernando Perez <fperez@colorado.edu>
3545 2002-02-17 Fernando Perez <fperez@colorado.edu>
3531
3546
3532 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3547 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3533 whole file a little.
3548 whole file a little.
3534
3549
3535 * ToDo: closed this document. Now there's a new_design.lyx
3550 * ToDo: closed this document. Now there's a new_design.lyx
3536 document for all new ideas. Added making a pdf of it for the
3551 document for all new ideas. Added making a pdf of it for the
3537 end-user distro.
3552 end-user distro.
3538
3553
3539 * IPython/Logger.py (Logger.switch_log): Created this to replace
3554 * IPython/Logger.py (Logger.switch_log): Created this to replace
3540 logon() and logoff(). It also fixes a nasty crash reported by
3555 logon() and logoff(). It also fixes a nasty crash reported by
3541 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3556 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3542
3557
3543 * IPython/iplib.py (complete): got auto-completion to work with
3558 * IPython/iplib.py (complete): got auto-completion to work with
3544 automagic (I had wanted this for a long time).
3559 automagic (I had wanted this for a long time).
3545
3560
3546 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3561 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3547 to @file, since file() is now a builtin and clashes with automagic
3562 to @file, since file() is now a builtin and clashes with automagic
3548 for @file.
3563 for @file.
3549
3564
3550 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3565 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3551 of this was previously in iplib, which had grown to more than 2000
3566 of this was previously in iplib, which had grown to more than 2000
3552 lines, way too long. No new functionality, but it makes managing
3567 lines, way too long. No new functionality, but it makes managing
3553 the code a bit easier.
3568 the code a bit easier.
3554
3569
3555 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3570 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3556 information to crash reports.
3571 information to crash reports.
3557
3572
3558 2002-02-12 Fernando Perez <fperez@colorado.edu>
3573 2002-02-12 Fernando Perez <fperez@colorado.edu>
3559
3574
3560 * Released 0.2.5.
3575 * Released 0.2.5.
3561
3576
3562 2002-02-11 Fernando Perez <fperez@colorado.edu>
3577 2002-02-11 Fernando Perez <fperez@colorado.edu>
3563
3578
3564 * Wrote a relatively complete Windows installer. It puts
3579 * Wrote a relatively complete Windows installer. It puts
3565 everything in place, creates Start Menu entries and fixes the
3580 everything in place, creates Start Menu entries and fixes the
3566 color issues. Nothing fancy, but it works.
3581 color issues. Nothing fancy, but it works.
3567
3582
3568 2002-02-10 Fernando Perez <fperez@colorado.edu>
3583 2002-02-10 Fernando Perez <fperez@colorado.edu>
3569
3584
3570 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3585 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3571 os.path.expanduser() call so that we can type @run ~/myfile.py and
3586 os.path.expanduser() call so that we can type @run ~/myfile.py and
3572 have thigs work as expected.
3587 have thigs work as expected.
3573
3588
3574 * IPython/genutils.py (page): fixed exception handling so things
3589 * IPython/genutils.py (page): fixed exception handling so things
3575 work both in Unix and Windows correctly. Quitting a pager triggers
3590 work both in Unix and Windows correctly. Quitting a pager triggers
3576 an IOError/broken pipe in Unix, and in windows not finding a pager
3591 an IOError/broken pipe in Unix, and in windows not finding a pager
3577 is also an IOError, so I had to actually look at the return value
3592 is also an IOError, so I had to actually look at the return value
3578 of the exception, not just the exception itself. Should be ok now.
3593 of the exception, not just the exception itself. Should be ok now.
3579
3594
3580 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3595 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3581 modified to allow case-insensitive color scheme changes.
3596 modified to allow case-insensitive color scheme changes.
3582
3597
3583 2002-02-09 Fernando Perez <fperez@colorado.edu>
3598 2002-02-09 Fernando Perez <fperez@colorado.edu>
3584
3599
3585 * IPython/genutils.py (native_line_ends): new function to leave
3600 * IPython/genutils.py (native_line_ends): new function to leave
3586 user config files with os-native line-endings.
3601 user config files with os-native line-endings.
3587
3602
3588 * README and manual updates.
3603 * README and manual updates.
3589
3604
3590 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3605 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3591 instead of StringType to catch Unicode strings.
3606 instead of StringType to catch Unicode strings.
3592
3607
3593 * IPython/genutils.py (filefind): fixed bug for paths with
3608 * IPython/genutils.py (filefind): fixed bug for paths with
3594 embedded spaces (very common in Windows).
3609 embedded spaces (very common in Windows).
3595
3610
3596 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3611 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3597 files under Windows, so that they get automatically associated
3612 files under Windows, so that they get automatically associated
3598 with a text editor. Windows makes it a pain to handle
3613 with a text editor. Windows makes it a pain to handle
3599 extension-less files.
3614 extension-less files.
3600
3615
3601 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3616 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3602 warning about readline only occur for Posix. In Windows there's no
3617 warning about readline only occur for Posix. In Windows there's no
3603 way to get readline, so why bother with the warning.
3618 way to get readline, so why bother with the warning.
3604
3619
3605 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3620 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3606 for __str__ instead of dir(self), since dir() changed in 2.2.
3621 for __str__ instead of dir(self), since dir() changed in 2.2.
3607
3622
3608 * Ported to Windows! Tested on XP, I suspect it should work fine
3623 * Ported to Windows! Tested on XP, I suspect it should work fine
3609 on NT/2000, but I don't think it will work on 98 et al. That
3624 on NT/2000, but I don't think it will work on 98 et al. That
3610 series of Windows is such a piece of junk anyway that I won't try
3625 series of Windows is such a piece of junk anyway that I won't try
3611 porting it there. The XP port was straightforward, showed a few
3626 porting it there. The XP port was straightforward, showed a few
3612 bugs here and there (fixed all), in particular some string
3627 bugs here and there (fixed all), in particular some string
3613 handling stuff which required considering Unicode strings (which
3628 handling stuff which required considering Unicode strings (which
3614 Windows uses). This is good, but hasn't been too tested :) No
3629 Windows uses). This is good, but hasn't been too tested :) No
3615 fancy installer yet, I'll put a note in the manual so people at
3630 fancy installer yet, I'll put a note in the manual so people at
3616 least make manually a shortcut.
3631 least make manually a shortcut.
3617
3632
3618 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3633 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3619 into a single one, "colors". This now controls both prompt and
3634 into a single one, "colors". This now controls both prompt and
3620 exception color schemes, and can be changed both at startup
3635 exception color schemes, and can be changed both at startup
3621 (either via command-line switches or via ipythonrc files) and at
3636 (either via command-line switches or via ipythonrc files) and at
3622 runtime, with @colors.
3637 runtime, with @colors.
3623 (Magic.magic_run): renamed @prun to @run and removed the old
3638 (Magic.magic_run): renamed @prun to @run and removed the old
3624 @run. The two were too similar to warrant keeping both.
3639 @run. The two were too similar to warrant keeping both.
3625
3640
3626 2002-02-03 Fernando Perez <fperez@colorado.edu>
3641 2002-02-03 Fernando Perez <fperez@colorado.edu>
3627
3642
3628 * IPython/iplib.py (install_first_time): Added comment on how to
3643 * IPython/iplib.py (install_first_time): Added comment on how to
3629 configure the color options for first-time users. Put a <return>
3644 configure the color options for first-time users. Put a <return>
3630 request at the end so that small-terminal users get a chance to
3645 request at the end so that small-terminal users get a chance to
3631 read the startup info.
3646 read the startup info.
3632
3647
3633 2002-01-23 Fernando Perez <fperez@colorado.edu>
3648 2002-01-23 Fernando Perez <fperez@colorado.edu>
3634
3649
3635 * IPython/iplib.py (CachedOutput.update): Changed output memory
3650 * IPython/iplib.py (CachedOutput.update): Changed output memory
3636 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3651 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3637 input history we still use _i. Did this b/c these variable are
3652 input history we still use _i. Did this b/c these variable are
3638 very commonly used in interactive work, so the less we need to
3653 very commonly used in interactive work, so the less we need to
3639 type the better off we are.
3654 type the better off we are.
3640 (Magic.magic_prun): updated @prun to better handle the namespaces
3655 (Magic.magic_prun): updated @prun to better handle the namespaces
3641 the file will run in, including a fix for __name__ not being set
3656 the file will run in, including a fix for __name__ not being set
3642 before.
3657 before.
3643
3658
3644 2002-01-20 Fernando Perez <fperez@colorado.edu>
3659 2002-01-20 Fernando Perez <fperez@colorado.edu>
3645
3660
3646 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3661 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3647 extra garbage for Python 2.2. Need to look more carefully into
3662 extra garbage for Python 2.2. Need to look more carefully into
3648 this later.
3663 this later.
3649
3664
3650 2002-01-19 Fernando Perez <fperez@colorado.edu>
3665 2002-01-19 Fernando Perez <fperez@colorado.edu>
3651
3666
3652 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3667 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3653 display SyntaxError exceptions properly formatted when they occur
3668 display SyntaxError exceptions properly formatted when they occur
3654 (they can be triggered by imported code).
3669 (they can be triggered by imported code).
3655
3670
3656 2002-01-18 Fernando Perez <fperez@colorado.edu>
3671 2002-01-18 Fernando Perez <fperez@colorado.edu>
3657
3672
3658 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3673 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3659 SyntaxError exceptions are reported nicely formatted, instead of
3674 SyntaxError exceptions are reported nicely formatted, instead of
3660 spitting out only offset information as before.
3675 spitting out only offset information as before.
3661 (Magic.magic_prun): Added the @prun function for executing
3676 (Magic.magic_prun): Added the @prun function for executing
3662 programs with command line args inside IPython.
3677 programs with command line args inside IPython.
3663
3678
3664 2002-01-16 Fernando Perez <fperez@colorado.edu>
3679 2002-01-16 Fernando Perez <fperez@colorado.edu>
3665
3680
3666 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3681 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3667 to *not* include the last item given in a range. This brings their
3682 to *not* include the last item given in a range. This brings their
3668 behavior in line with Python's slicing:
3683 behavior in line with Python's slicing:
3669 a[n1:n2] -> a[n1]...a[n2-1]
3684 a[n1:n2] -> a[n1]...a[n2-1]
3670 It may be a bit less convenient, but I prefer to stick to Python's
3685 It may be a bit less convenient, but I prefer to stick to Python's
3671 conventions *everywhere*, so users never have to wonder.
3686 conventions *everywhere*, so users never have to wonder.
3672 (Magic.magic_macro): Added @macro function to ease the creation of
3687 (Magic.magic_macro): Added @macro function to ease the creation of
3673 macros.
3688 macros.
3674
3689
3675 2002-01-05 Fernando Perez <fperez@colorado.edu>
3690 2002-01-05 Fernando Perez <fperez@colorado.edu>
3676
3691
3677 * Released 0.2.4.
3692 * Released 0.2.4.
3678
3693
3679 * IPython/iplib.py (Magic.magic_pdef):
3694 * IPython/iplib.py (Magic.magic_pdef):
3680 (InteractiveShell.safe_execfile): report magic lines and error
3695 (InteractiveShell.safe_execfile): report magic lines and error
3681 lines without line numbers so one can easily copy/paste them for
3696 lines without line numbers so one can easily copy/paste them for
3682 re-execution.
3697 re-execution.
3683
3698
3684 * Updated manual with recent changes.
3699 * Updated manual with recent changes.
3685
3700
3686 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3701 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3687 docstring printing when class? is called. Very handy for knowing
3702 docstring printing when class? is called. Very handy for knowing
3688 how to create class instances (as long as __init__ is well
3703 how to create class instances (as long as __init__ is well
3689 documented, of course :)
3704 documented, of course :)
3690 (Magic.magic_doc): print both class and constructor docstrings.
3705 (Magic.magic_doc): print both class and constructor docstrings.
3691 (Magic.magic_pdef): give constructor info if passed a class and
3706 (Magic.magic_pdef): give constructor info if passed a class and
3692 __call__ info for callable object instances.
3707 __call__ info for callable object instances.
3693
3708
3694 2002-01-04 Fernando Perez <fperez@colorado.edu>
3709 2002-01-04 Fernando Perez <fperez@colorado.edu>
3695
3710
3696 * Made deep_reload() off by default. It doesn't always work
3711 * Made deep_reload() off by default. It doesn't always work
3697 exactly as intended, so it's probably safer to have it off. It's
3712 exactly as intended, so it's probably safer to have it off. It's
3698 still available as dreload() anyway, so nothing is lost.
3713 still available as dreload() anyway, so nothing is lost.
3699
3714
3700 2002-01-02 Fernando Perez <fperez@colorado.edu>
3715 2002-01-02 Fernando Perez <fperez@colorado.edu>
3701
3716
3702 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3717 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3703 so I wanted an updated release).
3718 so I wanted an updated release).
3704
3719
3705 2001-12-27 Fernando Perez <fperez@colorado.edu>
3720 2001-12-27 Fernando Perez <fperez@colorado.edu>
3706
3721
3707 * IPython/iplib.py (InteractiveShell.interact): Added the original
3722 * IPython/iplib.py (InteractiveShell.interact): Added the original
3708 code from 'code.py' for this module in order to change the
3723 code from 'code.py' for this module in order to change the
3709 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3724 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3710 the history cache would break when the user hit Ctrl-C, and
3725 the history cache would break when the user hit Ctrl-C, and
3711 interact() offers no way to add any hooks to it.
3726 interact() offers no way to add any hooks to it.
3712
3727
3713 2001-12-23 Fernando Perez <fperez@colorado.edu>
3728 2001-12-23 Fernando Perez <fperez@colorado.edu>
3714
3729
3715 * setup.py: added check for 'MANIFEST' before trying to remove
3730 * setup.py: added check for 'MANIFEST' before trying to remove
3716 it. Thanks to Sean Reifschneider.
3731 it. Thanks to Sean Reifschneider.
3717
3732
3718 2001-12-22 Fernando Perez <fperez@colorado.edu>
3733 2001-12-22 Fernando Perez <fperez@colorado.edu>
3719
3734
3720 * Released 0.2.2.
3735 * Released 0.2.2.
3721
3736
3722 * Finished (reasonably) writing the manual. Later will add the
3737 * Finished (reasonably) writing the manual. Later will add the
3723 python-standard navigation stylesheets, but for the time being
3738 python-standard navigation stylesheets, but for the time being
3724 it's fairly complete. Distribution will include html and pdf
3739 it's fairly complete. Distribution will include html and pdf
3725 versions.
3740 versions.
3726
3741
3727 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3742 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3728 (MayaVi author).
3743 (MayaVi author).
3729
3744
3730 2001-12-21 Fernando Perez <fperez@colorado.edu>
3745 2001-12-21 Fernando Perez <fperez@colorado.edu>
3731
3746
3732 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3747 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3733 good public release, I think (with the manual and the distutils
3748 good public release, I think (with the manual and the distutils
3734 installer). The manual can use some work, but that can go
3749 installer). The manual can use some work, but that can go
3735 slowly. Otherwise I think it's quite nice for end users. Next
3750 slowly. Otherwise I think it's quite nice for end users. Next
3736 summer, rewrite the guts of it...
3751 summer, rewrite the guts of it...
3737
3752
3738 * Changed format of ipythonrc files to use whitespace as the
3753 * Changed format of ipythonrc files to use whitespace as the
3739 separator instead of an explicit '='. Cleaner.
3754 separator instead of an explicit '='. Cleaner.
3740
3755
3741 2001-12-20 Fernando Perez <fperez@colorado.edu>
3756 2001-12-20 Fernando Perez <fperez@colorado.edu>
3742
3757
3743 * Started a manual in LyX. For now it's just a quick merge of the
3758 * Started a manual in LyX. For now it's just a quick merge of the
3744 various internal docstrings and READMEs. Later it may grow into a
3759 various internal docstrings and READMEs. Later it may grow into a
3745 nice, full-blown manual.
3760 nice, full-blown manual.
3746
3761
3747 * Set up a distutils based installer. Installation should now be
3762 * Set up a distutils based installer. Installation should now be
3748 trivially simple for end-users.
3763 trivially simple for end-users.
3749
3764
3750 2001-12-11 Fernando Perez <fperez@colorado.edu>
3765 2001-12-11 Fernando Perez <fperez@colorado.edu>
3751
3766
3752 * Released 0.2.0. First public release, announced it at
3767 * Released 0.2.0. First public release, announced it at
3753 comp.lang.python. From now on, just bugfixes...
3768 comp.lang.python. From now on, just bugfixes...
3754
3769
3755 * Went through all the files, set copyright/license notices and
3770 * Went through all the files, set copyright/license notices and
3756 cleaned up things. Ready for release.
3771 cleaned up things. Ready for release.
3757
3772
3758 2001-12-10 Fernando Perez <fperez@colorado.edu>
3773 2001-12-10 Fernando Perez <fperez@colorado.edu>
3759
3774
3760 * Changed the first-time installer not to use tarfiles. It's more
3775 * Changed the first-time installer not to use tarfiles. It's more
3761 robust now and less unix-dependent. Also makes it easier for
3776 robust now and less unix-dependent. Also makes it easier for
3762 people to later upgrade versions.
3777 people to later upgrade versions.
3763
3778
3764 * Changed @exit to @abort to reflect the fact that it's pretty
3779 * Changed @exit to @abort to reflect the fact that it's pretty
3765 brutal (a sys.exit()). The difference between @abort and Ctrl-D
3780 brutal (a sys.exit()). The difference between @abort and Ctrl-D
3766 becomes significant only when IPyhton is embedded: in that case,
3781 becomes significant only when IPyhton is embedded: in that case,
3767 C-D closes IPython only, but @abort kills the enclosing program
3782 C-D closes IPython only, but @abort kills the enclosing program
3768 too (unless it had called IPython inside a try catching
3783 too (unless it had called IPython inside a try catching
3769 SystemExit).
3784 SystemExit).
3770
3785
3771 * Created Shell module which exposes the actuall IPython Shell
3786 * Created Shell module which exposes the actuall IPython Shell
3772 classes, currently the normal and the embeddable one. This at
3787 classes, currently the normal and the embeddable one. This at
3773 least offers a stable interface we won't need to change when
3788 least offers a stable interface we won't need to change when
3774 (later) the internals are rewritten. That rewrite will be confined
3789 (later) the internals are rewritten. That rewrite will be confined
3775 to iplib and ipmaker, but the Shell interface should remain as is.
3790 to iplib and ipmaker, but the Shell interface should remain as is.
3776
3791
3777 * Added embed module which offers an embeddable IPShell object,
3792 * Added embed module which offers an embeddable IPShell object,
3778 useful to fire up IPython *inside* a running program. Great for
3793 useful to fire up IPython *inside* a running program. Great for
3779 debugging or dynamical data analysis.
3794 debugging or dynamical data analysis.
3780
3795
3781 2001-12-08 Fernando Perez <fperez@colorado.edu>
3796 2001-12-08 Fernando Perez <fperez@colorado.edu>
3782
3797
3783 * Fixed small bug preventing seeing info from methods of defined
3798 * Fixed small bug preventing seeing info from methods of defined
3784 objects (incorrect namespace in _ofind()).
3799 objects (incorrect namespace in _ofind()).
3785
3800
3786 * Documentation cleanup. Moved the main usage docstrings to a
3801 * Documentation cleanup. Moved the main usage docstrings to a
3787 separate file, usage.py (cleaner to maintain, and hopefully in the
3802 separate file, usage.py (cleaner to maintain, and hopefully in the
3788 future some perlpod-like way of producing interactive, man and
3803 future some perlpod-like way of producing interactive, man and
3789 html docs out of it will be found).
3804 html docs out of it will be found).
3790
3805
3791 * Added @profile to see your profile at any time.
3806 * Added @profile to see your profile at any time.
3792
3807
3793 * Added @p as an alias for 'print'. It's especially convenient if
3808 * Added @p as an alias for 'print'. It's especially convenient if
3794 using automagic ('p x' prints x).
3809 using automagic ('p x' prints x).
3795
3810
3796 * Small cleanups and fixes after a pychecker run.
3811 * Small cleanups and fixes after a pychecker run.
3797
3812
3798 * Changed the @cd command to handle @cd - and @cd -<n> for
3813 * Changed the @cd command to handle @cd - and @cd -<n> for
3799 visiting any directory in _dh.
3814 visiting any directory in _dh.
3800
3815
3801 * Introduced _dh, a history of visited directories. @dhist prints
3816 * Introduced _dh, a history of visited directories. @dhist prints
3802 it out with numbers.
3817 it out with numbers.
3803
3818
3804 2001-12-07 Fernando Perez <fperez@colorado.edu>
3819 2001-12-07 Fernando Perez <fperez@colorado.edu>
3805
3820
3806 * Released 0.1.22
3821 * Released 0.1.22
3807
3822
3808 * Made initialization a bit more robust against invalid color
3823 * Made initialization a bit more robust against invalid color
3809 options in user input (exit, not traceback-crash).
3824 options in user input (exit, not traceback-crash).
3810
3825
3811 * Changed the bug crash reporter to write the report only in the
3826 * Changed the bug crash reporter to write the report only in the
3812 user's .ipython directory. That way IPython won't litter people's
3827 user's .ipython directory. That way IPython won't litter people's
3813 hard disks with crash files all over the place. Also print on
3828 hard disks with crash files all over the place. Also print on
3814 screen the necessary mail command.
3829 screen the necessary mail command.
3815
3830
3816 * With the new ultraTB, implemented LightBG color scheme for light
3831 * With the new ultraTB, implemented LightBG color scheme for light
3817 background terminals. A lot of people like white backgrounds, so I
3832 background terminals. A lot of people like white backgrounds, so I
3818 guess we should at least give them something readable.
3833 guess we should at least give them something readable.
3819
3834
3820 2001-12-06 Fernando Perez <fperez@colorado.edu>
3835 2001-12-06 Fernando Perez <fperez@colorado.edu>
3821
3836
3822 * Modified the structure of ultraTB. Now there's a proper class
3837 * Modified the structure of ultraTB. Now there's a proper class
3823 for tables of color schemes which allow adding schemes easily and
3838 for tables of color schemes which allow adding schemes easily and
3824 switching the active scheme without creating a new instance every
3839 switching the active scheme without creating a new instance every
3825 time (which was ridiculous). The syntax for creating new schemes
3840 time (which was ridiculous). The syntax for creating new schemes
3826 is also cleaner. I think ultraTB is finally done, with a clean
3841 is also cleaner. I think ultraTB is finally done, with a clean
3827 class structure. Names are also much cleaner (now there's proper
3842 class structure. Names are also much cleaner (now there's proper
3828 color tables, no need for every variable to also have 'color' in
3843 color tables, no need for every variable to also have 'color' in
3829 its name).
3844 its name).
3830
3845
3831 * Broke down genutils into separate files. Now genutils only
3846 * Broke down genutils into separate files. Now genutils only
3832 contains utility functions, and classes have been moved to their
3847 contains utility functions, and classes have been moved to their
3833 own files (they had enough independent functionality to warrant
3848 own files (they had enough independent functionality to warrant
3834 it): ConfigLoader, OutputTrap, Struct.
3849 it): ConfigLoader, OutputTrap, Struct.
3835
3850
3836 2001-12-05 Fernando Perez <fperez@colorado.edu>
3851 2001-12-05 Fernando Perez <fperez@colorado.edu>
3837
3852
3838 * IPython turns 21! Released version 0.1.21, as a candidate for
3853 * IPython turns 21! Released version 0.1.21, as a candidate for
3839 public consumption. If all goes well, release in a few days.
3854 public consumption. If all goes well, release in a few days.
3840
3855
3841 * Fixed path bug (files in Extensions/ directory wouldn't be found
3856 * Fixed path bug (files in Extensions/ directory wouldn't be found
3842 unless IPython/ was explicitly in sys.path).
3857 unless IPython/ was explicitly in sys.path).
3843
3858
3844 * Extended the FlexCompleter class as MagicCompleter to allow
3859 * Extended the FlexCompleter class as MagicCompleter to allow
3845 completion of @-starting lines.
3860 completion of @-starting lines.
3846
3861
3847 * Created __release__.py file as a central repository for release
3862 * Created __release__.py file as a central repository for release
3848 info that other files can read from.
3863 info that other files can read from.
3849
3864
3850 * Fixed small bug in logging: when logging was turned on in
3865 * Fixed small bug in logging: when logging was turned on in
3851 mid-session, old lines with special meanings (!@?) were being
3866 mid-session, old lines with special meanings (!@?) were being
3852 logged without the prepended comment, which is necessary since
3867 logged without the prepended comment, which is necessary since
3853 they are not truly valid python syntax. This should make session
3868 they are not truly valid python syntax. This should make session
3854 restores produce less errors.
3869 restores produce less errors.
3855
3870
3856 * The namespace cleanup forced me to make a FlexCompleter class
3871 * The namespace cleanup forced me to make a FlexCompleter class
3857 which is nothing but a ripoff of rlcompleter, but with selectable
3872 which is nothing but a ripoff of rlcompleter, but with selectable
3858 namespace (rlcompleter only works in __main__.__dict__). I'll try
3873 namespace (rlcompleter only works in __main__.__dict__). I'll try
3859 to submit a note to the authors to see if this change can be
3874 to submit a note to the authors to see if this change can be
3860 incorporated in future rlcompleter releases (Dec.6: done)
3875 incorporated in future rlcompleter releases (Dec.6: done)
3861
3876
3862 * More fixes to namespace handling. It was a mess! Now all
3877 * More fixes to namespace handling. It was a mess! Now all
3863 explicit references to __main__.__dict__ are gone (except when
3878 explicit references to __main__.__dict__ are gone (except when
3864 really needed) and everything is handled through the namespace
3879 really needed) and everything is handled through the namespace
3865 dicts in the IPython instance. We seem to be getting somewhere
3880 dicts in the IPython instance. We seem to be getting somewhere
3866 with this, finally...
3881 with this, finally...
3867
3882
3868 * Small documentation updates.
3883 * Small documentation updates.
3869
3884
3870 * Created the Extensions directory under IPython (with an
3885 * Created the Extensions directory under IPython (with an
3871 __init__.py). Put the PhysicalQ stuff there. This directory should
3886 __init__.py). Put the PhysicalQ stuff there. This directory should
3872 be used for all special-purpose extensions.
3887 be used for all special-purpose extensions.
3873
3888
3874 * File renaming:
3889 * File renaming:
3875 ipythonlib --> ipmaker
3890 ipythonlib --> ipmaker
3876 ipplib --> iplib
3891 ipplib --> iplib
3877 This makes a bit more sense in terms of what these files actually do.
3892 This makes a bit more sense in terms of what these files actually do.
3878
3893
3879 * Moved all the classes and functions in ipythonlib to ipplib, so
3894 * Moved all the classes and functions in ipythonlib to ipplib, so
3880 now ipythonlib only has make_IPython(). This will ease up its
3895 now ipythonlib only has make_IPython(). This will ease up its
3881 splitting in smaller functional chunks later.
3896 splitting in smaller functional chunks later.
3882
3897
3883 * Cleaned up (done, I think) output of @whos. Better column
3898 * Cleaned up (done, I think) output of @whos. Better column
3884 formatting, and now shows str(var) for as much as it can, which is
3899 formatting, and now shows str(var) for as much as it can, which is
3885 typically what one gets with a 'print var'.
3900 typically what one gets with a 'print var'.
3886
3901
3887 2001-12-04 Fernando Perez <fperez@colorado.edu>
3902 2001-12-04 Fernando Perez <fperez@colorado.edu>
3888
3903
3889 * Fixed namespace problems. Now builtin/IPyhton/user names get
3904 * Fixed namespace problems. Now builtin/IPyhton/user names get
3890 properly reported in their namespace. Internal namespace handling
3905 properly reported in their namespace. Internal namespace handling
3891 is finally getting decent (not perfect yet, but much better than
3906 is finally getting decent (not perfect yet, but much better than
3892 the ad-hoc mess we had).
3907 the ad-hoc mess we had).
3893
3908
3894 * Removed -exit option. If people just want to run a python
3909 * Removed -exit option. If people just want to run a python
3895 script, that's what the normal interpreter is for. Less
3910 script, that's what the normal interpreter is for. Less
3896 unnecessary options, less chances for bugs.
3911 unnecessary options, less chances for bugs.
3897
3912
3898 * Added a crash handler which generates a complete post-mortem if
3913 * Added a crash handler which generates a complete post-mortem if
3899 IPython crashes. This will help a lot in tracking bugs down the
3914 IPython crashes. This will help a lot in tracking bugs down the
3900 road.
3915 road.
3901
3916
3902 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
3917 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
3903 which were boud to functions being reassigned would bypass the
3918 which were boud to functions being reassigned would bypass the
3904 logger, breaking the sync of _il with the prompt counter. This
3919 logger, breaking the sync of _il with the prompt counter. This
3905 would then crash IPython later when a new line was logged.
3920 would then crash IPython later when a new line was logged.
3906
3921
3907 2001-12-02 Fernando Perez <fperez@colorado.edu>
3922 2001-12-02 Fernando Perez <fperez@colorado.edu>
3908
3923
3909 * Made IPython a package. This means people don't have to clutter
3924 * Made IPython a package. This means people don't have to clutter
3910 their sys.path with yet another directory. Changed the INSTALL
3925 their sys.path with yet another directory. Changed the INSTALL
3911 file accordingly.
3926 file accordingly.
3912
3927
3913 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
3928 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
3914 sorts its output (so @who shows it sorted) and @whos formats the
3929 sorts its output (so @who shows it sorted) and @whos formats the
3915 table according to the width of the first column. Nicer, easier to
3930 table according to the width of the first column. Nicer, easier to
3916 read. Todo: write a generic table_format() which takes a list of
3931 read. Todo: write a generic table_format() which takes a list of
3917 lists and prints it nicely formatted, with optional row/column
3932 lists and prints it nicely formatted, with optional row/column
3918 separators and proper padding and justification.
3933 separators and proper padding and justification.
3919
3934
3920 * Released 0.1.20
3935 * Released 0.1.20
3921
3936
3922 * Fixed bug in @log which would reverse the inputcache list (a
3937 * Fixed bug in @log which would reverse the inputcache list (a
3923 copy operation was missing).
3938 copy operation was missing).
3924
3939
3925 * Code cleanup. @config was changed to use page(). Better, since
3940 * Code cleanup. @config was changed to use page(). Better, since
3926 its output is always quite long.
3941 its output is always quite long.
3927
3942
3928 * Itpl is back as a dependency. I was having too many problems
3943 * Itpl is back as a dependency. I was having too many problems
3929 getting the parametric aliases to work reliably, and it's just
3944 getting the parametric aliases to work reliably, and it's just
3930 easier to code weird string operations with it than playing %()s
3945 easier to code weird string operations with it than playing %()s
3931 games. It's only ~6k, so I don't think it's too big a deal.
3946 games. It's only ~6k, so I don't think it's too big a deal.
3932
3947
3933 * Found (and fixed) a very nasty bug with history. !lines weren't
3948 * Found (and fixed) a very nasty bug with history. !lines weren't
3934 getting cached, and the out of sync caches would crash
3949 getting cached, and the out of sync caches would crash
3935 IPython. Fixed it by reorganizing the prefilter/handlers/logger
3950 IPython. Fixed it by reorganizing the prefilter/handlers/logger
3936 division of labor a bit better. Bug fixed, cleaner structure.
3951 division of labor a bit better. Bug fixed, cleaner structure.
3937
3952
3938 2001-12-01 Fernando Perez <fperez@colorado.edu>
3953 2001-12-01 Fernando Perez <fperez@colorado.edu>
3939
3954
3940 * Released 0.1.19
3955 * Released 0.1.19
3941
3956
3942 * Added option -n to @hist to prevent line number printing. Much
3957 * Added option -n to @hist to prevent line number printing. Much
3943 easier to copy/paste code this way.
3958 easier to copy/paste code this way.
3944
3959
3945 * Created global _il to hold the input list. Allows easy
3960 * Created global _il to hold the input list. Allows easy
3946 re-execution of blocks of code by slicing it (inspired by Janko's
3961 re-execution of blocks of code by slicing it (inspired by Janko's
3947 comment on 'macros').
3962 comment on 'macros').
3948
3963
3949 * Small fixes and doc updates.
3964 * Small fixes and doc updates.
3950
3965
3951 * Rewrote @history function (was @h). Renamed it to @hist, @h is
3966 * Rewrote @history function (was @h). Renamed it to @hist, @h is
3952 much too fragile with automagic. Handles properly multi-line
3967 much too fragile with automagic. Handles properly multi-line
3953 statements and takes parameters.
3968 statements and takes parameters.
3954
3969
3955 2001-11-30 Fernando Perez <fperez@colorado.edu>
3970 2001-11-30 Fernando Perez <fperez@colorado.edu>
3956
3971
3957 * Version 0.1.18 released.
3972 * Version 0.1.18 released.
3958
3973
3959 * Fixed nasty namespace bug in initial module imports.
3974 * Fixed nasty namespace bug in initial module imports.
3960
3975
3961 * Added copyright/license notes to all code files (except
3976 * Added copyright/license notes to all code files (except
3962 DPyGetOpt). For the time being, LGPL. That could change.
3977 DPyGetOpt). For the time being, LGPL. That could change.
3963
3978
3964 * Rewrote a much nicer README, updated INSTALL, cleaned up
3979 * Rewrote a much nicer README, updated INSTALL, cleaned up
3965 ipythonrc-* samples.
3980 ipythonrc-* samples.
3966
3981
3967 * Overall code/documentation cleanup. Basically ready for
3982 * Overall code/documentation cleanup. Basically ready for
3968 release. Only remaining thing: licence decision (LGPL?).
3983 release. Only remaining thing: licence decision (LGPL?).
3969
3984
3970 * Converted load_config to a class, ConfigLoader. Now recursion
3985 * Converted load_config to a class, ConfigLoader. Now recursion
3971 control is better organized. Doesn't include the same file twice.
3986 control is better organized. Doesn't include the same file twice.
3972
3987
3973 2001-11-29 Fernando Perez <fperez@colorado.edu>
3988 2001-11-29 Fernando Perez <fperez@colorado.edu>
3974
3989
3975 * Got input history working. Changed output history variables from
3990 * Got input history working. Changed output history variables from
3976 _p to _o so that _i is for input and _o for output. Just cleaner
3991 _p to _o so that _i is for input and _o for output. Just cleaner
3977 convention.
3992 convention.
3978
3993
3979 * Implemented parametric aliases. This pretty much allows the
3994 * Implemented parametric aliases. This pretty much allows the
3980 alias system to offer full-blown shell convenience, I think.
3995 alias system to offer full-blown shell convenience, I think.
3981
3996
3982 * Version 0.1.17 released, 0.1.18 opened.
3997 * Version 0.1.17 released, 0.1.18 opened.
3983
3998
3984 * dot_ipython/ipythonrc (alias): added documentation.
3999 * dot_ipython/ipythonrc (alias): added documentation.
3985 (xcolor): Fixed small bug (xcolors -> xcolor)
4000 (xcolor): Fixed small bug (xcolors -> xcolor)
3986
4001
3987 * Changed the alias system. Now alias is a magic command to define
4002 * Changed the alias system. Now alias is a magic command to define
3988 aliases just like the shell. Rationale: the builtin magics should
4003 aliases just like the shell. Rationale: the builtin magics should
3989 be there for things deeply connected to IPython's
4004 be there for things deeply connected to IPython's
3990 architecture. And this is a much lighter system for what I think
4005 architecture. And this is a much lighter system for what I think
3991 is the really important feature: allowing users to define quickly
4006 is the really important feature: allowing users to define quickly
3992 magics that will do shell things for them, so they can customize
4007 magics that will do shell things for them, so they can customize
3993 IPython easily to match their work habits. If someone is really
4008 IPython easily to match their work habits. If someone is really
3994 desperate to have another name for a builtin alias, they can
4009 desperate to have another name for a builtin alias, they can
3995 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4010 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
3996 works.
4011 works.
3997
4012
3998 2001-11-28 Fernando Perez <fperez@colorado.edu>
4013 2001-11-28 Fernando Perez <fperez@colorado.edu>
3999
4014
4000 * Changed @file so that it opens the source file at the proper
4015 * Changed @file so that it opens the source file at the proper
4001 line. Since it uses less, if your EDITOR environment is
4016 line. Since it uses less, if your EDITOR environment is
4002 configured, typing v will immediately open your editor of choice
4017 configured, typing v will immediately open your editor of choice
4003 right at the line where the object is defined. Not as quick as
4018 right at the line where the object is defined. Not as quick as
4004 having a direct @edit command, but for all intents and purposes it
4019 having a direct @edit command, but for all intents and purposes it
4005 works. And I don't have to worry about writing @edit to deal with
4020 works. And I don't have to worry about writing @edit to deal with
4006 all the editors, less does that.
4021 all the editors, less does that.
4007
4022
4008 * Version 0.1.16 released, 0.1.17 opened.
4023 * Version 0.1.16 released, 0.1.17 opened.
4009
4024
4010 * Fixed some nasty bugs in the page/page_dumb combo that could
4025 * Fixed some nasty bugs in the page/page_dumb combo that could
4011 crash IPython.
4026 crash IPython.
4012
4027
4013 2001-11-27 Fernando Perez <fperez@colorado.edu>
4028 2001-11-27 Fernando Perez <fperez@colorado.edu>
4014
4029
4015 * Version 0.1.15 released, 0.1.16 opened.
4030 * Version 0.1.15 released, 0.1.16 opened.
4016
4031
4017 * Finally got ? and ?? to work for undefined things: now it's
4032 * Finally got ? and ?? to work for undefined things: now it's
4018 possible to type {}.get? and get information about the get method
4033 possible to type {}.get? and get information about the get method
4019 of dicts, or os.path? even if only os is defined (so technically
4034 of dicts, or os.path? even if only os is defined (so technically
4020 os.path isn't). Works at any level. For example, after import os,
4035 os.path isn't). Works at any level. For example, after import os,
4021 os?, os.path?, os.path.abspath? all work. This is great, took some
4036 os?, os.path?, os.path.abspath? all work. This is great, took some
4022 work in _ofind.
4037 work in _ofind.
4023
4038
4024 * Fixed more bugs with logging. The sanest way to do it was to add
4039 * Fixed more bugs with logging. The sanest way to do it was to add
4025 to @log a 'mode' parameter. Killed two in one shot (this mode
4040 to @log a 'mode' parameter. Killed two in one shot (this mode
4026 option was a request of Janko's). I think it's finally clean
4041 option was a request of Janko's). I think it's finally clean
4027 (famous last words).
4042 (famous last words).
4028
4043
4029 * Added a page_dumb() pager which does a decent job of paging on
4044 * Added a page_dumb() pager which does a decent job of paging on
4030 screen, if better things (like less) aren't available. One less
4045 screen, if better things (like less) aren't available. One less
4031 unix dependency (someday maybe somebody will port this to
4046 unix dependency (someday maybe somebody will port this to
4032 windows).
4047 windows).
4033
4048
4034 * Fixed problem in magic_log: would lock of logging out if log
4049 * Fixed problem in magic_log: would lock of logging out if log
4035 creation failed (because it would still think it had succeeded).
4050 creation failed (because it would still think it had succeeded).
4036
4051
4037 * Improved the page() function using curses to auto-detect screen
4052 * Improved the page() function using curses to auto-detect screen
4038 size. Now it can make a much better decision on whether to print
4053 size. Now it can make a much better decision on whether to print
4039 or page a string. Option screen_length was modified: a value 0
4054 or page a string. Option screen_length was modified: a value 0
4040 means auto-detect, and that's the default now.
4055 means auto-detect, and that's the default now.
4041
4056
4042 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4057 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4043 go out. I'll test it for a few days, then talk to Janko about
4058 go out. I'll test it for a few days, then talk to Janko about
4044 licences and announce it.
4059 licences and announce it.
4045
4060
4046 * Fixed the length of the auto-generated ---> prompt which appears
4061 * Fixed the length of the auto-generated ---> prompt which appears
4047 for auto-parens and auto-quotes. Getting this right isn't trivial,
4062 for auto-parens and auto-quotes. Getting this right isn't trivial,
4048 with all the color escapes, different prompt types and optional
4063 with all the color escapes, different prompt types and optional
4049 separators. But it seems to be working in all the combinations.
4064 separators. But it seems to be working in all the combinations.
4050
4065
4051 2001-11-26 Fernando Perez <fperez@colorado.edu>
4066 2001-11-26 Fernando Perez <fperez@colorado.edu>
4052
4067
4053 * Wrote a regexp filter to get option types from the option names
4068 * Wrote a regexp filter to get option types from the option names
4054 string. This eliminates the need to manually keep two duplicate
4069 string. This eliminates the need to manually keep two duplicate
4055 lists.
4070 lists.
4056
4071
4057 * Removed the unneeded check_option_names. Now options are handled
4072 * Removed the unneeded check_option_names. Now options are handled
4058 in a much saner manner and it's easy to visually check that things
4073 in a much saner manner and it's easy to visually check that things
4059 are ok.
4074 are ok.
4060
4075
4061 * Updated version numbers on all files I modified to carry a
4076 * Updated version numbers on all files I modified to carry a
4062 notice so Janko and Nathan have clear version markers.
4077 notice so Janko and Nathan have clear version markers.
4063
4078
4064 * Updated docstring for ultraTB with my changes. I should send
4079 * Updated docstring for ultraTB with my changes. I should send
4065 this to Nathan.
4080 this to Nathan.
4066
4081
4067 * Lots of small fixes. Ran everything through pychecker again.
4082 * Lots of small fixes. Ran everything through pychecker again.
4068
4083
4069 * Made loading of deep_reload an cmd line option. If it's not too
4084 * Made loading of deep_reload an cmd line option. If it's not too
4070 kosher, now people can just disable it. With -nodeep_reload it's
4085 kosher, now people can just disable it. With -nodeep_reload it's
4071 still available as dreload(), it just won't overwrite reload().
4086 still available as dreload(), it just won't overwrite reload().
4072
4087
4073 * Moved many options to the no| form (-opt and -noopt
4088 * Moved many options to the no| form (-opt and -noopt
4074 accepted). Cleaner.
4089 accepted). Cleaner.
4075
4090
4076 * Changed magic_log so that if called with no parameters, it uses
4091 * Changed magic_log so that if called with no parameters, it uses
4077 'rotate' mode. That way auto-generated logs aren't automatically
4092 'rotate' mode. That way auto-generated logs aren't automatically
4078 over-written. For normal logs, now a backup is made if it exists
4093 over-written. For normal logs, now a backup is made if it exists
4079 (only 1 level of backups). A new 'backup' mode was added to the
4094 (only 1 level of backups). A new 'backup' mode was added to the
4080 Logger class to support this. This was a request by Janko.
4095 Logger class to support this. This was a request by Janko.
4081
4096
4082 * Added @logoff/@logon to stop/restart an active log.
4097 * Added @logoff/@logon to stop/restart an active log.
4083
4098
4084 * Fixed a lot of bugs in log saving/replay. It was pretty
4099 * Fixed a lot of bugs in log saving/replay. It was pretty
4085 broken. Now special lines (!@,/) appear properly in the command
4100 broken. Now special lines (!@,/) appear properly in the command
4086 history after a log replay.
4101 history after a log replay.
4087
4102
4088 * Tried and failed to implement full session saving via pickle. My
4103 * Tried and failed to implement full session saving via pickle. My
4089 idea was to pickle __main__.__dict__, but modules can't be
4104 idea was to pickle __main__.__dict__, but modules can't be
4090 pickled. This would be a better alternative to replaying logs, but
4105 pickled. This would be a better alternative to replaying logs, but
4091 seems quite tricky to get to work. Changed -session to be called
4106 seems quite tricky to get to work. Changed -session to be called
4092 -logplay, which more accurately reflects what it does. And if we
4107 -logplay, which more accurately reflects what it does. And if we
4093 ever get real session saving working, -session is now available.
4108 ever get real session saving working, -session is now available.
4094
4109
4095 * Implemented color schemes for prompts also. As for tracebacks,
4110 * Implemented color schemes for prompts also. As for tracebacks,
4096 currently only NoColor and Linux are supported. But now the
4111 currently only NoColor and Linux are supported. But now the
4097 infrastructure is in place, based on a generic ColorScheme
4112 infrastructure is in place, based on a generic ColorScheme
4098 class. So writing and activating new schemes both for the prompts
4113 class. So writing and activating new schemes both for the prompts
4099 and the tracebacks should be straightforward.
4114 and the tracebacks should be straightforward.
4100
4115
4101 * Version 0.1.13 released, 0.1.14 opened.
4116 * Version 0.1.13 released, 0.1.14 opened.
4102
4117
4103 * Changed handling of options for output cache. Now counter is
4118 * Changed handling of options for output cache. Now counter is
4104 hardwired starting at 1 and one specifies the maximum number of
4119 hardwired starting at 1 and one specifies the maximum number of
4105 entries *in the outcache* (not the max prompt counter). This is
4120 entries *in the outcache* (not the max prompt counter). This is
4106 much better, since many statements won't increase the cache
4121 much better, since many statements won't increase the cache
4107 count. It also eliminated some confusing options, now there's only
4122 count. It also eliminated some confusing options, now there's only
4108 one: cache_size.
4123 one: cache_size.
4109
4124
4110 * Added 'alias' magic function and magic_alias option in the
4125 * Added 'alias' magic function and magic_alias option in the
4111 ipythonrc file. Now the user can easily define whatever names he
4126 ipythonrc file. Now the user can easily define whatever names he
4112 wants for the magic functions without having to play weird
4127 wants for the magic functions without having to play weird
4113 namespace games. This gives IPython a real shell-like feel.
4128 namespace games. This gives IPython a real shell-like feel.
4114
4129
4115 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4130 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4116 @ or not).
4131 @ or not).
4117
4132
4118 This was one of the last remaining 'visible' bugs (that I know
4133 This was one of the last remaining 'visible' bugs (that I know
4119 of). I think if I can clean up the session loading so it works
4134 of). I think if I can clean up the session loading so it works
4120 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4135 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4121 about licensing).
4136 about licensing).
4122
4137
4123 2001-11-25 Fernando Perez <fperez@colorado.edu>
4138 2001-11-25 Fernando Perez <fperez@colorado.edu>
4124
4139
4125 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4140 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4126 there's a cleaner distinction between what ? and ?? show.
4141 there's a cleaner distinction between what ? and ?? show.
4127
4142
4128 * Added screen_length option. Now the user can define his own
4143 * Added screen_length option. Now the user can define his own
4129 screen size for page() operations.
4144 screen size for page() operations.
4130
4145
4131 * Implemented magic shell-like functions with automatic code
4146 * Implemented magic shell-like functions with automatic code
4132 generation. Now adding another function is just a matter of adding
4147 generation. Now adding another function is just a matter of adding
4133 an entry to a dict, and the function is dynamically generated at
4148 an entry to a dict, and the function is dynamically generated at
4134 run-time. Python has some really cool features!
4149 run-time. Python has some really cool features!
4135
4150
4136 * Renamed many options to cleanup conventions a little. Now all
4151 * Renamed many options to cleanup conventions a little. Now all
4137 are lowercase, and only underscores where needed. Also in the code
4152 are lowercase, and only underscores where needed. Also in the code
4138 option name tables are clearer.
4153 option name tables are clearer.
4139
4154
4140 * Changed prompts a little. Now input is 'In [n]:' instead of
4155 * Changed prompts a little. Now input is 'In [n]:' instead of
4141 'In[n]:='. This allows it the numbers to be aligned with the
4156 'In[n]:='. This allows it the numbers to be aligned with the
4142 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4157 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4143 Python (it was a Mathematica thing). The '...' continuation prompt
4158 Python (it was a Mathematica thing). The '...' continuation prompt
4144 was also changed a little to align better.
4159 was also changed a little to align better.
4145
4160
4146 * Fixed bug when flushing output cache. Not all _p<n> variables
4161 * Fixed bug when flushing output cache. Not all _p<n> variables
4147 exist, so their deletion needs to be wrapped in a try:
4162 exist, so their deletion needs to be wrapped in a try:
4148
4163
4149 * Figured out how to properly use inspect.formatargspec() (it
4164 * Figured out how to properly use inspect.formatargspec() (it
4150 requires the args preceded by *). So I removed all the code from
4165 requires the args preceded by *). So I removed all the code from
4151 _get_pdef in Magic, which was just replicating that.
4166 _get_pdef in Magic, which was just replicating that.
4152
4167
4153 * Added test to prefilter to allow redefining magic function names
4168 * Added test to prefilter to allow redefining magic function names
4154 as variables. This is ok, since the @ form is always available,
4169 as variables. This is ok, since the @ form is always available,
4155 but whe should allow the user to define a variable called 'ls' if
4170 but whe should allow the user to define a variable called 'ls' if
4156 he needs it.
4171 he needs it.
4157
4172
4158 * Moved the ToDo information from README into a separate ToDo.
4173 * Moved the ToDo information from README into a separate ToDo.
4159
4174
4160 * General code cleanup and small bugfixes. I think it's close to a
4175 * General code cleanup and small bugfixes. I think it's close to a
4161 state where it can be released, obviously with a big 'beta'
4176 state where it can be released, obviously with a big 'beta'
4162 warning on it.
4177 warning on it.
4163
4178
4164 * Got the magic function split to work. Now all magics are defined
4179 * Got the magic function split to work. Now all magics are defined
4165 in a separate class. It just organizes things a bit, and now
4180 in a separate class. It just organizes things a bit, and now
4166 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4181 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4167 was too long).
4182 was too long).
4168
4183
4169 * Changed @clear to @reset to avoid potential confusions with
4184 * Changed @clear to @reset to avoid potential confusions with
4170 the shell command clear. Also renamed @cl to @clear, which does
4185 the shell command clear. Also renamed @cl to @clear, which does
4171 exactly what people expect it to from their shell experience.
4186 exactly what people expect it to from their shell experience.
4172
4187
4173 Added a check to the @reset command (since it's so
4188 Added a check to the @reset command (since it's so
4174 destructive, it's probably a good idea to ask for confirmation).
4189 destructive, it's probably a good idea to ask for confirmation).
4175 But now reset only works for full namespace resetting. Since the
4190 But now reset only works for full namespace resetting. Since the
4176 del keyword is already there for deleting a few specific
4191 del keyword is already there for deleting a few specific
4177 variables, I don't see the point of having a redundant magic
4192 variables, I don't see the point of having a redundant magic
4178 function for the same task.
4193 function for the same task.
4179
4194
4180 2001-11-24 Fernando Perez <fperez@colorado.edu>
4195 2001-11-24 Fernando Perez <fperez@colorado.edu>
4181
4196
4182 * Updated the builtin docs (esp. the ? ones).
4197 * Updated the builtin docs (esp. the ? ones).
4183
4198
4184 * Ran all the code through pychecker. Not terribly impressed with
4199 * Ran all the code through pychecker. Not terribly impressed with
4185 it: lots of spurious warnings and didn't really find anything of
4200 it: lots of spurious warnings and didn't really find anything of
4186 substance (just a few modules being imported and not used).
4201 substance (just a few modules being imported and not used).
4187
4202
4188 * Implemented the new ultraTB functionality into IPython. New
4203 * Implemented the new ultraTB functionality into IPython. New
4189 option: xcolors. This chooses color scheme. xmode now only selects
4204 option: xcolors. This chooses color scheme. xmode now only selects
4190 between Plain and Verbose. Better orthogonality.
4205 between Plain and Verbose. Better orthogonality.
4191
4206
4192 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4207 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4193 mode and color scheme for the exception handlers. Now it's
4208 mode and color scheme for the exception handlers. Now it's
4194 possible to have the verbose traceback with no coloring.
4209 possible to have the verbose traceback with no coloring.
4195
4210
4196 2001-11-23 Fernando Perez <fperez@colorado.edu>
4211 2001-11-23 Fernando Perez <fperez@colorado.edu>
4197
4212
4198 * Version 0.1.12 released, 0.1.13 opened.
4213 * Version 0.1.12 released, 0.1.13 opened.
4199
4214
4200 * Removed option to set auto-quote and auto-paren escapes by
4215 * Removed option to set auto-quote and auto-paren escapes by
4201 user. The chances of breaking valid syntax are just too high. If
4216 user. The chances of breaking valid syntax are just too high. If
4202 someone *really* wants, they can always dig into the code.
4217 someone *really* wants, they can always dig into the code.
4203
4218
4204 * Made prompt separators configurable.
4219 * Made prompt separators configurable.
4205
4220
4206 2001-11-22 Fernando Perez <fperez@colorado.edu>
4221 2001-11-22 Fernando Perez <fperez@colorado.edu>
4207
4222
4208 * Small bugfixes in many places.
4223 * Small bugfixes in many places.
4209
4224
4210 * Removed the MyCompleter class from ipplib. It seemed redundant
4225 * Removed the MyCompleter class from ipplib. It seemed redundant
4211 with the C-p,C-n history search functionality. Less code to
4226 with the C-p,C-n history search functionality. Less code to
4212 maintain.
4227 maintain.
4213
4228
4214 * Moved all the original ipython.py code into ipythonlib.py. Right
4229 * Moved all the original ipython.py code into ipythonlib.py. Right
4215 now it's just one big dump into a function called make_IPython, so
4230 now it's just one big dump into a function called make_IPython, so
4216 no real modularity has been gained. But at least it makes the
4231 no real modularity has been gained. But at least it makes the
4217 wrapper script tiny, and since ipythonlib is a module, it gets
4232 wrapper script tiny, and since ipythonlib is a module, it gets
4218 compiled and startup is much faster.
4233 compiled and startup is much faster.
4219
4234
4220 This is a reasobably 'deep' change, so we should test it for a
4235 This is a reasobably 'deep' change, so we should test it for a
4221 while without messing too much more with the code.
4236 while without messing too much more with the code.
4222
4237
4223 2001-11-21 Fernando Perez <fperez@colorado.edu>
4238 2001-11-21 Fernando Perez <fperez@colorado.edu>
4224
4239
4225 * Version 0.1.11 released, 0.1.12 opened for further work.
4240 * Version 0.1.11 released, 0.1.12 opened for further work.
4226
4241
4227 * Removed dependency on Itpl. It was only needed in one place. It
4242 * Removed dependency on Itpl. It was only needed in one place. It
4228 would be nice if this became part of python, though. It makes life
4243 would be nice if this became part of python, though. It makes life
4229 *a lot* easier in some cases.
4244 *a lot* easier in some cases.
4230
4245
4231 * Simplified the prefilter code a bit. Now all handlers are
4246 * Simplified the prefilter code a bit. Now all handlers are
4232 expected to explicitly return a value (at least a blank string).
4247 expected to explicitly return a value (at least a blank string).
4233
4248
4234 * Heavy edits in ipplib. Removed the help system altogether. Now
4249 * Heavy edits in ipplib. Removed the help system altogether. Now
4235 obj?/?? is used for inspecting objects, a magic @doc prints
4250 obj?/?? is used for inspecting objects, a magic @doc prints
4236 docstrings, and full-blown Python help is accessed via the 'help'
4251 docstrings, and full-blown Python help is accessed via the 'help'
4237 keyword. This cleans up a lot of code (less to maintain) and does
4252 keyword. This cleans up a lot of code (less to maintain) and does
4238 the job. Since 'help' is now a standard Python component, might as
4253 the job. Since 'help' is now a standard Python component, might as
4239 well use it and remove duplicate functionality.
4254 well use it and remove duplicate functionality.
4240
4255
4241 Also removed the option to use ipplib as a standalone program. By
4256 Also removed the option to use ipplib as a standalone program. By
4242 now it's too dependent on other parts of IPython to function alone.
4257 now it's too dependent on other parts of IPython to function alone.
4243
4258
4244 * Fixed bug in genutils.pager. It would crash if the pager was
4259 * Fixed bug in genutils.pager. It would crash if the pager was
4245 exited immediately after opening (broken pipe).
4260 exited immediately after opening (broken pipe).
4246
4261
4247 * Trimmed down the VerboseTB reporting a little. The header is
4262 * Trimmed down the VerboseTB reporting a little. The header is
4248 much shorter now and the repeated exception arguments at the end
4263 much shorter now and the repeated exception arguments at the end
4249 have been removed. For interactive use the old header seemed a bit
4264 have been removed. For interactive use the old header seemed a bit
4250 excessive.
4265 excessive.
4251
4266
4252 * Fixed small bug in output of @whos for variables with multi-word
4267 * Fixed small bug in output of @whos for variables with multi-word
4253 types (only first word was displayed).
4268 types (only first word was displayed).
4254
4269
4255 2001-11-17 Fernando Perez <fperez@colorado.edu>
4270 2001-11-17 Fernando Perez <fperez@colorado.edu>
4256
4271
4257 * Version 0.1.10 released, 0.1.11 opened for further work.
4272 * Version 0.1.10 released, 0.1.11 opened for further work.
4258
4273
4259 * Modified dirs and friends. dirs now *returns* the stack (not
4274 * Modified dirs and friends. dirs now *returns* the stack (not
4260 prints), so one can manipulate it as a variable. Convenient to
4275 prints), so one can manipulate it as a variable. Convenient to
4261 travel along many directories.
4276 travel along many directories.
4262
4277
4263 * Fixed bug in magic_pdef: would only work with functions with
4278 * Fixed bug in magic_pdef: would only work with functions with
4264 arguments with default values.
4279 arguments with default values.
4265
4280
4266 2001-11-14 Fernando Perez <fperez@colorado.edu>
4281 2001-11-14 Fernando Perez <fperez@colorado.edu>
4267
4282
4268 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4283 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4269 example with IPython. Various other minor fixes and cleanups.
4284 example with IPython. Various other minor fixes and cleanups.
4270
4285
4271 * Version 0.1.9 released, 0.1.10 opened for further work.
4286 * Version 0.1.9 released, 0.1.10 opened for further work.
4272
4287
4273 * Added sys.path to the list of directories searched in the
4288 * Added sys.path to the list of directories searched in the
4274 execfile= option. It used to be the current directory and the
4289 execfile= option. It used to be the current directory and the
4275 user's IPYTHONDIR only.
4290 user's IPYTHONDIR only.
4276
4291
4277 2001-11-13 Fernando Perez <fperez@colorado.edu>
4292 2001-11-13 Fernando Perez <fperez@colorado.edu>
4278
4293
4279 * Reinstated the raw_input/prefilter separation that Janko had
4294 * Reinstated the raw_input/prefilter separation that Janko had
4280 initially. This gives a more convenient setup for extending the
4295 initially. This gives a more convenient setup for extending the
4281 pre-processor from the outside: raw_input always gets a string,
4296 pre-processor from the outside: raw_input always gets a string,
4282 and prefilter has to process it. We can then redefine prefilter
4297 and prefilter has to process it. We can then redefine prefilter
4283 from the outside and implement extensions for special
4298 from the outside and implement extensions for special
4284 purposes.
4299 purposes.
4285
4300
4286 Today I got one for inputting PhysicalQuantity objects
4301 Today I got one for inputting PhysicalQuantity objects
4287 (from Scientific) without needing any function calls at
4302 (from Scientific) without needing any function calls at
4288 all. Extremely convenient, and it's all done as a user-level
4303 all. Extremely convenient, and it's all done as a user-level
4289 extension (no IPython code was touched). Now instead of:
4304 extension (no IPython code was touched). Now instead of:
4290 a = PhysicalQuantity(4.2,'m/s**2')
4305 a = PhysicalQuantity(4.2,'m/s**2')
4291 one can simply say
4306 one can simply say
4292 a = 4.2 m/s**2
4307 a = 4.2 m/s**2
4293 or even
4308 or even
4294 a = 4.2 m/s^2
4309 a = 4.2 m/s^2
4295
4310
4296 I use this, but it's also a proof of concept: IPython really is
4311 I use this, but it's also a proof of concept: IPython really is
4297 fully user-extensible, even at the level of the parsing of the
4312 fully user-extensible, even at the level of the parsing of the
4298 command line. It's not trivial, but it's perfectly doable.
4313 command line. It's not trivial, but it's perfectly doable.
4299
4314
4300 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4315 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4301 the problem of modules being loaded in the inverse order in which
4316 the problem of modules being loaded in the inverse order in which
4302 they were defined in
4317 they were defined in
4303
4318
4304 * Version 0.1.8 released, 0.1.9 opened for further work.
4319 * Version 0.1.8 released, 0.1.9 opened for further work.
4305
4320
4306 * Added magics pdef, source and file. They respectively show the
4321 * Added magics pdef, source and file. They respectively show the
4307 definition line ('prototype' in C), source code and full python
4322 definition line ('prototype' in C), source code and full python
4308 file for any callable object. The object inspector oinfo uses
4323 file for any callable object. The object inspector oinfo uses
4309 these to show the same information.
4324 these to show the same information.
4310
4325
4311 * Version 0.1.7 released, 0.1.8 opened for further work.
4326 * Version 0.1.7 released, 0.1.8 opened for further work.
4312
4327
4313 * Separated all the magic functions into a class called Magic. The
4328 * Separated all the magic functions into a class called Magic. The
4314 InteractiveShell class was becoming too big for Xemacs to handle
4329 InteractiveShell class was becoming too big for Xemacs to handle
4315 (de-indenting a line would lock it up for 10 seconds while it
4330 (de-indenting a line would lock it up for 10 seconds while it
4316 backtracked on the whole class!)
4331 backtracked on the whole class!)
4317
4332
4318 FIXME: didn't work. It can be done, but right now namespaces are
4333 FIXME: didn't work. It can be done, but right now namespaces are
4319 all messed up. Do it later (reverted it for now, so at least
4334 all messed up. Do it later (reverted it for now, so at least
4320 everything works as before).
4335 everything works as before).
4321
4336
4322 * Got the object introspection system (magic_oinfo) working! I
4337 * Got the object introspection system (magic_oinfo) working! I
4323 think this is pretty much ready for release to Janko, so he can
4338 think this is pretty much ready for release to Janko, so he can
4324 test it for a while and then announce it. Pretty much 100% of what
4339 test it for a while and then announce it. Pretty much 100% of what
4325 I wanted for the 'phase 1' release is ready. Happy, tired.
4340 I wanted for the 'phase 1' release is ready. Happy, tired.
4326
4341
4327 2001-11-12 Fernando Perez <fperez@colorado.edu>
4342 2001-11-12 Fernando Perez <fperez@colorado.edu>
4328
4343
4329 * Version 0.1.6 released, 0.1.7 opened for further work.
4344 * Version 0.1.6 released, 0.1.7 opened for further work.
4330
4345
4331 * Fixed bug in printing: it used to test for truth before
4346 * Fixed bug in printing: it used to test for truth before
4332 printing, so 0 wouldn't print. Now checks for None.
4347 printing, so 0 wouldn't print. Now checks for None.
4333
4348
4334 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4349 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4335 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4350 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4336 reaches by hand into the outputcache. Think of a better way to do
4351 reaches by hand into the outputcache. Think of a better way to do
4337 this later.
4352 this later.
4338
4353
4339 * Various small fixes thanks to Nathan's comments.
4354 * Various small fixes thanks to Nathan's comments.
4340
4355
4341 * Changed magic_pprint to magic_Pprint. This way it doesn't
4356 * Changed magic_pprint to magic_Pprint. This way it doesn't
4342 collide with pprint() and the name is consistent with the command
4357 collide with pprint() and the name is consistent with the command
4343 line option.
4358 line option.
4344
4359
4345 * Changed prompt counter behavior to be fully like
4360 * Changed prompt counter behavior to be fully like
4346 Mathematica's. That is, even input that doesn't return a result
4361 Mathematica's. That is, even input that doesn't return a result
4347 raises the prompt counter. The old behavior was kind of confusing
4362 raises the prompt counter. The old behavior was kind of confusing
4348 (getting the same prompt number several times if the operation
4363 (getting the same prompt number several times if the operation
4349 didn't return a result).
4364 didn't return a result).
4350
4365
4351 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4366 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4352
4367
4353 * Fixed -Classic mode (wasn't working anymore).
4368 * Fixed -Classic mode (wasn't working anymore).
4354
4369
4355 * Added colored prompts using Nathan's new code. Colors are
4370 * Added colored prompts using Nathan's new code. Colors are
4356 currently hardwired, they can be user-configurable. For
4371 currently hardwired, they can be user-configurable. For
4357 developers, they can be chosen in file ipythonlib.py, at the
4372 developers, they can be chosen in file ipythonlib.py, at the
4358 beginning of the CachedOutput class def.
4373 beginning of the CachedOutput class def.
4359
4374
4360 2001-11-11 Fernando Perez <fperez@colorado.edu>
4375 2001-11-11 Fernando Perez <fperez@colorado.edu>
4361
4376
4362 * Version 0.1.5 released, 0.1.6 opened for further work.
4377 * Version 0.1.5 released, 0.1.6 opened for further work.
4363
4378
4364 * Changed magic_env to *return* the environment as a dict (not to
4379 * Changed magic_env to *return* the environment as a dict (not to
4365 print it). This way it prints, but it can also be processed.
4380 print it). This way it prints, but it can also be processed.
4366
4381
4367 * Added Verbose exception reporting to interactive
4382 * Added Verbose exception reporting to interactive
4368 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4383 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4369 traceback. Had to make some changes to the ultraTB file. This is
4384 traceback. Had to make some changes to the ultraTB file. This is
4370 probably the last 'big' thing in my mental todo list. This ties
4385 probably the last 'big' thing in my mental todo list. This ties
4371 in with the next entry:
4386 in with the next entry:
4372
4387
4373 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4388 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4374 has to specify is Plain, Color or Verbose for all exception
4389 has to specify is Plain, Color or Verbose for all exception
4375 handling.
4390 handling.
4376
4391
4377 * Removed ShellServices option. All this can really be done via
4392 * Removed ShellServices option. All this can really be done via
4378 the magic system. It's easier to extend, cleaner and has automatic
4393 the magic system. It's easier to extend, cleaner and has automatic
4379 namespace protection and documentation.
4394 namespace protection and documentation.
4380
4395
4381 2001-11-09 Fernando Perez <fperez@colorado.edu>
4396 2001-11-09 Fernando Perez <fperez@colorado.edu>
4382
4397
4383 * Fixed bug in output cache flushing (missing parameter to
4398 * Fixed bug in output cache flushing (missing parameter to
4384 __init__). Other small bugs fixed (found using pychecker).
4399 __init__). Other small bugs fixed (found using pychecker).
4385
4400
4386 * Version 0.1.4 opened for bugfixing.
4401 * Version 0.1.4 opened for bugfixing.
4387
4402
4388 2001-11-07 Fernando Perez <fperez@colorado.edu>
4403 2001-11-07 Fernando Perez <fperez@colorado.edu>
4389
4404
4390 * Version 0.1.3 released, mainly because of the raw_input bug.
4405 * Version 0.1.3 released, mainly because of the raw_input bug.
4391
4406
4392 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4407 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4393 and when testing for whether things were callable, a call could
4408 and when testing for whether things were callable, a call could
4394 actually be made to certain functions. They would get called again
4409 actually be made to certain functions. They would get called again
4395 once 'really' executed, with a resulting double call. A disaster
4410 once 'really' executed, with a resulting double call. A disaster
4396 in many cases (list.reverse() would never work!).
4411 in many cases (list.reverse() would never work!).
4397
4412
4398 * Removed prefilter() function, moved its code to raw_input (which
4413 * Removed prefilter() function, moved its code to raw_input (which
4399 after all was just a near-empty caller for prefilter). This saves
4414 after all was just a near-empty caller for prefilter). This saves
4400 a function call on every prompt, and simplifies the class a tiny bit.
4415 a function call on every prompt, and simplifies the class a tiny bit.
4401
4416
4402 * Fix _ip to __ip name in magic example file.
4417 * Fix _ip to __ip name in magic example file.
4403
4418
4404 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4419 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4405 work with non-gnu versions of tar.
4420 work with non-gnu versions of tar.
4406
4421
4407 2001-11-06 Fernando Perez <fperez@colorado.edu>
4422 2001-11-06 Fernando Perez <fperez@colorado.edu>
4408
4423
4409 * Version 0.1.2. Just to keep track of the recent changes.
4424 * Version 0.1.2. Just to keep track of the recent changes.
4410
4425
4411 * Fixed nasty bug in output prompt routine. It used to check 'if
4426 * Fixed nasty bug in output prompt routine. It used to check 'if
4412 arg != None...'. Problem is, this fails if arg implements a
4427 arg != None...'. Problem is, this fails if arg implements a
4413 special comparison (__cmp__) which disallows comparing to
4428 special comparison (__cmp__) which disallows comparing to
4414 None. Found it when trying to use the PhysicalQuantity module from
4429 None. Found it when trying to use the PhysicalQuantity module from
4415 ScientificPython.
4430 ScientificPython.
4416
4431
4417 2001-11-05 Fernando Perez <fperez@colorado.edu>
4432 2001-11-05 Fernando Perez <fperez@colorado.edu>
4418
4433
4419 * Also added dirs. Now the pushd/popd/dirs family functions
4434 * Also added dirs. Now the pushd/popd/dirs family functions
4420 basically like the shell, with the added convenience of going home
4435 basically like the shell, with the added convenience of going home
4421 when called with no args.
4436 when called with no args.
4422
4437
4423 * pushd/popd slightly modified to mimic shell behavior more
4438 * pushd/popd slightly modified to mimic shell behavior more
4424 closely.
4439 closely.
4425
4440
4426 * Added env,pushd,popd from ShellServices as magic functions. I
4441 * Added env,pushd,popd from ShellServices as magic functions. I
4427 think the cleanest will be to port all desired functions from
4442 think the cleanest will be to port all desired functions from
4428 ShellServices as magics and remove ShellServices altogether. This
4443 ShellServices as magics and remove ShellServices altogether. This
4429 will provide a single, clean way of adding functionality
4444 will provide a single, clean way of adding functionality
4430 (shell-type or otherwise) to IP.
4445 (shell-type or otherwise) to IP.
4431
4446
4432 2001-11-04 Fernando Perez <fperez@colorado.edu>
4447 2001-11-04 Fernando Perez <fperez@colorado.edu>
4433
4448
4434 * Added .ipython/ directory to sys.path. This way users can keep
4449 * Added .ipython/ directory to sys.path. This way users can keep
4435 customizations there and access them via import.
4450 customizations there and access them via import.
4436
4451
4437 2001-11-03 Fernando Perez <fperez@colorado.edu>
4452 2001-11-03 Fernando Perez <fperez@colorado.edu>
4438
4453
4439 * Opened version 0.1.1 for new changes.
4454 * Opened version 0.1.1 for new changes.
4440
4455
4441 * Changed version number to 0.1.0: first 'public' release, sent to
4456 * Changed version number to 0.1.0: first 'public' release, sent to
4442 Nathan and Janko.
4457 Nathan and Janko.
4443
4458
4444 * Lots of small fixes and tweaks.
4459 * Lots of small fixes and tweaks.
4445
4460
4446 * Minor changes to whos format. Now strings are shown, snipped if
4461 * Minor changes to whos format. Now strings are shown, snipped if
4447 too long.
4462 too long.
4448
4463
4449 * Changed ShellServices to work on __main__ so they show up in @who
4464 * Changed ShellServices to work on __main__ so they show up in @who
4450
4465
4451 * Help also works with ? at the end of a line:
4466 * Help also works with ? at the end of a line:
4452 ?sin and sin?
4467 ?sin and sin?
4453 both produce the same effect. This is nice, as often I use the
4468 both produce the same effect. This is nice, as often I use the
4454 tab-complete to find the name of a method, but I used to then have
4469 tab-complete to find the name of a method, but I used to then have
4455 to go to the beginning of the line to put a ? if I wanted more
4470 to go to the beginning of the line to put a ? if I wanted more
4456 info. Now I can just add the ? and hit return. Convenient.
4471 info. Now I can just add the ? and hit return. Convenient.
4457
4472
4458 2001-11-02 Fernando Perez <fperez@colorado.edu>
4473 2001-11-02 Fernando Perez <fperez@colorado.edu>
4459
4474
4460 * Python version check (>=2.1) added.
4475 * Python version check (>=2.1) added.
4461
4476
4462 * Added LazyPython documentation. At this point the docs are quite
4477 * Added LazyPython documentation. At this point the docs are quite
4463 a mess. A cleanup is in order.
4478 a mess. A cleanup is in order.
4464
4479
4465 * Auto-installer created. For some bizarre reason, the zipfiles
4480 * Auto-installer created. For some bizarre reason, the zipfiles
4466 module isn't working on my system. So I made a tar version
4481 module isn't working on my system. So I made a tar version
4467 (hopefully the command line options in various systems won't kill
4482 (hopefully the command line options in various systems won't kill
4468 me).
4483 me).
4469
4484
4470 * Fixes to Struct in genutils. Now all dictionary-like methods are
4485 * Fixes to Struct in genutils. Now all dictionary-like methods are
4471 protected (reasonably).
4486 protected (reasonably).
4472
4487
4473 * Added pager function to genutils and changed ? to print usage
4488 * Added pager function to genutils and changed ? to print usage
4474 note through it (it was too long).
4489 note through it (it was too long).
4475
4490
4476 * Added the LazyPython functionality. Works great! I changed the
4491 * Added the LazyPython functionality. Works great! I changed the
4477 auto-quote escape to ';', it's on home row and next to '. But
4492 auto-quote escape to ';', it's on home row and next to '. But
4478 both auto-quote and auto-paren (still /) escapes are command-line
4493 both auto-quote and auto-paren (still /) escapes are command-line
4479 parameters.
4494 parameters.
4480
4495
4481
4496
4482 2001-11-01 Fernando Perez <fperez@colorado.edu>
4497 2001-11-01 Fernando Perez <fperez@colorado.edu>
4483
4498
4484 * Version changed to 0.0.7. Fairly large change: configuration now
4499 * Version changed to 0.0.7. Fairly large change: configuration now
4485 is all stored in a directory, by default .ipython. There, all
4500 is all stored in a directory, by default .ipython. There, all
4486 config files have normal looking names (not .names)
4501 config files have normal looking names (not .names)
4487
4502
4488 * Version 0.0.6 Released first to Lucas and Archie as a test
4503 * Version 0.0.6 Released first to Lucas and Archie as a test
4489 run. Since it's the first 'semi-public' release, change version to
4504 run. Since it's the first 'semi-public' release, change version to
4490 > 0.0.6 for any changes now.
4505 > 0.0.6 for any changes now.
4491
4506
4492 * Stuff I had put in the ipplib.py changelog:
4507 * Stuff I had put in the ipplib.py changelog:
4493
4508
4494 Changes to InteractiveShell:
4509 Changes to InteractiveShell:
4495
4510
4496 - Made the usage message a parameter.
4511 - Made the usage message a parameter.
4497
4512
4498 - Require the name of the shell variable to be given. It's a bit
4513 - Require the name of the shell variable to be given. It's a bit
4499 of a hack, but allows the name 'shell' not to be hardwire in the
4514 of a hack, but allows the name 'shell' not to be hardwire in the
4500 magic (@) handler, which is problematic b/c it requires
4515 magic (@) handler, which is problematic b/c it requires
4501 polluting the global namespace with 'shell'. This in turn is
4516 polluting the global namespace with 'shell'. This in turn is
4502 fragile: if a user redefines a variable called shell, things
4517 fragile: if a user redefines a variable called shell, things
4503 break.
4518 break.
4504
4519
4505 - magic @: all functions available through @ need to be defined
4520 - magic @: all functions available through @ need to be defined
4506 as magic_<name>, even though they can be called simply as
4521 as magic_<name>, even though they can be called simply as
4507 @<name>. This allows the special command @magic to gather
4522 @<name>. This allows the special command @magic to gather
4508 information automatically about all existing magic functions,
4523 information automatically about all existing magic functions,
4509 even if they are run-time user extensions, by parsing the shell
4524 even if they are run-time user extensions, by parsing the shell
4510 instance __dict__ looking for special magic_ names.
4525 instance __dict__ looking for special magic_ names.
4511
4526
4512 - mainloop: added *two* local namespace parameters. This allows
4527 - mainloop: added *two* local namespace parameters. This allows
4513 the class to differentiate between parameters which were there
4528 the class to differentiate between parameters which were there
4514 before and after command line initialization was processed. This
4529 before and after command line initialization was processed. This
4515 way, later @who can show things loaded at startup by the
4530 way, later @who can show things loaded at startup by the
4516 user. This trick was necessary to make session saving/reloading
4531 user. This trick was necessary to make session saving/reloading
4517 really work: ideally after saving/exiting/reloading a session,
4532 really work: ideally after saving/exiting/reloading a session,
4518 *everythin* should look the same, including the output of @who. I
4533 *everythin* should look the same, including the output of @who. I
4519 was only able to make this work with this double namespace
4534 was only able to make this work with this double namespace
4520 trick.
4535 trick.
4521
4536
4522 - added a header to the logfile which allows (almost) full
4537 - added a header to the logfile which allows (almost) full
4523 session restoring.
4538 session restoring.
4524
4539
4525 - prepend lines beginning with @ or !, with a and log
4540 - prepend lines beginning with @ or !, with a and log
4526 them. Why? !lines: may be useful to know what you did @lines:
4541 them. Why? !lines: may be useful to know what you did @lines:
4527 they may affect session state. So when restoring a session, at
4542 they may affect session state. So when restoring a session, at
4528 least inform the user of their presence. I couldn't quite get
4543 least inform the user of their presence. I couldn't quite get
4529 them to properly re-execute, but at least the user is warned.
4544 them to properly re-execute, but at least the user is warned.
4530
4545
4531 * Started ChangeLog.
4546 * Started ChangeLog.
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now