##// END OF EJS Templates
First round of 'complete_command' hook, implements customizable command line ...
vivainio -
Show More
@@ -0,0 +1,47 b''
1 """ Tab completion support for a couple of linux package managers
2
3 This is also an example of how to write custom completer plugins
4 or hooks.
5
6 Practical use:
7
8 [ipython]|1> import ipy_linux_package_managers
9 [ipython]|2> apt-get u<<< press tab here >>>
10 update upgrade
11 [ipython]|2> apt-get up
12
13 """
14 import IPython.ipapi
15
16 ip = IPython.ipapi.get()
17
18 def apt_completers(self, event):
19 """ This should return a list of strings with possible completions.
20
21 Note that all the included strings that don't start with event.symbol
22 are removed, in order to not confuse readline.
23
24 """
25 # print event # dbg
26
27 # commands are only suggested for the 'command' part of package manager
28 # invocation
29
30 cmd = (event.line + "<placeholder>").rsplit(None,1)[0]
31 # print cmd
32 if cmd.endswith('apt-get') or cmd.endswith('yum'):
33 return ['update', 'upgrade', 'install', 'remove']
34
35 # later on, add dpkg -l / whatever to get list of possible
36 # packages, add switches etc. for the rest of command line
37 # filling
38
39 raise IPython.ipapi.TryNext
40
41
42 # re_key specifies the regexp that triggers the specified completer
43
44 ip.set_hook('complete_command', apt_completers, re_key = '.*apt-get')
45
46 ip.set_hook('complete_command', apt_completers, re_key = '.*yum')
47 No newline at end of file
@@ -0,0 +1,57 b''
1 from IPython.hooks import CommandChainDispatcher
2 import IPython.hooks
3
4 import re
5
6 class StrDispatch(object):
7 """ Dispatch (lookup) a set of strings / regexps for match """
8 def __init__(self):
9 self.strs = {}
10 self.regexs = {}
11 def add_s(self, s, obj, priority= 0 ):
12 """ Adds a target 'string' for dispatching """
13
14 chain = self.strs.get(s, CommandChainDispatcher())
15 chain.add(obj,priority)
16 self.strs[s] = chain
17
18 def add_re(self, regex, obj, priority= 0 ):
19 """ Adds a target regexp for dispatching """
20
21 chain = self.regexs.get(regex, CommandChainDispatcher())
22 chain.add(obj,priority)
23 self.regexs[regex] = chain
24
25 def dispatch(self, key):
26 """ Get a seq of Commandchain objects that match key """
27 if key in self.strs:
28 yield self.strs[key]
29
30 for r, obj in self.regexs.items():
31 if re.match(r, key):
32 yield obj
33 else:
34 #print "nomatch",key
35 pass
36
37
38 def __repr__(self):
39 return "<Strdispatch %s, %s>" % (self.strs, self.regexs)
40 def flat_matches(self, key):
41 """ Yield all 'value' targets, without priority """
42 for val in self.dispatch(key):
43 for el in val:
44 yield el[1] # only value, no priority
45 return
46
47
48 def test():
49 d = StrDispatch()
50 d.add_s('hei',34, priority = 4)
51 d.add_s('hei',123, priority = 2)
52 print list(d.dispatch('hei'))
53 d.add_re('h.i', 686)
54 print list(d.flat_matches('hei'))
55
56 if __name__ == '__main__':
57 test() No newline at end of file
@@ -1,72 +1,72 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 One of Python's nicest features is its interactive interpreter. This allows
5 One of Python's nicest features is its interactive interpreter. This allows
6 very fast testing of ideas without the overhead of creating test files as is
6 very fast testing of ideas without the overhead of creating test files as is
7 typical in most programming languages. However, the interpreter supplied with
7 typical in most programming languages. However, the interpreter supplied with
8 the standard Python distribution is fairly primitive (and IDLE isn't really
8 the standard Python distribution is fairly primitive (and IDLE isn't really
9 much better).
9 much better).
10
10
11 IPython tries to:
11 IPython tries to:
12
12
13 i - provide an efficient environment for interactive work in Python
13 i - provide an efficient environment for interactive work in Python
14 programming. It tries to address what we see as shortcomings of the standard
14 programming. It tries to address what we see as shortcomings of the standard
15 Python prompt, and adds many features to make interactive work much more
15 Python prompt, and adds many features to make interactive work much more
16 efficient.
16 efficient.
17
17
18 ii - offer a flexible framework so that it can be used as the base
18 ii - offer a flexible framework so that it can be used as the base
19 environment for other projects and problems where Python can be the
19 environment for other projects and problems where Python can be the
20 underlying language. Specifically scientific environments like Mathematica,
20 underlying language. Specifically scientific environments like Mathematica,
21 IDL and Mathcad inspired its design, but similar ideas can be useful in many
21 IDL and Mathcad inspired its design, but similar ideas can be useful in many
22 fields. Python is a fabulous language for implementing this kind of system
22 fields. Python is a fabulous language for implementing this kind of system
23 (due to its dynamic and introspective features), and with suitable libraries
23 (due to its dynamic and introspective features), and with suitable libraries
24 entire systems could be built leveraging Python's power.
24 entire systems could be built leveraging Python's power.
25
25
26 iii - serve as an embeddable, ready to go interpreter for your own programs.
26 iii - serve as an embeddable, ready to go interpreter for your own programs.
27
27
28 IPython requires Python 2.3 or newer.
28 IPython requires Python 2.3 or newer.
29
29
30 $Id: __init__.py 1328 2006-05-25 07:47:56Z fperez $"""
30 $Id: __init__.py 1854 2006-10-30 19:54:25Z vivainio $"""
31
31
32 #*****************************************************************************
32 #*****************************************************************************
33 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
33 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
34 #
34 #
35 # Distributed under the terms of the BSD License. The full license is in
35 # Distributed under the terms of the BSD License. The full license is in
36 # the file COPYING, distributed as part of this software.
36 # the file COPYING, distributed as part of this software.
37 #*****************************************************************************
37 #*****************************************************************************
38
38
39 # Enforce proper version requirements
39 # Enforce proper version requirements
40 import sys
40 import sys
41
41
42 if sys.version[0:3] < '2.3':
42 if sys.version[0:3] < '2.3':
43 raise ImportError('Python Version 2.3 or above is required for IPython.')
43 raise ImportError('Python Version 2.3 or above is required for IPython.')
44
44
45 # Make it easy to import extensions - they are always directly on pythonpath.
45 # Make it easy to import extensions - they are always directly on pythonpath.
46 # Therefore, non-IPython modules can be added to Extensions directory
46 # Therefore, non-IPython modules can be added to Extensions directory
47 import os
47 import os
48 sys.path.append(os.path.dirname(__file__) + "/Extensions")
48 sys.path.append(os.path.dirname(__file__) + "/Extensions")
49
49
50 # Define what gets imported with a 'from IPython import *'
50 # Define what gets imported with a 'from IPython import *'
51 __all__ = ['deep_reload','genutils','ipstruct','ultraTB','DPyGetOpt',
51 __all__ = ['deep_reload','genutils','ipstruct','ultraTB','DPyGetOpt',
52 'Itpl','hooks','ConfigLoader','OutputTrap','Release','Shell',
52 'Itpl','hooks','ConfigLoader','OutputTrap','Release','Shell',
53 'platutils','platutils_win32','platutils_posix','platutils_dummy',
53 'platutils','platutils_win32','platutils_posix','platutils_dummy',
54 'ipapi','rlineimpl']
54 'ipapi','rlineimpl', 'strdispatch']
55
55
56 # Load __all__ in IPython namespace so that a simple 'import IPython' gives
56 # Load __all__ in IPython namespace so that a simple 'import IPython' gives
57 # access to them via IPython.<name>
57 # access to them via IPython.<name>
58 glob,loc = globals(),locals()
58 glob,loc = globals(),locals()
59 for name in __all__:
59 for name in __all__:
60 __import__(name,glob,loc,[])
60 __import__(name,glob,loc,[])
61
61
62 # Release data
62 # Release data
63 from IPython import Release # do it explicitly so pydoc can see it - pydoc bug
63 from IPython import Release # do it explicitly so pydoc can see it - pydoc bug
64 __author__ = '%s <%s>\n%s <%s>\n%s <%s>' % \
64 __author__ = '%s <%s>\n%s <%s>\n%s <%s>' % \
65 ( Release.authors['Fernando'] + Release.authors['Janko'] + \
65 ( Release.authors['Fernando'] + Release.authors['Janko'] + \
66 Release.authors['Nathan'] )
66 Release.authors['Nathan'] )
67 __license__ = Release.license
67 __license__ = Release.license
68 __version__ = Release.version
68 __version__ = Release.version
69 __revision__ = Release.revision
69 __revision__ = Release.revision
70
70
71 # Namespace cleanup
71 # Namespace cleanup
72 del name,glob,loc
72 del name,glob,loc
@@ -1,581 +1,608 b''
1 """Word completion for IPython.
1 """Word completion for IPython.
2
2
3 This module is a fork of the rlcompleter module in the Python standard
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
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
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
6 functionality specific to IPython, so this module will continue to live as an
7 IPython-specific utility.
7 IPython-specific utility.
8
8
9 ---------------------------------------------------------------------------
9 ---------------------------------------------------------------------------
10 Original rlcompleter documentation:
10 Original rlcompleter documentation:
11
11
12 This requires the latest extension to the readline module (the
12 This requires the latest extension to the readline module (the
13 completes keywords, built-ins and globals in __main__; when completing
13 completes keywords, built-ins and globals in __main__; when completing
14 NAME.NAME..., it evaluates (!) the expression up to the last dot and
14 NAME.NAME..., it evaluates (!) the expression up to the last dot and
15 completes its attributes.
15 completes its attributes.
16
16
17 It's very cool to do "import string" type "string.", hit the
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
18 completion key (twice), and see the list of names defined by the
19 string module!
19 string module!
20
20
21 Tip: to use the tab key as the completion key, call
21 Tip: to use the tab key as the completion key, call
22
22
23 readline.parse_and_bind("tab: complete")
23 readline.parse_and_bind("tab: complete")
24
24
25 Notes:
25 Notes:
26
26
27 - Exceptions raised by the completer function are *ignored* (and
27 - Exceptions raised by the completer function are *ignored* (and
28 generally cause the completion to fail). This is a feature -- since
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
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,
30 traceback wouldn't work well without some complicated hoopla to save,
31 reset and restore the tty state.
31 reset and restore the tty state.
32
32
33 - The evaluation of the NAME.NAME... form may cause arbitrary
33 - The evaluation of the NAME.NAME... form may cause arbitrary
34 application defined code to be executed if an object with a
34 application defined code to be executed if an object with a
35 __getattr__ hook is found. Since it is the responsibility of the
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
36 application (or the user) to enable this feature, I consider this an
37 acceptable risk. More complicated expressions (e.g. function calls or
37 acceptable risk. More complicated expressions (e.g. function calls or
38 indexing operations) are *not* evaluated.
38 indexing operations) are *not* evaluated.
39
39
40 - GNU readline is also used by the built-in functions input() and
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
41 raw_input(), and thus these also benefit/suffer from the completer
42 features. Clearly an interactive application can benefit by
42 features. Clearly an interactive application can benefit by
43 specifying its own completer function and using raw_input() for all
43 specifying its own completer function and using raw_input() for all
44 its input.
44 its input.
45
45
46 - When the original stdin is not a tty device, GNU readline is never
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.
47 used, and this module (and the readline module) are silently inactive.
48
48
49 """
49 """
50
50
51 #*****************************************************************************
51 #*****************************************************************************
52 #
52 #
53 # Since this file is essentially a minimally modified copy of the rlcompleter
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
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
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).
56 # Software Foundation (in addition to my own, for all new code).
57 #
57 #
58 # Copyright (C) 2001 Python Software Foundation, www.python.org
58 # Copyright (C) 2001 Python Software Foundation, www.python.org
59 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
59 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
60 #
60 #
61 # Distributed under the terms of the BSD License. The full license is in
61 # Distributed under the terms of the BSD License. The full license is in
62 # the file COPYING, distributed as part of this software.
62 # the file COPYING, distributed as part of this software.
63 #
63 #
64 #*****************************************************************************
64 #*****************************************************************************
65
65
66 import __builtin__
66 import __builtin__
67 import __main__
67 import __main__
68 import glob
68 import glob
69 import keyword
69 import keyword
70 import os
70 import os
71 import re
71 import re
72 import shlex
72 import shlex
73 import sys
73 import sys
74 import IPython.rlineimpl as readline
74 import IPython.rlineimpl as readline
75 from IPython.ipstruct import Struct
76 from IPython import ipapi
75
77
76 import types
78 import types
77
79
78 # Python 2.4 offers sets as a builtin
80 # Python 2.4 offers sets as a builtin
79 try:
81 try:
80 set([1,2])
82 set([1,2])
81 except NameError:
83 except NameError:
82 from sets import Set as set
84 from sets import Set as set
83
85
84 from IPython.genutils import debugx
86 from IPython.genutils import debugx
85
87
86 __all__ = ['Completer','IPCompleter']
88 __all__ = ['Completer','IPCompleter']
87
89
88 def get_class_members(cls):
90 def get_class_members(cls):
89 ret = dir(cls)
91 ret = dir(cls)
90 if hasattr(cls,'__bases__'):
92 if hasattr(cls,'__bases__'):
91 for base in cls.__bases__:
93 for base in cls.__bases__:
92 ret.extend(get_class_members(base))
94 ret.extend(get_class_members(base))
93 return ret
95 return ret
94
96
95 class Completer:
97 class Completer:
96 def __init__(self,namespace=None,global_namespace=None):
98 def __init__(self,namespace=None,global_namespace=None):
97 """Create a new completer for the command line.
99 """Create a new completer for the command line.
98
100
99 Completer([namespace,global_namespace]) -> completer instance.
101 Completer([namespace,global_namespace]) -> completer instance.
100
102
101 If unspecified, the default namespace where completions are performed
103 If unspecified, the default namespace where completions are performed
102 is __main__ (technically, __main__.__dict__). Namespaces should be
104 is __main__ (technically, __main__.__dict__). Namespaces should be
103 given as dictionaries.
105 given as dictionaries.
104
106
105 An optional second namespace can be given. This allows the completer
107 An optional second namespace can be given. This allows the completer
106 to handle cases where both the local and global scopes need to be
108 to handle cases where both the local and global scopes need to be
107 distinguished.
109 distinguished.
108
110
109 Completer instances should be used as the completion mechanism of
111 Completer instances should be used as the completion mechanism of
110 readline via the set_completer() call:
112 readline via the set_completer() call:
111
113
112 readline.set_completer(Completer(my_namespace).complete)
114 readline.set_completer(Completer(my_namespace).complete)
113 """
115 """
114
116
115 # some minimal strict typechecks. For some core data structures, I
117 # some minimal strict typechecks. For some core data structures, I
116 # want actual basic python types, not just anything that looks like
118 # want actual basic python types, not just anything that looks like
117 # one. This is especially true for namespaces.
119 # one. This is especially true for namespaces.
118 for ns in (namespace,global_namespace):
120 for ns in (namespace,global_namespace):
119 if ns is not None and type(ns) != types.DictType:
121 if ns is not None and type(ns) != types.DictType:
120 raise TypeError,'namespace must be a dictionary'
122 raise TypeError,'namespace must be a dictionary'
121
123
122 # Don't bind to namespace quite yet, but flag whether the user wants a
124 # Don't bind to namespace quite yet, but flag whether the user wants a
123 # specific namespace or to use __main__.__dict__. This will allow us
125 # specific namespace or to use __main__.__dict__. This will allow us
124 # to bind to __main__.__dict__ at completion time, not now.
126 # to bind to __main__.__dict__ at completion time, not now.
125 if namespace is None:
127 if namespace is None:
126 self.use_main_ns = 1
128 self.use_main_ns = 1
127 else:
129 else:
128 self.use_main_ns = 0
130 self.use_main_ns = 0
129 self.namespace = namespace
131 self.namespace = namespace
130
132
131 # The global namespace, if given, can be bound directly
133 # The global namespace, if given, can be bound directly
132 if global_namespace is None:
134 if global_namespace is None:
133 self.global_namespace = {}
135 self.global_namespace = {}
134 else:
136 else:
135 self.global_namespace = global_namespace
137 self.global_namespace = global_namespace
136
138
137 def complete(self, text, state):
139 def complete(self, text, state):
138 """Return the next possible completion for 'text'.
140 """Return the next possible completion for 'text'.
139
141
140 This is called successively with state == 0, 1, 2, ... until it
142 This is called successively with state == 0, 1, 2, ... until it
141 returns None. The completion should begin with 'text'.
143 returns None. The completion should begin with 'text'.
142
144
143 """
145 """
144 if self.use_main_ns:
146 if self.use_main_ns:
145 self.namespace = __main__.__dict__
147 self.namespace = __main__.__dict__
146
148
147 if state == 0:
149 if state == 0:
148 if "." in text:
150 if "." in text:
149 self.matches = self.attr_matches(text)
151 self.matches = self.attr_matches(text)
150 else:
152 else:
151 self.matches = self.global_matches(text)
153 self.matches = self.global_matches(text)
152 try:
154 try:
153 return self.matches[state]
155 return self.matches[state]
154 except IndexError:
156 except IndexError:
155 return None
157 return None
156
158
157 def global_matches(self, text):
159 def global_matches(self, text):
158 """Compute matches when text is a simple name.
160 """Compute matches when text is a simple name.
159
161
160 Return a list of all keywords, built-in functions and names currently
162 Return a list of all keywords, built-in functions and names currently
161 defined in self.namespace or self.global_namespace that match.
163 defined in self.namespace or self.global_namespace that match.
162
164
163 """
165 """
164 matches = []
166 matches = []
165 match_append = matches.append
167 match_append = matches.append
166 n = len(text)
168 n = len(text)
167 for lst in [keyword.kwlist,
169 for lst in [keyword.kwlist,
168 __builtin__.__dict__.keys(),
170 __builtin__.__dict__.keys(),
169 self.namespace.keys(),
171 self.namespace.keys(),
170 self.global_namespace.keys()]:
172 self.global_namespace.keys()]:
171 for word in lst:
173 for word in lst:
172 if word[:n] == text and word != "__builtins__":
174 if word[:n] == text and word != "__builtins__":
173 match_append(word)
175 match_append(word)
174 return matches
176 return matches
175
177
176 def attr_matches(self, text):
178 def attr_matches(self, text):
177 """Compute matches when text contains a dot.
179 """Compute matches when text contains a dot.
178
180
179 Assuming the text is of the form NAME.NAME....[NAME], and is
181 Assuming the text is of the form NAME.NAME....[NAME], and is
180 evaluatable in self.namespace or self.global_namespace, it will be
182 evaluatable in self.namespace or self.global_namespace, it will be
181 evaluated and its attributes (as revealed by dir()) are used as
183 evaluated and its attributes (as revealed by dir()) are used as
182 possible completions. (For class instances, class members are are
184 possible completions. (For class instances, class members are are
183 also considered.)
185 also considered.)
184
186
185 WARNING: this can still invoke arbitrary C code, if an object
187 WARNING: this can still invoke arbitrary C code, if an object
186 with a __getattr__ hook is evaluated.
188 with a __getattr__ hook is evaluated.
187
189
188 """
190 """
189 import re
191 import re
190
192
191 # Another option, seems to work great. Catches things like ''.<tab>
193 # Another option, seems to work great. Catches things like ''.<tab>
192 m = re.match(r"(\S+(\.\w+)*)\.(\w*)$", text)
194 m = re.match(r"(\S+(\.\w+)*)\.(\w*)$", text)
193
195
194 if not m:
196 if not m:
195 return []
197 return []
196
198
197 expr, attr = m.group(1, 3)
199 expr, attr = m.group(1, 3)
198 try:
200 try:
199 object = eval(expr, self.namespace)
201 object = eval(expr, self.namespace)
200 except:
202 except:
201 object = eval(expr, self.global_namespace)
203 object = eval(expr, self.global_namespace)
202
204
203 # Start building the attribute list via dir(), and then complete it
205 # Start building the attribute list via dir(), and then complete it
204 # with a few extra special-purpose calls.
206 # with a few extra special-purpose calls.
205 words = dir(object)
207 words = dir(object)
206
208
207 if hasattr(object,'__class__'):
209 if hasattr(object,'__class__'):
208 words.append('__class__')
210 words.append('__class__')
209 words.extend(get_class_members(object.__class__))
211 words.extend(get_class_members(object.__class__))
210
212
211 # this is the 'dir' function for objects with Enthought's traits
213 # this is the 'dir' function for objects with Enthought's traits
212 if hasattr(object, 'trait_names'):
214 if hasattr(object, 'trait_names'):
213 try:
215 try:
214 words.extend(object.trait_names())
216 words.extend(object.trait_names())
215 # eliminate possible duplicates, as some traits may also
217 # eliminate possible duplicates, as some traits may also
216 # appear as normal attributes in the dir() call.
218 # appear as normal attributes in the dir() call.
217 words = set(words)
219 words = set(words)
218 except TypeError:
220 except TypeError:
219 # This will happen if `object` is a class and not an instance.
221 # This will happen if `object` is a class and not an instance.
220 pass
222 pass
221
223
222 # Support for PyCrust-style _getAttributeNames magic method.
224 # Support for PyCrust-style _getAttributeNames magic method.
223 if hasattr(object, '_getAttributeNames'):
225 if hasattr(object, '_getAttributeNames'):
224 try:
226 try:
225 words.extend(object._getAttributeNames())
227 words.extend(object._getAttributeNames())
226 # Eliminate duplicates.
228 # Eliminate duplicates.
227 words = set(words)
229 words = set(words)
228 except TypeError:
230 except TypeError:
229 # `object` is a class and not an instance. Ignore
231 # `object` is a class and not an instance. Ignore
230 # this error.
232 # this error.
231 pass
233 pass
232
234
233 # filter out non-string attributes which may be stuffed by dir() calls
235 # filter out non-string attributes which may be stuffed by dir() calls
234 # and poor coding in third-party modules
236 # and poor coding in third-party modules
235 words = [w for w in words
237 words = [w for w in words
236 if isinstance(w, basestring) and w != "__builtins__"]
238 if isinstance(w, basestring) and w != "__builtins__"]
237 # Build match list to return
239 # Build match list to return
238 n = len(attr)
240 n = len(attr)
239 return ["%s.%s" % (expr, w) for w in words if w[:n] == attr ]
241 return ["%s.%s" % (expr, w) for w in words if w[:n] == attr ]
240
242
241 class IPCompleter(Completer):
243 class IPCompleter(Completer):
242 """Extension of the completer class with IPython-specific features"""
244 """Extension of the completer class with IPython-specific features"""
243
245
244 def __init__(self,shell,namespace=None,global_namespace=None,
246 def __init__(self,shell,namespace=None,global_namespace=None,
245 omit__names=0,alias_table=None):
247 omit__names=0,alias_table=None):
246 """IPCompleter() -> completer
248 """IPCompleter() -> completer
247
249
248 Return a completer object suitable for use by the readline library
250 Return a completer object suitable for use by the readline library
249 via readline.set_completer().
251 via readline.set_completer().
250
252
251 Inputs:
253 Inputs:
252
254
253 - shell: a pointer to the ipython shell itself. This is needed
255 - shell: a pointer to the ipython shell itself. This is needed
254 because this completer knows about magic functions, and those can
256 because this completer knows about magic functions, and those can
255 only be accessed via the ipython instance.
257 only be accessed via the ipython instance.
256
258
257 - namespace: an optional dict where completions are performed.
259 - namespace: an optional dict where completions are performed.
258
260
259 - global_namespace: secondary optional dict for completions, to
261 - global_namespace: secondary optional dict for completions, to
260 handle cases (such as IPython embedded inside functions) where
262 handle cases (such as IPython embedded inside functions) where
261 both Python scopes are visible.
263 both Python scopes are visible.
262
264
263 - The optional omit__names parameter sets the completer to omit the
265 - The optional omit__names parameter sets the completer to omit the
264 'magic' names (__magicname__) for python objects unless the text
266 'magic' names (__magicname__) for python objects unless the text
265 to be completed explicitly starts with one or more underscores.
267 to be completed explicitly starts with one or more underscores.
266
268
267 - If alias_table is supplied, it should be a dictionary of aliases
269 - If alias_table is supplied, it should be a dictionary of aliases
268 to complete. """
270 to complete. """
269
271
270 Completer.__init__(self,namespace,global_namespace)
272 Completer.__init__(self,namespace,global_namespace)
271 self.magic_prefix = shell.name+'.magic_'
273 self.magic_prefix = shell.name+'.magic_'
272 self.magic_escape = shell.ESC_MAGIC
274 self.magic_escape = shell.ESC_MAGIC
273 self.readline = readline
275 self.readline = readline
274 delims = self.readline.get_completer_delims()
276 delims = self.readline.get_completer_delims()
275 delims = delims.replace(self.magic_escape,'')
277 delims = delims.replace(self.magic_escape,'')
276 self.readline.set_completer_delims(delims)
278 self.readline.set_completer_delims(delims)
277 self.get_line_buffer = self.readline.get_line_buffer
279 self.get_line_buffer = self.readline.get_line_buffer
278 self.omit__names = omit__names
280 self.omit__names = omit__names
279 self.merge_completions = shell.rc.readline_merge_completions
281 self.merge_completions = shell.rc.readline_merge_completions
280
282
281 if alias_table is None:
283 if alias_table is None:
282 alias_table = {}
284 alias_table = {}
283 self.alias_table = alias_table
285 self.alias_table = alias_table
284 # Regexp to split filenames with spaces in them
286 # Regexp to split filenames with spaces in them
285 self.space_name_re = re.compile(r'([^\\] )')
287 self.space_name_re = re.compile(r'([^\\] )')
286 # Hold a local ref. to glob.glob for speed
288 # Hold a local ref. to glob.glob for speed
287 self.glob = glob.glob
289 self.glob = glob.glob
288
290
289 # Determine if we are running on 'dumb' terminals, like (X)Emacs
291 # Determine if we are running on 'dumb' terminals, like (X)Emacs
290 # buffers, to avoid completion problems.
292 # buffers, to avoid completion problems.
291 term = os.environ.get('TERM','xterm')
293 term = os.environ.get('TERM','xterm')
292 self.dumb_terminal = term in ['dumb','emacs']
294 self.dumb_terminal = term in ['dumb','emacs']
293
295
294 # Special handling of backslashes needed in win32 platforms
296 # Special handling of backslashes needed in win32 platforms
295 if sys.platform == "win32":
297 if sys.platform == "win32":
296 self.clean_glob = self._clean_glob_win32
298 self.clean_glob = self._clean_glob_win32
297 else:
299 else:
298 self.clean_glob = self._clean_glob
300 self.clean_glob = self._clean_glob
299 self.matchers = [self.python_matches,
301 self.matchers = [self.python_matches,
300 self.file_matches,
302 self.file_matches,
301 self.alias_matches,
303 self.alias_matches,
302 self.python_func_kw_matches]
304 self.python_func_kw_matches]
303
305
304 # Code contributed by Alex Schmolck, for ipython/emacs integration
306 # Code contributed by Alex Schmolck, for ipython/emacs integration
305 def all_completions(self, text):
307 def all_completions(self, text):
306 """Return all possible completions for the benefit of emacs."""
308 """Return all possible completions for the benefit of emacs."""
307
309
308 completions = []
310 completions = []
309 comp_append = completions.append
311 comp_append = completions.append
310 try:
312 try:
311 for i in xrange(sys.maxint):
313 for i in xrange(sys.maxint):
312 res = self.complete(text, i)
314 res = self.complete(text, i)
313
315
314 if not res: break
316 if not res: break
315
317
316 comp_append(res)
318 comp_append(res)
317 #XXX workaround for ``notDefined.<tab>``
319 #XXX workaround for ``notDefined.<tab>``
318 except NameError:
320 except NameError:
319 pass
321 pass
320 return completions
322 return completions
321 # /end Alex Schmolck code.
323 # /end Alex Schmolck code.
322
324
323 def _clean_glob(self,text):
325 def _clean_glob(self,text):
324 return self.glob("%s*" % text)
326 return self.glob("%s*" % text)
325
327
326 def _clean_glob_win32(self,text):
328 def _clean_glob_win32(self,text):
327 return [f.replace("\\","/")
329 return [f.replace("\\","/")
328 for f in self.glob("%s*" % text)]
330 for f in self.glob("%s*" % text)]
329
331
330 def file_matches(self, text):
332 def file_matches(self, text):
331 """Match filneames, expanding ~USER type strings.
333 """Match filneames, expanding ~USER type strings.
332
334
333 Most of the seemingly convoluted logic in this completer is an
335 Most of the seemingly convoluted logic in this completer is an
334 attempt to handle filenames with spaces in them. And yet it's not
336 attempt to handle filenames with spaces in them. And yet it's not
335 quite perfect, because Python's readline doesn't expose all of the
337 quite perfect, because Python's readline doesn't expose all of the
336 GNU readline details needed for this to be done correctly.
338 GNU readline details needed for this to be done correctly.
337
339
338 For a filename with a space in it, the printed completions will be
340 For a filename with a space in it, the printed completions will be
339 only the parts after what's already been typed (instead of the
341 only the parts after what's already been typed (instead of the
340 full completions, as is normally done). I don't think with the
342 full completions, as is normally done). I don't think with the
341 current (as of Python 2.3) Python readline it's possible to do
343 current (as of Python 2.3) Python readline it's possible to do
342 better."""
344 better."""
343
345
344 #print 'Completer->file_matches: <%s>' % text # dbg
346 # print 'Completer->file_matches: <%s>' % text # dbg
345
347
346 # chars that require escaping with backslash - i.e. chars
348 # chars that require escaping with backslash - i.e. chars
347 # that readline treats incorrectly as delimiters, but we
349 # that readline treats incorrectly as delimiters, but we
348 # don't want to treat as delimiters in filename matching
350 # don't want to treat as delimiters in filename matching
349 # when escaped with backslash
351 # when escaped with backslash
350
352
351 protectables = ' ()[]{}'
353 protectables = ' ()[]{}'
352
354
353 def protect_filename(s):
355 def protect_filename(s):
354 return "".join([(ch in protectables and '\\' + ch or ch)
356 return "".join([(ch in protectables and '\\' + ch or ch)
355 for ch in s])
357 for ch in s])
356
358
357 lbuf = self.lbuf
359 lbuf = self.lbuf
358 open_quotes = 0 # track strings with open quotes
360 open_quotes = 0 # track strings with open quotes
359 try:
361 try:
360 lsplit = shlex.split(lbuf)[-1]
362 lsplit = shlex.split(lbuf)[-1]
361 except ValueError:
363 except ValueError:
362 # typically an unmatched ", or backslash without escaped char.
364 # typically an unmatched ", or backslash without escaped char.
363 if lbuf.count('"')==1:
365 if lbuf.count('"')==1:
364 open_quotes = 1
366 open_quotes = 1
365 lsplit = lbuf.split('"')[-1]
367 lsplit = lbuf.split('"')[-1]
366 elif lbuf.count("'")==1:
368 elif lbuf.count("'")==1:
367 open_quotes = 1
369 open_quotes = 1
368 lsplit = lbuf.split("'")[-1]
370 lsplit = lbuf.split("'")[-1]
369 else:
371 else:
370 return None
372 return None
371 except IndexError:
373 except IndexError:
372 # tab pressed on empty line
374 # tab pressed on empty line
373 lsplit = ""
375 lsplit = ""
374
376
375 if lsplit != protect_filename(lsplit):
377 if lsplit != protect_filename(lsplit):
376 # if protectables are found, do matching on the whole escaped
378 # if protectables are found, do matching on the whole escaped
377 # name
379 # name
378 has_protectables = 1
380 has_protectables = 1
379 text0,text = text,lsplit
381 text0,text = text,lsplit
380 else:
382 else:
381 has_protectables = 0
383 has_protectables = 0
382 text = os.path.expanduser(text)
384 text = os.path.expanduser(text)
383
385
384 if text == "":
386 if text == "":
385 return [protect_filename(f) for f in self.glob("*")]
387 return [protect_filename(f) for f in self.glob("*")]
386
388
387 m0 = self.clean_glob(text.replace('\\',''))
389 m0 = self.clean_glob(text.replace('\\',''))
388 if has_protectables:
390 if has_protectables:
389 # If we had protectables, we need to revert our changes to the
391 # If we had protectables, we need to revert our changes to the
390 # beginning of filename so that we don't double-write the part
392 # beginning of filename so that we don't double-write the part
391 # of the filename we have so far
393 # of the filename we have so far
392 len_lsplit = len(lsplit)
394 len_lsplit = len(lsplit)
393 matches = [text0 + protect_filename(f[len_lsplit:]) for f in m0]
395 matches = [text0 + protect_filename(f[len_lsplit:]) for f in m0]
394 else:
396 else:
395 if open_quotes:
397 if open_quotes:
396 # if we have a string with an open quote, we don't need to
398 # if we have a string with an open quote, we don't need to
397 # protect the names at all (and we _shouldn't_, as it
399 # protect the names at all (and we _shouldn't_, as it
398 # would cause bugs when the filesystem call is made).
400 # would cause bugs when the filesystem call is made).
399 matches = m0
401 matches = m0
400 else:
402 else:
401 matches = [protect_filename(f) for f in m0]
403 matches = [protect_filename(f) for f in m0]
402 if len(matches) == 1 and os.path.isdir(matches[0]):
404 if len(matches) == 1 and os.path.isdir(matches[0]):
403 # Takes care of links to directories also. Use '/'
405 # Takes care of links to directories also. Use '/'
404 # explicitly, even under Windows, so that name completions
406 # explicitly, even under Windows, so that name completions
405 # don't end up escaped.
407 # don't end up escaped.
406 matches[0] += '/'
408 matches[0] += '/'
407 return matches
409 return matches
408
410
409 def alias_matches(self, text):
411 def alias_matches(self, text):
410 """Match internal system aliases"""
412 """Match internal system aliases"""
411 #print 'Completer->alias_matches:',text,'lb',self.lbuf # dbg
413 #print 'Completer->alias_matches:',text,'lb',self.lbuf # dbg
412
414
413 # if we are not in the first 'item', alias matching
415 # if we are not in the first 'item', alias matching
414 # doesn't make sense
416 # doesn't make sense
415 if ' ' in self.lbuf:
417 if ' ' in self.lbuf:
416 return []
418 return []
417 text = os.path.expanduser(text)
419 text = os.path.expanduser(text)
418 aliases = self.alias_table.keys()
420 aliases = self.alias_table.keys()
419 if text == "":
421 if text == "":
420 return aliases
422 return aliases
421 else:
423 else:
422 return [alias for alias in aliases if alias.startswith(text)]
424 return [alias for alias in aliases if alias.startswith(text)]
423
425
424 def python_matches(self,text):
426 def python_matches(self,text):
425 """Match attributes or global python names"""
427 """Match attributes or global python names"""
426
428
427 #print 'Completer->python_matches, txt=<%s>' % text # dbg
429 #print 'Completer->python_matches, txt=<%s>' % text # dbg
428 if "." in text:
430 if "." in text:
429 try:
431 try:
430 matches = self.attr_matches(text)
432 matches = self.attr_matches(text)
431 if text.endswith('.') and self.omit__names:
433 if text.endswith('.') and self.omit__names:
432 if self.omit__names == 1:
434 if self.omit__names == 1:
433 # true if txt is _not_ a __ name, false otherwise:
435 # true if txt is _not_ a __ name, false otherwise:
434 no__name = (lambda txt:
436 no__name = (lambda txt:
435 re.match(r'.*\.__.*?__',txt) is None)
437 re.match(r'.*\.__.*?__',txt) is None)
436 else:
438 else:
437 # true if txt is _not_ a _ name, false otherwise:
439 # true if txt is _not_ a _ name, false otherwise:
438 no__name = (lambda txt:
440 no__name = (lambda txt:
439 re.match(r'.*\._.*?',txt) is None)
441 re.match(r'.*\._.*?',txt) is None)
440 matches = filter(no__name, matches)
442 matches = filter(no__name, matches)
441 except NameError:
443 except NameError:
442 # catches <undefined attributes>.<tab>
444 # catches <undefined attributes>.<tab>
443 matches = []
445 matches = []
444 else:
446 else:
445 matches = self.global_matches(text)
447 matches = self.global_matches(text)
446 # this is so completion finds magics when automagic is on:
448 # this is so completion finds magics when automagic is on:
447 if (matches == [] and
449 if (matches == [] and
448 not text.startswith(os.sep) and
450 not text.startswith(os.sep) and
449 not ' ' in self.lbuf):
451 not ' ' in self.lbuf):
450 matches = self.attr_matches(self.magic_prefix+text)
452 matches = self.attr_matches(self.magic_prefix+text)
451 return matches
453 return matches
452
454
453 def _default_arguments(self, obj):
455 def _default_arguments(self, obj):
454 """Return the list of default arguments of obj if it is callable,
456 """Return the list of default arguments of obj if it is callable,
455 or empty list otherwise."""
457 or empty list otherwise."""
456
458
457 if not (inspect.isfunction(obj) or inspect.ismethod(obj)):
459 if not (inspect.isfunction(obj) or inspect.ismethod(obj)):
458 # for classes, check for __init__,__new__
460 # for classes, check for __init__,__new__
459 if inspect.isclass(obj):
461 if inspect.isclass(obj):
460 obj = (getattr(obj,'__init__',None) or
462 obj = (getattr(obj,'__init__',None) or
461 getattr(obj,'__new__',None))
463 getattr(obj,'__new__',None))
462 # for all others, check if they are __call__able
464 # for all others, check if they are __call__able
463 elif hasattr(obj, '__call__'):
465 elif hasattr(obj, '__call__'):
464 obj = obj.__call__
466 obj = obj.__call__
465 # XXX: is there a way to handle the builtins ?
467 # XXX: is there a way to handle the builtins ?
466 try:
468 try:
467 args,_,_1,defaults = inspect.getargspec(obj)
469 args,_,_1,defaults = inspect.getargspec(obj)
468 if defaults:
470 if defaults:
469 return args[-len(defaults):]
471 return args[-len(defaults):]
470 except TypeError: pass
472 except TypeError: pass
471 return []
473 return []
472
474
473 def python_func_kw_matches(self,text):
475 def python_func_kw_matches(self,text):
474 """Match named parameters (kwargs) of the last open function"""
476 """Match named parameters (kwargs) of the last open function"""
475
477
476 if "." in text: # a parameter cannot be dotted
478 if "." in text: # a parameter cannot be dotted
477 return []
479 return []
478 try: regexp = self.__funcParamsRegex
480 try: regexp = self.__funcParamsRegex
479 except AttributeError:
481 except AttributeError:
480 regexp = self.__funcParamsRegex = re.compile(r'''
482 regexp = self.__funcParamsRegex = re.compile(r'''
481 '.*?' | # single quoted strings or
483 '.*?' | # single quoted strings or
482 ".*?" | # double quoted strings or
484 ".*?" | # double quoted strings or
483 \w+ | # identifier
485 \w+ | # identifier
484 \S # other characters
486 \S # other characters
485 ''', re.VERBOSE | re.DOTALL)
487 ''', re.VERBOSE | re.DOTALL)
486 # 1. find the nearest identifier that comes before an unclosed
488 # 1. find the nearest identifier that comes before an unclosed
487 # parenthesis e.g. for "foo (1+bar(x), pa", the candidate is "foo"
489 # parenthesis e.g. for "foo (1+bar(x), pa", the candidate is "foo"
488 tokens = regexp.findall(self.get_line_buffer())
490 tokens = regexp.findall(self.get_line_buffer())
489 tokens.reverse()
491 tokens.reverse()
490 iterTokens = iter(tokens); openPar = 0
492 iterTokens = iter(tokens); openPar = 0
491 for token in iterTokens:
493 for token in iterTokens:
492 if token == ')':
494 if token == ')':
493 openPar -= 1
495 openPar -= 1
494 elif token == '(':
496 elif token == '(':
495 openPar += 1
497 openPar += 1
496 if openPar > 0:
498 if openPar > 0:
497 # found the last unclosed parenthesis
499 # found the last unclosed parenthesis
498 break
500 break
499 else:
501 else:
500 return []
502 return []
501 # 2. Concatenate dotted names ("foo.bar" for "foo.bar(x, pa" )
503 # 2. Concatenate dotted names ("foo.bar" for "foo.bar(x, pa" )
502 ids = []
504 ids = []
503 isId = re.compile(r'\w+$').match
505 isId = re.compile(r'\w+$').match
504 while True:
506 while True:
505 try:
507 try:
506 ids.append(iterTokens.next())
508 ids.append(iterTokens.next())
507 if not isId(ids[-1]):
509 if not isId(ids[-1]):
508 ids.pop(); break
510 ids.pop(); break
509 if not iterTokens.next() == '.':
511 if not iterTokens.next() == '.':
510 break
512 break
511 except StopIteration:
513 except StopIteration:
512 break
514 break
513 # lookup the candidate callable matches either using global_matches
515 # lookup the candidate callable matches either using global_matches
514 # or attr_matches for dotted names
516 # or attr_matches for dotted names
515 if len(ids) == 1:
517 if len(ids) == 1:
516 callableMatches = self.global_matches(ids[0])
518 callableMatches = self.global_matches(ids[0])
517 else:
519 else:
518 callableMatches = self.attr_matches('.'.join(ids[::-1]))
520 callableMatches = self.attr_matches('.'.join(ids[::-1]))
519 argMatches = []
521 argMatches = []
520 for callableMatch in callableMatches:
522 for callableMatch in callableMatches:
521 try: namedArgs = self._default_arguments(eval(callableMatch,
523 try: namedArgs = self._default_arguments(eval(callableMatch,
522 self.namespace))
524 self.namespace))
523 except: continue
525 except: continue
524 for namedArg in namedArgs:
526 for namedArg in namedArgs:
525 if namedArg.startswith(text):
527 if namedArg.startswith(text):
526 argMatches.append("%s=" %namedArg)
528 argMatches.append("%s=" %namedArg)
527 return argMatches
529 return argMatches
528
530
531 def dispatch_custom_completer(self,text):
532 # print "Custom! '%s' %s" % (text, self.custom_completers) # dbg
533 line = self.lbuf
534 event = Struct()
535 event.line = line
536 event.symbol = text
537 event.command = None
538 for c in self.custom_completers.flat_matches(self.lbuf):
539 # print "try",c # dbg
540 try:
541 res = c(event)
542 return [r for r in res if r.startswith(text)]
543 except ipapi.TryNext:
544 pass
545
546 return None
547
548
549
529 def complete(self, text, state):
550 def complete(self, text, state):
530 """Return the next possible completion for 'text'.
551 """Return the next possible completion for 'text'.
531
552
532 This is called successively with state == 0, 1, 2, ... until it
553 This is called successively with state == 0, 1, 2, ... until it
533 returns None. The completion should begin with 'text'. """
554 returns None. The completion should begin with 'text'. """
534
555
535 #print '\n*** COMPLETE: <%s> (%s)' % (text,state) # dbg
556 #print '\n*** COMPLETE: <%s> (%s)' % (text,state) # dbg
536
557
537 # if there is only a tab on a line with only whitespace, instead
558 # if there is only a tab on a line with only whitespace, instead
538 # of the mostly useless 'do you want to see all million
559 # of the mostly useless 'do you want to see all million
539 # completions' message, just do the right thing and give the user
560 # completions' message, just do the right thing and give the user
540 # his tab! Incidentally, this enables pasting of tabbed text from
561 # his tab! Incidentally, this enables pasting of tabbed text from
541 # an editor (as long as autoindent is off).
562 # an editor (as long as autoindent is off).
542
563
543 # don't apply this on 'dumb' terminals, such as emacs buffers, so we
564 # don't apply this on 'dumb' terminals, such as emacs buffers, so we
544 # don't interfere with their own tab-completion mechanism.
565 # don't interfere with their own tab-completion mechanism.
545 self.lbuf = self.get_line_buffer()[:self.readline.get_endidx()]
566 self.lbuf = self.get_line_buffer()[:self.readline.get_endidx()]
546 if not (self.dumb_terminal or self.get_line_buffer().strip()):
567 if not (self.dumb_terminal or self.get_line_buffer().strip()):
547 self.readline.insert_text('\t')
568 self.readline.insert_text('\t')
548 return None
569 return None
549
570
571
550 magic_escape = self.magic_escape
572 magic_escape = self.magic_escape
551 magic_prefix = self.magic_prefix
573 magic_prefix = self.magic_prefix
552
574
553 try:
575 try:
554 if text.startswith(magic_escape):
576 if text.startswith(magic_escape):
555 text = text.replace(magic_escape,magic_prefix)
577 text = text.replace(magic_escape,magic_prefix)
556 elif text.startswith('~'):
578 elif text.startswith('~'):
557 text = os.path.expanduser(text)
579 text = os.path.expanduser(text)
558 if state == 0:
580 if state == 0:
559 # Extend the list of completions with the results of each
581 custom_res = self.dispatch_custom_completer(text)
560 # matcher, so we return results to the user from all
582 if custom_res is not None:
561 # namespaces.
583 # did custom completers produce something?
562 if self.merge_completions:
584 self.matches = custom_res
563 self.matches = []
564 for matcher in self.matchers:
565 self.matches.extend(matcher(text))
566 else:
585 else:
567 for matcher in self.matchers:
586 # Extend the list of completions with the results of each
568 self.matches = matcher(text)
587 # matcher, so we return results to the user from all
569 if self.matches:
588 # namespaces.
570 break
589 if self.merge_completions:
590 self.matches = []
591 for matcher in self.matchers:
592 self.matches.extend(matcher(text))
593 else:
594 for matcher in self.matchers:
595 self.matches = matcher(text)
596 if self.matches:
597 break
571
598
572 try:
599 try:
573 return self.matches[state].replace(magic_prefix,magic_escape)
600 return self.matches[state].replace(magic_prefix,magic_escape)
574 except IndexError:
601 except IndexError:
575 return None
602 return None
576 except:
603 except:
577 #from IPython.ultraTB import AutoFormattedTB; # dbg
604 from IPython.ultraTB import AutoFormattedTB; # dbg
578 #tb=AutoFormattedTB('Verbose');tb() #dbg
605 tb=AutoFormattedTB('Verbose');tb() #dbg
579
606
580 # If completion fails, don't annoy the user.
607 # If completion fails, don't annoy the user.
581 return None
608 return None
@@ -1,210 +1,217 b''
1 """hooks for IPython.
1 """hooks for IPython.
2
2
3 In Python, it is possible to overwrite any method of any object if you really
3 In Python, it is possible to overwrite any method of any object if you really
4 want to. But IPython exposes a few 'hooks', methods which are _designed_ to
4 want to. But IPython exposes a few 'hooks', methods which are _designed_ to
5 be overwritten by users for customization purposes. This module defines the
5 be overwritten by users for customization purposes. This module defines the
6 default versions of all such hooks, which get used by IPython if not
6 default versions of all such hooks, which get used by IPython if not
7 overridden by the user.
7 overridden by the user.
8
8
9 hooks are simple functions, but they should be declared with 'self' as their
9 hooks are simple functions, but they should be declared with 'self' as their
10 first argument, because when activated they are registered into IPython as
10 first argument, because when activated they are registered into IPython as
11 instance methods. The self argument will be the IPython running instance
11 instance methods. The self argument will be the IPython running instance
12 itself, so hooks have full access to the entire IPython object.
12 itself, so hooks have full access to the entire IPython object.
13
13
14 If you wish to define a new hook and activate it, you need to put the
14 If you wish to define a new hook and activate it, you need to put the
15 necessary code into a python file which can be either imported or execfile()'d
15 necessary code into a python file which can be either imported or execfile()'d
16 from within your ipythonrc configuration.
16 from within your ipythonrc configuration.
17
17
18 For example, suppose that you have a module called 'myiphooks' in your
18 For example, suppose that you have a module called 'myiphooks' in your
19 PYTHONPATH, which contains the following definition:
19 PYTHONPATH, which contains the following definition:
20
20
21 import os
21 import os
22 import IPython.ipapi
22 import IPython.ipapi
23 ip = IPython.ipapi.get()
23 ip = IPython.ipapi.get()
24
24
25 def calljed(self,filename, linenum):
25 def calljed(self,filename, linenum):
26 "My editor hook calls the jed editor directly."
26 "My editor hook calls the jed editor directly."
27 print "Calling my own editor, jed ..."
27 print "Calling my own editor, jed ..."
28 os.system('jed +%d %s' % (linenum,filename))
28 os.system('jed +%d %s' % (linenum,filename))
29
29
30 ip.set_hook('editor', calljed)
30 ip.set_hook('editor', calljed)
31
31
32 You can then enable the functionality by doing 'import myiphooks'
32 You can then enable the functionality by doing 'import myiphooks'
33 somewhere in your configuration files or ipython command line.
33 somewhere in your configuration files or ipython command line.
34
34
35 $Id: hooks.py 1366 2006-06-15 19:45:50Z vivainio $"""
35 $Id: hooks.py 1854 2006-10-30 19:54:25Z vivainio $"""
36
36
37 #*****************************************************************************
37 #*****************************************************************************
38 # Copyright (C) 2005 Fernando Perez. <fperez@colorado.edu>
38 # Copyright (C) 2005 Fernando Perez. <fperez@colorado.edu>
39 #
39 #
40 # Distributed under the terms of the BSD License. The full license is in
40 # Distributed under the terms of the BSD License. The full license is in
41 # the file COPYING, distributed as part of this software.
41 # the file COPYING, distributed as part of this software.
42 #*****************************************************************************
42 #*****************************************************************************
43
43
44 from IPython import Release
44 from IPython import Release
45 from IPython import ipapi
45 from IPython import ipapi
46 __author__ = '%s <%s>' % Release.authors['Fernando']
46 __author__ = '%s <%s>' % Release.authors['Fernando']
47 __license__ = Release.license
47 __license__ = Release.license
48 __version__ = Release.version
48 __version__ = Release.version
49
49
50 import os,bisect
50 import os,bisect
51 from genutils import Term
51 from genutils import Term
52 from pprint import PrettyPrinter
52 from pprint import PrettyPrinter
53
53
54 # List here all the default hooks. For now it's just the editor functions
54 # List here all the default hooks. For now it's just the editor functions
55 # but over time we'll move here all the public API for user-accessible things.
55 # but over time we'll move here all the public API for user-accessible things.
56 __all__ = ['editor', 'fix_error_editor', 'result_display',
56 __all__ = ['editor', 'fix_error_editor', 'result_display',
57 'input_prefilter', 'shutdown_hook', 'late_startup_hook',
57 'input_prefilter', 'shutdown_hook', 'late_startup_hook',
58 'generate_prompt', 'generate_output_prompt' ]
58 'generate_prompt', 'generate_output_prompt' ]
59
59
60 pformat = PrettyPrinter().pformat
60 pformat = PrettyPrinter().pformat
61
61
62 def editor(self,filename, linenum=None):
62 def editor(self,filename, linenum=None):
63 """Open the default editor at the given filename and linenumber.
63 """Open the default editor at the given filename and linenumber.
64
64
65 This is IPython's default editor hook, you can use it as an example to
65 This is IPython's default editor hook, you can use it as an example to
66 write your own modified one. To set your own editor function as the
66 write your own modified one. To set your own editor function as the
67 new editor hook, call ip.set_hook('editor',yourfunc)."""
67 new editor hook, call ip.set_hook('editor',yourfunc)."""
68
68
69 # IPython configures a default editor at startup by reading $EDITOR from
69 # IPython configures a default editor at startup by reading $EDITOR from
70 # the environment, and falling back on vi (unix) or notepad (win32).
70 # the environment, and falling back on vi (unix) or notepad (win32).
71 editor = self.rc.editor
71 editor = self.rc.editor
72
72
73 # marker for at which line to open the file (for existing objects)
73 # marker for at which line to open the file (for existing objects)
74 if linenum is None or editor=='notepad':
74 if linenum is None or editor=='notepad':
75 linemark = ''
75 linemark = ''
76 else:
76 else:
77 linemark = '+%d' % int(linenum)
77 linemark = '+%d' % int(linenum)
78
78
79 # Enclose in quotes if necessary and legal
79 # Enclose in quotes if necessary and legal
80 if ' ' in editor and os.path.isfile(editor) and editor[0] != '"':
80 if ' ' in editor and os.path.isfile(editor) and editor[0] != '"':
81 editor = '"%s"' % editor
81 editor = '"%s"' % editor
82
82
83 # Call the actual editor
83 # Call the actual editor
84 os.system('%s %s %s' % (editor,linemark,filename))
84 os.system('%s %s %s' % (editor,linemark,filename))
85
85
86 import tempfile
86 import tempfile
87 def fix_error_editor(self,filename,linenum,column,msg):
87 def fix_error_editor(self,filename,linenum,column,msg):
88 """Open the editor at the given filename, linenumber, column and
88 """Open the editor at the given filename, linenumber, column and
89 show an error message. This is used for correcting syntax errors.
89 show an error message. This is used for correcting syntax errors.
90 The current implementation only has special support for the VIM editor,
90 The current implementation only has special support for the VIM editor,
91 and falls back on the 'editor' hook if VIM is not used.
91 and falls back on the 'editor' hook if VIM is not used.
92
92
93 Call ip.set_hook('fix_error_editor',youfunc) to use your own function,
93 Call ip.set_hook('fix_error_editor',youfunc) to use your own function,
94 """
94 """
95 def vim_quickfix_file():
95 def vim_quickfix_file():
96 t = tempfile.NamedTemporaryFile()
96 t = tempfile.NamedTemporaryFile()
97 t.write('%s:%d:%d:%s\n' % (filename,linenum,column,msg))
97 t.write('%s:%d:%d:%s\n' % (filename,linenum,column,msg))
98 t.flush()
98 t.flush()
99 return t
99 return t
100 if os.path.basename(self.rc.editor) != 'vim':
100 if os.path.basename(self.rc.editor) != 'vim':
101 self.hooks.editor(filename,linenum)
101 self.hooks.editor(filename,linenum)
102 return
102 return
103 t = vim_quickfix_file()
103 t = vim_quickfix_file()
104 try:
104 try:
105 os.system('vim --cmd "set errorformat=%f:%l:%c:%m" -q ' + t.name)
105 os.system('vim --cmd "set errorformat=%f:%l:%c:%m" -q ' + t.name)
106 finally:
106 finally:
107 t.close()
107 t.close()
108
108
109
109
110 class CommandChainDispatcher:
110 class CommandChainDispatcher:
111 """ Dispatch calls to a chain of commands until some func can handle it
111 """ Dispatch calls to a chain of commands until some func can handle it
112
112
113 Usage: instantiate, execute "add" to add commands (with optional
113 Usage: instantiate, execute "add" to add commands (with optional
114 priority), execute normally via f() calling mechanism.
114 priority), execute normally via f() calling mechanism.
115
115
116 """
116 """
117 def __init__(self,commands=None):
117 def __init__(self,commands=None):
118 if commands is None:
118 if commands is None:
119 self.chain = []
119 self.chain = []
120 else:
120 else:
121 self.chain = commands
121 self.chain = commands
122
122
123
123
124 def __call__(self,*args, **kw):
124 def __call__(self,*args, **kw):
125 """ Command chain is called just like normal func.
125 """ Command chain is called just like normal func.
126
126
127 This will call all funcs in chain with the same args as were given to this
127 This will call all funcs in chain with the same args as were given to this
128 function, and return the result of first func that didn't raise
128 function, and return the result of first func that didn't raise
129 TryNext """
129 TryNext """
130
130
131 for prio,cmd in self.chain:
131 for prio,cmd in self.chain:
132 #print "prio",prio,"cmd",cmd #dbg
132 #print "prio",prio,"cmd",cmd #dbg
133 try:
133 try:
134 ret = cmd(*args, **kw)
134 ret = cmd(*args, **kw)
135 return ret
135 return ret
136 except ipapi.TryNext, exc:
136 except ipapi.TryNext, exc:
137 if exc.args or exc.kwargs:
137 if exc.args or exc.kwargs:
138 args = exc.args
138 args = exc.args
139 kw = exc.kwargs
139 kw = exc.kwargs
140
140
141 def __str__(self):
141 def __str__(self):
142 return str(self.chain)
142 return str(self.chain)
143
143
144 def add(self, func, priority=0):
144 def add(self, func, priority=0):
145 """ Add a func to the cmd chain with given priority """
145 """ Add a func to the cmd chain with given priority """
146 bisect.insort(self.chain,(priority,func))
146 bisect.insort(self.chain,(priority,func))
147
147
148 def __iter__(self):
149 """ Return all objects in chain.
150
151 Handy if the objects are not callable.
152 """
153 return iter(self.chain)
154
148 def result_display(self,arg):
155 def result_display(self,arg):
149 """ Default display hook.
156 """ Default display hook.
150
157
151 Called for displaying the result to the user.
158 Called for displaying the result to the user.
152 """
159 """
153
160
154 if self.rc.pprint:
161 if self.rc.pprint:
155 out = pformat(arg)
162 out = pformat(arg)
156 if '\n' in out:
163 if '\n' in out:
157 # So that multi-line strings line up with the left column of
164 # So that multi-line strings line up with the left column of
158 # the screen, instead of having the output prompt mess up
165 # the screen, instead of having the output prompt mess up
159 # their first line.
166 # their first line.
160 Term.cout.write('\n')
167 Term.cout.write('\n')
161 print >>Term.cout, out
168 print >>Term.cout, out
162 else:
169 else:
163 # By default, the interactive prompt uses repr() to display results,
170 # By default, the interactive prompt uses repr() to display results,
164 # so we should honor this. Users who'd rather use a different
171 # so we should honor this. Users who'd rather use a different
165 # mechanism can easily override this hook.
172 # mechanism can easily override this hook.
166 print >>Term.cout, repr(arg)
173 print >>Term.cout, repr(arg)
167 # the default display hook doesn't manipulate the value to put in history
174 # the default display hook doesn't manipulate the value to put in history
168 return None
175 return None
169
176
170 def input_prefilter(self,line):
177 def input_prefilter(self,line):
171 """ Default input prefilter
178 """ Default input prefilter
172
179
173 This returns the line as unchanged, so that the interpreter
180 This returns the line as unchanged, so that the interpreter
174 knows that nothing was done and proceeds with "classic" prefiltering
181 knows that nothing was done and proceeds with "classic" prefiltering
175 (%magics, !shell commands etc.).
182 (%magics, !shell commands etc.).
176
183
177 Note that leading whitespace is not passed to this hook. Prefilter
184 Note that leading whitespace is not passed to this hook. Prefilter
178 can't alter indentation.
185 can't alter indentation.
179
186
180 """
187 """
181 #print "attempt to rewrite",line #dbg
188 #print "attempt to rewrite",line #dbg
182 return line
189 return line
183
190
184 def shutdown_hook(self):
191 def shutdown_hook(self):
185 """ default shutdown hook
192 """ default shutdown hook
186
193
187 Typically, shotdown hooks should raise TryNext so all shutdown ops are done
194 Typically, shotdown hooks should raise TryNext so all shutdown ops are done
188 """
195 """
189
196
190 #print "default shutdown hook ok" # dbg
197 #print "default shutdown hook ok" # dbg
191 return
198 return
192
199
193 def late_startup_hook(self):
200 def late_startup_hook(self):
194 """ Executed after ipython has been constructed and configured
201 """ Executed after ipython has been constructed and configured
195
202
196 """
203 """
197 #print "default startup hook ok" # dbg
204 #print "default startup hook ok" # dbg
198
205
199 def generate_prompt(self, is_continuation):
206 def generate_prompt(self, is_continuation):
200 """ calculate and return a string with the prompt to display """
207 """ calculate and return a string with the prompt to display """
201 ip = self.api
208 ip = self.api
202 if is_continuation:
209 if is_continuation:
203 return str(ip.IP.outputcache.prompt2)
210 return str(ip.IP.outputcache.prompt2)
204 return str(ip.IP.outputcache.prompt1)
211 return str(ip.IP.outputcache.prompt1)
205
212
206 def generate_output_prompt(self):
213 def generate_output_prompt(self):
207 ip = self.api
214 ip = self.api
208 return str(ip.IP.outputcache.prompt_out)
215 return str(ip.IP.outputcache.prompt_out)
209
216
210 No newline at end of file
217
@@ -1,2442 +1,2461 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.3 or newer.
5 Requires Python 2.3 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 1853 2006-10-30 17:00:39Z vivainio $
9 $Id: iplib.py 1854 2006-10-30 19:54:25Z vivainio $
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-2006 Fernando Perez. <fperez@colorado.edu>
14 # Copyright (C) 2001-2006 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, all 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. At this point, there are no dependencies at all on the code
22 # subclassing. At this point, there are no dependencies at all on the code
23 # module anymore (it is not even imported). The Python License (sec. 2)
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
24 # allows for this, but it's always nice to acknowledge credit where credit is
25 # due.
25 # due.
26 #*****************************************************************************
26 #*****************************************************************************
27
27
28 #****************************************************************************
28 #****************************************************************************
29 # Modules and globals
29 # Modules and globals
30
30
31 from IPython import Release
31 from IPython import Release
32 __author__ = '%s <%s>\n%s <%s>' % \
32 __author__ = '%s <%s>\n%s <%s>' % \
33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
34 __license__ = Release.license
34 __license__ = Release.license
35 __version__ = Release.version
35 __version__ = Release.version
36
36
37 # Python standard modules
37 # Python standard modules
38 import __main__
38 import __main__
39 import __builtin__
39 import __builtin__
40 import StringIO
40 import StringIO
41 import bdb
41 import bdb
42 import cPickle as pickle
42 import cPickle as pickle
43 import codeop
43 import codeop
44 import exceptions
44 import exceptions
45 import glob
45 import glob
46 import inspect
46 import inspect
47 import keyword
47 import keyword
48 import new
48 import new
49 import os
49 import os
50 import pydoc
50 import pydoc
51 import re
51 import re
52 import shutil
52 import shutil
53 import string
53 import string
54 import sys
54 import sys
55 import tempfile
55 import tempfile
56 import traceback
56 import traceback
57 import types
57 import types
58 import pickleshare
58 import pickleshare
59 from sets import Set
59 from sets import Set
60 from pprint import pprint, pformat
60 from pprint import pprint, pformat
61
61
62 # IPython's own modules
62 # IPython's own modules
63 import IPython
63 import IPython
64 from IPython import OInspect,PyColorize,ultraTB
64 from IPython import OInspect,PyColorize,ultraTB
65 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
65 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
66 from IPython.FakeModule import FakeModule
66 from IPython.FakeModule import FakeModule
67 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
67 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
68 from IPython.Logger import Logger
68 from IPython.Logger import Logger
69 from IPython.Magic import Magic
69 from IPython.Magic import Magic
70 from IPython.Prompts import CachedOutput
70 from IPython.Prompts import CachedOutput
71 from IPython.ipstruct import Struct
71 from IPython.ipstruct import Struct
72 from IPython.background_jobs import BackgroundJobManager
72 from IPython.background_jobs import BackgroundJobManager
73 from IPython.usage import cmd_line_usage,interactive_usage
73 from IPython.usage import cmd_line_usage,interactive_usage
74 from IPython.genutils import *
74 from IPython.genutils import *
75 from IPython.strdispatch import StrDispatch
75 import IPython.ipapi
76 import IPython.ipapi
76
77
77 # Globals
78 # Globals
78
79
79 # store the builtin raw_input globally, and use this always, in case user code
80 # store the builtin raw_input globally, and use this always, in case user code
80 # overwrites it (like wx.py.PyShell does)
81 # overwrites it (like wx.py.PyShell does)
81 raw_input_original = raw_input
82 raw_input_original = raw_input
82
83
83 # compiled regexps for autoindent management
84 # compiled regexps for autoindent management
84 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
85 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
85
86
86
87
87 #****************************************************************************
88 #****************************************************************************
88 # Some utility function definitions
89 # Some utility function definitions
89
90
90 ini_spaces_re = re.compile(r'^(\s+)')
91 ini_spaces_re = re.compile(r'^(\s+)')
91
92
92 def num_ini_spaces(strng):
93 def num_ini_spaces(strng):
93 """Return the number of initial spaces in a string"""
94 """Return the number of initial spaces in a string"""
94
95
95 ini_spaces = ini_spaces_re.match(strng)
96 ini_spaces = ini_spaces_re.match(strng)
96 if ini_spaces:
97 if ini_spaces:
97 return ini_spaces.end()
98 return ini_spaces.end()
98 else:
99 else:
99 return 0
100 return 0
100
101
101 def softspace(file, newvalue):
102 def softspace(file, newvalue):
102 """Copied from code.py, to remove the dependency"""
103 """Copied from code.py, to remove the dependency"""
103
104
104 oldvalue = 0
105 oldvalue = 0
105 try:
106 try:
106 oldvalue = file.softspace
107 oldvalue = file.softspace
107 except AttributeError:
108 except AttributeError:
108 pass
109 pass
109 try:
110 try:
110 file.softspace = newvalue
111 file.softspace = newvalue
111 except (AttributeError, TypeError):
112 except (AttributeError, TypeError):
112 # "attribute-less object" or "read-only attributes"
113 # "attribute-less object" or "read-only attributes"
113 pass
114 pass
114 return oldvalue
115 return oldvalue
115
116
116
117
117 #****************************************************************************
118 #****************************************************************************
118 # Local use exceptions
119 # Local use exceptions
119 class SpaceInInput(exceptions.Exception): pass
120 class SpaceInInput(exceptions.Exception): pass
120
121
121
122
122 #****************************************************************************
123 #****************************************************************************
123 # Local use classes
124 # Local use classes
124 class Bunch: pass
125 class Bunch: pass
125
126
126 class Undefined: pass
127 class Undefined: pass
127
128
128 class Quitter(object):
129 class Quitter(object):
129 """Simple class to handle exit, similar to Python 2.5's.
130 """Simple class to handle exit, similar to Python 2.5's.
130
131
131 It handles exiting in an ipython-safe manner, which the one in Python 2.5
132 It handles exiting in an ipython-safe manner, which the one in Python 2.5
132 doesn't do (obviously, since it doesn't know about ipython)."""
133 doesn't do (obviously, since it doesn't know about ipython)."""
133
134
134 def __init__(self,shell,name):
135 def __init__(self,shell,name):
135 self.shell = shell
136 self.shell = shell
136 self.name = name
137 self.name = name
137
138
138 def __repr__(self):
139 def __repr__(self):
139 return 'Type %s() to exit.' % self.name
140 return 'Type %s() to exit.' % self.name
140 __str__ = __repr__
141 __str__ = __repr__
141
142
142 def __call__(self):
143 def __call__(self):
143 self.shell.exit()
144 self.shell.exit()
144
145
145 class InputList(list):
146 class InputList(list):
146 """Class to store user input.
147 """Class to store user input.
147
148
148 It's basically a list, but slices return a string instead of a list, thus
149 It's basically a list, but slices return a string instead of a list, thus
149 allowing things like (assuming 'In' is an instance):
150 allowing things like (assuming 'In' is an instance):
150
151
151 exec In[4:7]
152 exec In[4:7]
152
153
153 or
154 or
154
155
155 exec In[5:9] + In[14] + In[21:25]"""
156 exec In[5:9] + In[14] + In[21:25]"""
156
157
157 def __getslice__(self,i,j):
158 def __getslice__(self,i,j):
158 return ''.join(list.__getslice__(self,i,j))
159 return ''.join(list.__getslice__(self,i,j))
159
160
160 class SyntaxTB(ultraTB.ListTB):
161 class SyntaxTB(ultraTB.ListTB):
161 """Extension which holds some state: the last exception value"""
162 """Extension which holds some state: the last exception value"""
162
163
163 def __init__(self,color_scheme = 'NoColor'):
164 def __init__(self,color_scheme = 'NoColor'):
164 ultraTB.ListTB.__init__(self,color_scheme)
165 ultraTB.ListTB.__init__(self,color_scheme)
165 self.last_syntax_error = None
166 self.last_syntax_error = None
166
167
167 def __call__(self, etype, value, elist):
168 def __call__(self, etype, value, elist):
168 self.last_syntax_error = value
169 self.last_syntax_error = value
169 ultraTB.ListTB.__call__(self,etype,value,elist)
170 ultraTB.ListTB.__call__(self,etype,value,elist)
170
171
171 def clear_err_state(self):
172 def clear_err_state(self):
172 """Return the current error state and clear it"""
173 """Return the current error state and clear it"""
173 e = self.last_syntax_error
174 e = self.last_syntax_error
174 self.last_syntax_error = None
175 self.last_syntax_error = None
175 return e
176 return e
176
177
177 #****************************************************************************
178 #****************************************************************************
178 # Main IPython class
179 # Main IPython class
179
180
180 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
181 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
181 # until a full rewrite is made. I've cleaned all cross-class uses of
182 # until a full rewrite is made. I've cleaned all cross-class uses of
182 # attributes and methods, but too much user code out there relies on the
183 # attributes and methods, but too much user code out there relies on the
183 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
184 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
184 #
185 #
185 # But at least now, all the pieces have been separated and we could, in
186 # But at least now, all the pieces have been separated and we could, in
186 # principle, stop using the mixin. This will ease the transition to the
187 # principle, stop using the mixin. This will ease the transition to the
187 # chainsaw branch.
188 # chainsaw branch.
188
189
189 # For reference, the following is the list of 'self.foo' uses in the Magic
190 # For reference, the following is the list of 'self.foo' uses in the Magic
190 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
191 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
191 # class, to prevent clashes.
192 # class, to prevent clashes.
192
193
193 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
194 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
194 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
195 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
195 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
196 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
196 # 'self.value']
197 # 'self.value']
197
198
198 class InteractiveShell(object,Magic):
199 class InteractiveShell(object,Magic):
199 """An enhanced console for Python."""
200 """An enhanced console for Python."""
200
201
201 # class attribute to indicate whether the class supports threads or not.
202 # class attribute to indicate whether the class supports threads or not.
202 # Subclasses with thread support should override this as needed.
203 # Subclasses with thread support should override this as needed.
203 isthreaded = False
204 isthreaded = False
204
205
205 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
206 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
206 user_ns = None,user_global_ns=None,banner2='',
207 user_ns = None,user_global_ns=None,banner2='',
207 custom_exceptions=((),None),embedded=False):
208 custom_exceptions=((),None),embedded=False):
208
209
209 # log system
210 # log system
210 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
211 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
211
212
212 # some minimal strict typechecks. For some core data structures, I
213 # some minimal strict typechecks. For some core data structures, I
213 # want actual basic python types, not just anything that looks like
214 # want actual basic python types, not just anything that looks like
214 # one. This is especially true for namespaces.
215 # one. This is especially true for namespaces.
215 for ns in (user_ns,user_global_ns):
216 for ns in (user_ns,user_global_ns):
216 if ns is not None and type(ns) != types.DictType:
217 if ns is not None and type(ns) != types.DictType:
217 raise TypeError,'namespace must be a dictionary'
218 raise TypeError,'namespace must be a dictionary'
218
219
219 # Job manager (for jobs run as background threads)
220 # Job manager (for jobs run as background threads)
220 self.jobs = BackgroundJobManager()
221 self.jobs = BackgroundJobManager()
221
222
222 # Store the actual shell's name
223 # Store the actual shell's name
223 self.name = name
224 self.name = name
224
225
225 # We need to know whether the instance is meant for embedding, since
226 # We need to know whether the instance is meant for embedding, since
226 # global/local namespaces need to be handled differently in that case
227 # global/local namespaces need to be handled differently in that case
227 self.embedded = embedded
228 self.embedded = embedded
228
229
229 # command compiler
230 # command compiler
230 self.compile = codeop.CommandCompiler()
231 self.compile = codeop.CommandCompiler()
231
232
232 # User input buffer
233 # User input buffer
233 self.buffer = []
234 self.buffer = []
234
235
235 # Default name given in compilation of code
236 # Default name given in compilation of code
236 self.filename = '<ipython console>'
237 self.filename = '<ipython console>'
237
238
238 # Install our own quitter instead of the builtins. For python2.3-2.4,
239 # Install our own quitter instead of the builtins. For python2.3-2.4,
239 # this brings in behavior like 2.5, and for 2.5 it's identical.
240 # this brings in behavior like 2.5, and for 2.5 it's identical.
240 __builtin__.exit = Quitter(self,'exit')
241 __builtin__.exit = Quitter(self,'exit')
241 __builtin__.quit = Quitter(self,'quit')
242 __builtin__.quit = Quitter(self,'quit')
242
243
243 # Make an empty namespace, which extension writers can rely on both
244 # Make an empty namespace, which extension writers can rely on both
244 # existing and NEVER being used by ipython itself. This gives them a
245 # existing and NEVER being used by ipython itself. This gives them a
245 # convenient location for storing additional information and state
246 # convenient location for storing additional information and state
246 # their extensions may require, without fear of collisions with other
247 # their extensions may require, without fear of collisions with other
247 # ipython names that may develop later.
248 # ipython names that may develop later.
248 self.meta = Struct()
249 self.meta = Struct()
249
250
250 # Create the namespace where the user will operate. user_ns is
251 # Create the namespace where the user will operate. user_ns is
251 # normally the only one used, and it is passed to the exec calls as
252 # normally the only one used, and it is passed to the exec calls as
252 # the locals argument. But we do carry a user_global_ns namespace
253 # the locals argument. But we do carry a user_global_ns namespace
253 # given as the exec 'globals' argument, This is useful in embedding
254 # given as the exec 'globals' argument, This is useful in embedding
254 # situations where the ipython shell opens in a context where the
255 # situations where the ipython shell opens in a context where the
255 # distinction between locals and globals is meaningful.
256 # distinction between locals and globals is meaningful.
256
257
257 # FIXME. For some strange reason, __builtins__ is showing up at user
258 # FIXME. For some strange reason, __builtins__ is showing up at user
258 # level as a dict instead of a module. This is a manual fix, but I
259 # level as a dict instead of a module. This is a manual fix, but I
259 # should really track down where the problem is coming from. Alex
260 # should really track down where the problem is coming from. Alex
260 # Schmolck reported this problem first.
261 # Schmolck reported this problem first.
261
262
262 # A useful post by Alex Martelli on this topic:
263 # A useful post by Alex Martelli on this topic:
263 # Re: inconsistent value from __builtins__
264 # Re: inconsistent value from __builtins__
264 # Von: Alex Martelli <aleaxit@yahoo.com>
265 # Von: Alex Martelli <aleaxit@yahoo.com>
265 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
266 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
266 # Gruppen: comp.lang.python
267 # Gruppen: comp.lang.python
267
268
268 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
269 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
269 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
270 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
270 # > <type 'dict'>
271 # > <type 'dict'>
271 # > >>> print type(__builtins__)
272 # > >>> print type(__builtins__)
272 # > <type 'module'>
273 # > <type 'module'>
273 # > Is this difference in return value intentional?
274 # > Is this difference in return value intentional?
274
275
275 # Well, it's documented that '__builtins__' can be either a dictionary
276 # Well, it's documented that '__builtins__' can be either a dictionary
276 # or a module, and it's been that way for a long time. Whether it's
277 # or a module, and it's been that way for a long time. Whether it's
277 # intentional (or sensible), I don't know. In any case, the idea is
278 # intentional (or sensible), I don't know. In any case, the idea is
278 # that if you need to access the built-in namespace directly, you
279 # that if you need to access the built-in namespace directly, you
279 # should start with "import __builtin__" (note, no 's') which will
280 # should start with "import __builtin__" (note, no 's') which will
280 # definitely give you a module. Yeah, it's somewhat confusing:-(.
281 # definitely give you a module. Yeah, it's somewhat confusing:-(.
281
282
282 # These routines return properly built dicts as needed by the rest of
283 # These routines return properly built dicts as needed by the rest of
283 # the code, and can also be used by extension writers to generate
284 # the code, and can also be used by extension writers to generate
284 # properly initialized namespaces.
285 # properly initialized namespaces.
285 user_ns = IPython.ipapi.make_user_ns(user_ns)
286 user_ns = IPython.ipapi.make_user_ns(user_ns)
286 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
287 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
287
288
288 # Assign namespaces
289 # Assign namespaces
289 # This is the namespace where all normal user variables live
290 # This is the namespace where all normal user variables live
290 self.user_ns = user_ns
291 self.user_ns = user_ns
291 # Embedded instances require a separate namespace for globals.
292 # Embedded instances require a separate namespace for globals.
292 # Normally this one is unused by non-embedded instances.
293 # Normally this one is unused by non-embedded instances.
293 self.user_global_ns = user_global_ns
294 self.user_global_ns = user_global_ns
294 # A namespace to keep track of internal data structures to prevent
295 # A namespace to keep track of internal data structures to prevent
295 # them from cluttering user-visible stuff. Will be updated later
296 # them from cluttering user-visible stuff. Will be updated later
296 self.internal_ns = {}
297 self.internal_ns = {}
297
298
298 # Namespace of system aliases. Each entry in the alias
299 # Namespace of system aliases. Each entry in the alias
299 # table must be a 2-tuple of the form (N,name), where N is the number
300 # table must be a 2-tuple of the form (N,name), where N is the number
300 # of positional arguments of the alias.
301 # of positional arguments of the alias.
301 self.alias_table = {}
302 self.alias_table = {}
302
303
303 # A table holding all the namespaces IPython deals with, so that
304 # A table holding all the namespaces IPython deals with, so that
304 # introspection facilities can search easily.
305 # introspection facilities can search easily.
305 self.ns_table = {'user':user_ns,
306 self.ns_table = {'user':user_ns,
306 'user_global':user_global_ns,
307 'user_global':user_global_ns,
307 'alias':self.alias_table,
308 'alias':self.alias_table,
308 'internal':self.internal_ns,
309 'internal':self.internal_ns,
309 'builtin':__builtin__.__dict__
310 'builtin':__builtin__.__dict__
310 }
311 }
311
312
312 # The user namespace MUST have a pointer to the shell itself.
313 # The user namespace MUST have a pointer to the shell itself.
313 self.user_ns[name] = self
314 self.user_ns[name] = self
314
315
315 # We need to insert into sys.modules something that looks like a
316 # We need to insert into sys.modules something that looks like a
316 # module but which accesses the IPython namespace, for shelve and
317 # module but which accesses the IPython namespace, for shelve and
317 # pickle to work interactively. Normally they rely on getting
318 # pickle to work interactively. Normally they rely on getting
318 # everything out of __main__, but for embedding purposes each IPython
319 # everything out of __main__, but for embedding purposes each IPython
319 # instance has its own private namespace, so we can't go shoving
320 # instance has its own private namespace, so we can't go shoving
320 # everything into __main__.
321 # everything into __main__.
321
322
322 # note, however, that we should only do this for non-embedded
323 # note, however, that we should only do this for non-embedded
323 # ipythons, which really mimic the __main__.__dict__ with their own
324 # ipythons, which really mimic the __main__.__dict__ with their own
324 # namespace. Embedded instances, on the other hand, should not do
325 # namespace. Embedded instances, on the other hand, should not do
325 # this because they need to manage the user local/global namespaces
326 # this because they need to manage the user local/global namespaces
326 # only, but they live within a 'normal' __main__ (meaning, they
327 # only, but they live within a 'normal' __main__ (meaning, they
327 # shouldn't overtake the execution environment of the script they're
328 # shouldn't overtake the execution environment of the script they're
328 # embedded in).
329 # embedded in).
329
330
330 if not embedded:
331 if not embedded:
331 try:
332 try:
332 main_name = self.user_ns['__name__']
333 main_name = self.user_ns['__name__']
333 except KeyError:
334 except KeyError:
334 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
335 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
335 else:
336 else:
336 #print "pickle hack in place" # dbg
337 #print "pickle hack in place" # dbg
337 #print 'main_name:',main_name # dbg
338 #print 'main_name:',main_name # dbg
338 sys.modules[main_name] = FakeModule(self.user_ns)
339 sys.modules[main_name] = FakeModule(self.user_ns)
339
340
340 # List of input with multi-line handling.
341 # List of input with multi-line handling.
341 # Fill its zero entry, user counter starts at 1
342 # Fill its zero entry, user counter starts at 1
342 self.input_hist = InputList(['\n'])
343 self.input_hist = InputList(['\n'])
343 # This one will hold the 'raw' input history, without any
344 # This one will hold the 'raw' input history, without any
344 # pre-processing. This will allow users to retrieve the input just as
345 # pre-processing. This will allow users to retrieve the input just as
345 # it was exactly typed in by the user, with %hist -r.
346 # it was exactly typed in by the user, with %hist -r.
346 self.input_hist_raw = InputList(['\n'])
347 self.input_hist_raw = InputList(['\n'])
347
348
348 # list of visited directories
349 # list of visited directories
349 try:
350 try:
350 self.dir_hist = [os.getcwd()]
351 self.dir_hist = [os.getcwd()]
351 except IOError, e:
352 except IOError, e:
352 self.dir_hist = []
353 self.dir_hist = []
353
354
354 # dict of output history
355 # dict of output history
355 self.output_hist = {}
356 self.output_hist = {}
356
357
357 # dict of things NOT to alias (keywords, builtins and some magics)
358 # dict of things NOT to alias (keywords, builtins and some magics)
358 no_alias = {}
359 no_alias = {}
359 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
360 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
360 for key in keyword.kwlist + no_alias_magics:
361 for key in keyword.kwlist + no_alias_magics:
361 no_alias[key] = 1
362 no_alias[key] = 1
362 no_alias.update(__builtin__.__dict__)
363 no_alias.update(__builtin__.__dict__)
363 self.no_alias = no_alias
364 self.no_alias = no_alias
364
365
365 # make global variables for user access to these
366 # make global variables for user access to these
366 self.user_ns['_ih'] = self.input_hist
367 self.user_ns['_ih'] = self.input_hist
367 self.user_ns['_oh'] = self.output_hist
368 self.user_ns['_oh'] = self.output_hist
368 self.user_ns['_dh'] = self.dir_hist
369 self.user_ns['_dh'] = self.dir_hist
369
370
370 # user aliases to input and output histories
371 # user aliases to input and output histories
371 self.user_ns['In'] = self.input_hist
372 self.user_ns['In'] = self.input_hist
372 self.user_ns['Out'] = self.output_hist
373 self.user_ns['Out'] = self.output_hist
373
374
374 # Object variable to store code object waiting execution. This is
375 # Object variable to store code object waiting execution. This is
375 # used mainly by the multithreaded shells, but it can come in handy in
376 # used mainly by the multithreaded shells, but it can come in handy in
376 # other situations. No need to use a Queue here, since it's a single
377 # other situations. No need to use a Queue here, since it's a single
377 # item which gets cleared once run.
378 # item which gets cleared once run.
378 self.code_to_run = None
379 self.code_to_run = None
379
380
380 # escapes for automatic behavior on the command line
381 # escapes for automatic behavior on the command line
381 self.ESC_SHELL = '!'
382 self.ESC_SHELL = '!'
382 self.ESC_HELP = '?'
383 self.ESC_HELP = '?'
383 self.ESC_MAGIC = '%'
384 self.ESC_MAGIC = '%'
384 self.ESC_QUOTE = ','
385 self.ESC_QUOTE = ','
385 self.ESC_QUOTE2 = ';'
386 self.ESC_QUOTE2 = ';'
386 self.ESC_PAREN = '/'
387 self.ESC_PAREN = '/'
387
388
388 # And their associated handlers
389 # And their associated handlers
389 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
390 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
390 self.ESC_QUOTE : self.handle_auto,
391 self.ESC_QUOTE : self.handle_auto,
391 self.ESC_QUOTE2 : self.handle_auto,
392 self.ESC_QUOTE2 : self.handle_auto,
392 self.ESC_MAGIC : self.handle_magic,
393 self.ESC_MAGIC : self.handle_magic,
393 self.ESC_HELP : self.handle_help,
394 self.ESC_HELP : self.handle_help,
394 self.ESC_SHELL : self.handle_shell_escape,
395 self.ESC_SHELL : self.handle_shell_escape,
395 }
396 }
396
397
397 # class initializations
398 # class initializations
398 Magic.__init__(self,self)
399 Magic.__init__(self,self)
399
400
400 # Python source parser/formatter for syntax highlighting
401 # Python source parser/formatter for syntax highlighting
401 pyformat = PyColorize.Parser().format
402 pyformat = PyColorize.Parser().format
402 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
403 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
403
404
404 # hooks holds pointers used for user-side customizations
405 # hooks holds pointers used for user-side customizations
405 self.hooks = Struct()
406 self.hooks = Struct()
406
407
408 self.strdispatchers = {}
409
407 # Set all default hooks, defined in the IPython.hooks module.
410 # Set all default hooks, defined in the IPython.hooks module.
408 hooks = IPython.hooks
411 hooks = IPython.hooks
409 for hook_name in hooks.__all__:
412 for hook_name in hooks.__all__:
410 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
413 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
411 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
414 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
412 #print "bound hook",hook_name
415 #print "bound hook",hook_name
413
416
414 # Flag to mark unconditional exit
417 # Flag to mark unconditional exit
415 self.exit_now = False
418 self.exit_now = False
416
419
417 self.usage_min = """\
420 self.usage_min = """\
418 An enhanced console for Python.
421 An enhanced console for Python.
419 Some of its features are:
422 Some of its features are:
420 - Readline support if the readline library is present.
423 - Readline support if the readline library is present.
421 - Tab completion in the local namespace.
424 - Tab completion in the local namespace.
422 - Logging of input, see command-line options.
425 - Logging of input, see command-line options.
423 - System shell escape via ! , eg !ls.
426 - System shell escape via ! , eg !ls.
424 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
427 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
425 - Keeps track of locally defined variables via %who, %whos.
428 - Keeps track of locally defined variables via %who, %whos.
426 - Show object information with a ? eg ?x or x? (use ?? for more info).
429 - Show object information with a ? eg ?x or x? (use ?? for more info).
427 """
430 """
428 if usage: self.usage = usage
431 if usage: self.usage = usage
429 else: self.usage = self.usage_min
432 else: self.usage = self.usage_min
430
433
431 # Storage
434 # Storage
432 self.rc = rc # This will hold all configuration information
435 self.rc = rc # This will hold all configuration information
433 self.pager = 'less'
436 self.pager = 'less'
434 # temporary files used for various purposes. Deleted at exit.
437 # temporary files used for various purposes. Deleted at exit.
435 self.tempfiles = []
438 self.tempfiles = []
436
439
437 # Keep track of readline usage (later set by init_readline)
440 # Keep track of readline usage (later set by init_readline)
438 self.has_readline = False
441 self.has_readline = False
439
442
440 # template for logfile headers. It gets resolved at runtime by the
443 # template for logfile headers. It gets resolved at runtime by the
441 # logstart method.
444 # logstart method.
442 self.loghead_tpl = \
445 self.loghead_tpl = \
443 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
446 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
444 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
447 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
445 #log# opts = %s
448 #log# opts = %s
446 #log# args = %s
449 #log# args = %s
447 #log# It is safe to make manual edits below here.
450 #log# It is safe to make manual edits below here.
448 #log#-----------------------------------------------------------------------
451 #log#-----------------------------------------------------------------------
449 """
452 """
450 # for pushd/popd management
453 # for pushd/popd management
451 try:
454 try:
452 self.home_dir = get_home_dir()
455 self.home_dir = get_home_dir()
453 except HomeDirError,msg:
456 except HomeDirError,msg:
454 fatal(msg)
457 fatal(msg)
455
458
456 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
459 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
457
460
458 # Functions to call the underlying shell.
461 # Functions to call the underlying shell.
459
462
460 # utility to expand user variables via Itpl
463 # utility to expand user variables via Itpl
461 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
464 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
462 self.user_ns))
465 self.user_ns))
463 # The first is similar to os.system, but it doesn't return a value,
466 # The first is similar to os.system, but it doesn't return a value,
464 # and it allows interpolation of variables in the user's namespace.
467 # and it allows interpolation of variables in the user's namespace.
465 self.system = lambda cmd: shell(self.var_expand(cmd),
468 self.system = lambda cmd: shell(self.var_expand(cmd),
466 header='IPython system call: ',
469 header='IPython system call: ',
467 verbose=self.rc.system_verbose)
470 verbose=self.rc.system_verbose)
468 # These are for getoutput and getoutputerror:
471 # These are for getoutput and getoutputerror:
469 self.getoutput = lambda cmd: \
472 self.getoutput = lambda cmd: \
470 getoutput(self.var_expand(cmd),
473 getoutput(self.var_expand(cmd),
471 header='IPython system call: ',
474 header='IPython system call: ',
472 verbose=self.rc.system_verbose)
475 verbose=self.rc.system_verbose)
473 self.getoutputerror = lambda cmd: \
476 self.getoutputerror = lambda cmd: \
474 getoutputerror(self.var_expand(cmd),
477 getoutputerror(self.var_expand(cmd),
475 header='IPython system call: ',
478 header='IPython system call: ',
476 verbose=self.rc.system_verbose)
479 verbose=self.rc.system_verbose)
477
480
478 # RegExp for splitting line contents into pre-char//first
481 # RegExp for splitting line contents into pre-char//first
479 # word-method//rest. For clarity, each group in on one line.
482 # word-method//rest. For clarity, each group in on one line.
480
483
481 # WARNING: update the regexp if the above escapes are changed, as they
484 # WARNING: update the regexp if the above escapes are changed, as they
482 # are hardwired in.
485 # are hardwired in.
483
486
484 # Don't get carried away with trying to make the autocalling catch too
487 # Don't get carried away with trying to make the autocalling catch too
485 # much: it's better to be conservative rather than to trigger hidden
488 # much: it's better to be conservative rather than to trigger hidden
486 # evals() somewhere and end up causing side effects.
489 # evals() somewhere and end up causing side effects.
487
490
488 self.line_split = re.compile(r'^([\s*,;/])'
491 self.line_split = re.compile(r'^([\s*,;/])'
489 r'([\?\w\.]+\w*\s*)'
492 r'([\?\w\.]+\w*\s*)'
490 r'(\(?.*$)')
493 r'(\(?.*$)')
491
494
492 # Original re, keep around for a while in case changes break something
495 # Original re, keep around for a while in case changes break something
493 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
496 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
494 # r'(\s*[\?\w\.]+\w*\s*)'
497 # r'(\s*[\?\w\.]+\w*\s*)'
495 # r'(\(?.*$)')
498 # r'(\(?.*$)')
496
499
497 # RegExp to identify potential function names
500 # RegExp to identify potential function names
498 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
501 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
499
502
500 # RegExp to exclude strings with this start from autocalling. In
503 # RegExp to exclude strings with this start from autocalling. In
501 # particular, all binary operators should be excluded, so that if foo
504 # particular, all binary operators should be excluded, so that if foo
502 # is callable, foo OP bar doesn't become foo(OP bar), which is
505 # is callable, foo OP bar doesn't become foo(OP bar), which is
503 # invalid. The characters '!=()' don't need to be checked for, as the
506 # invalid. The characters '!=()' don't need to be checked for, as the
504 # _prefilter routine explicitely does so, to catch direct calls and
507 # _prefilter routine explicitely does so, to catch direct calls and
505 # rebindings of existing names.
508 # rebindings of existing names.
506
509
507 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
510 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
508 # it affects the rest of the group in square brackets.
511 # it affects the rest of the group in square brackets.
509 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
512 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
510 '|^is |^not |^in |^and |^or ')
513 '|^is |^not |^in |^and |^or ')
511
514
512 # try to catch also methods for stuff in lists/tuples/dicts: off
515 # try to catch also methods for stuff in lists/tuples/dicts: off
513 # (experimental). For this to work, the line_split regexp would need
516 # (experimental). For this to work, the line_split regexp would need
514 # to be modified so it wouldn't break things at '['. That line is
517 # to be modified so it wouldn't break things at '['. That line is
515 # nasty enough that I shouldn't change it until I can test it _well_.
518 # nasty enough that I shouldn't change it until I can test it _well_.
516 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
519 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
517
520
518 # keep track of where we started running (mainly for crash post-mortem)
521 # keep track of where we started running (mainly for crash post-mortem)
519 self.starting_dir = os.getcwd()
522 self.starting_dir = os.getcwd()
520
523
521 # Various switches which can be set
524 # Various switches which can be set
522 self.CACHELENGTH = 5000 # this is cheap, it's just text
525 self.CACHELENGTH = 5000 # this is cheap, it's just text
523 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
526 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
524 self.banner2 = banner2
527 self.banner2 = banner2
525
528
526 # TraceBack handlers:
529 # TraceBack handlers:
527
530
528 # Syntax error handler.
531 # Syntax error handler.
529 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
532 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
530
533
531 # The interactive one is initialized with an offset, meaning we always
534 # The interactive one is initialized with an offset, meaning we always
532 # want to remove the topmost item in the traceback, which is our own
535 # want to remove the topmost item in the traceback, which is our own
533 # internal code. Valid modes: ['Plain','Context','Verbose']
536 # internal code. Valid modes: ['Plain','Context','Verbose']
534 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
537 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
535 color_scheme='NoColor',
538 color_scheme='NoColor',
536 tb_offset = 1)
539 tb_offset = 1)
537
540
538 # IPython itself shouldn't crash. This will produce a detailed
541 # IPython itself shouldn't crash. This will produce a detailed
539 # post-mortem if it does. But we only install the crash handler for
542 # post-mortem if it does. But we only install the crash handler for
540 # non-threaded shells, the threaded ones use a normal verbose reporter
543 # non-threaded shells, the threaded ones use a normal verbose reporter
541 # and lose the crash handler. This is because exceptions in the main
544 # and lose the crash handler. This is because exceptions in the main
542 # thread (such as in GUI code) propagate directly to sys.excepthook,
545 # thread (such as in GUI code) propagate directly to sys.excepthook,
543 # and there's no point in printing crash dumps for every user exception.
546 # and there's no point in printing crash dumps for every user exception.
544 if self.isthreaded:
547 if self.isthreaded:
545 ipCrashHandler = ultraTB.FormattedTB()
548 ipCrashHandler = ultraTB.FormattedTB()
546 else:
549 else:
547 from IPython import CrashHandler
550 from IPython import CrashHandler
548 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
551 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
549 self.set_crash_handler(ipCrashHandler)
552 self.set_crash_handler(ipCrashHandler)
550
553
551 # and add any custom exception handlers the user may have specified
554 # and add any custom exception handlers the user may have specified
552 self.set_custom_exc(*custom_exceptions)
555 self.set_custom_exc(*custom_exceptions)
553
556
554 # indentation management
557 # indentation management
555 self.autoindent = False
558 self.autoindent = False
556 self.indent_current_nsp = 0
559 self.indent_current_nsp = 0
557
560
558 # Make some aliases automatically
561 # Make some aliases automatically
559 # Prepare list of shell aliases to auto-define
562 # Prepare list of shell aliases to auto-define
560 if os.name == 'posix':
563 if os.name == 'posix':
561 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
564 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
562 'mv mv -i','rm rm -i','cp cp -i',
565 'mv mv -i','rm rm -i','cp cp -i',
563 'cat cat','less less','clear clear',
566 'cat cat','less less','clear clear',
564 # a better ls
567 # a better ls
565 'ls ls -F',
568 'ls ls -F',
566 # long ls
569 # long ls
567 'll ls -lF')
570 'll ls -lF')
568 # Extra ls aliases with color, which need special treatment on BSD
571 # Extra ls aliases with color, which need special treatment on BSD
569 # variants
572 # variants
570 ls_extra = ( # color ls
573 ls_extra = ( # color ls
571 'lc ls -F -o --color',
574 'lc ls -F -o --color',
572 # ls normal files only
575 # ls normal files only
573 'lf ls -F -o --color %l | grep ^-',
576 'lf ls -F -o --color %l | grep ^-',
574 # ls symbolic links
577 # ls symbolic links
575 'lk ls -F -o --color %l | grep ^l',
578 'lk ls -F -o --color %l | grep ^l',
576 # directories or links to directories,
579 # directories or links to directories,
577 'ldir ls -F -o --color %l | grep /$',
580 'ldir ls -F -o --color %l | grep /$',
578 # things which are executable
581 # things which are executable
579 'lx ls -F -o --color %l | grep ^-..x',
582 'lx ls -F -o --color %l | grep ^-..x',
580 )
583 )
581 # The BSDs don't ship GNU ls, so they don't understand the
584 # The BSDs don't ship GNU ls, so they don't understand the
582 # --color switch out of the box
585 # --color switch out of the box
583 if 'bsd' in sys.platform:
586 if 'bsd' in sys.platform:
584 ls_extra = ( # ls normal files only
587 ls_extra = ( # ls normal files only
585 'lf ls -lF | grep ^-',
588 'lf ls -lF | grep ^-',
586 # ls symbolic links
589 # ls symbolic links
587 'lk ls -lF | grep ^l',
590 'lk ls -lF | grep ^l',
588 # directories or links to directories,
591 # directories or links to directories,
589 'ldir ls -lF | grep /$',
592 'ldir ls -lF | grep /$',
590 # things which are executable
593 # things which are executable
591 'lx ls -lF | grep ^-..x',
594 'lx ls -lF | grep ^-..x',
592 )
595 )
593 auto_alias = auto_alias + ls_extra
596 auto_alias = auto_alias + ls_extra
594 elif os.name in ['nt','dos']:
597 elif os.name in ['nt','dos']:
595 auto_alias = ('dir dir /on', 'ls dir /on',
598 auto_alias = ('dir dir /on', 'ls dir /on',
596 'ddir dir /ad /on', 'ldir dir /ad /on',
599 'ddir dir /ad /on', 'ldir dir /ad /on',
597 'mkdir mkdir','rmdir rmdir','echo echo',
600 'mkdir mkdir','rmdir rmdir','echo echo',
598 'ren ren','cls cls','copy copy')
601 'ren ren','cls cls','copy copy')
599 else:
602 else:
600 auto_alias = ()
603 auto_alias = ()
601 self.auto_alias = [s.split(None,1) for s in auto_alias]
604 self.auto_alias = [s.split(None,1) for s in auto_alias]
602 # Call the actual (public) initializer
605 # Call the actual (public) initializer
603 self.init_auto_alias()
606 self.init_auto_alias()
604
607
605 # Produce a public API instance
608 # Produce a public API instance
606 self.api = IPython.ipapi.IPApi(self)
609 self.api = IPython.ipapi.IPApi(self)
607
610
608 # track which builtins we add, so we can clean up later
611 # track which builtins we add, so we can clean up later
609 self.builtins_added = {}
612 self.builtins_added = {}
610 # This method will add the necessary builtins for operation, but
613 # This method will add the necessary builtins for operation, but
611 # tracking what it did via the builtins_added dict.
614 # tracking what it did via the builtins_added dict.
612 self.add_builtins()
615 self.add_builtins()
613
616
614 # end __init__
617 # end __init__
615
618
616 def pre_config_initialization(self):
619 def pre_config_initialization(self):
617 """Pre-configuration init method
620 """Pre-configuration init method
618
621
619 This is called before the configuration files are processed to
622 This is called before the configuration files are processed to
620 prepare the services the config files might need.
623 prepare the services the config files might need.
621
624
622 self.rc already has reasonable default values at this point.
625 self.rc already has reasonable default values at this point.
623 """
626 """
624 rc = self.rc
627 rc = self.rc
625
628
626 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
629 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
627
630
628 def post_config_initialization(self):
631 def post_config_initialization(self):
629 """Post configuration init method
632 """Post configuration init method
630
633
631 This is called after the configuration files have been processed to
634 This is called after the configuration files have been processed to
632 'finalize' the initialization."""
635 'finalize' the initialization."""
633
636
634 rc = self.rc
637 rc = self.rc
635
638
636 # Object inspector
639 # Object inspector
637 self.inspector = OInspect.Inspector(OInspect.InspectColors,
640 self.inspector = OInspect.Inspector(OInspect.InspectColors,
638 PyColorize.ANSICodeColors,
641 PyColorize.ANSICodeColors,
639 'NoColor',
642 'NoColor',
640 rc.object_info_string_level)
643 rc.object_info_string_level)
641
644
642 # Load readline proper
645 # Load readline proper
643 if rc.readline:
646 if rc.readline:
644 self.init_readline()
647 self.init_readline()
645
648
646 # local shortcut, this is used a LOT
649 # local shortcut, this is used a LOT
647 self.log = self.logger.log
650 self.log = self.logger.log
648
651
649 # Initialize cache, set in/out prompts and printing system
652 # Initialize cache, set in/out prompts and printing system
650 self.outputcache = CachedOutput(self,
653 self.outputcache = CachedOutput(self,
651 rc.cache_size,
654 rc.cache_size,
652 rc.pprint,
655 rc.pprint,
653 input_sep = rc.separate_in,
656 input_sep = rc.separate_in,
654 output_sep = rc.separate_out,
657 output_sep = rc.separate_out,
655 output_sep2 = rc.separate_out2,
658 output_sep2 = rc.separate_out2,
656 ps1 = rc.prompt_in1,
659 ps1 = rc.prompt_in1,
657 ps2 = rc.prompt_in2,
660 ps2 = rc.prompt_in2,
658 ps_out = rc.prompt_out,
661 ps_out = rc.prompt_out,
659 pad_left = rc.prompts_pad_left)
662 pad_left = rc.prompts_pad_left)
660
663
661 # user may have over-ridden the default print hook:
664 # user may have over-ridden the default print hook:
662 try:
665 try:
663 self.outputcache.__class__.display = self.hooks.display
666 self.outputcache.__class__.display = self.hooks.display
664 except AttributeError:
667 except AttributeError:
665 pass
668 pass
666
669
667 # I don't like assigning globally to sys, because it means when
670 # I don't like assigning globally to sys, because it means when
668 # embedding instances, each embedded instance overrides the previous
671 # embedding instances, each embedded instance overrides the previous
669 # choice. But sys.displayhook seems to be called internally by exec,
672 # choice. But sys.displayhook seems to be called internally by exec,
670 # so I don't see a way around it. We first save the original and then
673 # so I don't see a way around it. We first save the original and then
671 # overwrite it.
674 # overwrite it.
672 self.sys_displayhook = sys.displayhook
675 self.sys_displayhook = sys.displayhook
673 sys.displayhook = self.outputcache
676 sys.displayhook = self.outputcache
674
677
675 # Set user colors (don't do it in the constructor above so that it
678 # Set user colors (don't do it in the constructor above so that it
676 # doesn't crash if colors option is invalid)
679 # doesn't crash if colors option is invalid)
677 self.magic_colors(rc.colors)
680 self.magic_colors(rc.colors)
678
681
679 # Set calling of pdb on exceptions
682 # Set calling of pdb on exceptions
680 self.call_pdb = rc.pdb
683 self.call_pdb = rc.pdb
681
684
682 # Load user aliases
685 # Load user aliases
683 for alias in rc.alias:
686 for alias in rc.alias:
684 self.magic_alias(alias)
687 self.magic_alias(alias)
685 self.hooks.late_startup_hook()
688 self.hooks.late_startup_hook()
686
689
687 batchrun = False
690 batchrun = False
688 for batchfile in [path(arg) for arg in self.rc.args
691 for batchfile in [path(arg) for arg in self.rc.args
689 if arg.lower().endswith('.ipy')]:
692 if arg.lower().endswith('.ipy')]:
690 if not batchfile.isfile():
693 if not batchfile.isfile():
691 print "No such batch file:", batchfile
694 print "No such batch file:", batchfile
692 continue
695 continue
693 self.api.runlines(batchfile.text())
696 self.api.runlines(batchfile.text())
694 batchrun = True
697 batchrun = True
695 if batchrun:
698 if batchrun:
696 self.exit_now = True
699 self.exit_now = True
697
700
698 def add_builtins(self):
701 def add_builtins(self):
699 """Store ipython references into the builtin namespace.
702 """Store ipython references into the builtin namespace.
700
703
701 Some parts of ipython operate via builtins injected here, which hold a
704 Some parts of ipython operate via builtins injected here, which hold a
702 reference to IPython itself."""
705 reference to IPython itself."""
703
706
704 # TODO: deprecate all except _ip; 'jobs' should be installed
707 # TODO: deprecate all except _ip; 'jobs' should be installed
705 # by an extension and the rest are under _ip, ipalias is redundant
708 # by an extension and the rest are under _ip, ipalias is redundant
706 builtins_new = dict(__IPYTHON__ = self,
709 builtins_new = dict(__IPYTHON__ = self,
707 ip_set_hook = self.set_hook,
710 ip_set_hook = self.set_hook,
708 jobs = self.jobs,
711 jobs = self.jobs,
709 ipmagic = self.ipmagic,
712 ipmagic = self.ipmagic,
710 ipalias = self.ipalias,
713 ipalias = self.ipalias,
711 ipsystem = self.ipsystem,
714 ipsystem = self.ipsystem,
712 _ip = self.api
715 _ip = self.api
713 )
716 )
714 for biname,bival in builtins_new.items():
717 for biname,bival in builtins_new.items():
715 try:
718 try:
716 # store the orignal value so we can restore it
719 # store the orignal value so we can restore it
717 self.builtins_added[biname] = __builtin__.__dict__[biname]
720 self.builtins_added[biname] = __builtin__.__dict__[biname]
718 except KeyError:
721 except KeyError:
719 # or mark that it wasn't defined, and we'll just delete it at
722 # or mark that it wasn't defined, and we'll just delete it at
720 # cleanup
723 # cleanup
721 self.builtins_added[biname] = Undefined
724 self.builtins_added[biname] = Undefined
722 __builtin__.__dict__[biname] = bival
725 __builtin__.__dict__[biname] = bival
723
726
724 # Keep in the builtins a flag for when IPython is active. We set it
727 # Keep in the builtins a flag for when IPython is active. We set it
725 # with setdefault so that multiple nested IPythons don't clobber one
728 # with setdefault so that multiple nested IPythons don't clobber one
726 # another. Each will increase its value by one upon being activated,
729 # another. Each will increase its value by one upon being activated,
727 # which also gives us a way to determine the nesting level.
730 # which also gives us a way to determine the nesting level.
728 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
731 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
729
732
730 def clean_builtins(self):
733 def clean_builtins(self):
731 """Remove any builtins which might have been added by add_builtins, or
734 """Remove any builtins which might have been added by add_builtins, or
732 restore overwritten ones to their previous values."""
735 restore overwritten ones to their previous values."""
733 for biname,bival in self.builtins_added.items():
736 for biname,bival in self.builtins_added.items():
734 if bival is Undefined:
737 if bival is Undefined:
735 del __builtin__.__dict__[biname]
738 del __builtin__.__dict__[biname]
736 else:
739 else:
737 __builtin__.__dict__[biname] = bival
740 __builtin__.__dict__[biname] = bival
738 self.builtins_added.clear()
741 self.builtins_added.clear()
739
742
740 def set_hook(self,name,hook, priority = 50):
743 def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
741 """set_hook(name,hook) -> sets an internal IPython hook.
744 """set_hook(name,hook) -> sets an internal IPython hook.
742
745
743 IPython exposes some of its internal API as user-modifiable hooks. By
746 IPython exposes some of its internal API as user-modifiable hooks. By
744 adding your function to one of these hooks, you can modify IPython's
747 adding your function to one of these hooks, you can modify IPython's
745 behavior to call at runtime your own routines."""
748 behavior to call at runtime your own routines."""
746
749
747 # At some point in the future, this should validate the hook before it
750 # At some point in the future, this should validate the hook before it
748 # accepts it. Probably at least check that the hook takes the number
751 # accepts it. Probably at least check that the hook takes the number
749 # of args it's supposed to.
752 # of args it's supposed to.
753
754 f = new.instancemethod(hook,self,self.__class__)
755
756 # check if the hook is for strdispatcher first
757 if str_key is not None:
758 sdp = self.strdispatchers.get(name, StrDispatch())
759 sdp.add_s(str_key, f, priority )
760 self.strdispatchers[name] = sdp
761 return
762 if re_key is not None:
763 sdp = self.strdispatchers.get(name, StrDispatch())
764 sdp.add_re(re.compile(re_key), f, priority )
765 self.strdispatchers[name] = sdp
766 return
767
750 dp = getattr(self.hooks, name, None)
768 dp = getattr(self.hooks, name, None)
751 if name not in IPython.hooks.__all__:
769 if name not in IPython.hooks.__all__:
752 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
770 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
753 if not dp:
771 if not dp:
754 dp = IPython.hooks.CommandChainDispatcher()
772 dp = IPython.hooks.CommandChainDispatcher()
755
773
756 f = new.instancemethod(hook,self,self.__class__)
757 try:
774 try:
758 dp.add(f,priority)
775 dp.add(f,priority)
759 except AttributeError:
776 except AttributeError:
760 # it was not commandchain, plain old func - replace
777 # it was not commandchain, plain old func - replace
761 dp = f
778 dp = f
762
779
763 setattr(self.hooks,name, dp)
780 setattr(self.hooks,name, dp)
764
781
765
782
766 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
783 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
767
784
768 def set_crash_handler(self,crashHandler):
785 def set_crash_handler(self,crashHandler):
769 """Set the IPython crash handler.
786 """Set the IPython crash handler.
770
787
771 This must be a callable with a signature suitable for use as
788 This must be a callable with a signature suitable for use as
772 sys.excepthook."""
789 sys.excepthook."""
773
790
774 # Install the given crash handler as the Python exception hook
791 # Install the given crash handler as the Python exception hook
775 sys.excepthook = crashHandler
792 sys.excepthook = crashHandler
776
793
777 # The instance will store a pointer to this, so that runtime code
794 # The instance will store a pointer to this, so that runtime code
778 # (such as magics) can access it. This is because during the
795 # (such as magics) can access it. This is because during the
779 # read-eval loop, it gets temporarily overwritten (to deal with GUI
796 # read-eval loop, it gets temporarily overwritten (to deal with GUI
780 # frameworks).
797 # frameworks).
781 self.sys_excepthook = sys.excepthook
798 self.sys_excepthook = sys.excepthook
782
799
783
800
784 def set_custom_exc(self,exc_tuple,handler):
801 def set_custom_exc(self,exc_tuple,handler):
785 """set_custom_exc(exc_tuple,handler)
802 """set_custom_exc(exc_tuple,handler)
786
803
787 Set a custom exception handler, which will be called if any of the
804 Set a custom exception handler, which will be called if any of the
788 exceptions in exc_tuple occur in the mainloop (specifically, in the
805 exceptions in exc_tuple occur in the mainloop (specifically, in the
789 runcode() method.
806 runcode() method.
790
807
791 Inputs:
808 Inputs:
792
809
793 - exc_tuple: a *tuple* of valid exceptions to call the defined
810 - exc_tuple: a *tuple* of valid exceptions to call the defined
794 handler for. It is very important that you use a tuple, and NOT A
811 handler for. It is very important that you use a tuple, and NOT A
795 LIST here, because of the way Python's except statement works. If
812 LIST here, because of the way Python's except statement works. If
796 you only want to trap a single exception, use a singleton tuple:
813 you only want to trap a single exception, use a singleton tuple:
797
814
798 exc_tuple == (MyCustomException,)
815 exc_tuple == (MyCustomException,)
799
816
800 - handler: this must be defined as a function with the following
817 - handler: this must be defined as a function with the following
801 basic interface: def my_handler(self,etype,value,tb).
818 basic interface: def my_handler(self,etype,value,tb).
802
819
803 This will be made into an instance method (via new.instancemethod)
820 This will be made into an instance method (via new.instancemethod)
804 of IPython itself, and it will be called if any of the exceptions
821 of IPython itself, and it will be called if any of the exceptions
805 listed in the exc_tuple are caught. If the handler is None, an
822 listed in the exc_tuple are caught. If the handler is None, an
806 internal basic one is used, which just prints basic info.
823 internal basic one is used, which just prints basic info.
807
824
808 WARNING: by putting in your own exception handler into IPython's main
825 WARNING: by putting in your own exception handler into IPython's main
809 execution loop, you run a very good chance of nasty crashes. This
826 execution loop, you run a very good chance of nasty crashes. This
810 facility should only be used if you really know what you are doing."""
827 facility should only be used if you really know what you are doing."""
811
828
812 assert type(exc_tuple)==type(()) , \
829 assert type(exc_tuple)==type(()) , \
813 "The custom exceptions must be given AS A TUPLE."
830 "The custom exceptions must be given AS A TUPLE."
814
831
815 def dummy_handler(self,etype,value,tb):
832 def dummy_handler(self,etype,value,tb):
816 print '*** Simple custom exception handler ***'
833 print '*** Simple custom exception handler ***'
817 print 'Exception type :',etype
834 print 'Exception type :',etype
818 print 'Exception value:',value
835 print 'Exception value:',value
819 print 'Traceback :',tb
836 print 'Traceback :',tb
820 print 'Source code :','\n'.join(self.buffer)
837 print 'Source code :','\n'.join(self.buffer)
821
838
822 if handler is None: handler = dummy_handler
839 if handler is None: handler = dummy_handler
823
840
824 self.CustomTB = new.instancemethod(handler,self,self.__class__)
841 self.CustomTB = new.instancemethod(handler,self,self.__class__)
825 self.custom_exceptions = exc_tuple
842 self.custom_exceptions = exc_tuple
826
843
827 def set_custom_completer(self,completer,pos=0):
844 def set_custom_completer(self,completer,pos=0):
828 """set_custom_completer(completer,pos=0)
845 """set_custom_completer(completer,pos=0)
829
846
830 Adds a new custom completer function.
847 Adds a new custom completer function.
831
848
832 The position argument (defaults to 0) is the index in the completers
849 The position argument (defaults to 0) is the index in the completers
833 list where you want the completer to be inserted."""
850 list where you want the completer to be inserted."""
834
851
835 newcomp = new.instancemethod(completer,self.Completer,
852 newcomp = new.instancemethod(completer,self.Completer,
836 self.Completer.__class__)
853 self.Completer.__class__)
837 self.Completer.matchers.insert(pos,newcomp)
854 self.Completer.matchers.insert(pos,newcomp)
838
855
839 def _get_call_pdb(self):
856 def _get_call_pdb(self):
840 return self._call_pdb
857 return self._call_pdb
841
858
842 def _set_call_pdb(self,val):
859 def _set_call_pdb(self,val):
843
860
844 if val not in (0,1,False,True):
861 if val not in (0,1,False,True):
845 raise ValueError,'new call_pdb value must be boolean'
862 raise ValueError,'new call_pdb value must be boolean'
846
863
847 # store value in instance
864 # store value in instance
848 self._call_pdb = val
865 self._call_pdb = val
849
866
850 # notify the actual exception handlers
867 # notify the actual exception handlers
851 self.InteractiveTB.call_pdb = val
868 self.InteractiveTB.call_pdb = val
852 if self.isthreaded:
869 if self.isthreaded:
853 try:
870 try:
854 self.sys_excepthook.call_pdb = val
871 self.sys_excepthook.call_pdb = val
855 except:
872 except:
856 warn('Failed to activate pdb for threaded exception handler')
873 warn('Failed to activate pdb for threaded exception handler')
857
874
858 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
875 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
859 'Control auto-activation of pdb at exceptions')
876 'Control auto-activation of pdb at exceptions')
860
877
861
878
862 # These special functions get installed in the builtin namespace, to
879 # These special functions get installed in the builtin namespace, to
863 # provide programmatic (pure python) access to magics, aliases and system
880 # provide programmatic (pure python) access to magics, aliases and system
864 # calls. This is important for logging, user scripting, and more.
881 # calls. This is important for logging, user scripting, and more.
865
882
866 # We are basically exposing, via normal python functions, the three
883 # We are basically exposing, via normal python functions, the three
867 # mechanisms in which ipython offers special call modes (magics for
884 # mechanisms in which ipython offers special call modes (magics for
868 # internal control, aliases for direct system access via pre-selected
885 # internal control, aliases for direct system access via pre-selected
869 # names, and !cmd for calling arbitrary system commands).
886 # names, and !cmd for calling arbitrary system commands).
870
887
871 def ipmagic(self,arg_s):
888 def ipmagic(self,arg_s):
872 """Call a magic function by name.
889 """Call a magic function by name.
873
890
874 Input: a string containing the name of the magic function to call and any
891 Input: a string containing the name of the magic function to call and any
875 additional arguments to be passed to the magic.
892 additional arguments to be passed to the magic.
876
893
877 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
894 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
878 prompt:
895 prompt:
879
896
880 In[1]: %name -opt foo bar
897 In[1]: %name -opt foo bar
881
898
882 To call a magic without arguments, simply use ipmagic('name').
899 To call a magic without arguments, simply use ipmagic('name').
883
900
884 This provides a proper Python function to call IPython's magics in any
901 This provides a proper Python function to call IPython's magics in any
885 valid Python code you can type at the interpreter, including loops and
902 valid Python code you can type at the interpreter, including loops and
886 compound statements. It is added by IPython to the Python builtin
903 compound statements. It is added by IPython to the Python builtin
887 namespace upon initialization."""
904 namespace upon initialization."""
888
905
889 args = arg_s.split(' ',1)
906 args = arg_s.split(' ',1)
890 magic_name = args[0]
907 magic_name = args[0]
891 magic_name = magic_name.lstrip(self.ESC_MAGIC)
908 magic_name = magic_name.lstrip(self.ESC_MAGIC)
892
909
893 try:
910 try:
894 magic_args = args[1]
911 magic_args = args[1]
895 except IndexError:
912 except IndexError:
896 magic_args = ''
913 magic_args = ''
897 fn = getattr(self,'magic_'+magic_name,None)
914 fn = getattr(self,'magic_'+magic_name,None)
898 if fn is None:
915 if fn is None:
899 error("Magic function `%s` not found." % magic_name)
916 error("Magic function `%s` not found." % magic_name)
900 else:
917 else:
901 magic_args = self.var_expand(magic_args)
918 magic_args = self.var_expand(magic_args)
902 return fn(magic_args)
919 return fn(magic_args)
903
920
904 def ipalias(self,arg_s):
921 def ipalias(self,arg_s):
905 """Call an alias by name.
922 """Call an alias by name.
906
923
907 Input: a string containing the name of the alias to call and any
924 Input: a string containing the name of the alias to call and any
908 additional arguments to be passed to the magic.
925 additional arguments to be passed to the magic.
909
926
910 ipalias('name -opt foo bar') is equivalent to typing at the ipython
927 ipalias('name -opt foo bar') is equivalent to typing at the ipython
911 prompt:
928 prompt:
912
929
913 In[1]: name -opt foo bar
930 In[1]: name -opt foo bar
914
931
915 To call an alias without arguments, simply use ipalias('name').
932 To call an alias without arguments, simply use ipalias('name').
916
933
917 This provides a proper Python function to call IPython's aliases in any
934 This provides a proper Python function to call IPython's aliases in any
918 valid Python code you can type at the interpreter, including loops and
935 valid Python code you can type at the interpreter, including loops and
919 compound statements. It is added by IPython to the Python builtin
936 compound statements. It is added by IPython to the Python builtin
920 namespace upon initialization."""
937 namespace upon initialization."""
921
938
922 args = arg_s.split(' ',1)
939 args = arg_s.split(' ',1)
923 alias_name = args[0]
940 alias_name = args[0]
924 try:
941 try:
925 alias_args = args[1]
942 alias_args = args[1]
926 except IndexError:
943 except IndexError:
927 alias_args = ''
944 alias_args = ''
928 if alias_name in self.alias_table:
945 if alias_name in self.alias_table:
929 self.call_alias(alias_name,alias_args)
946 self.call_alias(alias_name,alias_args)
930 else:
947 else:
931 error("Alias `%s` not found." % alias_name)
948 error("Alias `%s` not found." % alias_name)
932
949
933 def ipsystem(self,arg_s):
950 def ipsystem(self,arg_s):
934 """Make a system call, using IPython."""
951 """Make a system call, using IPython."""
935
952
936 self.system(arg_s)
953 self.system(arg_s)
937
954
938 def complete(self,text):
955 def complete(self,text):
939 """Return a sorted list of all possible completions on text.
956 """Return a sorted list of all possible completions on text.
940
957
941 Inputs:
958 Inputs:
942
959
943 - text: a string of text to be completed on.
960 - text: a string of text to be completed on.
944
961
945 This is a wrapper around the completion mechanism, similar to what
962 This is a wrapper around the completion mechanism, similar to what
946 readline does at the command line when the TAB key is hit. By
963 readline does at the command line when the TAB key is hit. By
947 exposing it as a method, it can be used by other non-readline
964 exposing it as a method, it can be used by other non-readline
948 environments (such as GUIs) for text completion.
965 environments (such as GUIs) for text completion.
949
966
950 Simple usage example:
967 Simple usage example:
951
968
952 In [1]: x = 'hello'
969 In [1]: x = 'hello'
953
970
954 In [2]: __IP.complete('x.l')
971 In [2]: __IP.complete('x.l')
955 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
972 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
956
973
957 complete = self.Completer.complete
974 complete = self.Completer.complete
958 state = 0
975 state = 0
959 # use a dict so we get unique keys, since ipyhton's multiple
976 # use a dict so we get unique keys, since ipyhton's multiple
960 # completers can return duplicates.
977 # completers can return duplicates.
961 comps = {}
978 comps = {}
962 while True:
979 while True:
963 newcomp = complete(text,state)
980 newcomp = complete(text,state)
964 if newcomp is None:
981 if newcomp is None:
965 break
982 break
966 comps[newcomp] = 1
983 comps[newcomp] = 1
967 state += 1
984 state += 1
968 outcomps = comps.keys()
985 outcomps = comps.keys()
969 outcomps.sort()
986 outcomps.sort()
970 return outcomps
987 return outcomps
971
988
972 def set_completer_frame(self, frame=None):
989 def set_completer_frame(self, frame=None):
973 if frame:
990 if frame:
974 self.Completer.namespace = frame.f_locals
991 self.Completer.namespace = frame.f_locals
975 self.Completer.global_namespace = frame.f_globals
992 self.Completer.global_namespace = frame.f_globals
976 else:
993 else:
977 self.Completer.namespace = self.user_ns
994 self.Completer.namespace = self.user_ns
978 self.Completer.global_namespace = self.user_global_ns
995 self.Completer.global_namespace = self.user_global_ns
979
996
980 def init_auto_alias(self):
997 def init_auto_alias(self):
981 """Define some aliases automatically.
998 """Define some aliases automatically.
982
999
983 These are ALL parameter-less aliases"""
1000 These are ALL parameter-less aliases"""
984
1001
985 for alias,cmd in self.auto_alias:
1002 for alias,cmd in self.auto_alias:
986 self.alias_table[alias] = (0,cmd)
1003 self.alias_table[alias] = (0,cmd)
987
1004
988 def alias_table_validate(self,verbose=0):
1005 def alias_table_validate(self,verbose=0):
989 """Update information about the alias table.
1006 """Update information about the alias table.
990
1007
991 In particular, make sure no Python keywords/builtins are in it."""
1008 In particular, make sure no Python keywords/builtins are in it."""
992
1009
993 no_alias = self.no_alias
1010 no_alias = self.no_alias
994 for k in self.alias_table.keys():
1011 for k in self.alias_table.keys():
995 if k in no_alias:
1012 if k in no_alias:
996 del self.alias_table[k]
1013 del self.alias_table[k]
997 if verbose:
1014 if verbose:
998 print ("Deleting alias <%s>, it's a Python "
1015 print ("Deleting alias <%s>, it's a Python "
999 "keyword or builtin." % k)
1016 "keyword or builtin." % k)
1000
1017
1001 def set_autoindent(self,value=None):
1018 def set_autoindent(self,value=None):
1002 """Set the autoindent flag, checking for readline support.
1019 """Set the autoindent flag, checking for readline support.
1003
1020
1004 If called with no arguments, it acts as a toggle."""
1021 If called with no arguments, it acts as a toggle."""
1005
1022
1006 if not self.has_readline:
1023 if not self.has_readline:
1007 if os.name == 'posix':
1024 if os.name == 'posix':
1008 warn("The auto-indent feature requires the readline library")
1025 warn("The auto-indent feature requires the readline library")
1009 self.autoindent = 0
1026 self.autoindent = 0
1010 return
1027 return
1011 if value is None:
1028 if value is None:
1012 self.autoindent = not self.autoindent
1029 self.autoindent = not self.autoindent
1013 else:
1030 else:
1014 self.autoindent = value
1031 self.autoindent = value
1015
1032
1016 def rc_set_toggle(self,rc_field,value=None):
1033 def rc_set_toggle(self,rc_field,value=None):
1017 """Set or toggle a field in IPython's rc config. structure.
1034 """Set or toggle a field in IPython's rc config. structure.
1018
1035
1019 If called with no arguments, it acts as a toggle.
1036 If called with no arguments, it acts as a toggle.
1020
1037
1021 If called with a non-existent field, the resulting AttributeError
1038 If called with a non-existent field, the resulting AttributeError
1022 exception will propagate out."""
1039 exception will propagate out."""
1023
1040
1024 rc_val = getattr(self.rc,rc_field)
1041 rc_val = getattr(self.rc,rc_field)
1025 if value is None:
1042 if value is None:
1026 value = not rc_val
1043 value = not rc_val
1027 setattr(self.rc,rc_field,value)
1044 setattr(self.rc,rc_field,value)
1028
1045
1029 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1046 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1030 """Install the user configuration directory.
1047 """Install the user configuration directory.
1031
1048
1032 Can be called when running for the first time or to upgrade the user's
1049 Can be called when running for the first time or to upgrade the user's
1033 .ipython/ directory with the mode parameter. Valid modes are 'install'
1050 .ipython/ directory with the mode parameter. Valid modes are 'install'
1034 and 'upgrade'."""
1051 and 'upgrade'."""
1035
1052
1036 def wait():
1053 def wait():
1037 try:
1054 try:
1038 raw_input("Please press <RETURN> to start IPython.")
1055 raw_input("Please press <RETURN> to start IPython.")
1039 except EOFError:
1056 except EOFError:
1040 print >> Term.cout
1057 print >> Term.cout
1041 print '*'*70
1058 print '*'*70
1042
1059
1043 cwd = os.getcwd() # remember where we started
1060 cwd = os.getcwd() # remember where we started
1044 glb = glob.glob
1061 glb = glob.glob
1045 print '*'*70
1062 print '*'*70
1046 if mode == 'install':
1063 if mode == 'install':
1047 print \
1064 print \
1048 """Welcome to IPython. I will try to create a personal configuration directory
1065 """Welcome to IPython. I will try to create a personal configuration directory
1049 where you can customize many aspects of IPython's functionality in:\n"""
1066 where you can customize many aspects of IPython's functionality in:\n"""
1050 else:
1067 else:
1051 print 'I am going to upgrade your configuration in:'
1068 print 'I am going to upgrade your configuration in:'
1052
1069
1053 print ipythondir
1070 print ipythondir
1054
1071
1055 rcdirend = os.path.join('IPython','UserConfig')
1072 rcdirend = os.path.join('IPython','UserConfig')
1056 cfg = lambda d: os.path.join(d,rcdirend)
1073 cfg = lambda d: os.path.join(d,rcdirend)
1057 try:
1074 try:
1058 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1075 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1059 except IOError:
1076 except IOError:
1060 warning = """
1077 warning = """
1061 Installation error. IPython's directory was not found.
1078 Installation error. IPython's directory was not found.
1062
1079
1063 Check the following:
1080 Check the following:
1064
1081
1065 The ipython/IPython directory should be in a directory belonging to your
1082 The ipython/IPython directory should be in a directory belonging to your
1066 PYTHONPATH environment variable (that is, it should be in a directory
1083 PYTHONPATH environment variable (that is, it should be in a directory
1067 belonging to sys.path). You can copy it explicitly there or just link to it.
1084 belonging to sys.path). You can copy it explicitly there or just link to it.
1068
1085
1069 IPython will proceed with builtin defaults.
1086 IPython will proceed with builtin defaults.
1070 """
1087 """
1071 warn(warning)
1088 warn(warning)
1072 wait()
1089 wait()
1073 return
1090 return
1074
1091
1075 if mode == 'install':
1092 if mode == 'install':
1076 try:
1093 try:
1077 shutil.copytree(rcdir,ipythondir)
1094 shutil.copytree(rcdir,ipythondir)
1078 os.chdir(ipythondir)
1095 os.chdir(ipythondir)
1079 rc_files = glb("ipythonrc*")
1096 rc_files = glb("ipythonrc*")
1080 for rc_file in rc_files:
1097 for rc_file in rc_files:
1081 os.rename(rc_file,rc_file+rc_suffix)
1098 os.rename(rc_file,rc_file+rc_suffix)
1082 except:
1099 except:
1083 warning = """
1100 warning = """
1084
1101
1085 There was a problem with the installation:
1102 There was a problem with the installation:
1086 %s
1103 %s
1087 Try to correct it or contact the developers if you think it's a bug.
1104 Try to correct it or contact the developers if you think it's a bug.
1088 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1105 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1089 warn(warning)
1106 warn(warning)
1090 wait()
1107 wait()
1091 return
1108 return
1092
1109
1093 elif mode == 'upgrade':
1110 elif mode == 'upgrade':
1094 try:
1111 try:
1095 os.chdir(ipythondir)
1112 os.chdir(ipythondir)
1096 except:
1113 except:
1097 print """
1114 print """
1098 Can not upgrade: changing to directory %s failed. Details:
1115 Can not upgrade: changing to directory %s failed. Details:
1099 %s
1116 %s
1100 """ % (ipythondir,sys.exc_info()[1])
1117 """ % (ipythondir,sys.exc_info()[1])
1101 wait()
1118 wait()
1102 return
1119 return
1103 else:
1120 else:
1104 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1121 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1105 for new_full_path in sources:
1122 for new_full_path in sources:
1106 new_filename = os.path.basename(new_full_path)
1123 new_filename = os.path.basename(new_full_path)
1107 if new_filename.startswith('ipythonrc'):
1124 if new_filename.startswith('ipythonrc'):
1108 new_filename = new_filename + rc_suffix
1125 new_filename = new_filename + rc_suffix
1109 # The config directory should only contain files, skip any
1126 # The config directory should only contain files, skip any
1110 # directories which may be there (like CVS)
1127 # directories which may be there (like CVS)
1111 if os.path.isdir(new_full_path):
1128 if os.path.isdir(new_full_path):
1112 continue
1129 continue
1113 if os.path.exists(new_filename):
1130 if os.path.exists(new_filename):
1114 old_file = new_filename+'.old'
1131 old_file = new_filename+'.old'
1115 if os.path.exists(old_file):
1132 if os.path.exists(old_file):
1116 os.remove(old_file)
1133 os.remove(old_file)
1117 os.rename(new_filename,old_file)
1134 os.rename(new_filename,old_file)
1118 shutil.copy(new_full_path,new_filename)
1135 shutil.copy(new_full_path,new_filename)
1119 else:
1136 else:
1120 raise ValueError,'unrecognized mode for install:',`mode`
1137 raise ValueError,'unrecognized mode for install:',`mode`
1121
1138
1122 # Fix line-endings to those native to each platform in the config
1139 # Fix line-endings to those native to each platform in the config
1123 # directory.
1140 # directory.
1124 try:
1141 try:
1125 os.chdir(ipythondir)
1142 os.chdir(ipythondir)
1126 except:
1143 except:
1127 print """
1144 print """
1128 Problem: changing to directory %s failed.
1145 Problem: changing to directory %s failed.
1129 Details:
1146 Details:
1130 %s
1147 %s
1131
1148
1132 Some configuration files may have incorrect line endings. This should not
1149 Some configuration files may have incorrect line endings. This should not
1133 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1150 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1134 wait()
1151 wait()
1135 else:
1152 else:
1136 for fname in glb('ipythonrc*'):
1153 for fname in glb('ipythonrc*'):
1137 try:
1154 try:
1138 native_line_ends(fname,backup=0)
1155 native_line_ends(fname,backup=0)
1139 except IOError:
1156 except IOError:
1140 pass
1157 pass
1141
1158
1142 if mode == 'install':
1159 if mode == 'install':
1143 print """
1160 print """
1144 Successful installation!
1161 Successful installation!
1145
1162
1146 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1163 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1147 IPython manual (there are both HTML and PDF versions supplied with the
1164 IPython manual (there are both HTML and PDF versions supplied with the
1148 distribution) to make sure that your system environment is properly configured
1165 distribution) to make sure that your system environment is properly configured
1149 to take advantage of IPython's features.
1166 to take advantage of IPython's features.
1150
1167
1151 Important note: the configuration system has changed! The old system is
1168 Important note: the configuration system has changed! The old system is
1152 still in place, but its setting may be partly overridden by the settings in
1169 still in place, but its setting may be partly overridden by the settings in
1153 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1170 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1154 if some of the new settings bother you.
1171 if some of the new settings bother you.
1155
1172
1156 """
1173 """
1157 else:
1174 else:
1158 print """
1175 print """
1159 Successful upgrade!
1176 Successful upgrade!
1160
1177
1161 All files in your directory:
1178 All files in your directory:
1162 %(ipythondir)s
1179 %(ipythondir)s
1163 which would have been overwritten by the upgrade were backed up with a .old
1180 which would have been overwritten by the upgrade were backed up with a .old
1164 extension. If you had made particular customizations in those files you may
1181 extension. If you had made particular customizations in those files you may
1165 want to merge them back into the new files.""" % locals()
1182 want to merge them back into the new files.""" % locals()
1166 wait()
1183 wait()
1167 os.chdir(cwd)
1184 os.chdir(cwd)
1168 # end user_setup()
1185 # end user_setup()
1169
1186
1170 def atexit_operations(self):
1187 def atexit_operations(self):
1171 """This will be executed at the time of exit.
1188 """This will be executed at the time of exit.
1172
1189
1173 Saving of persistent data should be performed here. """
1190 Saving of persistent data should be performed here. """
1174
1191
1175 #print '*** IPython exit cleanup ***' # dbg
1192 #print '*** IPython exit cleanup ***' # dbg
1176 # input history
1193 # input history
1177 self.savehist()
1194 self.savehist()
1178
1195
1179 # Cleanup all tempfiles left around
1196 # Cleanup all tempfiles left around
1180 for tfile in self.tempfiles:
1197 for tfile in self.tempfiles:
1181 try:
1198 try:
1182 os.unlink(tfile)
1199 os.unlink(tfile)
1183 except OSError:
1200 except OSError:
1184 pass
1201 pass
1185
1202
1186 # save the "persistent data" catch-all dictionary
1203 # save the "persistent data" catch-all dictionary
1187 self.hooks.shutdown_hook()
1204 self.hooks.shutdown_hook()
1188
1205
1189 def savehist(self):
1206 def savehist(self):
1190 """Save input history to a file (via readline library)."""
1207 """Save input history to a file (via readline library)."""
1191 try:
1208 try:
1192 self.readline.write_history_file(self.histfile)
1209 self.readline.write_history_file(self.histfile)
1193 except:
1210 except:
1194 print 'Unable to save IPython command history to file: ' + \
1211 print 'Unable to save IPython command history to file: ' + \
1195 `self.histfile`
1212 `self.histfile`
1196
1213
1197 def pre_readline(self):
1214 def pre_readline(self):
1198 """readline hook to be used at the start of each line.
1215 """readline hook to be used at the start of each line.
1199
1216
1200 Currently it handles auto-indent only."""
1217 Currently it handles auto-indent only."""
1201
1218
1202 #debugx('self.indent_current_nsp','pre_readline:')
1219 #debugx('self.indent_current_nsp','pre_readline:')
1203 self.readline.insert_text(self.indent_current_str())
1220 self.readline.insert_text(self.indent_current_str())
1204
1221
1205 def init_readline(self):
1222 def init_readline(self):
1206 """Command history completion/saving/reloading."""
1223 """Command history completion/saving/reloading."""
1207
1224
1208 import IPython.rlineimpl as readline
1225 import IPython.rlineimpl as readline
1209 if not readline.have_readline:
1226 if not readline.have_readline:
1210 self.has_readline = 0
1227 self.has_readline = 0
1211 self.readline = None
1228 self.readline = None
1212 # no point in bugging windows users with this every time:
1229 # no point in bugging windows users with this every time:
1213 warn('Readline services not available on this platform.')
1230 warn('Readline services not available on this platform.')
1214 else:
1231 else:
1215 sys.modules['readline'] = readline
1232 sys.modules['readline'] = readline
1216 import atexit
1233 import atexit
1217 from IPython.completer import IPCompleter
1234 from IPython.completer import IPCompleter
1218 self.Completer = IPCompleter(self,
1235 self.Completer = IPCompleter(self,
1219 self.user_ns,
1236 self.user_ns,
1220 self.user_global_ns,
1237 self.user_global_ns,
1221 self.rc.readline_omit__names,
1238 self.rc.readline_omit__names,
1222 self.alias_table)
1239 self.alias_table)
1223
1240 sdisp = self.strdispatchers.get('complete_command', StrDispatch())
1241 self.strdispatchers['complete_command'] = sdisp
1242 self.Completer.custom_completers = sdisp
1224 # Platform-specific configuration
1243 # Platform-specific configuration
1225 if os.name == 'nt':
1244 if os.name == 'nt':
1226 self.readline_startup_hook = readline.set_pre_input_hook
1245 self.readline_startup_hook = readline.set_pre_input_hook
1227 else:
1246 else:
1228 self.readline_startup_hook = readline.set_startup_hook
1247 self.readline_startup_hook = readline.set_startup_hook
1229
1248
1230 # Load user's initrc file (readline config)
1249 # Load user's initrc file (readline config)
1231 inputrc_name = os.environ.get('INPUTRC')
1250 inputrc_name = os.environ.get('INPUTRC')
1232 if inputrc_name is None:
1251 if inputrc_name is None:
1233 home_dir = get_home_dir()
1252 home_dir = get_home_dir()
1234 if home_dir is not None:
1253 if home_dir is not None:
1235 inputrc_name = os.path.join(home_dir,'.inputrc')
1254 inputrc_name = os.path.join(home_dir,'.inputrc')
1236 if os.path.isfile(inputrc_name):
1255 if os.path.isfile(inputrc_name):
1237 try:
1256 try:
1238 readline.read_init_file(inputrc_name)
1257 readline.read_init_file(inputrc_name)
1239 except:
1258 except:
1240 warn('Problems reading readline initialization file <%s>'
1259 warn('Problems reading readline initialization file <%s>'
1241 % inputrc_name)
1260 % inputrc_name)
1242
1261
1243 self.has_readline = 1
1262 self.has_readline = 1
1244 self.readline = readline
1263 self.readline = readline
1245 # save this in sys so embedded copies can restore it properly
1264 # save this in sys so embedded copies can restore it properly
1246 sys.ipcompleter = self.Completer.complete
1265 sys.ipcompleter = self.Completer.complete
1247 readline.set_completer(self.Completer.complete)
1266 readline.set_completer(self.Completer.complete)
1248
1267
1249 # Configure readline according to user's prefs
1268 # Configure readline according to user's prefs
1250 for rlcommand in self.rc.readline_parse_and_bind:
1269 for rlcommand in self.rc.readline_parse_and_bind:
1251 readline.parse_and_bind(rlcommand)
1270 readline.parse_and_bind(rlcommand)
1252
1271
1253 # remove some chars from the delimiters list
1272 # remove some chars from the delimiters list
1254 delims = readline.get_completer_delims()
1273 delims = readline.get_completer_delims()
1255 delims = delims.translate(string._idmap,
1274 delims = delims.translate(string._idmap,
1256 self.rc.readline_remove_delims)
1275 self.rc.readline_remove_delims)
1257 readline.set_completer_delims(delims)
1276 readline.set_completer_delims(delims)
1258 # otherwise we end up with a monster history after a while:
1277 # otherwise we end up with a monster history after a while:
1259 readline.set_history_length(1000)
1278 readline.set_history_length(1000)
1260 try:
1279 try:
1261 #print '*** Reading readline history' # dbg
1280 #print '*** Reading readline history' # dbg
1262 readline.read_history_file(self.histfile)
1281 readline.read_history_file(self.histfile)
1263 except IOError:
1282 except IOError:
1264 pass # It doesn't exist yet.
1283 pass # It doesn't exist yet.
1265
1284
1266 atexit.register(self.atexit_operations)
1285 atexit.register(self.atexit_operations)
1267 del atexit
1286 del atexit
1268
1287
1269 # Configure auto-indent for all platforms
1288 # Configure auto-indent for all platforms
1270 self.set_autoindent(self.rc.autoindent)
1289 self.set_autoindent(self.rc.autoindent)
1271
1290
1272 def ask_yes_no(self,prompt,default=True):
1291 def ask_yes_no(self,prompt,default=True):
1273 if self.rc.quiet:
1292 if self.rc.quiet:
1274 return True
1293 return True
1275 return ask_yes_no(prompt,default)
1294 return ask_yes_no(prompt,default)
1276
1295
1277 def _should_recompile(self,e):
1296 def _should_recompile(self,e):
1278 """Utility routine for edit_syntax_error"""
1297 """Utility routine for edit_syntax_error"""
1279
1298
1280 if e.filename in ('<ipython console>','<input>','<string>',
1299 if e.filename in ('<ipython console>','<input>','<string>',
1281 '<console>','<BackgroundJob compilation>',
1300 '<console>','<BackgroundJob compilation>',
1282 None):
1301 None):
1283
1302
1284 return False
1303 return False
1285 try:
1304 try:
1286 if (self.rc.autoedit_syntax and
1305 if (self.rc.autoedit_syntax and
1287 not self.ask_yes_no('Return to editor to correct syntax error? '
1306 not self.ask_yes_no('Return to editor to correct syntax error? '
1288 '[Y/n] ','y')):
1307 '[Y/n] ','y')):
1289 return False
1308 return False
1290 except EOFError:
1309 except EOFError:
1291 return False
1310 return False
1292
1311
1293 def int0(x):
1312 def int0(x):
1294 try:
1313 try:
1295 return int(x)
1314 return int(x)
1296 except TypeError:
1315 except TypeError:
1297 return 0
1316 return 0
1298 # always pass integer line and offset values to editor hook
1317 # always pass integer line and offset values to editor hook
1299 self.hooks.fix_error_editor(e.filename,
1318 self.hooks.fix_error_editor(e.filename,
1300 int0(e.lineno),int0(e.offset),e.msg)
1319 int0(e.lineno),int0(e.offset),e.msg)
1301 return True
1320 return True
1302
1321
1303 def edit_syntax_error(self):
1322 def edit_syntax_error(self):
1304 """The bottom half of the syntax error handler called in the main loop.
1323 """The bottom half of the syntax error handler called in the main loop.
1305
1324
1306 Loop until syntax error is fixed or user cancels.
1325 Loop until syntax error is fixed or user cancels.
1307 """
1326 """
1308
1327
1309 while self.SyntaxTB.last_syntax_error:
1328 while self.SyntaxTB.last_syntax_error:
1310 # copy and clear last_syntax_error
1329 # copy and clear last_syntax_error
1311 err = self.SyntaxTB.clear_err_state()
1330 err = self.SyntaxTB.clear_err_state()
1312 if not self._should_recompile(err):
1331 if not self._should_recompile(err):
1313 return
1332 return
1314 try:
1333 try:
1315 # may set last_syntax_error again if a SyntaxError is raised
1334 # may set last_syntax_error again if a SyntaxError is raised
1316 self.safe_execfile(err.filename,self.user_ns)
1335 self.safe_execfile(err.filename,self.user_ns)
1317 except:
1336 except:
1318 self.showtraceback()
1337 self.showtraceback()
1319 else:
1338 else:
1320 try:
1339 try:
1321 f = file(err.filename)
1340 f = file(err.filename)
1322 try:
1341 try:
1323 sys.displayhook(f.read())
1342 sys.displayhook(f.read())
1324 finally:
1343 finally:
1325 f.close()
1344 f.close()
1326 except:
1345 except:
1327 self.showtraceback()
1346 self.showtraceback()
1328
1347
1329 def showsyntaxerror(self, filename=None):
1348 def showsyntaxerror(self, filename=None):
1330 """Display the syntax error that just occurred.
1349 """Display the syntax error that just occurred.
1331
1350
1332 This doesn't display a stack trace because there isn't one.
1351 This doesn't display a stack trace because there isn't one.
1333
1352
1334 If a filename is given, it is stuffed in the exception instead
1353 If a filename is given, it is stuffed in the exception instead
1335 of what was there before (because Python's parser always uses
1354 of what was there before (because Python's parser always uses
1336 "<string>" when reading from a string).
1355 "<string>" when reading from a string).
1337 """
1356 """
1338 etype, value, last_traceback = sys.exc_info()
1357 etype, value, last_traceback = sys.exc_info()
1339
1358
1340 # See note about these variables in showtraceback() below
1359 # See note about these variables in showtraceback() below
1341 sys.last_type = etype
1360 sys.last_type = etype
1342 sys.last_value = value
1361 sys.last_value = value
1343 sys.last_traceback = last_traceback
1362 sys.last_traceback = last_traceback
1344
1363
1345 if filename and etype is SyntaxError:
1364 if filename and etype is SyntaxError:
1346 # Work hard to stuff the correct filename in the exception
1365 # Work hard to stuff the correct filename in the exception
1347 try:
1366 try:
1348 msg, (dummy_filename, lineno, offset, line) = value
1367 msg, (dummy_filename, lineno, offset, line) = value
1349 except:
1368 except:
1350 # Not the format we expect; leave it alone
1369 # Not the format we expect; leave it alone
1351 pass
1370 pass
1352 else:
1371 else:
1353 # Stuff in the right filename
1372 # Stuff in the right filename
1354 try:
1373 try:
1355 # Assume SyntaxError is a class exception
1374 # Assume SyntaxError is a class exception
1356 value = SyntaxError(msg, (filename, lineno, offset, line))
1375 value = SyntaxError(msg, (filename, lineno, offset, line))
1357 except:
1376 except:
1358 # If that failed, assume SyntaxError is a string
1377 # If that failed, assume SyntaxError is a string
1359 value = msg, (filename, lineno, offset, line)
1378 value = msg, (filename, lineno, offset, line)
1360 self.SyntaxTB(etype,value,[])
1379 self.SyntaxTB(etype,value,[])
1361
1380
1362 def debugger(self):
1381 def debugger(self):
1363 """Call the pydb/pdb debugger."""
1382 """Call the pydb/pdb debugger."""
1364
1383
1365 if not self.rc.pdb:
1384 if not self.rc.pdb:
1366 return
1385 return
1367 have_pydb = False
1386 have_pydb = False
1368 if sys.version[:3] >= '2.5':
1387 if sys.version[:3] >= '2.5':
1369 try:
1388 try:
1370 from pydb import pm
1389 from pydb import pm
1371 have_pydb = True
1390 have_pydb = True
1372 except ImportError:
1391 except ImportError:
1373 pass
1392 pass
1374 if not have_pydb:
1393 if not have_pydb:
1375 from pdb import pm
1394 from pdb import pm
1376 pm()
1395 pm()
1377
1396
1378 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1397 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1379 """Display the exception that just occurred.
1398 """Display the exception that just occurred.
1380
1399
1381 If nothing is known about the exception, this is the method which
1400 If nothing is known about the exception, this is the method which
1382 should be used throughout the code for presenting user tracebacks,
1401 should be used throughout the code for presenting user tracebacks,
1383 rather than directly invoking the InteractiveTB object.
1402 rather than directly invoking the InteractiveTB object.
1384
1403
1385 A specific showsyntaxerror() also exists, but this method can take
1404 A specific showsyntaxerror() also exists, but this method can take
1386 care of calling it if needed, so unless you are explicitly catching a
1405 care of calling it if needed, so unless you are explicitly catching a
1387 SyntaxError exception, don't try to analyze the stack manually and
1406 SyntaxError exception, don't try to analyze the stack manually and
1388 simply call this method."""
1407 simply call this method."""
1389
1408
1390 # Though this won't be called by syntax errors in the input line,
1409 # Though this won't be called by syntax errors in the input line,
1391 # there may be SyntaxError cases whith imported code.
1410 # there may be SyntaxError cases whith imported code.
1392 if exc_tuple is None:
1411 if exc_tuple is None:
1393 etype, value, tb = sys.exc_info()
1412 etype, value, tb = sys.exc_info()
1394 else:
1413 else:
1395 etype, value, tb = exc_tuple
1414 etype, value, tb = exc_tuple
1396 if etype is SyntaxError:
1415 if etype is SyntaxError:
1397 self.showsyntaxerror(filename)
1416 self.showsyntaxerror(filename)
1398 else:
1417 else:
1399 # WARNING: these variables are somewhat deprecated and not
1418 # WARNING: these variables are somewhat deprecated and not
1400 # necessarily safe to use in a threaded environment, but tools
1419 # necessarily safe to use in a threaded environment, but tools
1401 # like pdb depend on their existence, so let's set them. If we
1420 # like pdb depend on their existence, so let's set them. If we
1402 # find problems in the field, we'll need to revisit their use.
1421 # find problems in the field, we'll need to revisit their use.
1403 sys.last_type = etype
1422 sys.last_type = etype
1404 sys.last_value = value
1423 sys.last_value = value
1405 sys.last_traceback = tb
1424 sys.last_traceback = tb
1406
1425
1407 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1426 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1408 if self.InteractiveTB.call_pdb and self.has_readline:
1427 if self.InteractiveTB.call_pdb and self.has_readline:
1409 # pdb mucks up readline, fix it back
1428 # pdb mucks up readline, fix it back
1410 self.readline.set_completer(self.Completer.complete)
1429 self.readline.set_completer(self.Completer.complete)
1411
1430
1412 def mainloop(self,banner=None):
1431 def mainloop(self,banner=None):
1413 """Creates the local namespace and starts the mainloop.
1432 """Creates the local namespace and starts the mainloop.
1414
1433
1415 If an optional banner argument is given, it will override the
1434 If an optional banner argument is given, it will override the
1416 internally created default banner."""
1435 internally created default banner."""
1417
1436
1418 if self.rc.c: # Emulate Python's -c option
1437 if self.rc.c: # Emulate Python's -c option
1419 self.exec_init_cmd()
1438 self.exec_init_cmd()
1420 if banner is None:
1439 if banner is None:
1421 if not self.rc.banner:
1440 if not self.rc.banner:
1422 banner = ''
1441 banner = ''
1423 # banner is string? Use it directly!
1442 # banner is string? Use it directly!
1424 elif isinstance(self.rc.banner,basestring):
1443 elif isinstance(self.rc.banner,basestring):
1425 banner = self.rc.banner
1444 banner = self.rc.banner
1426 else:
1445 else:
1427 banner = self.BANNER+self.banner2
1446 banner = self.BANNER+self.banner2
1428
1447
1429 self.interact(banner)
1448 self.interact(banner)
1430
1449
1431 def exec_init_cmd(self):
1450 def exec_init_cmd(self):
1432 """Execute a command given at the command line.
1451 """Execute a command given at the command line.
1433
1452
1434 This emulates Python's -c option."""
1453 This emulates Python's -c option."""
1435
1454
1436 #sys.argv = ['-c']
1455 #sys.argv = ['-c']
1437 self.push(self.rc.c)
1456 self.push(self.rc.c)
1438
1457
1439 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1458 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1440 """Embeds IPython into a running python program.
1459 """Embeds IPython into a running python program.
1441
1460
1442 Input:
1461 Input:
1443
1462
1444 - header: An optional header message can be specified.
1463 - header: An optional header message can be specified.
1445
1464
1446 - local_ns, global_ns: working namespaces. If given as None, the
1465 - local_ns, global_ns: working namespaces. If given as None, the
1447 IPython-initialized one is updated with __main__.__dict__, so that
1466 IPython-initialized one is updated with __main__.__dict__, so that
1448 program variables become visible but user-specific configuration
1467 program variables become visible but user-specific configuration
1449 remains possible.
1468 remains possible.
1450
1469
1451 - stack_depth: specifies how many levels in the stack to go to
1470 - stack_depth: specifies how many levels in the stack to go to
1452 looking for namespaces (when local_ns and global_ns are None). This
1471 looking for namespaces (when local_ns and global_ns are None). This
1453 allows an intermediate caller to make sure that this function gets
1472 allows an intermediate caller to make sure that this function gets
1454 the namespace from the intended level in the stack. By default (0)
1473 the namespace from the intended level in the stack. By default (0)
1455 it will get its locals and globals from the immediate caller.
1474 it will get its locals and globals from the immediate caller.
1456
1475
1457 Warning: it's possible to use this in a program which is being run by
1476 Warning: it's possible to use this in a program which is being run by
1458 IPython itself (via %run), but some funny things will happen (a few
1477 IPython itself (via %run), but some funny things will happen (a few
1459 globals get overwritten). In the future this will be cleaned up, as
1478 globals get overwritten). In the future this will be cleaned up, as
1460 there is no fundamental reason why it can't work perfectly."""
1479 there is no fundamental reason why it can't work perfectly."""
1461
1480
1462 # Get locals and globals from caller
1481 # Get locals and globals from caller
1463 if local_ns is None or global_ns is None:
1482 if local_ns is None or global_ns is None:
1464 call_frame = sys._getframe(stack_depth).f_back
1483 call_frame = sys._getframe(stack_depth).f_back
1465
1484
1466 if local_ns is None:
1485 if local_ns is None:
1467 local_ns = call_frame.f_locals
1486 local_ns = call_frame.f_locals
1468 if global_ns is None:
1487 if global_ns is None:
1469 global_ns = call_frame.f_globals
1488 global_ns = call_frame.f_globals
1470
1489
1471 # Update namespaces and fire up interpreter
1490 # Update namespaces and fire up interpreter
1472
1491
1473 # The global one is easy, we can just throw it in
1492 # The global one is easy, we can just throw it in
1474 self.user_global_ns = global_ns
1493 self.user_global_ns = global_ns
1475
1494
1476 # but the user/local one is tricky: ipython needs it to store internal
1495 # but the user/local one is tricky: ipython needs it to store internal
1477 # data, but we also need the locals. We'll copy locals in the user
1496 # data, but we also need the locals. We'll copy locals in the user
1478 # one, but will track what got copied so we can delete them at exit.
1497 # one, but will track what got copied so we can delete them at exit.
1479 # This is so that a later embedded call doesn't see locals from a
1498 # This is so that a later embedded call doesn't see locals from a
1480 # previous call (which most likely existed in a separate scope).
1499 # previous call (which most likely existed in a separate scope).
1481 local_varnames = local_ns.keys()
1500 local_varnames = local_ns.keys()
1482 self.user_ns.update(local_ns)
1501 self.user_ns.update(local_ns)
1483
1502
1484 # Patch for global embedding to make sure that things don't overwrite
1503 # Patch for global embedding to make sure that things don't overwrite
1485 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1504 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1486 # FIXME. Test this a bit more carefully (the if.. is new)
1505 # FIXME. Test this a bit more carefully (the if.. is new)
1487 if local_ns is None and global_ns is None:
1506 if local_ns is None and global_ns is None:
1488 self.user_global_ns.update(__main__.__dict__)
1507 self.user_global_ns.update(__main__.__dict__)
1489
1508
1490 # make sure the tab-completer has the correct frame information, so it
1509 # make sure the tab-completer has the correct frame information, so it
1491 # actually completes using the frame's locals/globals
1510 # actually completes using the frame's locals/globals
1492 self.set_completer_frame()
1511 self.set_completer_frame()
1493
1512
1494 # before activating the interactive mode, we need to make sure that
1513 # before activating the interactive mode, we need to make sure that
1495 # all names in the builtin namespace needed by ipython point to
1514 # all names in the builtin namespace needed by ipython point to
1496 # ourselves, and not to other instances.
1515 # ourselves, and not to other instances.
1497 self.add_builtins()
1516 self.add_builtins()
1498
1517
1499 self.interact(header)
1518 self.interact(header)
1500
1519
1501 # now, purge out the user namespace from anything we might have added
1520 # now, purge out the user namespace from anything we might have added
1502 # from the caller's local namespace
1521 # from the caller's local namespace
1503 delvar = self.user_ns.pop
1522 delvar = self.user_ns.pop
1504 for var in local_varnames:
1523 for var in local_varnames:
1505 delvar(var,None)
1524 delvar(var,None)
1506 # and clean builtins we may have overridden
1525 # and clean builtins we may have overridden
1507 self.clean_builtins()
1526 self.clean_builtins()
1508
1527
1509 def interact(self, banner=None):
1528 def interact(self, banner=None):
1510 """Closely emulate the interactive Python console.
1529 """Closely emulate the interactive Python console.
1511
1530
1512 The optional banner argument specify the banner to print
1531 The optional banner argument specify the banner to print
1513 before the first interaction; by default it prints a banner
1532 before the first interaction; by default it prints a banner
1514 similar to the one printed by the real Python interpreter,
1533 similar to the one printed by the real Python interpreter,
1515 followed by the current class name in parentheses (so as not
1534 followed by the current class name in parentheses (so as not
1516 to confuse this with the real interpreter -- since it's so
1535 to confuse this with the real interpreter -- since it's so
1517 close!).
1536 close!).
1518
1537
1519 """
1538 """
1520
1539
1521 if self.exit_now:
1540 if self.exit_now:
1522 # batch run -> do not interact
1541 # batch run -> do not interact
1523 return
1542 return
1524 cprt = 'Type "copyright", "credits" or "license" for more information.'
1543 cprt = 'Type "copyright", "credits" or "license" for more information.'
1525 if banner is None:
1544 if banner is None:
1526 self.write("Python %s on %s\n%s\n(%s)\n" %
1545 self.write("Python %s on %s\n%s\n(%s)\n" %
1527 (sys.version, sys.platform, cprt,
1546 (sys.version, sys.platform, cprt,
1528 self.__class__.__name__))
1547 self.__class__.__name__))
1529 else:
1548 else:
1530 self.write(banner)
1549 self.write(banner)
1531
1550
1532 more = 0
1551 more = 0
1533
1552
1534 # Mark activity in the builtins
1553 # Mark activity in the builtins
1535 __builtin__.__dict__['__IPYTHON__active'] += 1
1554 __builtin__.__dict__['__IPYTHON__active'] += 1
1536
1555
1537 # exit_now is set by a call to %Exit or %Quit
1556 # exit_now is set by a call to %Exit or %Quit
1538 while not self.exit_now:
1557 while not self.exit_now:
1539 if more:
1558 if more:
1540 prompt = self.hooks.generate_prompt(True)
1559 prompt = self.hooks.generate_prompt(True)
1541 if self.autoindent:
1560 if self.autoindent:
1542 self.readline_startup_hook(self.pre_readline)
1561 self.readline_startup_hook(self.pre_readline)
1543 else:
1562 else:
1544 prompt = self.hooks.generate_prompt(False)
1563 prompt = self.hooks.generate_prompt(False)
1545 try:
1564 try:
1546 line = self.raw_input(prompt,more)
1565 line = self.raw_input(prompt,more)
1547 if self.exit_now:
1566 if self.exit_now:
1548 # quick exit on sys.std[in|out] close
1567 # quick exit on sys.std[in|out] close
1549 break
1568 break
1550 if self.autoindent:
1569 if self.autoindent:
1551 self.readline_startup_hook(None)
1570 self.readline_startup_hook(None)
1552 except KeyboardInterrupt:
1571 except KeyboardInterrupt:
1553 self.write('\nKeyboardInterrupt\n')
1572 self.write('\nKeyboardInterrupt\n')
1554 self.resetbuffer()
1573 self.resetbuffer()
1555 # keep cache in sync with the prompt counter:
1574 # keep cache in sync with the prompt counter:
1556 self.outputcache.prompt_count -= 1
1575 self.outputcache.prompt_count -= 1
1557
1576
1558 if self.autoindent:
1577 if self.autoindent:
1559 self.indent_current_nsp = 0
1578 self.indent_current_nsp = 0
1560 more = 0
1579 more = 0
1561 except EOFError:
1580 except EOFError:
1562 if self.autoindent:
1581 if self.autoindent:
1563 self.readline_startup_hook(None)
1582 self.readline_startup_hook(None)
1564 self.write('\n')
1583 self.write('\n')
1565 self.exit()
1584 self.exit()
1566 except bdb.BdbQuit:
1585 except bdb.BdbQuit:
1567 warn('The Python debugger has exited with a BdbQuit exception.\n'
1586 warn('The Python debugger has exited with a BdbQuit exception.\n'
1568 'Because of how pdb handles the stack, it is impossible\n'
1587 'Because of how pdb handles the stack, it is impossible\n'
1569 'for IPython to properly format this particular exception.\n'
1588 'for IPython to properly format this particular exception.\n'
1570 'IPython will resume normal operation.')
1589 'IPython will resume normal operation.')
1571 except:
1590 except:
1572 # exceptions here are VERY RARE, but they can be triggered
1591 # exceptions here are VERY RARE, but they can be triggered
1573 # asynchronously by signal handlers, for example.
1592 # asynchronously by signal handlers, for example.
1574 self.showtraceback()
1593 self.showtraceback()
1575 else:
1594 else:
1576 more = self.push(line)
1595 more = self.push(line)
1577 if (self.SyntaxTB.last_syntax_error and
1596 if (self.SyntaxTB.last_syntax_error and
1578 self.rc.autoedit_syntax):
1597 self.rc.autoedit_syntax):
1579 self.edit_syntax_error()
1598 self.edit_syntax_error()
1580
1599
1581 # We are off again...
1600 # We are off again...
1582 __builtin__.__dict__['__IPYTHON__active'] -= 1
1601 __builtin__.__dict__['__IPYTHON__active'] -= 1
1583
1602
1584 def excepthook(self, etype, value, tb):
1603 def excepthook(self, etype, value, tb):
1585 """One more defense for GUI apps that call sys.excepthook.
1604 """One more defense for GUI apps that call sys.excepthook.
1586
1605
1587 GUI frameworks like wxPython trap exceptions and call
1606 GUI frameworks like wxPython trap exceptions and call
1588 sys.excepthook themselves. I guess this is a feature that
1607 sys.excepthook themselves. I guess this is a feature that
1589 enables them to keep running after exceptions that would
1608 enables them to keep running after exceptions that would
1590 otherwise kill their mainloop. This is a bother for IPython
1609 otherwise kill their mainloop. This is a bother for IPython
1591 which excepts to catch all of the program exceptions with a try:
1610 which excepts to catch all of the program exceptions with a try:
1592 except: statement.
1611 except: statement.
1593
1612
1594 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1613 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1595 any app directly invokes sys.excepthook, it will look to the user like
1614 any app directly invokes sys.excepthook, it will look to the user like
1596 IPython crashed. In order to work around this, we can disable the
1615 IPython crashed. In order to work around this, we can disable the
1597 CrashHandler and replace it with this excepthook instead, which prints a
1616 CrashHandler and replace it with this excepthook instead, which prints a
1598 regular traceback using our InteractiveTB. In this fashion, apps which
1617 regular traceback using our InteractiveTB. In this fashion, apps which
1599 call sys.excepthook will generate a regular-looking exception from
1618 call sys.excepthook will generate a regular-looking exception from
1600 IPython, and the CrashHandler will only be triggered by real IPython
1619 IPython, and the CrashHandler will only be triggered by real IPython
1601 crashes.
1620 crashes.
1602
1621
1603 This hook should be used sparingly, only in places which are not likely
1622 This hook should be used sparingly, only in places which are not likely
1604 to be true IPython errors.
1623 to be true IPython errors.
1605 """
1624 """
1606 self.showtraceback((etype,value,tb),tb_offset=0)
1625 self.showtraceback((etype,value,tb),tb_offset=0)
1607
1626
1608 def expand_aliases(self,fn,rest):
1627 def expand_aliases(self,fn,rest):
1609 """ Expand multiple levels of aliases:
1628 """ Expand multiple levels of aliases:
1610
1629
1611 if:
1630 if:
1612
1631
1613 alias foo bar /tmp
1632 alias foo bar /tmp
1614 alias baz foo
1633 alias baz foo
1615
1634
1616 then:
1635 then:
1617
1636
1618 baz huhhahhei -> bar /tmp huhhahhei
1637 baz huhhahhei -> bar /tmp huhhahhei
1619
1638
1620 """
1639 """
1621 line = fn + " " + rest
1640 line = fn + " " + rest
1622
1641
1623 done = Set()
1642 done = Set()
1624 while 1:
1643 while 1:
1625 pre,fn,rest = self.split_user_input(line)
1644 pre,fn,rest = self.split_user_input(line)
1626 if fn in self.alias_table:
1645 if fn in self.alias_table:
1627 if fn in done:
1646 if fn in done:
1628 warn("Cyclic alias definition, repeated '%s'" % fn)
1647 warn("Cyclic alias definition, repeated '%s'" % fn)
1629 return ""
1648 return ""
1630 done.add(fn)
1649 done.add(fn)
1631
1650
1632 l2 = self.transform_alias(fn,rest)
1651 l2 = self.transform_alias(fn,rest)
1633 # dir -> dir
1652 # dir -> dir
1634 if l2 == line:
1653 if l2 == line:
1635 break
1654 break
1636 # ls -> ls -F should not recurse forever
1655 # ls -> ls -F should not recurse forever
1637 if l2.split(None,1)[0] == line.split(None,1)[0]:
1656 if l2.split(None,1)[0] == line.split(None,1)[0]:
1638 line = l2
1657 line = l2
1639 break
1658 break
1640
1659
1641 line=l2
1660 line=l2
1642
1661
1643
1662
1644 # print "al expand to",line #dbg
1663 # print "al expand to",line #dbg
1645 else:
1664 else:
1646 break
1665 break
1647
1666
1648 return line
1667 return line
1649
1668
1650 def transform_alias(self, alias,rest=''):
1669 def transform_alias(self, alias,rest=''):
1651 """ Transform alias to system command string.
1670 """ Transform alias to system command string.
1652 """
1671 """
1653 nargs,cmd = self.alias_table[alias]
1672 nargs,cmd = self.alias_table[alias]
1654 if ' ' in cmd and os.path.isfile(cmd):
1673 if ' ' in cmd and os.path.isfile(cmd):
1655 cmd = '"%s"' % cmd
1674 cmd = '"%s"' % cmd
1656
1675
1657 # Expand the %l special to be the user's input line
1676 # Expand the %l special to be the user's input line
1658 if cmd.find('%l') >= 0:
1677 if cmd.find('%l') >= 0:
1659 cmd = cmd.replace('%l',rest)
1678 cmd = cmd.replace('%l',rest)
1660 rest = ''
1679 rest = ''
1661 if nargs==0:
1680 if nargs==0:
1662 # Simple, argument-less aliases
1681 # Simple, argument-less aliases
1663 cmd = '%s %s' % (cmd,rest)
1682 cmd = '%s %s' % (cmd,rest)
1664 else:
1683 else:
1665 # Handle aliases with positional arguments
1684 # Handle aliases with positional arguments
1666 args = rest.split(None,nargs)
1685 args = rest.split(None,nargs)
1667 if len(args)< nargs:
1686 if len(args)< nargs:
1668 error('Alias <%s> requires %s arguments, %s given.' %
1687 error('Alias <%s> requires %s arguments, %s given.' %
1669 (alias,nargs,len(args)))
1688 (alias,nargs,len(args)))
1670 return None
1689 return None
1671 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1690 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1672 # Now call the macro, evaluating in the user's namespace
1691 # Now call the macro, evaluating in the user's namespace
1673 #print 'new command: <%r>' % cmd # dbg
1692 #print 'new command: <%r>' % cmd # dbg
1674 return cmd
1693 return cmd
1675
1694
1676 def call_alias(self,alias,rest=''):
1695 def call_alias(self,alias,rest=''):
1677 """Call an alias given its name and the rest of the line.
1696 """Call an alias given its name and the rest of the line.
1678
1697
1679 This is only used to provide backwards compatibility for users of
1698 This is only used to provide backwards compatibility for users of
1680 ipalias(), use of which is not recommended for anymore."""
1699 ipalias(), use of which is not recommended for anymore."""
1681
1700
1682 # Now call the macro, evaluating in the user's namespace
1701 # Now call the macro, evaluating in the user's namespace
1683 cmd = self.transform_alias(alias, rest)
1702 cmd = self.transform_alias(alias, rest)
1684 try:
1703 try:
1685 self.system(cmd)
1704 self.system(cmd)
1686 except:
1705 except:
1687 self.showtraceback()
1706 self.showtraceback()
1688
1707
1689 def indent_current_str(self):
1708 def indent_current_str(self):
1690 """return the current level of indentation as a string"""
1709 """return the current level of indentation as a string"""
1691 return self.indent_current_nsp * ' '
1710 return self.indent_current_nsp * ' '
1692
1711
1693 def autoindent_update(self,line):
1712 def autoindent_update(self,line):
1694 """Keep track of the indent level."""
1713 """Keep track of the indent level."""
1695
1714
1696 #debugx('line')
1715 #debugx('line')
1697 #debugx('self.indent_current_nsp')
1716 #debugx('self.indent_current_nsp')
1698 if self.autoindent:
1717 if self.autoindent:
1699 if line:
1718 if line:
1700 inisp = num_ini_spaces(line)
1719 inisp = num_ini_spaces(line)
1701 if inisp < self.indent_current_nsp:
1720 if inisp < self.indent_current_nsp:
1702 self.indent_current_nsp = inisp
1721 self.indent_current_nsp = inisp
1703
1722
1704 if line[-1] == ':':
1723 if line[-1] == ':':
1705 self.indent_current_nsp += 4
1724 self.indent_current_nsp += 4
1706 elif dedent_re.match(line):
1725 elif dedent_re.match(line):
1707 self.indent_current_nsp -= 4
1726 self.indent_current_nsp -= 4
1708 else:
1727 else:
1709 self.indent_current_nsp = 0
1728 self.indent_current_nsp = 0
1710
1729
1711 def runlines(self,lines):
1730 def runlines(self,lines):
1712 """Run a string of one or more lines of source.
1731 """Run a string of one or more lines of source.
1713
1732
1714 This method is capable of running a string containing multiple source
1733 This method is capable of running a string containing multiple source
1715 lines, as if they had been entered at the IPython prompt. Since it
1734 lines, as if they had been entered at the IPython prompt. Since it
1716 exposes IPython's processing machinery, the given strings can contain
1735 exposes IPython's processing machinery, the given strings can contain
1717 magic calls (%magic), special shell access (!cmd), etc."""
1736 magic calls (%magic), special shell access (!cmd), etc."""
1718
1737
1719 # We must start with a clean buffer, in case this is run from an
1738 # We must start with a clean buffer, in case this is run from an
1720 # interactive IPython session (via a magic, for example).
1739 # interactive IPython session (via a magic, for example).
1721 self.resetbuffer()
1740 self.resetbuffer()
1722 lines = lines.split('\n')
1741 lines = lines.split('\n')
1723 more = 0
1742 more = 0
1724 for line in lines:
1743 for line in lines:
1725 # skip blank lines so we don't mess up the prompt counter, but do
1744 # skip blank lines so we don't mess up the prompt counter, but do
1726 # NOT skip even a blank line if we are in a code block (more is
1745 # NOT skip even a blank line if we are in a code block (more is
1727 # true)
1746 # true)
1728 if line or more:
1747 if line or more:
1729 more = self.push(self.prefilter(line,more))
1748 more = self.push(self.prefilter(line,more))
1730 # IPython's runsource returns None if there was an error
1749 # IPython's runsource returns None if there was an error
1731 # compiling the code. This allows us to stop processing right
1750 # compiling the code. This allows us to stop processing right
1732 # away, so the user gets the error message at the right place.
1751 # away, so the user gets the error message at the right place.
1733 if more is None:
1752 if more is None:
1734 break
1753 break
1735 # final newline in case the input didn't have it, so that the code
1754 # final newline in case the input didn't have it, so that the code
1736 # actually does get executed
1755 # actually does get executed
1737 if more:
1756 if more:
1738 self.push('\n')
1757 self.push('\n')
1739
1758
1740 def runsource(self, source, filename='<input>', symbol='single'):
1759 def runsource(self, source, filename='<input>', symbol='single'):
1741 """Compile and run some source in the interpreter.
1760 """Compile and run some source in the interpreter.
1742
1761
1743 Arguments are as for compile_command().
1762 Arguments are as for compile_command().
1744
1763
1745 One several things can happen:
1764 One several things can happen:
1746
1765
1747 1) The input is incorrect; compile_command() raised an
1766 1) The input is incorrect; compile_command() raised an
1748 exception (SyntaxError or OverflowError). A syntax traceback
1767 exception (SyntaxError or OverflowError). A syntax traceback
1749 will be printed by calling the showsyntaxerror() method.
1768 will be printed by calling the showsyntaxerror() method.
1750
1769
1751 2) The input is incomplete, and more input is required;
1770 2) The input is incomplete, and more input is required;
1752 compile_command() returned None. Nothing happens.
1771 compile_command() returned None. Nothing happens.
1753
1772
1754 3) The input is complete; compile_command() returned a code
1773 3) The input is complete; compile_command() returned a code
1755 object. The code is executed by calling self.runcode() (which
1774 object. The code is executed by calling self.runcode() (which
1756 also handles run-time exceptions, except for SystemExit).
1775 also handles run-time exceptions, except for SystemExit).
1757
1776
1758 The return value is:
1777 The return value is:
1759
1778
1760 - True in case 2
1779 - True in case 2
1761
1780
1762 - False in the other cases, unless an exception is raised, where
1781 - False in the other cases, unless an exception is raised, where
1763 None is returned instead. This can be used by external callers to
1782 None is returned instead. This can be used by external callers to
1764 know whether to continue feeding input or not.
1783 know whether to continue feeding input or not.
1765
1784
1766 The return value can be used to decide whether to use sys.ps1 or
1785 The return value can be used to decide whether to use sys.ps1 or
1767 sys.ps2 to prompt the next line."""
1786 sys.ps2 to prompt the next line."""
1768
1787
1769 try:
1788 try:
1770 code = self.compile(source,filename,symbol)
1789 code = self.compile(source,filename,symbol)
1771 except (OverflowError, SyntaxError, ValueError):
1790 except (OverflowError, SyntaxError, ValueError):
1772 # Case 1
1791 # Case 1
1773 self.showsyntaxerror(filename)
1792 self.showsyntaxerror(filename)
1774 return None
1793 return None
1775
1794
1776 if code is None:
1795 if code is None:
1777 # Case 2
1796 # Case 2
1778 return True
1797 return True
1779
1798
1780 # Case 3
1799 # Case 3
1781 # We store the code object so that threaded shells and
1800 # We store the code object so that threaded shells and
1782 # custom exception handlers can access all this info if needed.
1801 # custom exception handlers can access all this info if needed.
1783 # The source corresponding to this can be obtained from the
1802 # The source corresponding to this can be obtained from the
1784 # buffer attribute as '\n'.join(self.buffer).
1803 # buffer attribute as '\n'.join(self.buffer).
1785 self.code_to_run = code
1804 self.code_to_run = code
1786 # now actually execute the code object
1805 # now actually execute the code object
1787 if self.runcode(code) == 0:
1806 if self.runcode(code) == 0:
1788 return False
1807 return False
1789 else:
1808 else:
1790 return None
1809 return None
1791
1810
1792 def runcode(self,code_obj):
1811 def runcode(self,code_obj):
1793 """Execute a code object.
1812 """Execute a code object.
1794
1813
1795 When an exception occurs, self.showtraceback() is called to display a
1814 When an exception occurs, self.showtraceback() is called to display a
1796 traceback.
1815 traceback.
1797
1816
1798 Return value: a flag indicating whether the code to be run completed
1817 Return value: a flag indicating whether the code to be run completed
1799 successfully:
1818 successfully:
1800
1819
1801 - 0: successful execution.
1820 - 0: successful execution.
1802 - 1: an error occurred.
1821 - 1: an error occurred.
1803 """
1822 """
1804
1823
1805 # Set our own excepthook in case the user code tries to call it
1824 # Set our own excepthook in case the user code tries to call it
1806 # directly, so that the IPython crash handler doesn't get triggered
1825 # directly, so that the IPython crash handler doesn't get triggered
1807 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1826 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1808
1827
1809 # we save the original sys.excepthook in the instance, in case config
1828 # we save the original sys.excepthook in the instance, in case config
1810 # code (such as magics) needs access to it.
1829 # code (such as magics) needs access to it.
1811 self.sys_excepthook = old_excepthook
1830 self.sys_excepthook = old_excepthook
1812 outflag = 1 # happens in more places, so it's easier as default
1831 outflag = 1 # happens in more places, so it's easier as default
1813 try:
1832 try:
1814 try:
1833 try:
1815 # Embedded instances require separate global/local namespaces
1834 # Embedded instances require separate global/local namespaces
1816 # so they can see both the surrounding (local) namespace and
1835 # so they can see both the surrounding (local) namespace and
1817 # the module-level globals when called inside another function.
1836 # the module-level globals when called inside another function.
1818 if self.embedded:
1837 if self.embedded:
1819 exec code_obj in self.user_global_ns, self.user_ns
1838 exec code_obj in self.user_global_ns, self.user_ns
1820 # Normal (non-embedded) instances should only have a single
1839 # Normal (non-embedded) instances should only have a single
1821 # namespace for user code execution, otherwise functions won't
1840 # namespace for user code execution, otherwise functions won't
1822 # see interactive top-level globals.
1841 # see interactive top-level globals.
1823 else:
1842 else:
1824 exec code_obj in self.user_ns
1843 exec code_obj in self.user_ns
1825 finally:
1844 finally:
1826 # Reset our crash handler in place
1845 # Reset our crash handler in place
1827 sys.excepthook = old_excepthook
1846 sys.excepthook = old_excepthook
1828 except SystemExit:
1847 except SystemExit:
1829 self.resetbuffer()
1848 self.resetbuffer()
1830 self.showtraceback()
1849 self.showtraceback()
1831 warn("Type %exit or %quit to exit IPython "
1850 warn("Type %exit or %quit to exit IPython "
1832 "(%Exit or %Quit do so unconditionally).",level=1)
1851 "(%Exit or %Quit do so unconditionally).",level=1)
1833 except self.custom_exceptions:
1852 except self.custom_exceptions:
1834 etype,value,tb = sys.exc_info()
1853 etype,value,tb = sys.exc_info()
1835 self.CustomTB(etype,value,tb)
1854 self.CustomTB(etype,value,tb)
1836 except:
1855 except:
1837 self.showtraceback()
1856 self.showtraceback()
1838 else:
1857 else:
1839 outflag = 0
1858 outflag = 0
1840 if softspace(sys.stdout, 0):
1859 if softspace(sys.stdout, 0):
1841 print
1860 print
1842 # Flush out code object which has been run (and source)
1861 # Flush out code object which has been run (and source)
1843 self.code_to_run = None
1862 self.code_to_run = None
1844 return outflag
1863 return outflag
1845
1864
1846 def push(self, line):
1865 def push(self, line):
1847 """Push a line to the interpreter.
1866 """Push a line to the interpreter.
1848
1867
1849 The line should not have a trailing newline; it may have
1868 The line should not have a trailing newline; it may have
1850 internal newlines. The line is appended to a buffer and the
1869 internal newlines. The line is appended to a buffer and the
1851 interpreter's runsource() method is called with the
1870 interpreter's runsource() method is called with the
1852 concatenated contents of the buffer as source. If this
1871 concatenated contents of the buffer as source. If this
1853 indicates that the command was executed or invalid, the buffer
1872 indicates that the command was executed or invalid, the buffer
1854 is reset; otherwise, the command is incomplete, and the buffer
1873 is reset; otherwise, the command is incomplete, and the buffer
1855 is left as it was after the line was appended. The return
1874 is left as it was after the line was appended. The return
1856 value is 1 if more input is required, 0 if the line was dealt
1875 value is 1 if more input is required, 0 if the line was dealt
1857 with in some way (this is the same as runsource()).
1876 with in some way (this is the same as runsource()).
1858 """
1877 """
1859
1878
1860 # autoindent management should be done here, and not in the
1879 # autoindent management should be done here, and not in the
1861 # interactive loop, since that one is only seen by keyboard input. We
1880 # interactive loop, since that one is only seen by keyboard input. We
1862 # need this done correctly even for code run via runlines (which uses
1881 # need this done correctly even for code run via runlines (which uses
1863 # push).
1882 # push).
1864
1883
1865 #print 'push line: <%s>' % line # dbg
1884 #print 'push line: <%s>' % line # dbg
1866 for subline in line.splitlines():
1885 for subline in line.splitlines():
1867 self.autoindent_update(subline)
1886 self.autoindent_update(subline)
1868 self.buffer.append(line)
1887 self.buffer.append(line)
1869 more = self.runsource('\n'.join(self.buffer), self.filename)
1888 more = self.runsource('\n'.join(self.buffer), self.filename)
1870 if not more:
1889 if not more:
1871 self.resetbuffer()
1890 self.resetbuffer()
1872 return more
1891 return more
1873
1892
1874 def resetbuffer(self):
1893 def resetbuffer(self):
1875 """Reset the input buffer."""
1894 """Reset the input buffer."""
1876 self.buffer[:] = []
1895 self.buffer[:] = []
1877
1896
1878 def raw_input(self,prompt='',continue_prompt=False):
1897 def raw_input(self,prompt='',continue_prompt=False):
1879 """Write a prompt and read a line.
1898 """Write a prompt and read a line.
1880
1899
1881 The returned line does not include the trailing newline.
1900 The returned line does not include the trailing newline.
1882 When the user enters the EOF key sequence, EOFError is raised.
1901 When the user enters the EOF key sequence, EOFError is raised.
1883
1902
1884 Optional inputs:
1903 Optional inputs:
1885
1904
1886 - prompt(''): a string to be printed to prompt the user.
1905 - prompt(''): a string to be printed to prompt the user.
1887
1906
1888 - continue_prompt(False): whether this line is the first one or a
1907 - continue_prompt(False): whether this line is the first one or a
1889 continuation in a sequence of inputs.
1908 continuation in a sequence of inputs.
1890 """
1909 """
1891
1910
1892 try:
1911 try:
1893 line = raw_input_original(prompt)
1912 line = raw_input_original(prompt)
1894 except ValueError:
1913 except ValueError:
1895 warn("\n********\nYou or a %run:ed script called sys.stdin.close() or sys.stdout.close()!\nExiting IPython!")
1914 warn("\n********\nYou or a %run:ed script called sys.stdin.close() or sys.stdout.close()!\nExiting IPython!")
1896 self.exit_now = True
1915 self.exit_now = True
1897 return ""
1916 return ""
1898
1917
1899
1918
1900 # Try to be reasonably smart about not re-indenting pasted input more
1919 # Try to be reasonably smart about not re-indenting pasted input more
1901 # than necessary. We do this by trimming out the auto-indent initial
1920 # than necessary. We do this by trimming out the auto-indent initial
1902 # spaces, if the user's actual input started itself with whitespace.
1921 # spaces, if the user's actual input started itself with whitespace.
1903 #debugx('self.buffer[-1]')
1922 #debugx('self.buffer[-1]')
1904
1923
1905 if self.autoindent:
1924 if self.autoindent:
1906 if num_ini_spaces(line) > self.indent_current_nsp:
1925 if num_ini_spaces(line) > self.indent_current_nsp:
1907 line = line[self.indent_current_nsp:]
1926 line = line[self.indent_current_nsp:]
1908 self.indent_current_nsp = 0
1927 self.indent_current_nsp = 0
1909
1928
1910 # store the unfiltered input before the user has any chance to modify
1929 # store the unfiltered input before the user has any chance to modify
1911 # it.
1930 # it.
1912 if line.strip():
1931 if line.strip():
1913 if continue_prompt:
1932 if continue_prompt:
1914 self.input_hist_raw[-1] += '%s\n' % line
1933 self.input_hist_raw[-1] += '%s\n' % line
1915 if self.has_readline: # and some config option is set?
1934 if self.has_readline: # and some config option is set?
1916 try:
1935 try:
1917 histlen = self.readline.get_current_history_length()
1936 histlen = self.readline.get_current_history_length()
1918 newhist = self.input_hist_raw[-1].rstrip()
1937 newhist = self.input_hist_raw[-1].rstrip()
1919 self.readline.remove_history_item(histlen-1)
1938 self.readline.remove_history_item(histlen-1)
1920 self.readline.replace_history_item(histlen-2,newhist)
1939 self.readline.replace_history_item(histlen-2,newhist)
1921 except AttributeError:
1940 except AttributeError:
1922 pass # re{move,place}_history_item are new in 2.4.
1941 pass # re{move,place}_history_item are new in 2.4.
1923 else:
1942 else:
1924 self.input_hist_raw.append('%s\n' % line)
1943 self.input_hist_raw.append('%s\n' % line)
1925
1944
1926 try:
1945 try:
1927 lineout = self.prefilter(line,continue_prompt)
1946 lineout = self.prefilter(line,continue_prompt)
1928 except:
1947 except:
1929 # blanket except, in case a user-defined prefilter crashes, so it
1948 # blanket except, in case a user-defined prefilter crashes, so it
1930 # can't take all of ipython with it.
1949 # can't take all of ipython with it.
1931 self.showtraceback()
1950 self.showtraceback()
1932 return ''
1951 return ''
1933 else:
1952 else:
1934 return lineout
1953 return lineout
1935
1954
1936 def split_user_input(self,line):
1955 def split_user_input(self,line):
1937 """Split user input into pre-char, function part and rest."""
1956 """Split user input into pre-char, function part and rest."""
1938
1957
1939 lsplit = self.line_split.match(line)
1958 lsplit = self.line_split.match(line)
1940 if lsplit is None: # no regexp match returns None
1959 if lsplit is None: # no regexp match returns None
1941 try:
1960 try:
1942 iFun,theRest = line.split(None,1)
1961 iFun,theRest = line.split(None,1)
1943 except ValueError:
1962 except ValueError:
1944 iFun,theRest = line,''
1963 iFun,theRest = line,''
1945 pre = re.match('^(\s*)(.*)',line).groups()[0]
1964 pre = re.match('^(\s*)(.*)',line).groups()[0]
1946 else:
1965 else:
1947 pre,iFun,theRest = lsplit.groups()
1966 pre,iFun,theRest = lsplit.groups()
1948
1967
1949 #print 'line:<%s>' % line # dbg
1968 #print 'line:<%s>' % line # dbg
1950 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1969 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1951 return pre,iFun.strip(),theRest
1970 return pre,iFun.strip(),theRest
1952
1971
1953 def _prefilter(self, line, continue_prompt):
1972 def _prefilter(self, line, continue_prompt):
1954 """Calls different preprocessors, depending on the form of line."""
1973 """Calls different preprocessors, depending on the form of line."""
1955
1974
1956 # All handlers *must* return a value, even if it's blank ('').
1975 # All handlers *must* return a value, even if it's blank ('').
1957
1976
1958 # Lines are NOT logged here. Handlers should process the line as
1977 # Lines are NOT logged here. Handlers should process the line as
1959 # needed, update the cache AND log it (so that the input cache array
1978 # needed, update the cache AND log it (so that the input cache array
1960 # stays synced).
1979 # stays synced).
1961
1980
1962 # This function is _very_ delicate, and since it's also the one which
1981 # This function is _very_ delicate, and since it's also the one which
1963 # determines IPython's response to user input, it must be as efficient
1982 # determines IPython's response to user input, it must be as efficient
1964 # as possible. For this reason it has _many_ returns in it, trying
1983 # as possible. For this reason it has _many_ returns in it, trying
1965 # always to exit as quickly as it can figure out what it needs to do.
1984 # always to exit as quickly as it can figure out what it needs to do.
1966
1985
1967 # This function is the main responsible for maintaining IPython's
1986 # This function is the main responsible for maintaining IPython's
1968 # behavior respectful of Python's semantics. So be _very_ careful if
1987 # behavior respectful of Python's semantics. So be _very_ careful if
1969 # making changes to anything here.
1988 # making changes to anything here.
1970
1989
1971 #.....................................................................
1990 #.....................................................................
1972 # Code begins
1991 # Code begins
1973
1992
1974 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1993 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1975
1994
1976 # save the line away in case we crash, so the post-mortem handler can
1995 # save the line away in case we crash, so the post-mortem handler can
1977 # record it
1996 # record it
1978 self._last_input_line = line
1997 self._last_input_line = line
1979
1998
1980 #print '***line: <%s>' % line # dbg
1999 #print '***line: <%s>' % line # dbg
1981
2000
1982 # the input history needs to track even empty lines
2001 # the input history needs to track even empty lines
1983 stripped = line.strip()
2002 stripped = line.strip()
1984
2003
1985 if not stripped:
2004 if not stripped:
1986 if not continue_prompt:
2005 if not continue_prompt:
1987 self.outputcache.prompt_count -= 1
2006 self.outputcache.prompt_count -= 1
1988 return self.handle_normal(line,continue_prompt)
2007 return self.handle_normal(line,continue_prompt)
1989 #return self.handle_normal('',continue_prompt)
2008 #return self.handle_normal('',continue_prompt)
1990
2009
1991 # print '***cont',continue_prompt # dbg
2010 # print '***cont',continue_prompt # dbg
1992 # special handlers are only allowed for single line statements
2011 # special handlers are only allowed for single line statements
1993 if continue_prompt and not self.rc.multi_line_specials:
2012 if continue_prompt and not self.rc.multi_line_specials:
1994 return self.handle_normal(line,continue_prompt)
2013 return self.handle_normal(line,continue_prompt)
1995
2014
1996
2015
1997 # For the rest, we need the structure of the input
2016 # For the rest, we need the structure of the input
1998 pre,iFun,theRest = self.split_user_input(line)
2017 pre,iFun,theRest = self.split_user_input(line)
1999
2018
2000 # See whether any pre-existing handler can take care of it
2019 # See whether any pre-existing handler can take care of it
2001
2020
2002 rewritten = self.hooks.input_prefilter(stripped)
2021 rewritten = self.hooks.input_prefilter(stripped)
2003 if rewritten != stripped: # ok, some prefilter did something
2022 if rewritten != stripped: # ok, some prefilter did something
2004 rewritten = pre + rewritten # add indentation
2023 rewritten = pre + rewritten # add indentation
2005 return self.handle_normal(rewritten)
2024 return self.handle_normal(rewritten)
2006
2025
2007 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2026 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2008
2027
2009 # First check for explicit escapes in the last/first character
2028 # First check for explicit escapes in the last/first character
2010 handler = None
2029 handler = None
2011 if line[-1] == self.ESC_HELP:
2030 if line[-1] == self.ESC_HELP:
2012 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
2031 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
2013 if handler is None:
2032 if handler is None:
2014 # look at the first character of iFun, NOT of line, so we skip
2033 # look at the first character of iFun, NOT of line, so we skip
2015 # leading whitespace in multiline input
2034 # leading whitespace in multiline input
2016 handler = self.esc_handlers.get(iFun[0:1])
2035 handler = self.esc_handlers.get(iFun[0:1])
2017 if handler is not None:
2036 if handler is not None:
2018 return handler(line,continue_prompt,pre,iFun,theRest)
2037 return handler(line,continue_prompt,pre,iFun,theRest)
2019 # Emacs ipython-mode tags certain input lines
2038 # Emacs ipython-mode tags certain input lines
2020 if line.endswith('# PYTHON-MODE'):
2039 if line.endswith('# PYTHON-MODE'):
2021 return self.handle_emacs(line,continue_prompt)
2040 return self.handle_emacs(line,continue_prompt)
2022
2041
2023 # Next, check if we can automatically execute this thing
2042 # Next, check if we can automatically execute this thing
2024
2043
2025 # Allow ! in multi-line statements if multi_line_specials is on:
2044 # Allow ! in multi-line statements if multi_line_specials is on:
2026 if continue_prompt and self.rc.multi_line_specials and \
2045 if continue_prompt and self.rc.multi_line_specials and \
2027 iFun.startswith(self.ESC_SHELL):
2046 iFun.startswith(self.ESC_SHELL):
2028 return self.handle_shell_escape(line,continue_prompt,
2047 return self.handle_shell_escape(line,continue_prompt,
2029 pre=pre,iFun=iFun,
2048 pre=pre,iFun=iFun,
2030 theRest=theRest)
2049 theRest=theRest)
2031
2050
2032 # Let's try to find if the input line is a magic fn
2051 # Let's try to find if the input line is a magic fn
2033 oinfo = None
2052 oinfo = None
2034 if hasattr(self,'magic_'+iFun):
2053 if hasattr(self,'magic_'+iFun):
2035 # WARNING: _ofind uses getattr(), so it can consume generators and
2054 # WARNING: _ofind uses getattr(), so it can consume generators and
2036 # cause other side effects.
2055 # cause other side effects.
2037 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2056 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2038 if oinfo['ismagic']:
2057 if oinfo['ismagic']:
2039 # Be careful not to call magics when a variable assignment is
2058 # Be careful not to call magics when a variable assignment is
2040 # being made (ls='hi', for example)
2059 # being made (ls='hi', for example)
2041 if self.rc.automagic and \
2060 if self.rc.automagic and \
2042 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
2061 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
2043 (self.rc.multi_line_specials or not continue_prompt):
2062 (self.rc.multi_line_specials or not continue_prompt):
2044 return self.handle_magic(line,continue_prompt,
2063 return self.handle_magic(line,continue_prompt,
2045 pre,iFun,theRest)
2064 pre,iFun,theRest)
2046 else:
2065 else:
2047 return self.handle_normal(line,continue_prompt)
2066 return self.handle_normal(line,continue_prompt)
2048
2067
2049 # If the rest of the line begins with an (in)equality, assginment or
2068 # If the rest of the line begins with an (in)equality, assginment or
2050 # function call, we should not call _ofind but simply execute it.
2069 # function call, we should not call _ofind but simply execute it.
2051 # This avoids spurious geattr() accesses on objects upon assignment.
2070 # This avoids spurious geattr() accesses on objects upon assignment.
2052 #
2071 #
2053 # It also allows users to assign to either alias or magic names true
2072 # It also allows users to assign to either alias or magic names true
2054 # python variables (the magic/alias systems always take second seat to
2073 # python variables (the magic/alias systems always take second seat to
2055 # true python code).
2074 # true python code).
2056 if theRest and theRest[0] in '!=()':
2075 if theRest and theRest[0] in '!=()':
2057 return self.handle_normal(line,continue_prompt)
2076 return self.handle_normal(line,continue_prompt)
2058
2077
2059 if oinfo is None:
2078 if oinfo is None:
2060 # let's try to ensure that _oinfo is ONLY called when autocall is
2079 # let's try to ensure that _oinfo is ONLY called when autocall is
2061 # on. Since it has inevitable potential side effects, at least
2080 # on. Since it has inevitable potential side effects, at least
2062 # having autocall off should be a guarantee to the user that no
2081 # having autocall off should be a guarantee to the user that no
2063 # weird things will happen.
2082 # weird things will happen.
2064
2083
2065 if self.rc.autocall:
2084 if self.rc.autocall:
2066 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2085 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2067 else:
2086 else:
2068 # in this case, all that's left is either an alias or
2087 # in this case, all that's left is either an alias or
2069 # processing the line normally.
2088 # processing the line normally.
2070 if iFun in self.alias_table:
2089 if iFun in self.alias_table:
2071 # if autocall is off, by not running _ofind we won't know
2090 # if autocall is off, by not running _ofind we won't know
2072 # whether the given name may also exist in one of the
2091 # whether the given name may also exist in one of the
2073 # user's namespace. At this point, it's best to do a
2092 # user's namespace. At this point, it's best to do a
2074 # quick check just to be sure that we don't let aliases
2093 # quick check just to be sure that we don't let aliases
2075 # shadow variables.
2094 # shadow variables.
2076 head = iFun.split('.',1)[0]
2095 head = iFun.split('.',1)[0]
2077 if head in self.user_ns or head in self.internal_ns \
2096 if head in self.user_ns or head in self.internal_ns \
2078 or head in __builtin__.__dict__:
2097 or head in __builtin__.__dict__:
2079 return self.handle_normal(line,continue_prompt)
2098 return self.handle_normal(line,continue_prompt)
2080 else:
2099 else:
2081 return self.handle_alias(line,continue_prompt,
2100 return self.handle_alias(line,continue_prompt,
2082 pre,iFun,theRest)
2101 pre,iFun,theRest)
2083
2102
2084 else:
2103 else:
2085 return self.handle_normal(line,continue_prompt)
2104 return self.handle_normal(line,continue_prompt)
2086
2105
2087 if not oinfo['found']:
2106 if not oinfo['found']:
2088 return self.handle_normal(line,continue_prompt)
2107 return self.handle_normal(line,continue_prompt)
2089 else:
2108 else:
2090 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2109 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2091 if oinfo['isalias']:
2110 if oinfo['isalias']:
2092 return self.handle_alias(line,continue_prompt,
2111 return self.handle_alias(line,continue_prompt,
2093 pre,iFun,theRest)
2112 pre,iFun,theRest)
2094
2113
2095 if (self.rc.autocall
2114 if (self.rc.autocall
2096 and
2115 and
2097 (
2116 (
2098 #only consider exclusion re if not "," or ";" autoquoting
2117 #only consider exclusion re if not "," or ";" autoquoting
2099 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
2118 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
2100 or pre == self.ESC_PAREN) or
2119 or pre == self.ESC_PAREN) or
2101 (not self.re_exclude_auto.match(theRest)))
2120 (not self.re_exclude_auto.match(theRest)))
2102 and
2121 and
2103 self.re_fun_name.match(iFun) and
2122 self.re_fun_name.match(iFun) and
2104 callable(oinfo['obj'])) :
2123 callable(oinfo['obj'])) :
2105 #print 'going auto' # dbg
2124 #print 'going auto' # dbg
2106 return self.handle_auto(line,continue_prompt,
2125 return self.handle_auto(line,continue_prompt,
2107 pre,iFun,theRest,oinfo['obj'])
2126 pre,iFun,theRest,oinfo['obj'])
2108 else:
2127 else:
2109 #print 'was callable?', callable(oinfo['obj']) # dbg
2128 #print 'was callable?', callable(oinfo['obj']) # dbg
2110 return self.handle_normal(line,continue_prompt)
2129 return self.handle_normal(line,continue_prompt)
2111
2130
2112 # If we get here, we have a normal Python line. Log and return.
2131 # If we get here, we have a normal Python line. Log and return.
2113 return self.handle_normal(line,continue_prompt)
2132 return self.handle_normal(line,continue_prompt)
2114
2133
2115 def _prefilter_dumb(self, line, continue_prompt):
2134 def _prefilter_dumb(self, line, continue_prompt):
2116 """simple prefilter function, for debugging"""
2135 """simple prefilter function, for debugging"""
2117 return self.handle_normal(line,continue_prompt)
2136 return self.handle_normal(line,continue_prompt)
2118
2137
2119
2138
2120 def multiline_prefilter(self, line, continue_prompt):
2139 def multiline_prefilter(self, line, continue_prompt):
2121 """ Run _prefilter for each line of input
2140 """ Run _prefilter for each line of input
2122
2141
2123 Covers cases where there are multiple lines in the user entry,
2142 Covers cases where there are multiple lines in the user entry,
2124 which is the case when the user goes back to a multiline history
2143 which is the case when the user goes back to a multiline history
2125 entry and presses enter.
2144 entry and presses enter.
2126
2145
2127 """
2146 """
2128 out = []
2147 out = []
2129 for l in line.rstrip('\n').split('\n'):
2148 for l in line.rstrip('\n').split('\n'):
2130 out.append(self._prefilter(l, continue_prompt))
2149 out.append(self._prefilter(l, continue_prompt))
2131 return '\n'.join(out)
2150 return '\n'.join(out)
2132
2151
2133 # Set the default prefilter() function (this can be user-overridden)
2152 # Set the default prefilter() function (this can be user-overridden)
2134 prefilter = multiline_prefilter
2153 prefilter = multiline_prefilter
2135
2154
2136 def handle_normal(self,line,continue_prompt=None,
2155 def handle_normal(self,line,continue_prompt=None,
2137 pre=None,iFun=None,theRest=None):
2156 pre=None,iFun=None,theRest=None):
2138 """Handle normal input lines. Use as a template for handlers."""
2157 """Handle normal input lines. Use as a template for handlers."""
2139
2158
2140 # With autoindent on, we need some way to exit the input loop, and I
2159 # With autoindent on, we need some way to exit the input loop, and I
2141 # don't want to force the user to have to backspace all the way to
2160 # don't want to force the user to have to backspace all the way to
2142 # clear the line. The rule will be in this case, that either two
2161 # clear the line. The rule will be in this case, that either two
2143 # lines of pure whitespace in a row, or a line of pure whitespace but
2162 # lines of pure whitespace in a row, or a line of pure whitespace but
2144 # of a size different to the indent level, will exit the input loop.
2163 # of a size different to the indent level, will exit the input loop.
2145
2164
2146 if (continue_prompt and self.autoindent and line.isspace() and
2165 if (continue_prompt and self.autoindent and line.isspace() and
2147 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2166 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2148 (self.buffer[-1]).isspace() )):
2167 (self.buffer[-1]).isspace() )):
2149 line = ''
2168 line = ''
2150
2169
2151 self.log(line,line,continue_prompt)
2170 self.log(line,line,continue_prompt)
2152 return line
2171 return line
2153
2172
2154 def handle_alias(self,line,continue_prompt=None,
2173 def handle_alias(self,line,continue_prompt=None,
2155 pre=None,iFun=None,theRest=None):
2174 pre=None,iFun=None,theRest=None):
2156 """Handle alias input lines. """
2175 """Handle alias input lines. """
2157
2176
2158 # pre is needed, because it carries the leading whitespace. Otherwise
2177 # pre is needed, because it carries the leading whitespace. Otherwise
2159 # aliases won't work in indented sections.
2178 # aliases won't work in indented sections.
2160 transformed = self.expand_aliases(iFun, theRest)
2179 transformed = self.expand_aliases(iFun, theRest)
2161 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
2180 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
2162 self.log(line,line_out,continue_prompt)
2181 self.log(line,line_out,continue_prompt)
2163 #print 'line out:',line_out # dbg
2182 #print 'line out:',line_out # dbg
2164 return line_out
2183 return line_out
2165
2184
2166 def handle_shell_escape(self, line, continue_prompt=None,
2185 def handle_shell_escape(self, line, continue_prompt=None,
2167 pre=None,iFun=None,theRest=None):
2186 pre=None,iFun=None,theRest=None):
2168 """Execute the line in a shell, empty return value"""
2187 """Execute the line in a shell, empty return value"""
2169
2188
2170 #print 'line in :', `line` # dbg
2189 #print 'line in :', `line` # dbg
2171 # Example of a special handler. Others follow a similar pattern.
2190 # Example of a special handler. Others follow a similar pattern.
2172 if line.lstrip().startswith('!!'):
2191 if line.lstrip().startswith('!!'):
2173 # rewrite iFun/theRest to properly hold the call to %sx and
2192 # rewrite iFun/theRest to properly hold the call to %sx and
2174 # the actual command to be executed, so handle_magic can work
2193 # the actual command to be executed, so handle_magic can work
2175 # correctly
2194 # correctly
2176 theRest = '%s %s' % (iFun[2:],theRest)
2195 theRest = '%s %s' % (iFun[2:],theRest)
2177 iFun = 'sx'
2196 iFun = 'sx'
2178 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2197 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2179 line.lstrip()[2:]),
2198 line.lstrip()[2:]),
2180 continue_prompt,pre,iFun,theRest)
2199 continue_prompt,pre,iFun,theRest)
2181 else:
2200 else:
2182 cmd=line.lstrip().lstrip('!')
2201 cmd=line.lstrip().lstrip('!')
2183 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2202 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2184 # update cache/log and return
2203 # update cache/log and return
2185 self.log(line,line_out,continue_prompt)
2204 self.log(line,line_out,continue_prompt)
2186 return line_out
2205 return line_out
2187
2206
2188 def handle_magic(self, line, continue_prompt=None,
2207 def handle_magic(self, line, continue_prompt=None,
2189 pre=None,iFun=None,theRest=None):
2208 pre=None,iFun=None,theRest=None):
2190 """Execute magic functions."""
2209 """Execute magic functions."""
2191
2210
2192
2211
2193 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2212 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2194 self.log(line,cmd,continue_prompt)
2213 self.log(line,cmd,continue_prompt)
2195 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2214 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2196 return cmd
2215 return cmd
2197
2216
2198 def handle_auto(self, line, continue_prompt=None,
2217 def handle_auto(self, line, continue_prompt=None,
2199 pre=None,iFun=None,theRest=None,obj=None):
2218 pre=None,iFun=None,theRest=None,obj=None):
2200 """Hande lines which can be auto-executed, quoting if requested."""
2219 """Hande lines which can be auto-executed, quoting if requested."""
2201
2220
2202 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2221 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2203
2222
2204 # This should only be active for single-line input!
2223 # This should only be active for single-line input!
2205 if continue_prompt:
2224 if continue_prompt:
2206 self.log(line,line,continue_prompt)
2225 self.log(line,line,continue_prompt)
2207 return line
2226 return line
2208
2227
2209 auto_rewrite = True
2228 auto_rewrite = True
2210
2229
2211 if pre == self.ESC_QUOTE:
2230 if pre == self.ESC_QUOTE:
2212 # Auto-quote splitting on whitespace
2231 # Auto-quote splitting on whitespace
2213 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2232 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2214 elif pre == self.ESC_QUOTE2:
2233 elif pre == self.ESC_QUOTE2:
2215 # Auto-quote whole string
2234 # Auto-quote whole string
2216 newcmd = '%s("%s")' % (iFun,theRest)
2235 newcmd = '%s("%s")' % (iFun,theRest)
2217 elif pre == self.ESC_PAREN:
2236 elif pre == self.ESC_PAREN:
2218 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2237 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2219 else:
2238 else:
2220 # Auto-paren.
2239 # Auto-paren.
2221 # We only apply it to argument-less calls if the autocall
2240 # We only apply it to argument-less calls if the autocall
2222 # parameter is set to 2. We only need to check that autocall is <
2241 # parameter is set to 2. We only need to check that autocall is <
2223 # 2, since this function isn't called unless it's at least 1.
2242 # 2, since this function isn't called unless it's at least 1.
2224 if not theRest and (self.rc.autocall < 2):
2243 if not theRest and (self.rc.autocall < 2):
2225 newcmd = '%s %s' % (iFun,theRest)
2244 newcmd = '%s %s' % (iFun,theRest)
2226 auto_rewrite = False
2245 auto_rewrite = False
2227 else:
2246 else:
2228 if theRest.startswith('['):
2247 if theRest.startswith('['):
2229 if hasattr(obj,'__getitem__'):
2248 if hasattr(obj,'__getitem__'):
2230 # Don't autocall in this case: item access for an object
2249 # Don't autocall in this case: item access for an object
2231 # which is BOTH callable and implements __getitem__.
2250 # which is BOTH callable and implements __getitem__.
2232 newcmd = '%s %s' % (iFun,theRest)
2251 newcmd = '%s %s' % (iFun,theRest)
2233 auto_rewrite = False
2252 auto_rewrite = False
2234 else:
2253 else:
2235 # if the object doesn't support [] access, go ahead and
2254 # if the object doesn't support [] access, go ahead and
2236 # autocall
2255 # autocall
2237 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2256 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2238 elif theRest.endswith(';'):
2257 elif theRest.endswith(';'):
2239 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2258 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2240 else:
2259 else:
2241 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2260 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2242
2261
2243 if auto_rewrite:
2262 if auto_rewrite:
2244 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2263 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2245 # log what is now valid Python, not the actual user input (without the
2264 # log what is now valid Python, not the actual user input (without the
2246 # final newline)
2265 # final newline)
2247 self.log(line,newcmd,continue_prompt)
2266 self.log(line,newcmd,continue_prompt)
2248 return newcmd
2267 return newcmd
2249
2268
2250 def handle_help(self, line, continue_prompt=None,
2269 def handle_help(self, line, continue_prompt=None,
2251 pre=None,iFun=None,theRest=None):
2270 pre=None,iFun=None,theRest=None):
2252 """Try to get some help for the object.
2271 """Try to get some help for the object.
2253
2272
2254 obj? or ?obj -> basic information.
2273 obj? or ?obj -> basic information.
2255 obj?? or ??obj -> more details.
2274 obj?? or ??obj -> more details.
2256 """
2275 """
2257
2276
2258 # We need to make sure that we don't process lines which would be
2277 # We need to make sure that we don't process lines which would be
2259 # otherwise valid python, such as "x=1 # what?"
2278 # otherwise valid python, such as "x=1 # what?"
2260 try:
2279 try:
2261 codeop.compile_command(line)
2280 codeop.compile_command(line)
2262 except SyntaxError:
2281 except SyntaxError:
2263 # We should only handle as help stuff which is NOT valid syntax
2282 # We should only handle as help stuff which is NOT valid syntax
2264 if line[0]==self.ESC_HELP:
2283 if line[0]==self.ESC_HELP:
2265 line = line[1:]
2284 line = line[1:]
2266 elif line[-1]==self.ESC_HELP:
2285 elif line[-1]==self.ESC_HELP:
2267 line = line[:-1]
2286 line = line[:-1]
2268 self.log(line,'#?'+line,continue_prompt)
2287 self.log(line,'#?'+line,continue_prompt)
2269 if line:
2288 if line:
2270 self.magic_pinfo(line)
2289 self.magic_pinfo(line)
2271 else:
2290 else:
2272 page(self.usage,screen_lines=self.rc.screen_length)
2291 page(self.usage,screen_lines=self.rc.screen_length)
2273 return '' # Empty string is needed here!
2292 return '' # Empty string is needed here!
2274 except:
2293 except:
2275 # Pass any other exceptions through to the normal handler
2294 # Pass any other exceptions through to the normal handler
2276 return self.handle_normal(line,continue_prompt)
2295 return self.handle_normal(line,continue_prompt)
2277 else:
2296 else:
2278 # If the code compiles ok, we should handle it normally
2297 # If the code compiles ok, we should handle it normally
2279 return self.handle_normal(line,continue_prompt)
2298 return self.handle_normal(line,continue_prompt)
2280
2299
2281 def getapi(self):
2300 def getapi(self):
2282 """ Get an IPApi object for this shell instance
2301 """ Get an IPApi object for this shell instance
2283
2302
2284 Getting an IPApi object is always preferable to accessing the shell
2303 Getting an IPApi object is always preferable to accessing the shell
2285 directly, but this holds true especially for extensions.
2304 directly, but this holds true especially for extensions.
2286
2305
2287 It should always be possible to implement an extension with IPApi
2306 It should always be possible to implement an extension with IPApi
2288 alone. If not, contact maintainer to request an addition.
2307 alone. If not, contact maintainer to request an addition.
2289
2308
2290 """
2309 """
2291 return self.api
2310 return self.api
2292
2311
2293 def handle_emacs(self,line,continue_prompt=None,
2312 def handle_emacs(self,line,continue_prompt=None,
2294 pre=None,iFun=None,theRest=None):
2313 pre=None,iFun=None,theRest=None):
2295 """Handle input lines marked by python-mode."""
2314 """Handle input lines marked by python-mode."""
2296
2315
2297 # Currently, nothing is done. Later more functionality can be added
2316 # Currently, nothing is done. Later more functionality can be added
2298 # here if needed.
2317 # here if needed.
2299
2318
2300 # The input cache shouldn't be updated
2319 # The input cache shouldn't be updated
2301
2320
2302 return line
2321 return line
2303
2322
2304 def mktempfile(self,data=None):
2323 def mktempfile(self,data=None):
2305 """Make a new tempfile and return its filename.
2324 """Make a new tempfile and return its filename.
2306
2325
2307 This makes a call to tempfile.mktemp, but it registers the created
2326 This makes a call to tempfile.mktemp, but it registers the created
2308 filename internally so ipython cleans it up at exit time.
2327 filename internally so ipython cleans it up at exit time.
2309
2328
2310 Optional inputs:
2329 Optional inputs:
2311
2330
2312 - data(None): if data is given, it gets written out to the temp file
2331 - data(None): if data is given, it gets written out to the temp file
2313 immediately, and the file is closed again."""
2332 immediately, and the file is closed again."""
2314
2333
2315 filename = tempfile.mktemp('.py','ipython_edit_')
2334 filename = tempfile.mktemp('.py','ipython_edit_')
2316 self.tempfiles.append(filename)
2335 self.tempfiles.append(filename)
2317
2336
2318 if data:
2337 if data:
2319 tmp_file = open(filename,'w')
2338 tmp_file = open(filename,'w')
2320 tmp_file.write(data)
2339 tmp_file.write(data)
2321 tmp_file.close()
2340 tmp_file.close()
2322 return filename
2341 return filename
2323
2342
2324 def write(self,data):
2343 def write(self,data):
2325 """Write a string to the default output"""
2344 """Write a string to the default output"""
2326 Term.cout.write(data)
2345 Term.cout.write(data)
2327
2346
2328 def write_err(self,data):
2347 def write_err(self,data):
2329 """Write a string to the default error output"""
2348 """Write a string to the default error output"""
2330 Term.cerr.write(data)
2349 Term.cerr.write(data)
2331
2350
2332 def exit(self):
2351 def exit(self):
2333 """Handle interactive exit.
2352 """Handle interactive exit.
2334
2353
2335 This method sets the exit_now attribute."""
2354 This method sets the exit_now attribute."""
2336
2355
2337 if self.rc.confirm_exit:
2356 if self.rc.confirm_exit:
2338 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2357 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2339 self.exit_now = True
2358 self.exit_now = True
2340 else:
2359 else:
2341 self.exit_now = True
2360 self.exit_now = True
2342
2361
2343 def safe_execfile(self,fname,*where,**kw):
2362 def safe_execfile(self,fname,*where,**kw):
2344 fname = os.path.expanduser(fname)
2363 fname = os.path.expanduser(fname)
2345
2364
2346 # find things also in current directory
2365 # find things also in current directory
2347 dname = os.path.dirname(fname)
2366 dname = os.path.dirname(fname)
2348 if not sys.path.count(dname):
2367 if not sys.path.count(dname):
2349 sys.path.append(dname)
2368 sys.path.append(dname)
2350
2369
2351 try:
2370 try:
2352 xfile = open(fname)
2371 xfile = open(fname)
2353 except:
2372 except:
2354 print >> Term.cerr, \
2373 print >> Term.cerr, \
2355 'Could not open file <%s> for safe execution.' % fname
2374 'Could not open file <%s> for safe execution.' % fname
2356 return None
2375 return None
2357
2376
2358 kw.setdefault('islog',0)
2377 kw.setdefault('islog',0)
2359 kw.setdefault('quiet',1)
2378 kw.setdefault('quiet',1)
2360 kw.setdefault('exit_ignore',0)
2379 kw.setdefault('exit_ignore',0)
2361 first = xfile.readline()
2380 first = xfile.readline()
2362 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2381 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2363 xfile.close()
2382 xfile.close()
2364 # line by line execution
2383 # line by line execution
2365 if first.startswith(loghead) or kw['islog']:
2384 if first.startswith(loghead) or kw['islog']:
2366 print 'Loading log file <%s> one line at a time...' % fname
2385 print 'Loading log file <%s> one line at a time...' % fname
2367 if kw['quiet']:
2386 if kw['quiet']:
2368 stdout_save = sys.stdout
2387 stdout_save = sys.stdout
2369 sys.stdout = StringIO.StringIO()
2388 sys.stdout = StringIO.StringIO()
2370 try:
2389 try:
2371 globs,locs = where[0:2]
2390 globs,locs = where[0:2]
2372 except:
2391 except:
2373 try:
2392 try:
2374 globs = locs = where[0]
2393 globs = locs = where[0]
2375 except:
2394 except:
2376 globs = locs = globals()
2395 globs = locs = globals()
2377 badblocks = []
2396 badblocks = []
2378
2397
2379 # we also need to identify indented blocks of code when replaying
2398 # we also need to identify indented blocks of code when replaying
2380 # logs and put them together before passing them to an exec
2399 # logs and put them together before passing them to an exec
2381 # statement. This takes a bit of regexp and look-ahead work in the
2400 # statement. This takes a bit of regexp and look-ahead work in the
2382 # file. It's easiest if we swallow the whole thing in memory
2401 # file. It's easiest if we swallow the whole thing in memory
2383 # first, and manually walk through the lines list moving the
2402 # first, and manually walk through the lines list moving the
2384 # counter ourselves.
2403 # counter ourselves.
2385 indent_re = re.compile('\s+\S')
2404 indent_re = re.compile('\s+\S')
2386 xfile = open(fname)
2405 xfile = open(fname)
2387 filelines = xfile.readlines()
2406 filelines = xfile.readlines()
2388 xfile.close()
2407 xfile.close()
2389 nlines = len(filelines)
2408 nlines = len(filelines)
2390 lnum = 0
2409 lnum = 0
2391 while lnum < nlines:
2410 while lnum < nlines:
2392 line = filelines[lnum]
2411 line = filelines[lnum]
2393 lnum += 1
2412 lnum += 1
2394 # don't re-insert logger status info into cache
2413 # don't re-insert logger status info into cache
2395 if line.startswith('#log#'):
2414 if line.startswith('#log#'):
2396 continue
2415 continue
2397 else:
2416 else:
2398 # build a block of code (maybe a single line) for execution
2417 # build a block of code (maybe a single line) for execution
2399 block = line
2418 block = line
2400 try:
2419 try:
2401 next = filelines[lnum] # lnum has already incremented
2420 next = filelines[lnum] # lnum has already incremented
2402 except:
2421 except:
2403 next = None
2422 next = None
2404 while next and indent_re.match(next):
2423 while next and indent_re.match(next):
2405 block += next
2424 block += next
2406 lnum += 1
2425 lnum += 1
2407 try:
2426 try:
2408 next = filelines[lnum]
2427 next = filelines[lnum]
2409 except:
2428 except:
2410 next = None
2429 next = None
2411 # now execute the block of one or more lines
2430 # now execute the block of one or more lines
2412 try:
2431 try:
2413 exec block in globs,locs
2432 exec block in globs,locs
2414 except SystemExit:
2433 except SystemExit:
2415 pass
2434 pass
2416 except:
2435 except:
2417 badblocks.append(block.rstrip())
2436 badblocks.append(block.rstrip())
2418 if kw['quiet']: # restore stdout
2437 if kw['quiet']: # restore stdout
2419 sys.stdout.close()
2438 sys.stdout.close()
2420 sys.stdout = stdout_save
2439 sys.stdout = stdout_save
2421 print 'Finished replaying log file <%s>' % fname
2440 print 'Finished replaying log file <%s>' % fname
2422 if badblocks:
2441 if badblocks:
2423 print >> sys.stderr, ('\nThe following lines/blocks in file '
2442 print >> sys.stderr, ('\nThe following lines/blocks in file '
2424 '<%s> reported errors:' % fname)
2443 '<%s> reported errors:' % fname)
2425
2444
2426 for badline in badblocks:
2445 for badline in badblocks:
2427 print >> sys.stderr, badline
2446 print >> sys.stderr, badline
2428 else: # regular file execution
2447 else: # regular file execution
2429 try:
2448 try:
2430 execfile(fname,*where)
2449 execfile(fname,*where)
2431 except SyntaxError:
2450 except SyntaxError:
2432 self.showsyntaxerror()
2451 self.showsyntaxerror()
2433 warn('Failure executing file: <%s>' % fname)
2452 warn('Failure executing file: <%s>' % fname)
2434 except SystemExit,status:
2453 except SystemExit,status:
2435 if not kw['exit_ignore']:
2454 if not kw['exit_ignore']:
2436 self.showtraceback()
2455 self.showtraceback()
2437 warn('Failure executing file: <%s>' % fname)
2456 warn('Failure executing file: <%s>' % fname)
2438 except:
2457 except:
2439 self.showtraceback()
2458 self.showtraceback()
2440 warn('Failure executing file: <%s>' % fname)
2459 warn('Failure executing file: <%s>' % fname)
2441
2460
2442 #************************* end of file <iplib.py> *****************************
2461 #************************* end of file <iplib.py> *****************************
@@ -1,5839 +1,5845 b''
1 2006-10-30 Ville Vainio <vivainio@gmail.com>
1 2006-10-30 Ville Vainio <vivainio@gmail.com>
2
2
3 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
3 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
4 Bernsteins's patches for pydb integration.
4 Bernsteins's patches for pydb integration.
5 http://bashdb.sourceforge.net/pydb/
5 http://bashdb.sourceforge.net/pydb/
6
7 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
8 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
9 custom completer hook to allow the users to implement their own
10 completers. See ipy_linux_package_managers.py for example. The
11 hook name is 'complete_command'.
6
12
7 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
13 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
8
14
9 * IPython/UserConfig/ipythonrc-scipy: minor clenaups to remove old
15 * IPython/UserConfig/ipythonrc-scipy: minor clenaups to remove old
10 Numeric leftovers.
16 Numeric leftovers.
11
17
12 * ipython.el (py-execute-region): apply Stefan's patch to fix
18 * ipython.el (py-execute-region): apply Stefan's patch to fix
13 garbled results if the python shell hasn't been previously started.
19 garbled results if the python shell hasn't been previously started.
14
20
15 * IPython/genutils.py (arg_split): moved to genutils, since it's a
21 * IPython/genutils.py (arg_split): moved to genutils, since it's a
16 pretty generic function and useful for other things.
22 pretty generic function and useful for other things.
17
23
18 * IPython/OInspect.py (getsource): Add customizable source
24 * IPython/OInspect.py (getsource): Add customizable source
19 extractor. After a request/patch form W. Stein (SAGE).
25 extractor. After a request/patch form W. Stein (SAGE).
20
26
21 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
27 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
22 window size to a more reasonable value from what pexpect does,
28 window size to a more reasonable value from what pexpect does,
23 since their choice causes wrapping bugs with long input lines.
29 since their choice causes wrapping bugs with long input lines.
24
30
25 2006-10-28 Ville Vainio <vivainio@gmail.com>
31 2006-10-28 Ville Vainio <vivainio@gmail.com>
26
32
27 * Magic.py (%run): Save and restore the readline history from
33 * Magic.py (%run): Save and restore the readline history from
28 file around %run commands to prevent side effects from
34 file around %run commands to prevent side effects from
29 %runned programs that might use readline (e.g. pydb).
35 %runned programs that might use readline (e.g. pydb).
30
36
31 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
37 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
32 invoking the pydb enhanced debugger.
38 invoking the pydb enhanced debugger.
33
39
34 2006-10-23 Walter Doerwald <walter@livinglogic.de>
40 2006-10-23 Walter Doerwald <walter@livinglogic.de>
35
41
36 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
42 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
37 call the base class method and propagate the return value to
43 call the base class method and propagate the return value to
38 ifile. This is now done by path itself.
44 ifile. This is now done by path itself.
39
45
40 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
46 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
41
47
42 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
48 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
43 api: set_crash_handler(), to expose the ability to change the
49 api: set_crash_handler(), to expose the ability to change the
44 internal crash handler.
50 internal crash handler.
45
51
46 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
52 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
47 the various parameters of the crash handler so that apps using
53 the various parameters of the crash handler so that apps using
48 IPython as their engine can customize crash handling. Ipmlemented
54 IPython as their engine can customize crash handling. Ipmlemented
49 at the request of SAGE.
55 at the request of SAGE.
50
56
51 2006-10-14 Ville Vainio <vivainio@gmail.com>
57 2006-10-14 Ville Vainio <vivainio@gmail.com>
52
58
53 * Magic.py, ipython.el: applied first "safe" part of Rocky
59 * Magic.py, ipython.el: applied first "safe" part of Rocky
54 Bernstein's patch set for pydb integration.
60 Bernstein's patch set for pydb integration.
55
61
56 * Magic.py (%unalias, %alias): %store'd aliases can now be
62 * Magic.py (%unalias, %alias): %store'd aliases can now be
57 removed with '%unalias'. %alias w/o args now shows most
63 removed with '%unalias'. %alias w/o args now shows most
58 interesting (stored / manually defined) aliases last
64 interesting (stored / manually defined) aliases last
59 where they catch the eye w/o scrolling.
65 where they catch the eye w/o scrolling.
60
66
61 * Magic.py (%rehashx), ext_rehashdir.py: files with
67 * Magic.py (%rehashx), ext_rehashdir.py: files with
62 'py' extension are always considered executable, even
68 'py' extension are always considered executable, even
63 when not in PATHEXT environment variable.
69 when not in PATHEXT environment variable.
64
70
65 2006-10-12 Ville Vainio <vivainio@gmail.com>
71 2006-10-12 Ville Vainio <vivainio@gmail.com>
66
72
67 * jobctrl.py: Add new "jobctrl" extension for spawning background
73 * jobctrl.py: Add new "jobctrl" extension for spawning background
68 processes with "&find /". 'import jobctrl' to try it out. Requires
74 processes with "&find /". 'import jobctrl' to try it out. Requires
69 'subprocess' module, standard in python 2.4+.
75 'subprocess' module, standard in python 2.4+.
70
76
71 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
77 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
72 so if foo -> bar and bar -> baz, then foo -> baz.
78 so if foo -> bar and bar -> baz, then foo -> baz.
73
79
74 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
80 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
75
81
76 * IPython/Magic.py (Magic.parse_options): add a new posix option
82 * IPython/Magic.py (Magic.parse_options): add a new posix option
77 to allow parsing of input args in magics that doesn't strip quotes
83 to allow parsing of input args in magics that doesn't strip quotes
78 (if posix=False). This also closes %timeit bug reported by
84 (if posix=False). This also closes %timeit bug reported by
79 Stefan.
85 Stefan.
80
86
81 2006-10-03 Ville Vainio <vivainio@gmail.com>
87 2006-10-03 Ville Vainio <vivainio@gmail.com>
82
88
83 * iplib.py (raw_input, interact): Return ValueError catching for
89 * iplib.py (raw_input, interact): Return ValueError catching for
84 raw_input. Fixes infinite loop for sys.stdin.close() or
90 raw_input. Fixes infinite loop for sys.stdin.close() or
85 sys.stdout.close().
91 sys.stdout.close().
86
92
87 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
93 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
88
94
89 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
95 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
90 to help in handling doctests. irunner is now pretty useful for
96 to help in handling doctests. irunner is now pretty useful for
91 running standalone scripts and simulate a full interactive session
97 running standalone scripts and simulate a full interactive session
92 in a format that can be then pasted as a doctest.
98 in a format that can be then pasted as a doctest.
93
99
94 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
100 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
95 on top of the default (useless) ones. This also fixes the nasty
101 on top of the default (useless) ones. This also fixes the nasty
96 way in which 2.5's Quitter() exits (reverted [1785]).
102 way in which 2.5's Quitter() exits (reverted [1785]).
97
103
98 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
104 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
99 2.5.
105 2.5.
100
106
101 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
107 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
102 color scheme is updated as well when color scheme is changed
108 color scheme is updated as well when color scheme is changed
103 interactively.
109 interactively.
104
110
105 2006-09-27 Ville Vainio <vivainio@gmail.com>
111 2006-09-27 Ville Vainio <vivainio@gmail.com>
106
112
107 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
113 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
108 infinite loop and just exit. It's a hack, but will do for a while.
114 infinite loop and just exit. It's a hack, but will do for a while.
109
115
110 2006-08-25 Walter Doerwald <walter@livinglogic.de>
116 2006-08-25 Walter Doerwald <walter@livinglogic.de>
111
117
112 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
118 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
113 the constructor, this makes it possible to get a list of only directories
119 the constructor, this makes it possible to get a list of only directories
114 or only files.
120 or only files.
115
121
116 2006-08-12 Ville Vainio <vivainio@gmail.com>
122 2006-08-12 Ville Vainio <vivainio@gmail.com>
117
123
118 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
124 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
119 they broke unittest
125 they broke unittest
120
126
121 2006-08-11 Ville Vainio <vivainio@gmail.com>
127 2006-08-11 Ville Vainio <vivainio@gmail.com>
122
128
123 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
129 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
124 by resolving issue properly, i.e. by inheriting FakeModule
130 by resolving issue properly, i.e. by inheriting FakeModule
125 from types.ModuleType. Pickling ipython interactive data
131 from types.ModuleType. Pickling ipython interactive data
126 should still work as usual (testing appreciated).
132 should still work as usual (testing appreciated).
127
133
128 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
134 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
129
135
130 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
136 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
131 running under python 2.3 with code from 2.4 to fix a bug with
137 running under python 2.3 with code from 2.4 to fix a bug with
132 help(). Reported by the Debian maintainers, Norbert Tretkowski
138 help(). Reported by the Debian maintainers, Norbert Tretkowski
133 <norbert-AT-tretkowski.de> and Alexandre Fayolle
139 <norbert-AT-tretkowski.de> and Alexandre Fayolle
134 <afayolle-AT-debian.org>.
140 <afayolle-AT-debian.org>.
135
141
136 2006-08-04 Walter Doerwald <walter@livinglogic.de>
142 2006-08-04 Walter Doerwald <walter@livinglogic.de>
137
143
138 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
144 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
139 (which was displaying "quit" twice).
145 (which was displaying "quit" twice).
140
146
141 2006-07-28 Walter Doerwald <walter@livinglogic.de>
147 2006-07-28 Walter Doerwald <walter@livinglogic.de>
142
148
143 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
149 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
144 the mode argument).
150 the mode argument).
145
151
146 2006-07-27 Walter Doerwald <walter@livinglogic.de>
152 2006-07-27 Walter Doerwald <walter@livinglogic.de>
147
153
148 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
154 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
149 not running under IPython.
155 not running under IPython.
150
156
151 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
157 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
152 and make it iterable (iterating over the attribute itself). Add two new
158 and make it iterable (iterating over the attribute itself). Add two new
153 magic strings for __xattrs__(): If the string starts with "-", the attribute
159 magic strings for __xattrs__(): If the string starts with "-", the attribute
154 will not be displayed in ibrowse's detail view (but it can still be
160 will not be displayed in ibrowse's detail view (but it can still be
155 iterated over). This makes it possible to add attributes that are large
161 iterated over). This makes it possible to add attributes that are large
156 lists or generator methods to the detail view. Replace magic attribute names
162 lists or generator methods to the detail view. Replace magic attribute names
157 and _attrname() and _getattr() with "descriptors": For each type of magic
163 and _attrname() and _getattr() with "descriptors": For each type of magic
158 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
164 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
159 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
165 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
160 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
166 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
161 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
167 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
162 are still supported.
168 are still supported.
163
169
164 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
170 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
165 fails in ibrowse.fetch(), the exception object is added as the last item
171 fails in ibrowse.fetch(), the exception object is added as the last item
166 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
172 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
167 a generator throws an exception midway through execution.
173 a generator throws an exception midway through execution.
168
174
169 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
175 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
170 encoding into methods.
176 encoding into methods.
171
177
172 2006-07-26 Ville Vainio <vivainio@gmail.com>
178 2006-07-26 Ville Vainio <vivainio@gmail.com>
173
179
174 * iplib.py: history now stores multiline input as single
180 * iplib.py: history now stores multiline input as single
175 history entries. Patch by Jorgen Cederlof.
181 history entries. Patch by Jorgen Cederlof.
176
182
177 2006-07-18 Walter Doerwald <walter@livinglogic.de>
183 2006-07-18 Walter Doerwald <walter@livinglogic.de>
178
184
179 * IPython/Extensions/ibrowse.py: Make cursor visible over
185 * IPython/Extensions/ibrowse.py: Make cursor visible over
180 non existing attributes.
186 non existing attributes.
181
187
182 2006-07-14 Walter Doerwald <walter@livinglogic.de>
188 2006-07-14 Walter Doerwald <walter@livinglogic.de>
183
189
184 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
190 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
185 error output of the running command doesn't mess up the screen.
191 error output of the running command doesn't mess up the screen.
186
192
187 2006-07-13 Walter Doerwald <walter@livinglogic.de>
193 2006-07-13 Walter Doerwald <walter@livinglogic.de>
188
194
189 * IPython/Extensions/ipipe.py (isort): Make isort usable without
195 * IPython/Extensions/ipipe.py (isort): Make isort usable without
190 argument. This sorts the items themselves.
196 argument. This sorts the items themselves.
191
197
192 2006-07-12 Walter Doerwald <walter@livinglogic.de>
198 2006-07-12 Walter Doerwald <walter@livinglogic.de>
193
199
194 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
200 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
195 Compile expression strings into code objects. This should speed
201 Compile expression strings into code objects. This should speed
196 up ifilter and friends somewhat.
202 up ifilter and friends somewhat.
197
203
198 2006-07-08 Ville Vainio <vivainio@gmail.com>
204 2006-07-08 Ville Vainio <vivainio@gmail.com>
199
205
200 * Magic.py: %cpaste now strips > from the beginning of lines
206 * Magic.py: %cpaste now strips > from the beginning of lines
201 to ease pasting quoted code from emails. Contributed by
207 to ease pasting quoted code from emails. Contributed by
202 Stefan van der Walt.
208 Stefan van der Walt.
203
209
204 2006-06-29 Ville Vainio <vivainio@gmail.com>
210 2006-06-29 Ville Vainio <vivainio@gmail.com>
205
211
206 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
212 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
207 mode, patch contributed by Darren Dale. NEEDS TESTING!
213 mode, patch contributed by Darren Dale. NEEDS TESTING!
208
214
209 2006-06-28 Walter Doerwald <walter@livinglogic.de>
215 2006-06-28 Walter Doerwald <walter@livinglogic.de>
210
216
211 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
217 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
212 a blue background. Fix fetching new display rows when the browser
218 a blue background. Fix fetching new display rows when the browser
213 scrolls more than a screenful (e.g. by using the goto command).
219 scrolls more than a screenful (e.g. by using the goto command).
214
220
215 2006-06-27 Ville Vainio <vivainio@gmail.com>
221 2006-06-27 Ville Vainio <vivainio@gmail.com>
216
222
217 * Magic.py (_inspect, _ofind) Apply David Huard's
223 * Magic.py (_inspect, _ofind) Apply David Huard's
218 patch for displaying the correct docstring for 'property'
224 patch for displaying the correct docstring for 'property'
219 attributes.
225 attributes.
220
226
221 2006-06-23 Walter Doerwald <walter@livinglogic.de>
227 2006-06-23 Walter Doerwald <walter@livinglogic.de>
222
228
223 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
229 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
224 commands into the methods implementing them.
230 commands into the methods implementing them.
225
231
226 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
232 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
227
233
228 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
234 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
229 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
235 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
230 autoindent support was authored by Jin Liu.
236 autoindent support was authored by Jin Liu.
231
237
232 2006-06-22 Walter Doerwald <walter@livinglogic.de>
238 2006-06-22 Walter Doerwald <walter@livinglogic.de>
233
239
234 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
240 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
235 for keymaps with a custom class that simplifies handling.
241 for keymaps with a custom class that simplifies handling.
236
242
237 2006-06-19 Walter Doerwald <walter@livinglogic.de>
243 2006-06-19 Walter Doerwald <walter@livinglogic.de>
238
244
239 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
245 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
240 resizing. This requires Python 2.5 to work.
246 resizing. This requires Python 2.5 to work.
241
247
242 2006-06-16 Walter Doerwald <walter@livinglogic.de>
248 2006-06-16 Walter Doerwald <walter@livinglogic.de>
243
249
244 * IPython/Extensions/ibrowse.py: Add two new commands to
250 * IPython/Extensions/ibrowse.py: Add two new commands to
245 ibrowse: "hideattr" (mapped to "h") hides the attribute under
251 ibrowse: "hideattr" (mapped to "h") hides the attribute under
246 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
252 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
247 attributes again. Remapped the help command to "?". Display
253 attributes again. Remapped the help command to "?". Display
248 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
254 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
249 as keys for the "home" and "end" commands. Add three new commands
255 as keys for the "home" and "end" commands. Add three new commands
250 to the input mode for "find" and friends: "delend" (CTRL-K)
256 to the input mode for "find" and friends: "delend" (CTRL-K)
251 deletes to the end of line. "incsearchup" searches upwards in the
257 deletes to the end of line. "incsearchup" searches upwards in the
252 command history for an input that starts with the text before the cursor.
258 command history for an input that starts with the text before the cursor.
253 "incsearchdown" does the same downwards. Removed a bogus mapping of
259 "incsearchdown" does the same downwards. Removed a bogus mapping of
254 the x key to "delete".
260 the x key to "delete".
255
261
256 2006-06-15 Ville Vainio <vivainio@gmail.com>
262 2006-06-15 Ville Vainio <vivainio@gmail.com>
257
263
258 * iplib.py, hooks.py: Added new generate_prompt hook that can be
264 * iplib.py, hooks.py: Added new generate_prompt hook that can be
259 used to create prompts dynamically, instead of the "old" way of
265 used to create prompts dynamically, instead of the "old" way of
260 assigning "magic" strings to prompt_in1 and prompt_in2. The old
266 assigning "magic" strings to prompt_in1 and prompt_in2. The old
261 way still works (it's invoked by the default hook), of course.
267 way still works (it's invoked by the default hook), of course.
262
268
263 * Prompts.py: added generate_output_prompt hook for altering output
269 * Prompts.py: added generate_output_prompt hook for altering output
264 prompt
270 prompt
265
271
266 * Release.py: Changed version string to 0.7.3.svn.
272 * Release.py: Changed version string to 0.7.3.svn.
267
273
268 2006-06-15 Walter Doerwald <walter@livinglogic.de>
274 2006-06-15 Walter Doerwald <walter@livinglogic.de>
269
275
270 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
276 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
271 the call to fetch() always tries to fetch enough data for at least one
277 the call to fetch() always tries to fetch enough data for at least one
272 full screen. This makes it possible to simply call moveto(0,0,True) in
278 full screen. This makes it possible to simply call moveto(0,0,True) in
273 the constructor. Fix typos and removed the obsolete goto attribute.
279 the constructor. Fix typos and removed the obsolete goto attribute.
274
280
275 2006-06-12 Ville Vainio <vivainio@gmail.com>
281 2006-06-12 Ville Vainio <vivainio@gmail.com>
276
282
277 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
283 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
278 allowing $variable interpolation within multiline statements,
284 allowing $variable interpolation within multiline statements,
279 though so far only with "sh" profile for a testing period.
285 though so far only with "sh" profile for a testing period.
280 The patch also enables splitting long commands with \ but it
286 The patch also enables splitting long commands with \ but it
281 doesn't work properly yet.
287 doesn't work properly yet.
282
288
283 2006-06-12 Walter Doerwald <walter@livinglogic.de>
289 2006-06-12 Walter Doerwald <walter@livinglogic.de>
284
290
285 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
291 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
286 input history and the position of the cursor in the input history for
292 input history and the position of the cursor in the input history for
287 the find, findbackwards and goto command.
293 the find, findbackwards and goto command.
288
294
289 2006-06-10 Walter Doerwald <walter@livinglogic.de>
295 2006-06-10 Walter Doerwald <walter@livinglogic.de>
290
296
291 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
297 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
292 implements the basic functionality of browser commands that require
298 implements the basic functionality of browser commands that require
293 input. Reimplement the goto, find and findbackwards commands as
299 input. Reimplement the goto, find and findbackwards commands as
294 subclasses of _CommandInput. Add an input history and keymaps to those
300 subclasses of _CommandInput. Add an input history and keymaps to those
295 commands. Add "\r" as a keyboard shortcut for the enterdefault and
301 commands. Add "\r" as a keyboard shortcut for the enterdefault and
296 execute commands.
302 execute commands.
297
303
298 2006-06-07 Ville Vainio <vivainio@gmail.com>
304 2006-06-07 Ville Vainio <vivainio@gmail.com>
299
305
300 * iplib.py: ipython mybatch.ipy exits ipython immediately after
306 * iplib.py: ipython mybatch.ipy exits ipython immediately after
301 running the batch files instead of leaving the session open.
307 running the batch files instead of leaving the session open.
302
308
303 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
309 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
304
310
305 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
311 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
306 the original fix was incomplete. Patch submitted by W. Maier.
312 the original fix was incomplete. Patch submitted by W. Maier.
307
313
308 2006-06-07 Ville Vainio <vivainio@gmail.com>
314 2006-06-07 Ville Vainio <vivainio@gmail.com>
309
315
310 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
316 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
311 Confirmation prompts can be supressed by 'quiet' option.
317 Confirmation prompts can be supressed by 'quiet' option.
312 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
318 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
313
319
314 2006-06-06 *** Released version 0.7.2
320 2006-06-06 *** Released version 0.7.2
315
321
316 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
322 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
317
323
318 * IPython/Release.py (version): Made 0.7.2 final for release.
324 * IPython/Release.py (version): Made 0.7.2 final for release.
319 Repo tagged and release cut.
325 Repo tagged and release cut.
320
326
321 2006-06-05 Ville Vainio <vivainio@gmail.com>
327 2006-06-05 Ville Vainio <vivainio@gmail.com>
322
328
323 * Magic.py (magic_rehashx): Honor no_alias list earlier in
329 * Magic.py (magic_rehashx): Honor no_alias list earlier in
324 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
330 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
325
331
326 * upgrade_dir.py: try import 'path' module a bit harder
332 * upgrade_dir.py: try import 'path' module a bit harder
327 (for %upgrade)
333 (for %upgrade)
328
334
329 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
335 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
330
336
331 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
337 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
332 instead of looping 20 times.
338 instead of looping 20 times.
333
339
334 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
340 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
335 correctly at initialization time. Bug reported by Krishna Mohan
341 correctly at initialization time. Bug reported by Krishna Mohan
336 Gundu <gkmohan-AT-gmail.com> on the user list.
342 Gundu <gkmohan-AT-gmail.com> on the user list.
337
343
338 * IPython/Release.py (version): Mark 0.7.2 version to start
344 * IPython/Release.py (version): Mark 0.7.2 version to start
339 testing for release on 06/06.
345 testing for release on 06/06.
340
346
341 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
347 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
342
348
343 * scripts/irunner: thin script interface so users don't have to
349 * scripts/irunner: thin script interface so users don't have to
344 find the module and call it as an executable, since modules rarely
350 find the module and call it as an executable, since modules rarely
345 live in people's PATH.
351 live in people's PATH.
346
352
347 * IPython/irunner.py (InteractiveRunner.__init__): added
353 * IPython/irunner.py (InteractiveRunner.__init__): added
348 delaybeforesend attribute to control delays with newer versions of
354 delaybeforesend attribute to control delays with newer versions of
349 pexpect. Thanks to detailed help from pexpect's author, Noah
355 pexpect. Thanks to detailed help from pexpect's author, Noah
350 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
356 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
351 correctly (it works in NoColor mode).
357 correctly (it works in NoColor mode).
352
358
353 * IPython/iplib.py (handle_normal): fix nasty crash reported on
359 * IPython/iplib.py (handle_normal): fix nasty crash reported on
354 SAGE list, from improper log() calls.
360 SAGE list, from improper log() calls.
355
361
356 2006-05-31 Ville Vainio <vivainio@gmail.com>
362 2006-05-31 Ville Vainio <vivainio@gmail.com>
357
363
358 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
364 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
359 with args in parens to work correctly with dirs that have spaces.
365 with args in parens to work correctly with dirs that have spaces.
360
366
361 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
367 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
362
368
363 * IPython/Logger.py (Logger.logstart): add option to log raw input
369 * IPython/Logger.py (Logger.logstart): add option to log raw input
364 instead of the processed one. A -r flag was added to the
370 instead of the processed one. A -r flag was added to the
365 %logstart magic used for controlling logging.
371 %logstart magic used for controlling logging.
366
372
367 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
373 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
368
374
369 * IPython/iplib.py (InteractiveShell.__init__): add check for the
375 * IPython/iplib.py (InteractiveShell.__init__): add check for the
370 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
376 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
371 recognize the option. After a bug report by Will Maier. This
377 recognize the option. After a bug report by Will Maier. This
372 closes #64 (will do it after confirmation from W. Maier).
378 closes #64 (will do it after confirmation from W. Maier).
373
379
374 * IPython/irunner.py: New module to run scripts as if manually
380 * IPython/irunner.py: New module to run scripts as if manually
375 typed into an interactive environment, based on pexpect. After a
381 typed into an interactive environment, based on pexpect. After a
376 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
382 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
377 ipython-user list. Simple unittests in the tests/ directory.
383 ipython-user list. Simple unittests in the tests/ directory.
378
384
379 * tools/release: add Will Maier, OpenBSD port maintainer, to
385 * tools/release: add Will Maier, OpenBSD port maintainer, to
380 recepients list. We are now officially part of the OpenBSD ports:
386 recepients list. We are now officially part of the OpenBSD ports:
381 http://www.openbsd.org/ports.html ! Many thanks to Will for the
387 http://www.openbsd.org/ports.html ! Many thanks to Will for the
382 work.
388 work.
383
389
384 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
390 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
385
391
386 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
392 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
387 so that it doesn't break tkinter apps.
393 so that it doesn't break tkinter apps.
388
394
389 * IPython/iplib.py (_prefilter): fix bug where aliases would
395 * IPython/iplib.py (_prefilter): fix bug where aliases would
390 shadow variables when autocall was fully off. Reported by SAGE
396 shadow variables when autocall was fully off. Reported by SAGE
391 author William Stein.
397 author William Stein.
392
398
393 * IPython/OInspect.py (Inspector.__init__): add a flag to control
399 * IPython/OInspect.py (Inspector.__init__): add a flag to control
394 at what detail level strings are computed when foo? is requested.
400 at what detail level strings are computed when foo? is requested.
395 This allows users to ask for example that the string form of an
401 This allows users to ask for example that the string form of an
396 object is only computed when foo?? is called, or even never, by
402 object is only computed when foo?? is called, or even never, by
397 setting the object_info_string_level >= 2 in the configuration
403 setting the object_info_string_level >= 2 in the configuration
398 file. This new option has been added and documented. After a
404 file. This new option has been added and documented. After a
399 request by SAGE to be able to control the printing of very large
405 request by SAGE to be able to control the printing of very large
400 objects more easily.
406 objects more easily.
401
407
402 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
408 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
403
409
404 * IPython/ipmaker.py (make_IPython): remove the ipython call path
410 * IPython/ipmaker.py (make_IPython): remove the ipython call path
405 from sys.argv, to be 100% consistent with how Python itself works
411 from sys.argv, to be 100% consistent with how Python itself works
406 (as seen for example with python -i file.py). After a bug report
412 (as seen for example with python -i file.py). After a bug report
407 by Jeffrey Collins.
413 by Jeffrey Collins.
408
414
409 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
415 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
410 nasty bug which was preventing custom namespaces with -pylab,
416 nasty bug which was preventing custom namespaces with -pylab,
411 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
417 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
412 compatibility (long gone from mpl).
418 compatibility (long gone from mpl).
413
419
414 * IPython/ipapi.py (make_session): name change: create->make. We
420 * IPython/ipapi.py (make_session): name change: create->make. We
415 use make in other places (ipmaker,...), it's shorter and easier to
421 use make in other places (ipmaker,...), it's shorter and easier to
416 type and say, etc. I'm trying to clean things before 0.7.2 so
422 type and say, etc. I'm trying to clean things before 0.7.2 so
417 that I can keep things stable wrt to ipapi in the chainsaw branch.
423 that I can keep things stable wrt to ipapi in the chainsaw branch.
418
424
419 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
425 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
420 python-mode recognizes our debugger mode. Add support for
426 python-mode recognizes our debugger mode. Add support for
421 autoindent inside (X)emacs. After a patch sent in by Jin Liu
427 autoindent inside (X)emacs. After a patch sent in by Jin Liu
422 <m.liu.jin-AT-gmail.com> originally written by
428 <m.liu.jin-AT-gmail.com> originally written by
423 doxgen-AT-newsmth.net (with minor modifications for xemacs
429 doxgen-AT-newsmth.net (with minor modifications for xemacs
424 compatibility)
430 compatibility)
425
431
426 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
432 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
427 tracebacks when walking the stack so that the stack tracking system
433 tracebacks when walking the stack so that the stack tracking system
428 in emacs' python-mode can identify the frames correctly.
434 in emacs' python-mode can identify the frames correctly.
429
435
430 * IPython/ipmaker.py (make_IPython): make the internal (and
436 * IPython/ipmaker.py (make_IPython): make the internal (and
431 default config) autoedit_syntax value false by default. Too many
437 default config) autoedit_syntax value false by default. Too many
432 users have complained to me (both on and off-list) about problems
438 users have complained to me (both on and off-list) about problems
433 with this option being on by default, so I'm making it default to
439 with this option being on by default, so I'm making it default to
434 off. It can still be enabled by anyone via the usual mechanisms.
440 off. It can still be enabled by anyone via the usual mechanisms.
435
441
436 * IPython/completer.py (Completer.attr_matches): add support for
442 * IPython/completer.py (Completer.attr_matches): add support for
437 PyCrust-style _getAttributeNames magic method. Patch contributed
443 PyCrust-style _getAttributeNames magic method. Patch contributed
438 by <mscott-AT-goldenspud.com>. Closes #50.
444 by <mscott-AT-goldenspud.com>. Closes #50.
439
445
440 * IPython/iplib.py (InteractiveShell.__init__): remove the
446 * IPython/iplib.py (InteractiveShell.__init__): remove the
441 deletion of exit/quit from __builtin__, which can break
447 deletion of exit/quit from __builtin__, which can break
442 third-party tools like the Zope debugging console. The
448 third-party tools like the Zope debugging console. The
443 %exit/%quit magics remain. In general, it's probably a good idea
449 %exit/%quit magics remain. In general, it's probably a good idea
444 not to delete anything from __builtin__, since we never know what
450 not to delete anything from __builtin__, since we never know what
445 that will break. In any case, python now (for 2.5) will support
451 that will break. In any case, python now (for 2.5) will support
446 'real' exit/quit, so this issue is moot. Closes #55.
452 'real' exit/quit, so this issue is moot. Closes #55.
447
453
448 * IPython/genutils.py (with_obj): rename the 'with' function to
454 * IPython/genutils.py (with_obj): rename the 'with' function to
449 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
455 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
450 becomes a language keyword. Closes #53.
456 becomes a language keyword. Closes #53.
451
457
452 * IPython/FakeModule.py (FakeModule.__init__): add a proper
458 * IPython/FakeModule.py (FakeModule.__init__): add a proper
453 __file__ attribute to this so it fools more things into thinking
459 __file__ attribute to this so it fools more things into thinking
454 it is a real module. Closes #59.
460 it is a real module. Closes #59.
455
461
456 * IPython/Magic.py (magic_edit): add -n option to open the editor
462 * IPython/Magic.py (magic_edit): add -n option to open the editor
457 at a specific line number. After a patch by Stefan van der Walt.
463 at a specific line number. After a patch by Stefan van der Walt.
458
464
459 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
465 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
460
466
461 * IPython/iplib.py (edit_syntax_error): fix crash when for some
467 * IPython/iplib.py (edit_syntax_error): fix crash when for some
462 reason the file could not be opened. After automatic crash
468 reason the file could not be opened. After automatic crash
463 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
469 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
464 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
470 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
465 (_should_recompile): Don't fire editor if using %bg, since there
471 (_should_recompile): Don't fire editor if using %bg, since there
466 is no file in the first place. From the same report as above.
472 is no file in the first place. From the same report as above.
467 (raw_input): protect against faulty third-party prefilters. After
473 (raw_input): protect against faulty third-party prefilters. After
468 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
474 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
469 while running under SAGE.
475 while running under SAGE.
470
476
471 2006-05-23 Ville Vainio <vivainio@gmail.com>
477 2006-05-23 Ville Vainio <vivainio@gmail.com>
472
478
473 * ipapi.py: Stripped down ip.to_user_ns() to work only as
479 * ipapi.py: Stripped down ip.to_user_ns() to work only as
474 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
480 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
475 now returns None (again), unless dummy is specifically allowed by
481 now returns None (again), unless dummy is specifically allowed by
476 ipapi.get(allow_dummy=True).
482 ipapi.get(allow_dummy=True).
477
483
478 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
484 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
479
485
480 * IPython: remove all 2.2-compatibility objects and hacks from
486 * IPython: remove all 2.2-compatibility objects and hacks from
481 everywhere, since we only support 2.3 at this point. Docs
487 everywhere, since we only support 2.3 at this point. Docs
482 updated.
488 updated.
483
489
484 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
490 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
485 Anything requiring extra validation can be turned into a Python
491 Anything requiring extra validation can be turned into a Python
486 property in the future. I used a property for the db one b/c
492 property in the future. I used a property for the db one b/c
487 there was a nasty circularity problem with the initialization
493 there was a nasty circularity problem with the initialization
488 order, which right now I don't have time to clean up.
494 order, which right now I don't have time to clean up.
489
495
490 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
496 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
491 another locking bug reported by Jorgen. I'm not 100% sure though,
497 another locking bug reported by Jorgen. I'm not 100% sure though,
492 so more testing is needed...
498 so more testing is needed...
493
499
494 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
500 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
495
501
496 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
502 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
497 local variables from any routine in user code (typically executed
503 local variables from any routine in user code (typically executed
498 with %run) directly into the interactive namespace. Very useful
504 with %run) directly into the interactive namespace. Very useful
499 when doing complex debugging.
505 when doing complex debugging.
500 (IPythonNotRunning): Changed the default None object to a dummy
506 (IPythonNotRunning): Changed the default None object to a dummy
501 whose attributes can be queried as well as called without
507 whose attributes can be queried as well as called without
502 exploding, to ease writing code which works transparently both in
508 exploding, to ease writing code which works transparently both in
503 and out of ipython and uses some of this API.
509 and out of ipython and uses some of this API.
504
510
505 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
511 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
506
512
507 * IPython/hooks.py (result_display): Fix the fact that our display
513 * IPython/hooks.py (result_display): Fix the fact that our display
508 hook was using str() instead of repr(), as the default python
514 hook was using str() instead of repr(), as the default python
509 console does. This had gone unnoticed b/c it only happened if
515 console does. This had gone unnoticed b/c it only happened if
510 %Pprint was off, but the inconsistency was there.
516 %Pprint was off, but the inconsistency was there.
511
517
512 2006-05-15 Ville Vainio <vivainio@gmail.com>
518 2006-05-15 Ville Vainio <vivainio@gmail.com>
513
519
514 * Oinspect.py: Only show docstring for nonexisting/binary files
520 * Oinspect.py: Only show docstring for nonexisting/binary files
515 when doing object??, closing ticket #62
521 when doing object??, closing ticket #62
516
522
517 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
523 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
518
524
519 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
525 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
520 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
526 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
521 was being released in a routine which hadn't checked if it had
527 was being released in a routine which hadn't checked if it had
522 been the one to acquire it.
528 been the one to acquire it.
523
529
524 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
530 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
525
531
526 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
532 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
527
533
528 2006-04-11 Ville Vainio <vivainio@gmail.com>
534 2006-04-11 Ville Vainio <vivainio@gmail.com>
529
535
530 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
536 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
531 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
537 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
532 prefilters, allowing stuff like magics and aliases in the file.
538 prefilters, allowing stuff like magics and aliases in the file.
533
539
534 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
540 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
535 added. Supported now are "%clear in" and "%clear out" (clear input and
541 added. Supported now are "%clear in" and "%clear out" (clear input and
536 output history, respectively). Also fixed CachedOutput.flush to
542 output history, respectively). Also fixed CachedOutput.flush to
537 properly flush the output cache.
543 properly flush the output cache.
538
544
539 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
545 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
540 half-success (and fail explicitly).
546 half-success (and fail explicitly).
541
547
542 2006-03-28 Ville Vainio <vivainio@gmail.com>
548 2006-03-28 Ville Vainio <vivainio@gmail.com>
543
549
544 * iplib.py: Fix quoting of aliases so that only argless ones
550 * iplib.py: Fix quoting of aliases so that only argless ones
545 are quoted
551 are quoted
546
552
547 2006-03-28 Ville Vainio <vivainio@gmail.com>
553 2006-03-28 Ville Vainio <vivainio@gmail.com>
548
554
549 * iplib.py: Quote aliases with spaces in the name.
555 * iplib.py: Quote aliases with spaces in the name.
550 "c:\program files\blah\bin" is now legal alias target.
556 "c:\program files\blah\bin" is now legal alias target.
551
557
552 * ext_rehashdir.py: Space no longer allowed as arg
558 * ext_rehashdir.py: Space no longer allowed as arg
553 separator, since space is legal in path names.
559 separator, since space is legal in path names.
554
560
555 2006-03-16 Ville Vainio <vivainio@gmail.com>
561 2006-03-16 Ville Vainio <vivainio@gmail.com>
556
562
557 * upgrade_dir.py: Take path.py from Extensions, correcting
563 * upgrade_dir.py: Take path.py from Extensions, correcting
558 %upgrade magic
564 %upgrade magic
559
565
560 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
566 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
561
567
562 * hooks.py: Only enclose editor binary in quotes if legal and
568 * hooks.py: Only enclose editor binary in quotes if legal and
563 necessary (space in the name, and is an existing file). Fixes a bug
569 necessary (space in the name, and is an existing file). Fixes a bug
564 reported by Zachary Pincus.
570 reported by Zachary Pincus.
565
571
566 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
572 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
567
573
568 * Manual: thanks to a tip on proper color handling for Emacs, by
574 * Manual: thanks to a tip on proper color handling for Emacs, by
569 Eric J Haywiser <ejh1-AT-MIT.EDU>.
575 Eric J Haywiser <ejh1-AT-MIT.EDU>.
570
576
571 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
577 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
572 by applying the provided patch. Thanks to Liu Jin
578 by applying the provided patch. Thanks to Liu Jin
573 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
579 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
574 XEmacs/Linux, I'm trusting the submitter that it actually helps
580 XEmacs/Linux, I'm trusting the submitter that it actually helps
575 under win32/GNU Emacs. Will revisit if any problems are reported.
581 under win32/GNU Emacs. Will revisit if any problems are reported.
576
582
577 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
583 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
578
584
579 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
585 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
580 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
586 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
581
587
582 2006-03-12 Ville Vainio <vivainio@gmail.com>
588 2006-03-12 Ville Vainio <vivainio@gmail.com>
583
589
584 * Magic.py (magic_timeit): Added %timeit magic, contributed by
590 * Magic.py (magic_timeit): Added %timeit magic, contributed by
585 Torsten Marek.
591 Torsten Marek.
586
592
587 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
593 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
588
594
589 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
595 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
590 line ranges works again.
596 line ranges works again.
591
597
592 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
598 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
593
599
594 * IPython/iplib.py (showtraceback): add back sys.last_traceback
600 * IPython/iplib.py (showtraceback): add back sys.last_traceback
595 and friends, after a discussion with Zach Pincus on ipython-user.
601 and friends, after a discussion with Zach Pincus on ipython-user.
596 I'm not 100% sure, but after thinking about it quite a bit, it may
602 I'm not 100% sure, but after thinking about it quite a bit, it may
597 be OK. Testing with the multithreaded shells didn't reveal any
603 be OK. Testing with the multithreaded shells didn't reveal any
598 problems, but let's keep an eye out.
604 problems, but let's keep an eye out.
599
605
600 In the process, I fixed a few things which were calling
606 In the process, I fixed a few things which were calling
601 self.InteractiveTB() directly (like safe_execfile), which is a
607 self.InteractiveTB() directly (like safe_execfile), which is a
602 mistake: ALL exception reporting should be done by calling
608 mistake: ALL exception reporting should be done by calling
603 self.showtraceback(), which handles state and tab-completion and
609 self.showtraceback(), which handles state and tab-completion and
604 more.
610 more.
605
611
606 2006-03-01 Ville Vainio <vivainio@gmail.com>
612 2006-03-01 Ville Vainio <vivainio@gmail.com>
607
613
608 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
614 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
609 To use, do "from ipipe import *".
615 To use, do "from ipipe import *".
610
616
611 2006-02-24 Ville Vainio <vivainio@gmail.com>
617 2006-02-24 Ville Vainio <vivainio@gmail.com>
612
618
613 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
619 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
614 "cleanly" and safely than the older upgrade mechanism.
620 "cleanly" and safely than the older upgrade mechanism.
615
621
616 2006-02-21 Ville Vainio <vivainio@gmail.com>
622 2006-02-21 Ville Vainio <vivainio@gmail.com>
617
623
618 * Magic.py: %save works again.
624 * Magic.py: %save works again.
619
625
620 2006-02-15 Ville Vainio <vivainio@gmail.com>
626 2006-02-15 Ville Vainio <vivainio@gmail.com>
621
627
622 * Magic.py: %Pprint works again
628 * Magic.py: %Pprint works again
623
629
624 * Extensions/ipy_sane_defaults.py: Provide everything provided
630 * Extensions/ipy_sane_defaults.py: Provide everything provided
625 in default ipythonrc, to make it possible to have a completely empty
631 in default ipythonrc, to make it possible to have a completely empty
626 ipythonrc (and thus completely rc-file free configuration)
632 ipythonrc (and thus completely rc-file free configuration)
627
633
628 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
634 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
629
635
630 * IPython/hooks.py (editor): quote the call to the editor command,
636 * IPython/hooks.py (editor): quote the call to the editor command,
631 to allow commands with spaces in them. Problem noted by watching
637 to allow commands with spaces in them. Problem noted by watching
632 Ian Oswald's video about textpad under win32 at
638 Ian Oswald's video about textpad under win32 at
633 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
639 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
634
640
635 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
641 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
636 describing magics (we haven't used @ for a loong time).
642 describing magics (we haven't used @ for a loong time).
637
643
638 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
644 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
639 contributed by marienz to close
645 contributed by marienz to close
640 http://www.scipy.net/roundup/ipython/issue53.
646 http://www.scipy.net/roundup/ipython/issue53.
641
647
642 2006-02-10 Ville Vainio <vivainio@gmail.com>
648 2006-02-10 Ville Vainio <vivainio@gmail.com>
643
649
644 * genutils.py: getoutput now works in win32 too
650 * genutils.py: getoutput now works in win32 too
645
651
646 * completer.py: alias and magic completion only invoked
652 * completer.py: alias and magic completion only invoked
647 at the first "item" in the line, to avoid "cd %store"
653 at the first "item" in the line, to avoid "cd %store"
648 nonsense.
654 nonsense.
649
655
650 2006-02-09 Ville Vainio <vivainio@gmail.com>
656 2006-02-09 Ville Vainio <vivainio@gmail.com>
651
657
652 * test/*: Added a unit testing framework (finally).
658 * test/*: Added a unit testing framework (finally).
653 '%run runtests.py' to run test_*.
659 '%run runtests.py' to run test_*.
654
660
655 * ipapi.py: Exposed runlines and set_custom_exc
661 * ipapi.py: Exposed runlines and set_custom_exc
656
662
657 2006-02-07 Ville Vainio <vivainio@gmail.com>
663 2006-02-07 Ville Vainio <vivainio@gmail.com>
658
664
659 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
665 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
660 instead use "f(1 2)" as before.
666 instead use "f(1 2)" as before.
661
667
662 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
668 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
663
669
664 * IPython/demo.py (IPythonDemo): Add new classes to the demo
670 * IPython/demo.py (IPythonDemo): Add new classes to the demo
665 facilities, for demos processed by the IPython input filter
671 facilities, for demos processed by the IPython input filter
666 (IPythonDemo), and for running a script one-line-at-a-time as a
672 (IPythonDemo), and for running a script one-line-at-a-time as a
667 demo, both for pure Python (LineDemo) and for IPython-processed
673 demo, both for pure Python (LineDemo) and for IPython-processed
668 input (IPythonLineDemo). After a request by Dave Kohel, from the
674 input (IPythonLineDemo). After a request by Dave Kohel, from the
669 SAGE team.
675 SAGE team.
670 (Demo.edit): added an edit() method to the demo objects, to edit
676 (Demo.edit): added an edit() method to the demo objects, to edit
671 the in-memory copy of the last executed block.
677 the in-memory copy of the last executed block.
672
678
673 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
679 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
674 processing to %edit, %macro and %save. These commands can now be
680 processing to %edit, %macro and %save. These commands can now be
675 invoked on the unprocessed input as it was typed by the user
681 invoked on the unprocessed input as it was typed by the user
676 (without any prefilters applied). After requests by the SAGE team
682 (without any prefilters applied). After requests by the SAGE team
677 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
683 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
678
684
679 2006-02-01 Ville Vainio <vivainio@gmail.com>
685 2006-02-01 Ville Vainio <vivainio@gmail.com>
680
686
681 * setup.py, eggsetup.py: easy_install ipython==dev works
687 * setup.py, eggsetup.py: easy_install ipython==dev works
682 correctly now (on Linux)
688 correctly now (on Linux)
683
689
684 * ipy_user_conf,ipmaker: user config changes, removed spurious
690 * ipy_user_conf,ipmaker: user config changes, removed spurious
685 warnings
691 warnings
686
692
687 * iplib: if rc.banner is string, use it as is.
693 * iplib: if rc.banner is string, use it as is.
688
694
689 * Magic: %pycat accepts a string argument and pages it's contents.
695 * Magic: %pycat accepts a string argument and pages it's contents.
690
696
691
697
692 2006-01-30 Ville Vainio <vivainio@gmail.com>
698 2006-01-30 Ville Vainio <vivainio@gmail.com>
693
699
694 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
700 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
695 Now %store and bookmarks work through PickleShare, meaning that
701 Now %store and bookmarks work through PickleShare, meaning that
696 concurrent access is possible and all ipython sessions see the
702 concurrent access is possible and all ipython sessions see the
697 same database situation all the time, instead of snapshot of
703 same database situation all the time, instead of snapshot of
698 the situation when the session was started. Hence, %bookmark
704 the situation when the session was started. Hence, %bookmark
699 results are immediately accessible from othes sessions. The database
705 results are immediately accessible from othes sessions. The database
700 is also available for use by user extensions. See:
706 is also available for use by user extensions. See:
701 http://www.python.org/pypi/pickleshare
707 http://www.python.org/pypi/pickleshare
702
708
703 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
709 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
704
710
705 * aliases can now be %store'd
711 * aliases can now be %store'd
706
712
707 * path.py moved to Extensions so that pickleshare does not need
713 * path.py moved to Extensions so that pickleshare does not need
708 IPython-specific import. Extensions added to pythonpath right
714 IPython-specific import. Extensions added to pythonpath right
709 at __init__.
715 at __init__.
710
716
711 * iplib.py: ipalias deprecated/redundant; aliases are converted and
717 * iplib.py: ipalias deprecated/redundant; aliases are converted and
712 called with _ip.system and the pre-transformed command string.
718 called with _ip.system and the pre-transformed command string.
713
719
714 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
720 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
715
721
716 * IPython/iplib.py (interact): Fix that we were not catching
722 * IPython/iplib.py (interact): Fix that we were not catching
717 KeyboardInterrupt exceptions properly. I'm not quite sure why the
723 KeyboardInterrupt exceptions properly. I'm not quite sure why the
718 logic here had to change, but it's fixed now.
724 logic here had to change, but it's fixed now.
719
725
720 2006-01-29 Ville Vainio <vivainio@gmail.com>
726 2006-01-29 Ville Vainio <vivainio@gmail.com>
721
727
722 * iplib.py: Try to import pyreadline on Windows.
728 * iplib.py: Try to import pyreadline on Windows.
723
729
724 2006-01-27 Ville Vainio <vivainio@gmail.com>
730 2006-01-27 Ville Vainio <vivainio@gmail.com>
725
731
726 * iplib.py: Expose ipapi as _ip in builtin namespace.
732 * iplib.py: Expose ipapi as _ip in builtin namespace.
727 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
733 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
728 and ip_set_hook (-> _ip.set_hook) redundant. % and !
734 and ip_set_hook (-> _ip.set_hook) redundant. % and !
729 syntax now produce _ip.* variant of the commands.
735 syntax now produce _ip.* variant of the commands.
730
736
731 * "_ip.options().autoedit_syntax = 2" automatically throws
737 * "_ip.options().autoedit_syntax = 2" automatically throws
732 user to editor for syntax error correction without prompting.
738 user to editor for syntax error correction without prompting.
733
739
734 2006-01-27 Ville Vainio <vivainio@gmail.com>
740 2006-01-27 Ville Vainio <vivainio@gmail.com>
735
741
736 * ipmaker.py: Give "realistic" sys.argv for scripts (without
742 * ipmaker.py: Give "realistic" sys.argv for scripts (without
737 'ipython' at argv[0]) executed through command line.
743 'ipython' at argv[0]) executed through command line.
738 NOTE: this DEPRECATES calling ipython with multiple scripts
744 NOTE: this DEPRECATES calling ipython with multiple scripts
739 ("ipython a.py b.py c.py")
745 ("ipython a.py b.py c.py")
740
746
741 * iplib.py, hooks.py: Added configurable input prefilter,
747 * iplib.py, hooks.py: Added configurable input prefilter,
742 named 'input_prefilter'. See ext_rescapture.py for example
748 named 'input_prefilter'. See ext_rescapture.py for example
743 usage.
749 usage.
744
750
745 * ext_rescapture.py, Magic.py: Better system command output capture
751 * ext_rescapture.py, Magic.py: Better system command output capture
746 through 'var = !ls' (deprecates user-visible %sc). Same notation
752 through 'var = !ls' (deprecates user-visible %sc). Same notation
747 applies for magics, 'var = %alias' assigns alias list to var.
753 applies for magics, 'var = %alias' assigns alias list to var.
748
754
749 * ipapi.py: added meta() for accessing extension-usable data store.
755 * ipapi.py: added meta() for accessing extension-usable data store.
750
756
751 * iplib.py: added InteractiveShell.getapi(). New magics should be
757 * iplib.py: added InteractiveShell.getapi(). New magics should be
752 written doing self.getapi() instead of using the shell directly.
758 written doing self.getapi() instead of using the shell directly.
753
759
754 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
760 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
755 %store foo >> ~/myfoo.txt to store variables to files (in clean
761 %store foo >> ~/myfoo.txt to store variables to files (in clean
756 textual form, not a restorable pickle).
762 textual form, not a restorable pickle).
757
763
758 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
764 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
759
765
760 * usage.py, Magic.py: added %quickref
766 * usage.py, Magic.py: added %quickref
761
767
762 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
768 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
763
769
764 * GetoptErrors when invoking magics etc. with wrong args
770 * GetoptErrors when invoking magics etc. with wrong args
765 are now more helpful:
771 are now more helpful:
766 GetoptError: option -l not recognized (allowed: "qb" )
772 GetoptError: option -l not recognized (allowed: "qb" )
767
773
768 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
774 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
769
775
770 * IPython/demo.py (Demo.show): Flush stdout after each block, so
776 * IPython/demo.py (Demo.show): Flush stdout after each block, so
771 computationally intensive blocks don't appear to stall the demo.
777 computationally intensive blocks don't appear to stall the demo.
772
778
773 2006-01-24 Ville Vainio <vivainio@gmail.com>
779 2006-01-24 Ville Vainio <vivainio@gmail.com>
774
780
775 * iplib.py, hooks.py: 'result_display' hook can return a non-None
781 * iplib.py, hooks.py: 'result_display' hook can return a non-None
776 value to manipulate resulting history entry.
782 value to manipulate resulting history entry.
777
783
778 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
784 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
779 to instance methods of IPApi class, to make extending an embedded
785 to instance methods of IPApi class, to make extending an embedded
780 IPython feasible. See ext_rehashdir.py for example usage.
786 IPython feasible. See ext_rehashdir.py for example usage.
781
787
782 * Merged 1071-1076 from branches/0.7.1
788 * Merged 1071-1076 from branches/0.7.1
783
789
784
790
785 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
791 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
786
792
787 * tools/release (daystamp): Fix build tools to use the new
793 * tools/release (daystamp): Fix build tools to use the new
788 eggsetup.py script to build lightweight eggs.
794 eggsetup.py script to build lightweight eggs.
789
795
790 * Applied changesets 1062 and 1064 before 0.7.1 release.
796 * Applied changesets 1062 and 1064 before 0.7.1 release.
791
797
792 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
798 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
793 see the raw input history (without conversions like %ls ->
799 see the raw input history (without conversions like %ls ->
794 ipmagic("ls")). After a request from W. Stein, SAGE
800 ipmagic("ls")). After a request from W. Stein, SAGE
795 (http://modular.ucsd.edu/sage) developer. This information is
801 (http://modular.ucsd.edu/sage) developer. This information is
796 stored in the input_hist_raw attribute of the IPython instance, so
802 stored in the input_hist_raw attribute of the IPython instance, so
797 developers can access it if needed (it's an InputList instance).
803 developers can access it if needed (it's an InputList instance).
798
804
799 * Versionstring = 0.7.2.svn
805 * Versionstring = 0.7.2.svn
800
806
801 * eggsetup.py: A separate script for constructing eggs, creates
807 * eggsetup.py: A separate script for constructing eggs, creates
802 proper launch scripts even on Windows (an .exe file in
808 proper launch scripts even on Windows (an .exe file in
803 \python24\scripts).
809 \python24\scripts).
804
810
805 * ipapi.py: launch_new_instance, launch entry point needed for the
811 * ipapi.py: launch_new_instance, launch entry point needed for the
806 egg.
812 egg.
807
813
808 2006-01-23 Ville Vainio <vivainio@gmail.com>
814 2006-01-23 Ville Vainio <vivainio@gmail.com>
809
815
810 * Added %cpaste magic for pasting python code
816 * Added %cpaste magic for pasting python code
811
817
812 2006-01-22 Ville Vainio <vivainio@gmail.com>
818 2006-01-22 Ville Vainio <vivainio@gmail.com>
813
819
814 * Merge from branches/0.7.1 into trunk, revs 1052-1057
820 * Merge from branches/0.7.1 into trunk, revs 1052-1057
815
821
816 * Versionstring = 0.7.2.svn
822 * Versionstring = 0.7.2.svn
817
823
818 * eggsetup.py: A separate script for constructing eggs, creates
824 * eggsetup.py: A separate script for constructing eggs, creates
819 proper launch scripts even on Windows (an .exe file in
825 proper launch scripts even on Windows (an .exe file in
820 \python24\scripts).
826 \python24\scripts).
821
827
822 * ipapi.py: launch_new_instance, launch entry point needed for the
828 * ipapi.py: launch_new_instance, launch entry point needed for the
823 egg.
829 egg.
824
830
825 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
831 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
826
832
827 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
833 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
828 %pfile foo would print the file for foo even if it was a binary.
834 %pfile foo would print the file for foo even if it was a binary.
829 Now, extensions '.so' and '.dll' are skipped.
835 Now, extensions '.so' and '.dll' are skipped.
830
836
831 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
837 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
832 bug, where macros would fail in all threaded modes. I'm not 100%
838 bug, where macros would fail in all threaded modes. I'm not 100%
833 sure, so I'm going to put out an rc instead of making a release
839 sure, so I'm going to put out an rc instead of making a release
834 today, and wait for feedback for at least a few days.
840 today, and wait for feedback for at least a few days.
835
841
836 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
842 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
837 it...) the handling of pasting external code with autoindent on.
843 it...) the handling of pasting external code with autoindent on.
838 To get out of a multiline input, the rule will appear for most
844 To get out of a multiline input, the rule will appear for most
839 users unchanged: two blank lines or change the indent level
845 users unchanged: two blank lines or change the indent level
840 proposed by IPython. But there is a twist now: you can
846 proposed by IPython. But there is a twist now: you can
841 add/subtract only *one or two spaces*. If you add/subtract three
847 add/subtract only *one or two spaces*. If you add/subtract three
842 or more (unless you completely delete the line), IPython will
848 or more (unless you completely delete the line), IPython will
843 accept that line, and you'll need to enter a second one of pure
849 accept that line, and you'll need to enter a second one of pure
844 whitespace. I know it sounds complicated, but I can't find a
850 whitespace. I know it sounds complicated, but I can't find a
845 different solution that covers all the cases, with the right
851 different solution that covers all the cases, with the right
846 heuristics. Hopefully in actual use, nobody will really notice
852 heuristics. Hopefully in actual use, nobody will really notice
847 all these strange rules and things will 'just work'.
853 all these strange rules and things will 'just work'.
848
854
849 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
855 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
850
856
851 * IPython/iplib.py (interact): catch exceptions which can be
857 * IPython/iplib.py (interact): catch exceptions which can be
852 triggered asynchronously by signal handlers. Thanks to an
858 triggered asynchronously by signal handlers. Thanks to an
853 automatic crash report, submitted by Colin Kingsley
859 automatic crash report, submitted by Colin Kingsley
854 <tercel-AT-gentoo.org>.
860 <tercel-AT-gentoo.org>.
855
861
856 2006-01-20 Ville Vainio <vivainio@gmail.com>
862 2006-01-20 Ville Vainio <vivainio@gmail.com>
857
863
858 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
864 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
859 (%rehashdir, very useful, try it out) of how to extend ipython
865 (%rehashdir, very useful, try it out) of how to extend ipython
860 with new magics. Also added Extensions dir to pythonpath to make
866 with new magics. Also added Extensions dir to pythonpath to make
861 importing extensions easy.
867 importing extensions easy.
862
868
863 * %store now complains when trying to store interactively declared
869 * %store now complains when trying to store interactively declared
864 classes / instances of those classes.
870 classes / instances of those classes.
865
871
866 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
872 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
867 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
873 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
868 if they exist, and ipy_user_conf.py with some defaults is created for
874 if they exist, and ipy_user_conf.py with some defaults is created for
869 the user.
875 the user.
870
876
871 * Startup rehashing done by the config file, not InterpreterExec.
877 * Startup rehashing done by the config file, not InterpreterExec.
872 This means system commands are available even without selecting the
878 This means system commands are available even without selecting the
873 pysh profile. It's the sensible default after all.
879 pysh profile. It's the sensible default after all.
874
880
875 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
881 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
876
882
877 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
883 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
878 multiline code with autoindent on working. But I am really not
884 multiline code with autoindent on working. But I am really not
879 sure, so this needs more testing. Will commit a debug-enabled
885 sure, so this needs more testing. Will commit a debug-enabled
880 version for now, while I test it some more, so that Ville and
886 version for now, while I test it some more, so that Ville and
881 others may also catch any problems. Also made
887 others may also catch any problems. Also made
882 self.indent_current_str() a method, to ensure that there's no
888 self.indent_current_str() a method, to ensure that there's no
883 chance of the indent space count and the corresponding string
889 chance of the indent space count and the corresponding string
884 falling out of sync. All code needing the string should just call
890 falling out of sync. All code needing the string should just call
885 the method.
891 the method.
886
892
887 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
893 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
888
894
889 * IPython/Magic.py (magic_edit): fix check for when users don't
895 * IPython/Magic.py (magic_edit): fix check for when users don't
890 save their output files, the try/except was in the wrong section.
896 save their output files, the try/except was in the wrong section.
891
897
892 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
898 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
893
899
894 * IPython/Magic.py (magic_run): fix __file__ global missing from
900 * IPython/Magic.py (magic_run): fix __file__ global missing from
895 script's namespace when executed via %run. After a report by
901 script's namespace when executed via %run. After a report by
896 Vivian.
902 Vivian.
897
903
898 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
904 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
899 when using python 2.4. The parent constructor changed in 2.4, and
905 when using python 2.4. The parent constructor changed in 2.4, and
900 we need to track it directly (we can't call it, as it messes up
906 we need to track it directly (we can't call it, as it messes up
901 readline and tab-completion inside our pdb would stop working).
907 readline and tab-completion inside our pdb would stop working).
902 After a bug report by R. Bernstein <rocky-AT-panix.com>.
908 After a bug report by R. Bernstein <rocky-AT-panix.com>.
903
909
904 2006-01-16 Ville Vainio <vivainio@gmail.com>
910 2006-01-16 Ville Vainio <vivainio@gmail.com>
905
911
906 * Ipython/magic.py: Reverted back to old %edit functionality
912 * Ipython/magic.py: Reverted back to old %edit functionality
907 that returns file contents on exit.
913 that returns file contents on exit.
908
914
909 * IPython/path.py: Added Jason Orendorff's "path" module to
915 * IPython/path.py: Added Jason Orendorff's "path" module to
910 IPython tree, http://www.jorendorff.com/articles/python/path/.
916 IPython tree, http://www.jorendorff.com/articles/python/path/.
911 You can get path objects conveniently through %sc, and !!, e.g.:
917 You can get path objects conveniently through %sc, and !!, e.g.:
912 sc files=ls
918 sc files=ls
913 for p in files.paths: # or files.p
919 for p in files.paths: # or files.p
914 print p,p.mtime
920 print p,p.mtime
915
921
916 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
922 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
917 now work again without considering the exclusion regexp -
923 now work again without considering the exclusion regexp -
918 hence, things like ',foo my/path' turn to 'foo("my/path")'
924 hence, things like ',foo my/path' turn to 'foo("my/path")'
919 instead of syntax error.
925 instead of syntax error.
920
926
921
927
922 2006-01-14 Ville Vainio <vivainio@gmail.com>
928 2006-01-14 Ville Vainio <vivainio@gmail.com>
923
929
924 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
930 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
925 ipapi decorators for python 2.4 users, options() provides access to rc
931 ipapi decorators for python 2.4 users, options() provides access to rc
926 data.
932 data.
927
933
928 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
934 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
929 as path separators (even on Linux ;-). Space character after
935 as path separators (even on Linux ;-). Space character after
930 backslash (as yielded by tab completer) is still space;
936 backslash (as yielded by tab completer) is still space;
931 "%cd long\ name" works as expected.
937 "%cd long\ name" works as expected.
932
938
933 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
939 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
934 as "chain of command", with priority. API stays the same,
940 as "chain of command", with priority. API stays the same,
935 TryNext exception raised by a hook function signals that
941 TryNext exception raised by a hook function signals that
936 current hook failed and next hook should try handling it, as
942 current hook failed and next hook should try handling it, as
937 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
943 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
938 requested configurable display hook, which is now implemented.
944 requested configurable display hook, which is now implemented.
939
945
940 2006-01-13 Ville Vainio <vivainio@gmail.com>
946 2006-01-13 Ville Vainio <vivainio@gmail.com>
941
947
942 * IPython/platutils*.py: platform specific utility functions,
948 * IPython/platutils*.py: platform specific utility functions,
943 so far only set_term_title is implemented (change terminal
949 so far only set_term_title is implemented (change terminal
944 label in windowing systems). %cd now changes the title to
950 label in windowing systems). %cd now changes the title to
945 current dir.
951 current dir.
946
952
947 * IPython/Release.py: Added myself to "authors" list,
953 * IPython/Release.py: Added myself to "authors" list,
948 had to create new files.
954 had to create new files.
949
955
950 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
956 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
951 shell escape; not a known bug but had potential to be one in the
957 shell escape; not a known bug but had potential to be one in the
952 future.
958 future.
953
959
954 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
960 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
955 extension API for IPython! See the module for usage example. Fix
961 extension API for IPython! See the module for usage example. Fix
956 OInspect for docstring-less magic functions.
962 OInspect for docstring-less magic functions.
957
963
958
964
959 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
965 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
960
966
961 * IPython/iplib.py (raw_input): temporarily deactivate all
967 * IPython/iplib.py (raw_input): temporarily deactivate all
962 attempts at allowing pasting of code with autoindent on. It
968 attempts at allowing pasting of code with autoindent on. It
963 introduced bugs (reported by Prabhu) and I can't seem to find a
969 introduced bugs (reported by Prabhu) and I can't seem to find a
964 robust combination which works in all cases. Will have to revisit
970 robust combination which works in all cases. Will have to revisit
965 later.
971 later.
966
972
967 * IPython/genutils.py: remove isspace() function. We've dropped
973 * IPython/genutils.py: remove isspace() function. We've dropped
968 2.2 compatibility, so it's OK to use the string method.
974 2.2 compatibility, so it's OK to use the string method.
969
975
970 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
976 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
971
977
972 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
978 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
973 matching what NOT to autocall on, to include all python binary
979 matching what NOT to autocall on, to include all python binary
974 operators (including things like 'and', 'or', 'is' and 'in').
980 operators (including things like 'and', 'or', 'is' and 'in').
975 Prompted by a bug report on 'foo & bar', but I realized we had
981 Prompted by a bug report on 'foo & bar', but I realized we had
976 many more potential bug cases with other operators. The regexp is
982 many more potential bug cases with other operators. The regexp is
977 self.re_exclude_auto, it's fairly commented.
983 self.re_exclude_auto, it's fairly commented.
978
984
979 2006-01-12 Ville Vainio <vivainio@gmail.com>
985 2006-01-12 Ville Vainio <vivainio@gmail.com>
980
986
981 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
987 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
982 Prettified and hardened string/backslash quoting with ipsystem(),
988 Prettified and hardened string/backslash quoting with ipsystem(),
983 ipalias() and ipmagic(). Now even \ characters are passed to
989 ipalias() and ipmagic(). Now even \ characters are passed to
984 %magics, !shell escapes and aliases exactly as they are in the
990 %magics, !shell escapes and aliases exactly as they are in the
985 ipython command line. Should improve backslash experience,
991 ipython command line. Should improve backslash experience,
986 particularly in Windows (path delimiter for some commands that
992 particularly in Windows (path delimiter for some commands that
987 won't understand '/'), but Unix benefits as well (regexps). %cd
993 won't understand '/'), but Unix benefits as well (regexps). %cd
988 magic still doesn't support backslash path delimiters, though. Also
994 magic still doesn't support backslash path delimiters, though. Also
989 deleted all pretense of supporting multiline command strings in
995 deleted all pretense of supporting multiline command strings in
990 !system or %magic commands. Thanks to Jerry McRae for suggestions.
996 !system or %magic commands. Thanks to Jerry McRae for suggestions.
991
997
992 * doc/build_doc_instructions.txt added. Documentation on how to
998 * doc/build_doc_instructions.txt added. Documentation on how to
993 use doc/update_manual.py, added yesterday. Both files contributed
999 use doc/update_manual.py, added yesterday. Both files contributed
994 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1000 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
995 doc/*.sh for deprecation at a later date.
1001 doc/*.sh for deprecation at a later date.
996
1002
997 * /ipython.py Added ipython.py to root directory for
1003 * /ipython.py Added ipython.py to root directory for
998 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1004 zero-installation (tar xzvf ipython.tgz; cd ipython; python
999 ipython.py) and development convenience (no need to keep doing
1005 ipython.py) and development convenience (no need to keep doing
1000 "setup.py install" between changes).
1006 "setup.py install" between changes).
1001
1007
1002 * Made ! and !! shell escapes work (again) in multiline expressions:
1008 * Made ! and !! shell escapes work (again) in multiline expressions:
1003 if 1:
1009 if 1:
1004 !ls
1010 !ls
1005 !!ls
1011 !!ls
1006
1012
1007 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1013 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1008
1014
1009 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1015 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1010 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1016 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1011 module in case-insensitive installation. Was causing crashes
1017 module in case-insensitive installation. Was causing crashes
1012 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1018 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1013
1019
1014 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1020 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1015 <marienz-AT-gentoo.org>, closes
1021 <marienz-AT-gentoo.org>, closes
1016 http://www.scipy.net/roundup/ipython/issue51.
1022 http://www.scipy.net/roundup/ipython/issue51.
1017
1023
1018 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1024 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1019
1025
1020 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1026 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1021 problem of excessive CPU usage under *nix and keyboard lag under
1027 problem of excessive CPU usage under *nix and keyboard lag under
1022 win32.
1028 win32.
1023
1029
1024 2006-01-10 *** Released version 0.7.0
1030 2006-01-10 *** Released version 0.7.0
1025
1031
1026 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1032 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1027
1033
1028 * IPython/Release.py (revision): tag version number to 0.7.0,
1034 * IPython/Release.py (revision): tag version number to 0.7.0,
1029 ready for release.
1035 ready for release.
1030
1036
1031 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1037 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1032 it informs the user of the name of the temp. file used. This can
1038 it informs the user of the name of the temp. file used. This can
1033 help if you decide later to reuse that same file, so you know
1039 help if you decide later to reuse that same file, so you know
1034 where to copy the info from.
1040 where to copy the info from.
1035
1041
1036 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1042 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1037
1043
1038 * setup_bdist_egg.py: little script to build an egg. Added
1044 * setup_bdist_egg.py: little script to build an egg. Added
1039 support in the release tools as well.
1045 support in the release tools as well.
1040
1046
1041 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1047 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1042
1048
1043 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1049 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1044 version selection (new -wxversion command line and ipythonrc
1050 version selection (new -wxversion command line and ipythonrc
1045 parameter). Patch contributed by Arnd Baecker
1051 parameter). Patch contributed by Arnd Baecker
1046 <arnd.baecker-AT-web.de>.
1052 <arnd.baecker-AT-web.de>.
1047
1053
1048 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1054 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1049 embedded instances, for variables defined at the interactive
1055 embedded instances, for variables defined at the interactive
1050 prompt of the embedded ipython. Reported by Arnd.
1056 prompt of the embedded ipython. Reported by Arnd.
1051
1057
1052 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1058 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1053 it can be used as a (stateful) toggle, or with a direct parameter.
1059 it can be used as a (stateful) toggle, or with a direct parameter.
1054
1060
1055 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1061 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1056 could be triggered in certain cases and cause the traceback
1062 could be triggered in certain cases and cause the traceback
1057 printer not to work.
1063 printer not to work.
1058
1064
1059 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1065 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1060
1066
1061 * IPython/iplib.py (_should_recompile): Small fix, closes
1067 * IPython/iplib.py (_should_recompile): Small fix, closes
1062 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1068 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1063
1069
1064 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1070 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1065
1071
1066 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1072 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1067 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1073 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1068 Moad for help with tracking it down.
1074 Moad for help with tracking it down.
1069
1075
1070 * IPython/iplib.py (handle_auto): fix autocall handling for
1076 * IPython/iplib.py (handle_auto): fix autocall handling for
1071 objects which support BOTH __getitem__ and __call__ (so that f [x]
1077 objects which support BOTH __getitem__ and __call__ (so that f [x]
1072 is left alone, instead of becoming f([x]) automatically).
1078 is left alone, instead of becoming f([x]) automatically).
1073
1079
1074 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1080 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1075 Ville's patch.
1081 Ville's patch.
1076
1082
1077 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1083 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1078
1084
1079 * IPython/iplib.py (handle_auto): changed autocall semantics to
1085 * IPython/iplib.py (handle_auto): changed autocall semantics to
1080 include 'smart' mode, where the autocall transformation is NOT
1086 include 'smart' mode, where the autocall transformation is NOT
1081 applied if there are no arguments on the line. This allows you to
1087 applied if there are no arguments on the line. This allows you to
1082 just type 'foo' if foo is a callable to see its internal form,
1088 just type 'foo' if foo is a callable to see its internal form,
1083 instead of having it called with no arguments (typically a
1089 instead of having it called with no arguments (typically a
1084 mistake). The old 'full' autocall still exists: for that, you
1090 mistake). The old 'full' autocall still exists: for that, you
1085 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1091 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1086
1092
1087 * IPython/completer.py (Completer.attr_matches): add
1093 * IPython/completer.py (Completer.attr_matches): add
1088 tab-completion support for Enthoughts' traits. After a report by
1094 tab-completion support for Enthoughts' traits. After a report by
1089 Arnd and a patch by Prabhu.
1095 Arnd and a patch by Prabhu.
1090
1096
1091 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1097 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1092
1098
1093 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1099 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1094 Schmolck's patch to fix inspect.getinnerframes().
1100 Schmolck's patch to fix inspect.getinnerframes().
1095
1101
1096 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1102 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1097 for embedded instances, regarding handling of namespaces and items
1103 for embedded instances, regarding handling of namespaces and items
1098 added to the __builtin__ one. Multiple embedded instances and
1104 added to the __builtin__ one. Multiple embedded instances and
1099 recursive embeddings should work better now (though I'm not sure
1105 recursive embeddings should work better now (though I'm not sure
1100 I've got all the corner cases fixed, that code is a bit of a brain
1106 I've got all the corner cases fixed, that code is a bit of a brain
1101 twister).
1107 twister).
1102
1108
1103 * IPython/Magic.py (magic_edit): added support to edit in-memory
1109 * IPython/Magic.py (magic_edit): added support to edit in-memory
1104 macros (automatically creates the necessary temp files). %edit
1110 macros (automatically creates the necessary temp files). %edit
1105 also doesn't return the file contents anymore, it's just noise.
1111 also doesn't return the file contents anymore, it's just noise.
1106
1112
1107 * IPython/completer.py (Completer.attr_matches): revert change to
1113 * IPython/completer.py (Completer.attr_matches): revert change to
1108 complete only on attributes listed in __all__. I realized it
1114 complete only on attributes listed in __all__. I realized it
1109 cripples the tab-completion system as a tool for exploring the
1115 cripples the tab-completion system as a tool for exploring the
1110 internals of unknown libraries (it renders any non-__all__
1116 internals of unknown libraries (it renders any non-__all__
1111 attribute off-limits). I got bit by this when trying to see
1117 attribute off-limits). I got bit by this when trying to see
1112 something inside the dis module.
1118 something inside the dis module.
1113
1119
1114 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1120 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1115
1121
1116 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1122 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1117 namespace for users and extension writers to hold data in. This
1123 namespace for users and extension writers to hold data in. This
1118 follows the discussion in
1124 follows the discussion in
1119 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1125 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1120
1126
1121 * IPython/completer.py (IPCompleter.complete): small patch to help
1127 * IPython/completer.py (IPCompleter.complete): small patch to help
1122 tab-completion under Emacs, after a suggestion by John Barnard
1128 tab-completion under Emacs, after a suggestion by John Barnard
1123 <barnarj-AT-ccf.org>.
1129 <barnarj-AT-ccf.org>.
1124
1130
1125 * IPython/Magic.py (Magic.extract_input_slices): added support for
1131 * IPython/Magic.py (Magic.extract_input_slices): added support for
1126 the slice notation in magics to use N-M to represent numbers N...M
1132 the slice notation in magics to use N-M to represent numbers N...M
1127 (closed endpoints). This is used by %macro and %save.
1133 (closed endpoints). This is used by %macro and %save.
1128
1134
1129 * IPython/completer.py (Completer.attr_matches): for modules which
1135 * IPython/completer.py (Completer.attr_matches): for modules which
1130 define __all__, complete only on those. After a patch by Jeffrey
1136 define __all__, complete only on those. After a patch by Jeffrey
1131 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1137 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1132 speed up this routine.
1138 speed up this routine.
1133
1139
1134 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1140 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1135 don't know if this is the end of it, but the behavior now is
1141 don't know if this is the end of it, but the behavior now is
1136 certainly much more correct. Note that coupled with macros,
1142 certainly much more correct. Note that coupled with macros,
1137 slightly surprising (at first) behavior may occur: a macro will in
1143 slightly surprising (at first) behavior may occur: a macro will in
1138 general expand to multiple lines of input, so upon exiting, the
1144 general expand to multiple lines of input, so upon exiting, the
1139 in/out counters will both be bumped by the corresponding amount
1145 in/out counters will both be bumped by the corresponding amount
1140 (as if the macro's contents had been typed interactively). Typing
1146 (as if the macro's contents had been typed interactively). Typing
1141 %hist will reveal the intermediate (silently processed) lines.
1147 %hist will reveal the intermediate (silently processed) lines.
1142
1148
1143 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1149 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1144 pickle to fail (%run was overwriting __main__ and not restoring
1150 pickle to fail (%run was overwriting __main__ and not restoring
1145 it, but pickle relies on __main__ to operate).
1151 it, but pickle relies on __main__ to operate).
1146
1152
1147 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1153 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1148 using properties, but forgot to make the main InteractiveShell
1154 using properties, but forgot to make the main InteractiveShell
1149 class a new-style class. Properties fail silently, and
1155 class a new-style class. Properties fail silently, and
1150 mysteriously, with old-style class (getters work, but
1156 mysteriously, with old-style class (getters work, but
1151 setters don't do anything).
1157 setters don't do anything).
1152
1158
1153 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1159 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1154
1160
1155 * IPython/Magic.py (magic_history): fix history reporting bug (I
1161 * IPython/Magic.py (magic_history): fix history reporting bug (I
1156 know some nasties are still there, I just can't seem to find a
1162 know some nasties are still there, I just can't seem to find a
1157 reproducible test case to track them down; the input history is
1163 reproducible test case to track them down; the input history is
1158 falling out of sync...)
1164 falling out of sync...)
1159
1165
1160 * IPython/iplib.py (handle_shell_escape): fix bug where both
1166 * IPython/iplib.py (handle_shell_escape): fix bug where both
1161 aliases and system accesses where broken for indented code (such
1167 aliases and system accesses where broken for indented code (such
1162 as loops).
1168 as loops).
1163
1169
1164 * IPython/genutils.py (shell): fix small but critical bug for
1170 * IPython/genutils.py (shell): fix small but critical bug for
1165 win32 system access.
1171 win32 system access.
1166
1172
1167 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1173 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1168
1174
1169 * IPython/iplib.py (showtraceback): remove use of the
1175 * IPython/iplib.py (showtraceback): remove use of the
1170 sys.last_{type/value/traceback} structures, which are non
1176 sys.last_{type/value/traceback} structures, which are non
1171 thread-safe.
1177 thread-safe.
1172 (_prefilter): change control flow to ensure that we NEVER
1178 (_prefilter): change control flow to ensure that we NEVER
1173 introspect objects when autocall is off. This will guarantee that
1179 introspect objects when autocall is off. This will guarantee that
1174 having an input line of the form 'x.y', where access to attribute
1180 having an input line of the form 'x.y', where access to attribute
1175 'y' has side effects, doesn't trigger the side effect TWICE. It
1181 'y' has side effects, doesn't trigger the side effect TWICE. It
1176 is important to note that, with autocall on, these side effects
1182 is important to note that, with autocall on, these side effects
1177 can still happen.
1183 can still happen.
1178 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1184 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1179 trio. IPython offers these three kinds of special calls which are
1185 trio. IPython offers these three kinds of special calls which are
1180 not python code, and it's a good thing to have their call method
1186 not python code, and it's a good thing to have their call method
1181 be accessible as pure python functions (not just special syntax at
1187 be accessible as pure python functions (not just special syntax at
1182 the command line). It gives us a better internal implementation
1188 the command line). It gives us a better internal implementation
1183 structure, as well as exposing these for user scripting more
1189 structure, as well as exposing these for user scripting more
1184 cleanly.
1190 cleanly.
1185
1191
1186 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1192 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1187 file. Now that they'll be more likely to be used with the
1193 file. Now that they'll be more likely to be used with the
1188 persistance system (%store), I want to make sure their module path
1194 persistance system (%store), I want to make sure their module path
1189 doesn't change in the future, so that we don't break things for
1195 doesn't change in the future, so that we don't break things for
1190 users' persisted data.
1196 users' persisted data.
1191
1197
1192 * IPython/iplib.py (autoindent_update): move indentation
1198 * IPython/iplib.py (autoindent_update): move indentation
1193 management into the _text_ processing loop, not the keyboard
1199 management into the _text_ processing loop, not the keyboard
1194 interactive one. This is necessary to correctly process non-typed
1200 interactive one. This is necessary to correctly process non-typed
1195 multiline input (such as macros).
1201 multiline input (such as macros).
1196
1202
1197 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1203 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1198 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1204 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1199 which was producing problems in the resulting manual.
1205 which was producing problems in the resulting manual.
1200 (magic_whos): improve reporting of instances (show their class,
1206 (magic_whos): improve reporting of instances (show their class,
1201 instead of simply printing 'instance' which isn't terribly
1207 instead of simply printing 'instance' which isn't terribly
1202 informative).
1208 informative).
1203
1209
1204 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1210 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1205 (minor mods) to support network shares under win32.
1211 (minor mods) to support network shares under win32.
1206
1212
1207 * IPython/winconsole.py (get_console_size): add new winconsole
1213 * IPython/winconsole.py (get_console_size): add new winconsole
1208 module and fixes to page_dumb() to improve its behavior under
1214 module and fixes to page_dumb() to improve its behavior under
1209 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1215 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1210
1216
1211 * IPython/Magic.py (Macro): simplified Macro class to just
1217 * IPython/Magic.py (Macro): simplified Macro class to just
1212 subclass list. We've had only 2.2 compatibility for a very long
1218 subclass list. We've had only 2.2 compatibility for a very long
1213 time, yet I was still avoiding subclassing the builtin types. No
1219 time, yet I was still avoiding subclassing the builtin types. No
1214 more (I'm also starting to use properties, though I won't shift to
1220 more (I'm also starting to use properties, though I won't shift to
1215 2.3-specific features quite yet).
1221 2.3-specific features quite yet).
1216 (magic_store): added Ville's patch for lightweight variable
1222 (magic_store): added Ville's patch for lightweight variable
1217 persistence, after a request on the user list by Matt Wilkie
1223 persistence, after a request on the user list by Matt Wilkie
1218 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1224 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1219 details.
1225 details.
1220
1226
1221 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1227 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1222 changed the default logfile name from 'ipython.log' to
1228 changed the default logfile name from 'ipython.log' to
1223 'ipython_log.py'. These logs are real python files, and now that
1229 'ipython_log.py'. These logs are real python files, and now that
1224 we have much better multiline support, people are more likely to
1230 we have much better multiline support, people are more likely to
1225 want to use them as such. Might as well name them correctly.
1231 want to use them as such. Might as well name them correctly.
1226
1232
1227 * IPython/Magic.py: substantial cleanup. While we can't stop
1233 * IPython/Magic.py: substantial cleanup. While we can't stop
1228 using magics as mixins, due to the existing customizations 'out
1234 using magics as mixins, due to the existing customizations 'out
1229 there' which rely on the mixin naming conventions, at least I
1235 there' which rely on the mixin naming conventions, at least I
1230 cleaned out all cross-class name usage. So once we are OK with
1236 cleaned out all cross-class name usage. So once we are OK with
1231 breaking compatibility, the two systems can be separated.
1237 breaking compatibility, the two systems can be separated.
1232
1238
1233 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1239 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1234 anymore, and the class is a fair bit less hideous as well. New
1240 anymore, and the class is a fair bit less hideous as well. New
1235 features were also introduced: timestamping of input, and logging
1241 features were also introduced: timestamping of input, and logging
1236 of output results. These are user-visible with the -t and -o
1242 of output results. These are user-visible with the -t and -o
1237 options to %logstart. Closes
1243 options to %logstart. Closes
1238 http://www.scipy.net/roundup/ipython/issue11 and a request by
1244 http://www.scipy.net/roundup/ipython/issue11 and a request by
1239 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1245 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1240
1246
1241 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1247 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1242
1248
1243 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1249 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1244 better handle backslashes in paths. See the thread 'More Windows
1250 better handle backslashes in paths. See the thread 'More Windows
1245 questions part 2 - \/ characters revisited' on the iypthon user
1251 questions part 2 - \/ characters revisited' on the iypthon user
1246 list:
1252 list:
1247 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1253 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1248
1254
1249 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1255 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1250
1256
1251 (InteractiveShell.__init__): change threaded shells to not use the
1257 (InteractiveShell.__init__): change threaded shells to not use the
1252 ipython crash handler. This was causing more problems than not,
1258 ipython crash handler. This was causing more problems than not,
1253 as exceptions in the main thread (GUI code, typically) would
1259 as exceptions in the main thread (GUI code, typically) would
1254 always show up as a 'crash', when they really weren't.
1260 always show up as a 'crash', when they really weren't.
1255
1261
1256 The colors and exception mode commands (%colors/%xmode) have been
1262 The colors and exception mode commands (%colors/%xmode) have been
1257 synchronized to also take this into account, so users can get
1263 synchronized to also take this into account, so users can get
1258 verbose exceptions for their threaded code as well. I also added
1264 verbose exceptions for their threaded code as well. I also added
1259 support for activating pdb inside this exception handler as well,
1265 support for activating pdb inside this exception handler as well,
1260 so now GUI authors can use IPython's enhanced pdb at runtime.
1266 so now GUI authors can use IPython's enhanced pdb at runtime.
1261
1267
1262 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1268 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1263 true by default, and add it to the shipped ipythonrc file. Since
1269 true by default, and add it to the shipped ipythonrc file. Since
1264 this asks the user before proceeding, I think it's OK to make it
1270 this asks the user before proceeding, I think it's OK to make it
1265 true by default.
1271 true by default.
1266
1272
1267 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1273 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1268 of the previous special-casing of input in the eval loop. I think
1274 of the previous special-casing of input in the eval loop. I think
1269 this is cleaner, as they really are commands and shouldn't have
1275 this is cleaner, as they really are commands and shouldn't have
1270 a special role in the middle of the core code.
1276 a special role in the middle of the core code.
1271
1277
1272 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1278 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1273
1279
1274 * IPython/iplib.py (edit_syntax_error): added support for
1280 * IPython/iplib.py (edit_syntax_error): added support for
1275 automatically reopening the editor if the file had a syntax error
1281 automatically reopening the editor if the file had a syntax error
1276 in it. Thanks to scottt who provided the patch at:
1282 in it. Thanks to scottt who provided the patch at:
1277 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1283 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1278 version committed).
1284 version committed).
1279
1285
1280 * IPython/iplib.py (handle_normal): add suport for multi-line
1286 * IPython/iplib.py (handle_normal): add suport for multi-line
1281 input with emtpy lines. This fixes
1287 input with emtpy lines. This fixes
1282 http://www.scipy.net/roundup/ipython/issue43 and a similar
1288 http://www.scipy.net/roundup/ipython/issue43 and a similar
1283 discussion on the user list.
1289 discussion on the user list.
1284
1290
1285 WARNING: a behavior change is necessarily introduced to support
1291 WARNING: a behavior change is necessarily introduced to support
1286 blank lines: now a single blank line with whitespace does NOT
1292 blank lines: now a single blank line with whitespace does NOT
1287 break the input loop, which means that when autoindent is on, by
1293 break the input loop, which means that when autoindent is on, by
1288 default hitting return on the next (indented) line does NOT exit.
1294 default hitting return on the next (indented) line does NOT exit.
1289
1295
1290 Instead, to exit a multiline input you can either have:
1296 Instead, to exit a multiline input you can either have:
1291
1297
1292 - TWO whitespace lines (just hit return again), or
1298 - TWO whitespace lines (just hit return again), or
1293 - a single whitespace line of a different length than provided
1299 - a single whitespace line of a different length than provided
1294 by the autoindent (add or remove a space).
1300 by the autoindent (add or remove a space).
1295
1301
1296 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1302 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1297 module to better organize all readline-related functionality.
1303 module to better organize all readline-related functionality.
1298 I've deleted FlexCompleter and put all completion clases here.
1304 I've deleted FlexCompleter and put all completion clases here.
1299
1305
1300 * IPython/iplib.py (raw_input): improve indentation management.
1306 * IPython/iplib.py (raw_input): improve indentation management.
1301 It is now possible to paste indented code with autoindent on, and
1307 It is now possible to paste indented code with autoindent on, and
1302 the code is interpreted correctly (though it still looks bad on
1308 the code is interpreted correctly (though it still looks bad on
1303 screen, due to the line-oriented nature of ipython).
1309 screen, due to the line-oriented nature of ipython).
1304 (MagicCompleter.complete): change behavior so that a TAB key on an
1310 (MagicCompleter.complete): change behavior so that a TAB key on an
1305 otherwise empty line actually inserts a tab, instead of completing
1311 otherwise empty line actually inserts a tab, instead of completing
1306 on the entire global namespace. This makes it easier to use the
1312 on the entire global namespace. This makes it easier to use the
1307 TAB key for indentation. After a request by Hans Meine
1313 TAB key for indentation. After a request by Hans Meine
1308 <hans_meine-AT-gmx.net>
1314 <hans_meine-AT-gmx.net>
1309 (_prefilter): add support so that typing plain 'exit' or 'quit'
1315 (_prefilter): add support so that typing plain 'exit' or 'quit'
1310 does a sensible thing. Originally I tried to deviate as little as
1316 does a sensible thing. Originally I tried to deviate as little as
1311 possible from the default python behavior, but even that one may
1317 possible from the default python behavior, but even that one may
1312 change in this direction (thread on python-dev to that effect).
1318 change in this direction (thread on python-dev to that effect).
1313 Regardless, ipython should do the right thing even if CPython's
1319 Regardless, ipython should do the right thing even if CPython's
1314 '>>>' prompt doesn't.
1320 '>>>' prompt doesn't.
1315 (InteractiveShell): removed subclassing code.InteractiveConsole
1321 (InteractiveShell): removed subclassing code.InteractiveConsole
1316 class. By now we'd overridden just about all of its methods: I've
1322 class. By now we'd overridden just about all of its methods: I've
1317 copied the remaining two over, and now ipython is a standalone
1323 copied the remaining two over, and now ipython is a standalone
1318 class. This will provide a clearer picture for the chainsaw
1324 class. This will provide a clearer picture for the chainsaw
1319 branch refactoring.
1325 branch refactoring.
1320
1326
1321 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1327 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1322
1328
1323 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1329 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1324 failures for objects which break when dir() is called on them.
1330 failures for objects which break when dir() is called on them.
1325
1331
1326 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1332 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1327 distinct local and global namespaces in the completer API. This
1333 distinct local and global namespaces in the completer API. This
1328 change allows us to properly handle completion with distinct
1334 change allows us to properly handle completion with distinct
1329 scopes, including in embedded instances (this had never really
1335 scopes, including in embedded instances (this had never really
1330 worked correctly).
1336 worked correctly).
1331
1337
1332 Note: this introduces a change in the constructor for
1338 Note: this introduces a change in the constructor for
1333 MagicCompleter, as a new global_namespace parameter is now the
1339 MagicCompleter, as a new global_namespace parameter is now the
1334 second argument (the others were bumped one position).
1340 second argument (the others were bumped one position).
1335
1341
1336 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1342 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1337
1343
1338 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1344 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1339 embedded instances (which can be done now thanks to Vivian's
1345 embedded instances (which can be done now thanks to Vivian's
1340 frame-handling fixes for pdb).
1346 frame-handling fixes for pdb).
1341 (InteractiveShell.__init__): Fix namespace handling problem in
1347 (InteractiveShell.__init__): Fix namespace handling problem in
1342 embedded instances. We were overwriting __main__ unconditionally,
1348 embedded instances. We were overwriting __main__ unconditionally,
1343 and this should only be done for 'full' (non-embedded) IPython;
1349 and this should only be done for 'full' (non-embedded) IPython;
1344 embedded instances must respect the caller's __main__. Thanks to
1350 embedded instances must respect the caller's __main__. Thanks to
1345 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1351 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1346
1352
1347 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1353 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1348
1354
1349 * setup.py: added download_url to setup(). This registers the
1355 * setup.py: added download_url to setup(). This registers the
1350 download address at PyPI, which is not only useful to humans
1356 download address at PyPI, which is not only useful to humans
1351 browsing the site, but is also picked up by setuptools (the Eggs
1357 browsing the site, but is also picked up by setuptools (the Eggs
1352 machinery). Thanks to Ville and R. Kern for the info/discussion
1358 machinery). Thanks to Ville and R. Kern for the info/discussion
1353 on this.
1359 on this.
1354
1360
1355 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1361 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1356
1362
1357 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1363 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1358 This brings a lot of nice functionality to the pdb mode, which now
1364 This brings a lot of nice functionality to the pdb mode, which now
1359 has tab-completion, syntax highlighting, and better stack handling
1365 has tab-completion, syntax highlighting, and better stack handling
1360 than before. Many thanks to Vivian De Smedt
1366 than before. Many thanks to Vivian De Smedt
1361 <vivian-AT-vdesmedt.com> for the original patches.
1367 <vivian-AT-vdesmedt.com> for the original patches.
1362
1368
1363 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1369 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1364
1370
1365 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1371 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1366 sequence to consistently accept the banner argument. The
1372 sequence to consistently accept the banner argument. The
1367 inconsistency was tripping SAGE, thanks to Gary Zablackis
1373 inconsistency was tripping SAGE, thanks to Gary Zablackis
1368 <gzabl-AT-yahoo.com> for the report.
1374 <gzabl-AT-yahoo.com> for the report.
1369
1375
1370 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1376 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1371
1377
1372 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1378 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1373 Fix bug where a naked 'alias' call in the ipythonrc file would
1379 Fix bug where a naked 'alias' call in the ipythonrc file would
1374 cause a crash. Bug reported by Jorgen Stenarson.
1380 cause a crash. Bug reported by Jorgen Stenarson.
1375
1381
1376 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1382 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1377
1383
1378 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1384 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1379 startup time.
1385 startup time.
1380
1386
1381 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1387 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1382 instances had introduced a bug with globals in normal code. Now
1388 instances had introduced a bug with globals in normal code. Now
1383 it's working in all cases.
1389 it's working in all cases.
1384
1390
1385 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1391 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1386 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1392 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1387 has been introduced to set the default case sensitivity of the
1393 has been introduced to set the default case sensitivity of the
1388 searches. Users can still select either mode at runtime on a
1394 searches. Users can still select either mode at runtime on a
1389 per-search basis.
1395 per-search basis.
1390
1396
1391 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1397 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1392
1398
1393 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1399 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1394 attributes in wildcard searches for subclasses. Modified version
1400 attributes in wildcard searches for subclasses. Modified version
1395 of a patch by Jorgen.
1401 of a patch by Jorgen.
1396
1402
1397 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1403 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1398
1404
1399 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1405 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1400 embedded instances. I added a user_global_ns attribute to the
1406 embedded instances. I added a user_global_ns attribute to the
1401 InteractiveShell class to handle this.
1407 InteractiveShell class to handle this.
1402
1408
1403 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1409 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1404
1410
1405 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1411 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1406 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1412 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1407 (reported under win32, but may happen also in other platforms).
1413 (reported under win32, but may happen also in other platforms).
1408 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1414 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1409
1415
1410 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1416 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1411
1417
1412 * IPython/Magic.py (magic_psearch): new support for wildcard
1418 * IPython/Magic.py (magic_psearch): new support for wildcard
1413 patterns. Now, typing ?a*b will list all names which begin with a
1419 patterns. Now, typing ?a*b will list all names which begin with a
1414 and end in b, for example. The %psearch magic has full
1420 and end in b, for example. The %psearch magic has full
1415 docstrings. Many thanks to JΓΆrgen Stenarson
1421 docstrings. Many thanks to JΓΆrgen Stenarson
1416 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1422 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1417 implementing this functionality.
1423 implementing this functionality.
1418
1424
1419 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1425 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1420
1426
1421 * Manual: fixed long-standing annoyance of double-dashes (as in
1427 * Manual: fixed long-standing annoyance of double-dashes (as in
1422 --prefix=~, for example) being stripped in the HTML version. This
1428 --prefix=~, for example) being stripped in the HTML version. This
1423 is a latex2html bug, but a workaround was provided. Many thanks
1429 is a latex2html bug, but a workaround was provided. Many thanks
1424 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1430 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1425 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1431 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1426 rolling. This seemingly small issue had tripped a number of users
1432 rolling. This seemingly small issue had tripped a number of users
1427 when first installing, so I'm glad to see it gone.
1433 when first installing, so I'm glad to see it gone.
1428
1434
1429 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1435 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1430
1436
1431 * IPython/Extensions/numeric_formats.py: fix missing import,
1437 * IPython/Extensions/numeric_formats.py: fix missing import,
1432 reported by Stephen Walton.
1438 reported by Stephen Walton.
1433
1439
1434 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1440 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1435
1441
1436 * IPython/demo.py: finish demo module, fully documented now.
1442 * IPython/demo.py: finish demo module, fully documented now.
1437
1443
1438 * IPython/genutils.py (file_read): simple little utility to read a
1444 * IPython/genutils.py (file_read): simple little utility to read a
1439 file and ensure it's closed afterwards.
1445 file and ensure it's closed afterwards.
1440
1446
1441 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1447 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1442
1448
1443 * IPython/demo.py (Demo.__init__): added support for individually
1449 * IPython/demo.py (Demo.__init__): added support for individually
1444 tagging blocks for automatic execution.
1450 tagging blocks for automatic execution.
1445
1451
1446 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1452 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1447 syntax-highlighted python sources, requested by John.
1453 syntax-highlighted python sources, requested by John.
1448
1454
1449 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1455 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1450
1456
1451 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1457 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1452 finishing.
1458 finishing.
1453
1459
1454 * IPython/genutils.py (shlex_split): moved from Magic to here,
1460 * IPython/genutils.py (shlex_split): moved from Magic to here,
1455 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1461 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1456
1462
1457 * IPython/demo.py (Demo.__init__): added support for silent
1463 * IPython/demo.py (Demo.__init__): added support for silent
1458 blocks, improved marks as regexps, docstrings written.
1464 blocks, improved marks as regexps, docstrings written.
1459 (Demo.__init__): better docstring, added support for sys.argv.
1465 (Demo.__init__): better docstring, added support for sys.argv.
1460
1466
1461 * IPython/genutils.py (marquee): little utility used by the demo
1467 * IPython/genutils.py (marquee): little utility used by the demo
1462 code, handy in general.
1468 code, handy in general.
1463
1469
1464 * IPython/demo.py (Demo.__init__): new class for interactive
1470 * IPython/demo.py (Demo.__init__): new class for interactive
1465 demos. Not documented yet, I just wrote it in a hurry for
1471 demos. Not documented yet, I just wrote it in a hurry for
1466 scipy'05. Will docstring later.
1472 scipy'05. Will docstring later.
1467
1473
1468 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1474 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1469
1475
1470 * IPython/Shell.py (sigint_handler): Drastic simplification which
1476 * IPython/Shell.py (sigint_handler): Drastic simplification which
1471 also seems to make Ctrl-C work correctly across threads! This is
1477 also seems to make Ctrl-C work correctly across threads! This is
1472 so simple, that I can't beleive I'd missed it before. Needs more
1478 so simple, that I can't beleive I'd missed it before. Needs more
1473 testing, though.
1479 testing, though.
1474 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1480 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1475 like this before...
1481 like this before...
1476
1482
1477 * IPython/genutils.py (get_home_dir): add protection against
1483 * IPython/genutils.py (get_home_dir): add protection against
1478 non-dirs in win32 registry.
1484 non-dirs in win32 registry.
1479
1485
1480 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1486 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1481 bug where dict was mutated while iterating (pysh crash).
1487 bug where dict was mutated while iterating (pysh crash).
1482
1488
1483 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1489 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1484
1490
1485 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1491 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1486 spurious newlines added by this routine. After a report by
1492 spurious newlines added by this routine. After a report by
1487 F. Mantegazza.
1493 F. Mantegazza.
1488
1494
1489 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1495 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1490
1496
1491 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1497 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1492 calls. These were a leftover from the GTK 1.x days, and can cause
1498 calls. These were a leftover from the GTK 1.x days, and can cause
1493 problems in certain cases (after a report by John Hunter).
1499 problems in certain cases (after a report by John Hunter).
1494
1500
1495 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1501 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1496 os.getcwd() fails at init time. Thanks to patch from David Remahl
1502 os.getcwd() fails at init time. Thanks to patch from David Remahl
1497 <chmod007-AT-mac.com>.
1503 <chmod007-AT-mac.com>.
1498 (InteractiveShell.__init__): prevent certain special magics from
1504 (InteractiveShell.__init__): prevent certain special magics from
1499 being shadowed by aliases. Closes
1505 being shadowed by aliases. Closes
1500 http://www.scipy.net/roundup/ipython/issue41.
1506 http://www.scipy.net/roundup/ipython/issue41.
1501
1507
1502 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1508 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1503
1509
1504 * IPython/iplib.py (InteractiveShell.complete): Added new
1510 * IPython/iplib.py (InteractiveShell.complete): Added new
1505 top-level completion method to expose the completion mechanism
1511 top-level completion method to expose the completion mechanism
1506 beyond readline-based environments.
1512 beyond readline-based environments.
1507
1513
1508 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1514 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1509
1515
1510 * tools/ipsvnc (svnversion): fix svnversion capture.
1516 * tools/ipsvnc (svnversion): fix svnversion capture.
1511
1517
1512 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1518 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1513 attribute to self, which was missing. Before, it was set by a
1519 attribute to self, which was missing. Before, it was set by a
1514 routine which in certain cases wasn't being called, so the
1520 routine which in certain cases wasn't being called, so the
1515 instance could end up missing the attribute. This caused a crash.
1521 instance could end up missing the attribute. This caused a crash.
1516 Closes http://www.scipy.net/roundup/ipython/issue40.
1522 Closes http://www.scipy.net/roundup/ipython/issue40.
1517
1523
1518 2005-08-16 Fernando Perez <fperez@colorado.edu>
1524 2005-08-16 Fernando Perez <fperez@colorado.edu>
1519
1525
1520 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1526 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1521 contains non-string attribute. Closes
1527 contains non-string attribute. Closes
1522 http://www.scipy.net/roundup/ipython/issue38.
1528 http://www.scipy.net/roundup/ipython/issue38.
1523
1529
1524 2005-08-14 Fernando Perez <fperez@colorado.edu>
1530 2005-08-14 Fernando Perez <fperez@colorado.edu>
1525
1531
1526 * tools/ipsvnc: Minor improvements, to add changeset info.
1532 * tools/ipsvnc: Minor improvements, to add changeset info.
1527
1533
1528 2005-08-12 Fernando Perez <fperez@colorado.edu>
1534 2005-08-12 Fernando Perez <fperez@colorado.edu>
1529
1535
1530 * IPython/iplib.py (runsource): remove self.code_to_run_src
1536 * IPython/iplib.py (runsource): remove self.code_to_run_src
1531 attribute. I realized this is nothing more than
1537 attribute. I realized this is nothing more than
1532 '\n'.join(self.buffer), and having the same data in two different
1538 '\n'.join(self.buffer), and having the same data in two different
1533 places is just asking for synchronization bugs. This may impact
1539 places is just asking for synchronization bugs. This may impact
1534 people who have custom exception handlers, so I need to warn
1540 people who have custom exception handlers, so I need to warn
1535 ipython-dev about it (F. Mantegazza may use them).
1541 ipython-dev about it (F. Mantegazza may use them).
1536
1542
1537 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1543 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1538
1544
1539 * IPython/genutils.py: fix 2.2 compatibility (generators)
1545 * IPython/genutils.py: fix 2.2 compatibility (generators)
1540
1546
1541 2005-07-18 Fernando Perez <fperez@colorado.edu>
1547 2005-07-18 Fernando Perez <fperez@colorado.edu>
1542
1548
1543 * IPython/genutils.py (get_home_dir): fix to help users with
1549 * IPython/genutils.py (get_home_dir): fix to help users with
1544 invalid $HOME under win32.
1550 invalid $HOME under win32.
1545
1551
1546 2005-07-17 Fernando Perez <fperez@colorado.edu>
1552 2005-07-17 Fernando Perez <fperez@colorado.edu>
1547
1553
1548 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1554 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1549 some old hacks and clean up a bit other routines; code should be
1555 some old hacks and clean up a bit other routines; code should be
1550 simpler and a bit faster.
1556 simpler and a bit faster.
1551
1557
1552 * IPython/iplib.py (interact): removed some last-resort attempts
1558 * IPython/iplib.py (interact): removed some last-resort attempts
1553 to survive broken stdout/stderr. That code was only making it
1559 to survive broken stdout/stderr. That code was only making it
1554 harder to abstract out the i/o (necessary for gui integration),
1560 harder to abstract out the i/o (necessary for gui integration),
1555 and the crashes it could prevent were extremely rare in practice
1561 and the crashes it could prevent were extremely rare in practice
1556 (besides being fully user-induced in a pretty violent manner).
1562 (besides being fully user-induced in a pretty violent manner).
1557
1563
1558 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1564 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1559 Nothing major yet, but the code is simpler to read; this should
1565 Nothing major yet, but the code is simpler to read; this should
1560 make it easier to do more serious modifications in the future.
1566 make it easier to do more serious modifications in the future.
1561
1567
1562 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1568 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1563 which broke in .15 (thanks to a report by Ville).
1569 which broke in .15 (thanks to a report by Ville).
1564
1570
1565 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1571 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1566 be quite correct, I know next to nothing about unicode). This
1572 be quite correct, I know next to nothing about unicode). This
1567 will allow unicode strings to be used in prompts, amongst other
1573 will allow unicode strings to be used in prompts, amongst other
1568 cases. It also will prevent ipython from crashing when unicode
1574 cases. It also will prevent ipython from crashing when unicode
1569 shows up unexpectedly in many places. If ascii encoding fails, we
1575 shows up unexpectedly in many places. If ascii encoding fails, we
1570 assume utf_8. Currently the encoding is not a user-visible
1576 assume utf_8. Currently the encoding is not a user-visible
1571 setting, though it could be made so if there is demand for it.
1577 setting, though it could be made so if there is demand for it.
1572
1578
1573 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1579 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1574
1580
1575 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1581 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1576
1582
1577 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1583 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1578
1584
1579 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1585 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1580 code can work transparently for 2.2/2.3.
1586 code can work transparently for 2.2/2.3.
1581
1587
1582 2005-07-16 Fernando Perez <fperez@colorado.edu>
1588 2005-07-16 Fernando Perez <fperez@colorado.edu>
1583
1589
1584 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1590 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1585 out of the color scheme table used for coloring exception
1591 out of the color scheme table used for coloring exception
1586 tracebacks. This allows user code to add new schemes at runtime.
1592 tracebacks. This allows user code to add new schemes at runtime.
1587 This is a minimally modified version of the patch at
1593 This is a minimally modified version of the patch at
1588 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1594 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1589 for the contribution.
1595 for the contribution.
1590
1596
1591 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1597 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1592 slightly modified version of the patch in
1598 slightly modified version of the patch in
1593 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1599 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1594 to remove the previous try/except solution (which was costlier).
1600 to remove the previous try/except solution (which was costlier).
1595 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1601 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1596
1602
1597 2005-06-08 Fernando Perez <fperez@colorado.edu>
1603 2005-06-08 Fernando Perez <fperez@colorado.edu>
1598
1604
1599 * IPython/iplib.py (write/write_err): Add methods to abstract all
1605 * IPython/iplib.py (write/write_err): Add methods to abstract all
1600 I/O a bit more.
1606 I/O a bit more.
1601
1607
1602 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1608 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1603 warning, reported by Aric Hagberg, fix by JD Hunter.
1609 warning, reported by Aric Hagberg, fix by JD Hunter.
1604
1610
1605 2005-06-02 *** Released version 0.6.15
1611 2005-06-02 *** Released version 0.6.15
1606
1612
1607 2005-06-01 Fernando Perez <fperez@colorado.edu>
1613 2005-06-01 Fernando Perez <fperez@colorado.edu>
1608
1614
1609 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1615 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1610 tab-completion of filenames within open-quoted strings. Note that
1616 tab-completion of filenames within open-quoted strings. Note that
1611 this requires that in ~/.ipython/ipythonrc, users change the
1617 this requires that in ~/.ipython/ipythonrc, users change the
1612 readline delimiters configuration to read:
1618 readline delimiters configuration to read:
1613
1619
1614 readline_remove_delims -/~
1620 readline_remove_delims -/~
1615
1621
1616
1622
1617 2005-05-31 *** Released version 0.6.14
1623 2005-05-31 *** Released version 0.6.14
1618
1624
1619 2005-05-29 Fernando Perez <fperez@colorado.edu>
1625 2005-05-29 Fernando Perez <fperez@colorado.edu>
1620
1626
1621 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1627 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1622 with files not on the filesystem. Reported by Eliyahu Sandler
1628 with files not on the filesystem. Reported by Eliyahu Sandler
1623 <eli@gondolin.net>
1629 <eli@gondolin.net>
1624
1630
1625 2005-05-22 Fernando Perez <fperez@colorado.edu>
1631 2005-05-22 Fernando Perez <fperez@colorado.edu>
1626
1632
1627 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1633 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1628 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1634 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1629
1635
1630 2005-05-19 Fernando Perez <fperez@colorado.edu>
1636 2005-05-19 Fernando Perez <fperez@colorado.edu>
1631
1637
1632 * IPython/iplib.py (safe_execfile): close a file which could be
1638 * IPython/iplib.py (safe_execfile): close a file which could be
1633 left open (causing problems in win32, which locks open files).
1639 left open (causing problems in win32, which locks open files).
1634 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1640 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1635
1641
1636 2005-05-18 Fernando Perez <fperez@colorado.edu>
1642 2005-05-18 Fernando Perez <fperez@colorado.edu>
1637
1643
1638 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1644 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1639 keyword arguments correctly to safe_execfile().
1645 keyword arguments correctly to safe_execfile().
1640
1646
1641 2005-05-13 Fernando Perez <fperez@colorado.edu>
1647 2005-05-13 Fernando Perez <fperez@colorado.edu>
1642
1648
1643 * ipython.1: Added info about Qt to manpage, and threads warning
1649 * ipython.1: Added info about Qt to manpage, and threads warning
1644 to usage page (invoked with --help).
1650 to usage page (invoked with --help).
1645
1651
1646 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1652 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1647 new matcher (it goes at the end of the priority list) to do
1653 new matcher (it goes at the end of the priority list) to do
1648 tab-completion on named function arguments. Submitted by George
1654 tab-completion on named function arguments. Submitted by George
1649 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1655 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1650 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1656 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1651 for more details.
1657 for more details.
1652
1658
1653 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1659 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1654 SystemExit exceptions in the script being run. Thanks to a report
1660 SystemExit exceptions in the script being run. Thanks to a report
1655 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1661 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1656 producing very annoying behavior when running unit tests.
1662 producing very annoying behavior when running unit tests.
1657
1663
1658 2005-05-12 Fernando Perez <fperez@colorado.edu>
1664 2005-05-12 Fernando Perez <fperez@colorado.edu>
1659
1665
1660 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1666 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1661 which I'd broken (again) due to a changed regexp. In the process,
1667 which I'd broken (again) due to a changed regexp. In the process,
1662 added ';' as an escape to auto-quote the whole line without
1668 added ';' as an escape to auto-quote the whole line without
1663 splitting its arguments. Thanks to a report by Jerry McRae
1669 splitting its arguments. Thanks to a report by Jerry McRae
1664 <qrs0xyc02-AT-sneakemail.com>.
1670 <qrs0xyc02-AT-sneakemail.com>.
1665
1671
1666 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1672 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1667 possible crashes caused by a TokenError. Reported by Ed Schofield
1673 possible crashes caused by a TokenError. Reported by Ed Schofield
1668 <schofield-AT-ftw.at>.
1674 <schofield-AT-ftw.at>.
1669
1675
1670 2005-05-06 Fernando Perez <fperez@colorado.edu>
1676 2005-05-06 Fernando Perez <fperez@colorado.edu>
1671
1677
1672 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1678 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1673
1679
1674 2005-04-29 Fernando Perez <fperez@colorado.edu>
1680 2005-04-29 Fernando Perez <fperez@colorado.edu>
1675
1681
1676 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1682 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1677 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1683 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1678 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1684 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1679 which provides support for Qt interactive usage (similar to the
1685 which provides support for Qt interactive usage (similar to the
1680 existing one for WX and GTK). This had been often requested.
1686 existing one for WX and GTK). This had been often requested.
1681
1687
1682 2005-04-14 *** Released version 0.6.13
1688 2005-04-14 *** Released version 0.6.13
1683
1689
1684 2005-04-08 Fernando Perez <fperez@colorado.edu>
1690 2005-04-08 Fernando Perez <fperez@colorado.edu>
1685
1691
1686 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1692 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1687 from _ofind, which gets called on almost every input line. Now,
1693 from _ofind, which gets called on almost every input line. Now,
1688 we only try to get docstrings if they are actually going to be
1694 we only try to get docstrings if they are actually going to be
1689 used (the overhead of fetching unnecessary docstrings can be
1695 used (the overhead of fetching unnecessary docstrings can be
1690 noticeable for certain objects, such as Pyro proxies).
1696 noticeable for certain objects, such as Pyro proxies).
1691
1697
1692 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1698 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1693 for completers. For some reason I had been passing them the state
1699 for completers. For some reason I had been passing them the state
1694 variable, which completers never actually need, and was in
1700 variable, which completers never actually need, and was in
1695 conflict with the rlcompleter API. Custom completers ONLY need to
1701 conflict with the rlcompleter API. Custom completers ONLY need to
1696 take the text parameter.
1702 take the text parameter.
1697
1703
1698 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1704 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1699 work correctly in pysh. I've also moved all the logic which used
1705 work correctly in pysh. I've also moved all the logic which used
1700 to be in pysh.py here, which will prevent problems with future
1706 to be in pysh.py here, which will prevent problems with future
1701 upgrades. However, this time I must warn users to update their
1707 upgrades. However, this time I must warn users to update their
1702 pysh profile to include the line
1708 pysh profile to include the line
1703
1709
1704 import_all IPython.Extensions.InterpreterExec
1710 import_all IPython.Extensions.InterpreterExec
1705
1711
1706 because otherwise things won't work for them. They MUST also
1712 because otherwise things won't work for them. They MUST also
1707 delete pysh.py and the line
1713 delete pysh.py and the line
1708
1714
1709 execfile pysh.py
1715 execfile pysh.py
1710
1716
1711 from their ipythonrc-pysh.
1717 from their ipythonrc-pysh.
1712
1718
1713 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1719 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1714 robust in the face of objects whose dir() returns non-strings
1720 robust in the face of objects whose dir() returns non-strings
1715 (which it shouldn't, but some broken libs like ITK do). Thanks to
1721 (which it shouldn't, but some broken libs like ITK do). Thanks to
1716 a patch by John Hunter (implemented differently, though). Also
1722 a patch by John Hunter (implemented differently, though). Also
1717 minor improvements by using .extend instead of + on lists.
1723 minor improvements by using .extend instead of + on lists.
1718
1724
1719 * pysh.py:
1725 * pysh.py:
1720
1726
1721 2005-04-06 Fernando Perez <fperez@colorado.edu>
1727 2005-04-06 Fernando Perez <fperez@colorado.edu>
1722
1728
1723 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1729 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1724 by default, so that all users benefit from it. Those who don't
1730 by default, so that all users benefit from it. Those who don't
1725 want it can still turn it off.
1731 want it can still turn it off.
1726
1732
1727 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1733 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1728 config file, I'd forgotten about this, so users were getting it
1734 config file, I'd forgotten about this, so users were getting it
1729 off by default.
1735 off by default.
1730
1736
1731 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1737 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1732 consistency. Now magics can be called in multiline statements,
1738 consistency. Now magics can be called in multiline statements,
1733 and python variables can be expanded in magic calls via $var.
1739 and python variables can be expanded in magic calls via $var.
1734 This makes the magic system behave just like aliases or !system
1740 This makes the magic system behave just like aliases or !system
1735 calls.
1741 calls.
1736
1742
1737 2005-03-28 Fernando Perez <fperez@colorado.edu>
1743 2005-03-28 Fernando Perez <fperez@colorado.edu>
1738
1744
1739 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1745 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1740 expensive string additions for building command. Add support for
1746 expensive string additions for building command. Add support for
1741 trailing ';' when autocall is used.
1747 trailing ';' when autocall is used.
1742
1748
1743 2005-03-26 Fernando Perez <fperez@colorado.edu>
1749 2005-03-26 Fernando Perez <fperez@colorado.edu>
1744
1750
1745 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1751 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1746 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1752 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1747 ipython.el robust against prompts with any number of spaces
1753 ipython.el robust against prompts with any number of spaces
1748 (including 0) after the ':' character.
1754 (including 0) after the ':' character.
1749
1755
1750 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1756 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1751 continuation prompt, which misled users to think the line was
1757 continuation prompt, which misled users to think the line was
1752 already indented. Closes debian Bug#300847, reported to me by
1758 already indented. Closes debian Bug#300847, reported to me by
1753 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1759 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1754
1760
1755 2005-03-23 Fernando Perez <fperez@colorado.edu>
1761 2005-03-23 Fernando Perez <fperez@colorado.edu>
1756
1762
1757 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1763 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1758 properly aligned if they have embedded newlines.
1764 properly aligned if they have embedded newlines.
1759
1765
1760 * IPython/iplib.py (runlines): Add a public method to expose
1766 * IPython/iplib.py (runlines): Add a public method to expose
1761 IPython's code execution machinery, so that users can run strings
1767 IPython's code execution machinery, so that users can run strings
1762 as if they had been typed at the prompt interactively.
1768 as if they had been typed at the prompt interactively.
1763 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1769 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1764 methods which can call the system shell, but with python variable
1770 methods which can call the system shell, but with python variable
1765 expansion. The three such methods are: __IPYTHON__.system,
1771 expansion. The three such methods are: __IPYTHON__.system,
1766 .getoutput and .getoutputerror. These need to be documented in a
1772 .getoutput and .getoutputerror. These need to be documented in a
1767 'public API' section (to be written) of the manual.
1773 'public API' section (to be written) of the manual.
1768
1774
1769 2005-03-20 Fernando Perez <fperez@colorado.edu>
1775 2005-03-20 Fernando Perez <fperez@colorado.edu>
1770
1776
1771 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1777 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1772 for custom exception handling. This is quite powerful, and it
1778 for custom exception handling. This is quite powerful, and it
1773 allows for user-installable exception handlers which can trap
1779 allows for user-installable exception handlers which can trap
1774 custom exceptions at runtime and treat them separately from
1780 custom exceptions at runtime and treat them separately from
1775 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1781 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1776 Mantegazza <mantegazza-AT-ill.fr>.
1782 Mantegazza <mantegazza-AT-ill.fr>.
1777 (InteractiveShell.set_custom_completer): public API function to
1783 (InteractiveShell.set_custom_completer): public API function to
1778 add new completers at runtime.
1784 add new completers at runtime.
1779
1785
1780 2005-03-19 Fernando Perez <fperez@colorado.edu>
1786 2005-03-19 Fernando Perez <fperez@colorado.edu>
1781
1787
1782 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1788 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1783 allow objects which provide their docstrings via non-standard
1789 allow objects which provide their docstrings via non-standard
1784 mechanisms (like Pyro proxies) to still be inspected by ipython's
1790 mechanisms (like Pyro proxies) to still be inspected by ipython's
1785 ? system.
1791 ? system.
1786
1792
1787 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1793 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1788 automatic capture system. I tried quite hard to make it work
1794 automatic capture system. I tried quite hard to make it work
1789 reliably, and simply failed. I tried many combinations with the
1795 reliably, and simply failed. I tried many combinations with the
1790 subprocess module, but eventually nothing worked in all needed
1796 subprocess module, but eventually nothing worked in all needed
1791 cases (not blocking stdin for the child, duplicating stdout
1797 cases (not blocking stdin for the child, duplicating stdout
1792 without blocking, etc). The new %sc/%sx still do capture to these
1798 without blocking, etc). The new %sc/%sx still do capture to these
1793 magical list/string objects which make shell use much more
1799 magical list/string objects which make shell use much more
1794 conveninent, so not all is lost.
1800 conveninent, so not all is lost.
1795
1801
1796 XXX - FIX MANUAL for the change above!
1802 XXX - FIX MANUAL for the change above!
1797
1803
1798 (runsource): I copied code.py's runsource() into ipython to modify
1804 (runsource): I copied code.py's runsource() into ipython to modify
1799 it a bit. Now the code object and source to be executed are
1805 it a bit. Now the code object and source to be executed are
1800 stored in ipython. This makes this info accessible to third-party
1806 stored in ipython. This makes this info accessible to third-party
1801 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1807 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1802 Mantegazza <mantegazza-AT-ill.fr>.
1808 Mantegazza <mantegazza-AT-ill.fr>.
1803
1809
1804 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1810 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1805 history-search via readline (like C-p/C-n). I'd wanted this for a
1811 history-search via readline (like C-p/C-n). I'd wanted this for a
1806 long time, but only recently found out how to do it. For users
1812 long time, but only recently found out how to do it. For users
1807 who already have their ipythonrc files made and want this, just
1813 who already have their ipythonrc files made and want this, just
1808 add:
1814 add:
1809
1815
1810 readline_parse_and_bind "\e[A": history-search-backward
1816 readline_parse_and_bind "\e[A": history-search-backward
1811 readline_parse_and_bind "\e[B": history-search-forward
1817 readline_parse_and_bind "\e[B": history-search-forward
1812
1818
1813 2005-03-18 Fernando Perez <fperez@colorado.edu>
1819 2005-03-18 Fernando Perez <fperez@colorado.edu>
1814
1820
1815 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1821 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1816 LSString and SList classes which allow transparent conversions
1822 LSString and SList classes which allow transparent conversions
1817 between list mode and whitespace-separated string.
1823 between list mode and whitespace-separated string.
1818 (magic_r): Fix recursion problem in %r.
1824 (magic_r): Fix recursion problem in %r.
1819
1825
1820 * IPython/genutils.py (LSString): New class to be used for
1826 * IPython/genutils.py (LSString): New class to be used for
1821 automatic storage of the results of all alias/system calls in _o
1827 automatic storage of the results of all alias/system calls in _o
1822 and _e (stdout/err). These provide a .l/.list attribute which
1828 and _e (stdout/err). These provide a .l/.list attribute which
1823 does automatic splitting on newlines. This means that for most
1829 does automatic splitting on newlines. This means that for most
1824 uses, you'll never need to do capturing of output with %sc/%sx
1830 uses, you'll never need to do capturing of output with %sc/%sx
1825 anymore, since ipython keeps this always done for you. Note that
1831 anymore, since ipython keeps this always done for you. Note that
1826 only the LAST results are stored, the _o/e variables are
1832 only the LAST results are stored, the _o/e variables are
1827 overwritten on each call. If you need to save their contents
1833 overwritten on each call. If you need to save their contents
1828 further, simply bind them to any other name.
1834 further, simply bind them to any other name.
1829
1835
1830 2005-03-17 Fernando Perez <fperez@colorado.edu>
1836 2005-03-17 Fernando Perez <fperez@colorado.edu>
1831
1837
1832 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1838 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1833 prompt namespace handling.
1839 prompt namespace handling.
1834
1840
1835 2005-03-16 Fernando Perez <fperez@colorado.edu>
1841 2005-03-16 Fernando Perez <fperez@colorado.edu>
1836
1842
1837 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1843 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1838 classic prompts to be '>>> ' (final space was missing, and it
1844 classic prompts to be '>>> ' (final space was missing, and it
1839 trips the emacs python mode).
1845 trips the emacs python mode).
1840 (BasePrompt.__str__): Added safe support for dynamic prompt
1846 (BasePrompt.__str__): Added safe support for dynamic prompt
1841 strings. Now you can set your prompt string to be '$x', and the
1847 strings. Now you can set your prompt string to be '$x', and the
1842 value of x will be printed from your interactive namespace. The
1848 value of x will be printed from your interactive namespace. The
1843 interpolation syntax includes the full Itpl support, so
1849 interpolation syntax includes the full Itpl support, so
1844 ${foo()+x+bar()} is a valid prompt string now, and the function
1850 ${foo()+x+bar()} is a valid prompt string now, and the function
1845 calls will be made at runtime.
1851 calls will be made at runtime.
1846
1852
1847 2005-03-15 Fernando Perez <fperez@colorado.edu>
1853 2005-03-15 Fernando Perez <fperez@colorado.edu>
1848
1854
1849 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1855 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1850 avoid name clashes in pylab. %hist still works, it just forwards
1856 avoid name clashes in pylab. %hist still works, it just forwards
1851 the call to %history.
1857 the call to %history.
1852
1858
1853 2005-03-02 *** Released version 0.6.12
1859 2005-03-02 *** Released version 0.6.12
1854
1860
1855 2005-03-02 Fernando Perez <fperez@colorado.edu>
1861 2005-03-02 Fernando Perez <fperez@colorado.edu>
1856
1862
1857 * IPython/iplib.py (handle_magic): log magic calls properly as
1863 * IPython/iplib.py (handle_magic): log magic calls properly as
1858 ipmagic() function calls.
1864 ipmagic() function calls.
1859
1865
1860 * IPython/Magic.py (magic_time): Improved %time to support
1866 * IPython/Magic.py (magic_time): Improved %time to support
1861 statements and provide wall-clock as well as CPU time.
1867 statements and provide wall-clock as well as CPU time.
1862
1868
1863 2005-02-27 Fernando Perez <fperez@colorado.edu>
1869 2005-02-27 Fernando Perez <fperez@colorado.edu>
1864
1870
1865 * IPython/hooks.py: New hooks module, to expose user-modifiable
1871 * IPython/hooks.py: New hooks module, to expose user-modifiable
1866 IPython functionality in a clean manner. For now only the editor
1872 IPython functionality in a clean manner. For now only the editor
1867 hook is actually written, and other thigns which I intend to turn
1873 hook is actually written, and other thigns which I intend to turn
1868 into proper hooks aren't yet there. The display and prefilter
1874 into proper hooks aren't yet there. The display and prefilter
1869 stuff, for example, should be hooks. But at least now the
1875 stuff, for example, should be hooks. But at least now the
1870 framework is in place, and the rest can be moved here with more
1876 framework is in place, and the rest can be moved here with more
1871 time later. IPython had had a .hooks variable for a long time for
1877 time later. IPython had had a .hooks variable for a long time for
1872 this purpose, but I'd never actually used it for anything.
1878 this purpose, but I'd never actually used it for anything.
1873
1879
1874 2005-02-26 Fernando Perez <fperez@colorado.edu>
1880 2005-02-26 Fernando Perez <fperez@colorado.edu>
1875
1881
1876 * IPython/ipmaker.py (make_IPython): make the default ipython
1882 * IPython/ipmaker.py (make_IPython): make the default ipython
1877 directory be called _ipython under win32, to follow more the
1883 directory be called _ipython under win32, to follow more the
1878 naming peculiarities of that platform (where buggy software like
1884 naming peculiarities of that platform (where buggy software like
1879 Visual Sourcesafe breaks with .named directories). Reported by
1885 Visual Sourcesafe breaks with .named directories). Reported by
1880 Ville Vainio.
1886 Ville Vainio.
1881
1887
1882 2005-02-23 Fernando Perez <fperez@colorado.edu>
1888 2005-02-23 Fernando Perez <fperez@colorado.edu>
1883
1889
1884 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1890 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1885 auto_aliases for win32 which were causing problems. Users can
1891 auto_aliases for win32 which were causing problems. Users can
1886 define the ones they personally like.
1892 define the ones they personally like.
1887
1893
1888 2005-02-21 Fernando Perez <fperez@colorado.edu>
1894 2005-02-21 Fernando Perez <fperez@colorado.edu>
1889
1895
1890 * IPython/Magic.py (magic_time): new magic to time execution of
1896 * IPython/Magic.py (magic_time): new magic to time execution of
1891 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1897 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1892
1898
1893 2005-02-19 Fernando Perez <fperez@colorado.edu>
1899 2005-02-19 Fernando Perez <fperez@colorado.edu>
1894
1900
1895 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1901 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1896 into keys (for prompts, for example).
1902 into keys (for prompts, for example).
1897
1903
1898 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1904 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1899 prompts in case users want them. This introduces a small behavior
1905 prompts in case users want them. This introduces a small behavior
1900 change: ipython does not automatically add a space to all prompts
1906 change: ipython does not automatically add a space to all prompts
1901 anymore. To get the old prompts with a space, users should add it
1907 anymore. To get the old prompts with a space, users should add it
1902 manually to their ipythonrc file, so for example prompt_in1 should
1908 manually to their ipythonrc file, so for example prompt_in1 should
1903 now read 'In [\#]: ' instead of 'In [\#]:'.
1909 now read 'In [\#]: ' instead of 'In [\#]:'.
1904 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1910 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1905 file) to control left-padding of secondary prompts.
1911 file) to control left-padding of secondary prompts.
1906
1912
1907 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1913 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1908 the profiler can't be imported. Fix for Debian, which removed
1914 the profiler can't be imported. Fix for Debian, which removed
1909 profile.py because of License issues. I applied a slightly
1915 profile.py because of License issues. I applied a slightly
1910 modified version of the original Debian patch at
1916 modified version of the original Debian patch at
1911 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1917 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1912
1918
1913 2005-02-17 Fernando Perez <fperez@colorado.edu>
1919 2005-02-17 Fernando Perez <fperez@colorado.edu>
1914
1920
1915 * IPython/genutils.py (native_line_ends): Fix bug which would
1921 * IPython/genutils.py (native_line_ends): Fix bug which would
1916 cause improper line-ends under win32 b/c I was not opening files
1922 cause improper line-ends under win32 b/c I was not opening files
1917 in binary mode. Bug report and fix thanks to Ville.
1923 in binary mode. Bug report and fix thanks to Ville.
1918
1924
1919 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1925 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1920 trying to catch spurious foo[1] autocalls. My fix actually broke
1926 trying to catch spurious foo[1] autocalls. My fix actually broke
1921 ',/' autoquote/call with explicit escape (bad regexp).
1927 ',/' autoquote/call with explicit escape (bad regexp).
1922
1928
1923 2005-02-15 *** Released version 0.6.11
1929 2005-02-15 *** Released version 0.6.11
1924
1930
1925 2005-02-14 Fernando Perez <fperez@colorado.edu>
1931 2005-02-14 Fernando Perez <fperez@colorado.edu>
1926
1932
1927 * IPython/background_jobs.py: New background job management
1933 * IPython/background_jobs.py: New background job management
1928 subsystem. This is implemented via a new set of classes, and
1934 subsystem. This is implemented via a new set of classes, and
1929 IPython now provides a builtin 'jobs' object for background job
1935 IPython now provides a builtin 'jobs' object for background job
1930 execution. A convenience %bg magic serves as a lightweight
1936 execution. A convenience %bg magic serves as a lightweight
1931 frontend for starting the more common type of calls. This was
1937 frontend for starting the more common type of calls. This was
1932 inspired by discussions with B. Granger and the BackgroundCommand
1938 inspired by discussions with B. Granger and the BackgroundCommand
1933 class described in the book Python Scripting for Computational
1939 class described in the book Python Scripting for Computational
1934 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1940 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1935 (although ultimately no code from this text was used, as IPython's
1941 (although ultimately no code from this text was used, as IPython's
1936 system is a separate implementation).
1942 system is a separate implementation).
1937
1943
1938 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1944 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1939 to control the completion of single/double underscore names
1945 to control the completion of single/double underscore names
1940 separately. As documented in the example ipytonrc file, the
1946 separately. As documented in the example ipytonrc file, the
1941 readline_omit__names variable can now be set to 2, to omit even
1947 readline_omit__names variable can now be set to 2, to omit even
1942 single underscore names. Thanks to a patch by Brian Wong
1948 single underscore names. Thanks to a patch by Brian Wong
1943 <BrianWong-AT-AirgoNetworks.Com>.
1949 <BrianWong-AT-AirgoNetworks.Com>.
1944 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1950 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1945 be autocalled as foo([1]) if foo were callable. A problem for
1951 be autocalled as foo([1]) if foo were callable. A problem for
1946 things which are both callable and implement __getitem__.
1952 things which are both callable and implement __getitem__.
1947 (init_readline): Fix autoindentation for win32. Thanks to a patch
1953 (init_readline): Fix autoindentation for win32. Thanks to a patch
1948 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1954 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1949
1955
1950 2005-02-12 Fernando Perez <fperez@colorado.edu>
1956 2005-02-12 Fernando Perez <fperez@colorado.edu>
1951
1957
1952 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1958 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1953 which I had written long ago to sort out user error messages which
1959 which I had written long ago to sort out user error messages which
1954 may occur during startup. This seemed like a good idea initially,
1960 may occur during startup. This seemed like a good idea initially,
1955 but it has proven a disaster in retrospect. I don't want to
1961 but it has proven a disaster in retrospect. I don't want to
1956 change much code for now, so my fix is to set the internal 'debug'
1962 change much code for now, so my fix is to set the internal 'debug'
1957 flag to true everywhere, whose only job was precisely to control
1963 flag to true everywhere, whose only job was precisely to control
1958 this subsystem. This closes issue 28 (as well as avoiding all
1964 this subsystem. This closes issue 28 (as well as avoiding all
1959 sorts of strange hangups which occur from time to time).
1965 sorts of strange hangups which occur from time to time).
1960
1966
1961 2005-02-07 Fernando Perez <fperez@colorado.edu>
1967 2005-02-07 Fernando Perez <fperez@colorado.edu>
1962
1968
1963 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
1969 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
1964 previous call produced a syntax error.
1970 previous call produced a syntax error.
1965
1971
1966 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1972 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1967 classes without constructor.
1973 classes without constructor.
1968
1974
1969 2005-02-06 Fernando Perez <fperez@colorado.edu>
1975 2005-02-06 Fernando Perez <fperez@colorado.edu>
1970
1976
1971 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
1977 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
1972 completions with the results of each matcher, so we return results
1978 completions with the results of each matcher, so we return results
1973 to the user from all namespaces. This breaks with ipython
1979 to the user from all namespaces. This breaks with ipython
1974 tradition, but I think it's a nicer behavior. Now you get all
1980 tradition, but I think it's a nicer behavior. Now you get all
1975 possible completions listed, from all possible namespaces (python,
1981 possible completions listed, from all possible namespaces (python,
1976 filesystem, magics...) After a request by John Hunter
1982 filesystem, magics...) After a request by John Hunter
1977 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1983 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1978
1984
1979 2005-02-05 Fernando Perez <fperez@colorado.edu>
1985 2005-02-05 Fernando Perez <fperez@colorado.edu>
1980
1986
1981 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
1987 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
1982 the call had quote characters in it (the quotes were stripped).
1988 the call had quote characters in it (the quotes were stripped).
1983
1989
1984 2005-01-31 Fernando Perez <fperez@colorado.edu>
1990 2005-01-31 Fernando Perez <fperez@colorado.edu>
1985
1991
1986 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
1992 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
1987 Itpl.itpl() to make the code more robust against psyco
1993 Itpl.itpl() to make the code more robust against psyco
1988 optimizations.
1994 optimizations.
1989
1995
1990 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
1996 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
1991 of causing an exception. Quicker, cleaner.
1997 of causing an exception. Quicker, cleaner.
1992
1998
1993 2005-01-28 Fernando Perez <fperez@colorado.edu>
1999 2005-01-28 Fernando Perez <fperez@colorado.edu>
1994
2000
1995 * scripts/ipython_win_post_install.py (install): hardcode
2001 * scripts/ipython_win_post_install.py (install): hardcode
1996 sys.prefix+'python.exe' as the executable path. It turns out that
2002 sys.prefix+'python.exe' as the executable path. It turns out that
1997 during the post-installation run, sys.executable resolves to the
2003 during the post-installation run, sys.executable resolves to the
1998 name of the binary installer! I should report this as a distutils
2004 name of the binary installer! I should report this as a distutils
1999 bug, I think. I updated the .10 release with this tiny fix, to
2005 bug, I think. I updated the .10 release with this tiny fix, to
2000 avoid annoying the lists further.
2006 avoid annoying the lists further.
2001
2007
2002 2005-01-27 *** Released version 0.6.10
2008 2005-01-27 *** Released version 0.6.10
2003
2009
2004 2005-01-27 Fernando Perez <fperez@colorado.edu>
2010 2005-01-27 Fernando Perez <fperez@colorado.edu>
2005
2011
2006 * IPython/numutils.py (norm): Added 'inf' as optional name for
2012 * IPython/numutils.py (norm): Added 'inf' as optional name for
2007 L-infinity norm, included references to mathworld.com for vector
2013 L-infinity norm, included references to mathworld.com for vector
2008 norm definitions.
2014 norm definitions.
2009 (amin/amax): added amin/amax for array min/max. Similar to what
2015 (amin/amax): added amin/amax for array min/max. Similar to what
2010 pylab ships with after the recent reorganization of names.
2016 pylab ships with after the recent reorganization of names.
2011 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2017 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2012
2018
2013 * ipython.el: committed Alex's recent fixes and improvements.
2019 * ipython.el: committed Alex's recent fixes and improvements.
2014 Tested with python-mode from CVS, and it looks excellent. Since
2020 Tested with python-mode from CVS, and it looks excellent. Since
2015 python-mode hasn't released anything in a while, I'm temporarily
2021 python-mode hasn't released anything in a while, I'm temporarily
2016 putting a copy of today's CVS (v 4.70) of python-mode in:
2022 putting a copy of today's CVS (v 4.70) of python-mode in:
2017 http://ipython.scipy.org/tmp/python-mode.el
2023 http://ipython.scipy.org/tmp/python-mode.el
2018
2024
2019 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2025 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2020 sys.executable for the executable name, instead of assuming it's
2026 sys.executable for the executable name, instead of assuming it's
2021 called 'python.exe' (the post-installer would have produced broken
2027 called 'python.exe' (the post-installer would have produced broken
2022 setups on systems with a differently named python binary).
2028 setups on systems with a differently named python binary).
2023
2029
2024 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2030 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2025 references to os.linesep, to make the code more
2031 references to os.linesep, to make the code more
2026 platform-independent. This is also part of the win32 coloring
2032 platform-independent. This is also part of the win32 coloring
2027 fixes.
2033 fixes.
2028
2034
2029 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2035 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2030 lines, which actually cause coloring bugs because the length of
2036 lines, which actually cause coloring bugs because the length of
2031 the line is very difficult to correctly compute with embedded
2037 the line is very difficult to correctly compute with embedded
2032 escapes. This was the source of all the coloring problems under
2038 escapes. This was the source of all the coloring problems under
2033 Win32. I think that _finally_, Win32 users have a properly
2039 Win32. I think that _finally_, Win32 users have a properly
2034 working ipython in all respects. This would never have happened
2040 working ipython in all respects. This would never have happened
2035 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2041 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2036
2042
2037 2005-01-26 *** Released version 0.6.9
2043 2005-01-26 *** Released version 0.6.9
2038
2044
2039 2005-01-25 Fernando Perez <fperez@colorado.edu>
2045 2005-01-25 Fernando Perez <fperez@colorado.edu>
2040
2046
2041 * setup.py: finally, we have a true Windows installer, thanks to
2047 * setup.py: finally, we have a true Windows installer, thanks to
2042 the excellent work of Viktor Ransmayr
2048 the excellent work of Viktor Ransmayr
2043 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2049 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2044 Windows users. The setup routine is quite a bit cleaner thanks to
2050 Windows users. The setup routine is quite a bit cleaner thanks to
2045 this, and the post-install script uses the proper functions to
2051 this, and the post-install script uses the proper functions to
2046 allow a clean de-installation using the standard Windows Control
2052 allow a clean de-installation using the standard Windows Control
2047 Panel.
2053 Panel.
2048
2054
2049 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2055 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2050 environment variable under all OSes (including win32) if
2056 environment variable under all OSes (including win32) if
2051 available. This will give consistency to win32 users who have set
2057 available. This will give consistency to win32 users who have set
2052 this variable for any reason. If os.environ['HOME'] fails, the
2058 this variable for any reason. If os.environ['HOME'] fails, the
2053 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2059 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2054
2060
2055 2005-01-24 Fernando Perez <fperez@colorado.edu>
2061 2005-01-24 Fernando Perez <fperez@colorado.edu>
2056
2062
2057 * IPython/numutils.py (empty_like): add empty_like(), similar to
2063 * IPython/numutils.py (empty_like): add empty_like(), similar to
2058 zeros_like() but taking advantage of the new empty() Numeric routine.
2064 zeros_like() but taking advantage of the new empty() Numeric routine.
2059
2065
2060 2005-01-23 *** Released version 0.6.8
2066 2005-01-23 *** Released version 0.6.8
2061
2067
2062 2005-01-22 Fernando Perez <fperez@colorado.edu>
2068 2005-01-22 Fernando Perez <fperez@colorado.edu>
2063
2069
2064 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2070 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2065 automatic show() calls. After discussing things with JDH, it
2071 automatic show() calls. After discussing things with JDH, it
2066 turns out there are too many corner cases where this can go wrong.
2072 turns out there are too many corner cases where this can go wrong.
2067 It's best not to try to be 'too smart', and simply have ipython
2073 It's best not to try to be 'too smart', and simply have ipython
2068 reproduce as much as possible the default behavior of a normal
2074 reproduce as much as possible the default behavior of a normal
2069 python shell.
2075 python shell.
2070
2076
2071 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2077 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2072 line-splitting regexp and _prefilter() to avoid calling getattr()
2078 line-splitting regexp and _prefilter() to avoid calling getattr()
2073 on assignments. This closes
2079 on assignments. This closes
2074 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2080 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2075 readline uses getattr(), so a simple <TAB> keypress is still
2081 readline uses getattr(), so a simple <TAB> keypress is still
2076 enough to trigger getattr() calls on an object.
2082 enough to trigger getattr() calls on an object.
2077
2083
2078 2005-01-21 Fernando Perez <fperez@colorado.edu>
2084 2005-01-21 Fernando Perez <fperez@colorado.edu>
2079
2085
2080 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2086 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2081 docstring under pylab so it doesn't mask the original.
2087 docstring under pylab so it doesn't mask the original.
2082
2088
2083 2005-01-21 *** Released version 0.6.7
2089 2005-01-21 *** Released version 0.6.7
2084
2090
2085 2005-01-21 Fernando Perez <fperez@colorado.edu>
2091 2005-01-21 Fernando Perez <fperez@colorado.edu>
2086
2092
2087 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2093 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2088 signal handling for win32 users in multithreaded mode.
2094 signal handling for win32 users in multithreaded mode.
2089
2095
2090 2005-01-17 Fernando Perez <fperez@colorado.edu>
2096 2005-01-17 Fernando Perez <fperez@colorado.edu>
2091
2097
2092 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2098 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2093 instances with no __init__. After a crash report by Norbert Nemec
2099 instances with no __init__. After a crash report by Norbert Nemec
2094 <Norbert-AT-nemec-online.de>.
2100 <Norbert-AT-nemec-online.de>.
2095
2101
2096 2005-01-14 Fernando Perez <fperez@colorado.edu>
2102 2005-01-14 Fernando Perez <fperez@colorado.edu>
2097
2103
2098 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2104 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2099 names for verbose exceptions, when multiple dotted names and the
2105 names for verbose exceptions, when multiple dotted names and the
2100 'parent' object were present on the same line.
2106 'parent' object were present on the same line.
2101
2107
2102 2005-01-11 Fernando Perez <fperez@colorado.edu>
2108 2005-01-11 Fernando Perez <fperez@colorado.edu>
2103
2109
2104 * IPython/genutils.py (flag_calls): new utility to trap and flag
2110 * IPython/genutils.py (flag_calls): new utility to trap and flag
2105 calls in functions. I need it to clean up matplotlib support.
2111 calls in functions. I need it to clean up matplotlib support.
2106 Also removed some deprecated code in genutils.
2112 Also removed some deprecated code in genutils.
2107
2113
2108 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2114 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2109 that matplotlib scripts called with %run, which don't call show()
2115 that matplotlib scripts called with %run, which don't call show()
2110 themselves, still have their plotting windows open.
2116 themselves, still have their plotting windows open.
2111
2117
2112 2005-01-05 Fernando Perez <fperez@colorado.edu>
2118 2005-01-05 Fernando Perez <fperez@colorado.edu>
2113
2119
2114 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2120 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2115 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2121 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2116
2122
2117 2004-12-19 Fernando Perez <fperez@colorado.edu>
2123 2004-12-19 Fernando Perez <fperez@colorado.edu>
2118
2124
2119 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2125 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2120 parent_runcode, which was an eyesore. The same result can be
2126 parent_runcode, which was an eyesore. The same result can be
2121 obtained with Python's regular superclass mechanisms.
2127 obtained with Python's regular superclass mechanisms.
2122
2128
2123 2004-12-17 Fernando Perez <fperez@colorado.edu>
2129 2004-12-17 Fernando Perez <fperez@colorado.edu>
2124
2130
2125 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2131 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2126 reported by Prabhu.
2132 reported by Prabhu.
2127 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2133 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2128 sys.stderr) instead of explicitly calling sys.stderr. This helps
2134 sys.stderr) instead of explicitly calling sys.stderr. This helps
2129 maintain our I/O abstractions clean, for future GUI embeddings.
2135 maintain our I/O abstractions clean, for future GUI embeddings.
2130
2136
2131 * IPython/genutils.py (info): added new utility for sys.stderr
2137 * IPython/genutils.py (info): added new utility for sys.stderr
2132 unified info message handling (thin wrapper around warn()).
2138 unified info message handling (thin wrapper around warn()).
2133
2139
2134 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2140 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2135 composite (dotted) names on verbose exceptions.
2141 composite (dotted) names on verbose exceptions.
2136 (VerboseTB.nullrepr): harden against another kind of errors which
2142 (VerboseTB.nullrepr): harden against another kind of errors which
2137 Python's inspect module can trigger, and which were crashing
2143 Python's inspect module can trigger, and which were crashing
2138 IPython. Thanks to a report by Marco Lombardi
2144 IPython. Thanks to a report by Marco Lombardi
2139 <mlombard-AT-ma010192.hq.eso.org>.
2145 <mlombard-AT-ma010192.hq.eso.org>.
2140
2146
2141 2004-12-13 *** Released version 0.6.6
2147 2004-12-13 *** Released version 0.6.6
2142
2148
2143 2004-12-12 Fernando Perez <fperez@colorado.edu>
2149 2004-12-12 Fernando Perez <fperez@colorado.edu>
2144
2150
2145 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2151 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2146 generated by pygtk upon initialization if it was built without
2152 generated by pygtk upon initialization if it was built without
2147 threads (for matplotlib users). After a crash reported by
2153 threads (for matplotlib users). After a crash reported by
2148 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2154 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2149
2155
2150 * IPython/ipmaker.py (make_IPython): fix small bug in the
2156 * IPython/ipmaker.py (make_IPython): fix small bug in the
2151 import_some parameter for multiple imports.
2157 import_some parameter for multiple imports.
2152
2158
2153 * IPython/iplib.py (ipmagic): simplified the interface of
2159 * IPython/iplib.py (ipmagic): simplified the interface of
2154 ipmagic() to take a single string argument, just as it would be
2160 ipmagic() to take a single string argument, just as it would be
2155 typed at the IPython cmd line.
2161 typed at the IPython cmd line.
2156 (ipalias): Added new ipalias() with an interface identical to
2162 (ipalias): Added new ipalias() with an interface identical to
2157 ipmagic(). This completes exposing a pure python interface to the
2163 ipmagic(). This completes exposing a pure python interface to the
2158 alias and magic system, which can be used in loops or more complex
2164 alias and magic system, which can be used in loops or more complex
2159 code where IPython's automatic line mangling is not active.
2165 code where IPython's automatic line mangling is not active.
2160
2166
2161 * IPython/genutils.py (timing): changed interface of timing to
2167 * IPython/genutils.py (timing): changed interface of timing to
2162 simply run code once, which is the most common case. timings()
2168 simply run code once, which is the most common case. timings()
2163 remains unchanged, for the cases where you want multiple runs.
2169 remains unchanged, for the cases where you want multiple runs.
2164
2170
2165 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2171 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2166 bug where Python2.2 crashes with exec'ing code which does not end
2172 bug where Python2.2 crashes with exec'ing code which does not end
2167 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2173 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2168 before.
2174 before.
2169
2175
2170 2004-12-10 Fernando Perez <fperez@colorado.edu>
2176 2004-12-10 Fernando Perez <fperez@colorado.edu>
2171
2177
2172 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2178 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2173 -t to -T, to accomodate the new -t flag in %run (the %run and
2179 -t to -T, to accomodate the new -t flag in %run (the %run and
2174 %prun options are kind of intermixed, and it's not easy to change
2180 %prun options are kind of intermixed, and it's not easy to change
2175 this with the limitations of python's getopt).
2181 this with the limitations of python's getopt).
2176
2182
2177 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2183 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2178 the execution of scripts. It's not as fine-tuned as timeit.py,
2184 the execution of scripts. It's not as fine-tuned as timeit.py,
2179 but it works from inside ipython (and under 2.2, which lacks
2185 but it works from inside ipython (and under 2.2, which lacks
2180 timeit.py). Optionally a number of runs > 1 can be given for
2186 timeit.py). Optionally a number of runs > 1 can be given for
2181 timing very short-running code.
2187 timing very short-running code.
2182
2188
2183 * IPython/genutils.py (uniq_stable): new routine which returns a
2189 * IPython/genutils.py (uniq_stable): new routine which returns a
2184 list of unique elements in any iterable, but in stable order of
2190 list of unique elements in any iterable, but in stable order of
2185 appearance. I needed this for the ultraTB fixes, and it's a handy
2191 appearance. I needed this for the ultraTB fixes, and it's a handy
2186 utility.
2192 utility.
2187
2193
2188 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2194 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2189 dotted names in Verbose exceptions. This had been broken since
2195 dotted names in Verbose exceptions. This had been broken since
2190 the very start, now x.y will properly be printed in a Verbose
2196 the very start, now x.y will properly be printed in a Verbose
2191 traceback, instead of x being shown and y appearing always as an
2197 traceback, instead of x being shown and y appearing always as an
2192 'undefined global'. Getting this to work was a bit tricky,
2198 'undefined global'. Getting this to work was a bit tricky,
2193 because by default python tokenizers are stateless. Saved by
2199 because by default python tokenizers are stateless. Saved by
2194 python's ability to easily add a bit of state to an arbitrary
2200 python's ability to easily add a bit of state to an arbitrary
2195 function (without needing to build a full-blown callable object).
2201 function (without needing to build a full-blown callable object).
2196
2202
2197 Also big cleanup of this code, which had horrendous runtime
2203 Also big cleanup of this code, which had horrendous runtime
2198 lookups of zillions of attributes for colorization. Moved all
2204 lookups of zillions of attributes for colorization. Moved all
2199 this code into a few templates, which make it cleaner and quicker.
2205 this code into a few templates, which make it cleaner and quicker.
2200
2206
2201 Printout quality was also improved for Verbose exceptions: one
2207 Printout quality was also improved for Verbose exceptions: one
2202 variable per line, and memory addresses are printed (this can be
2208 variable per line, and memory addresses are printed (this can be
2203 quite handy in nasty debugging situations, which is what Verbose
2209 quite handy in nasty debugging situations, which is what Verbose
2204 is for).
2210 is for).
2205
2211
2206 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2212 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2207 the command line as scripts to be loaded by embedded instances.
2213 the command line as scripts to be loaded by embedded instances.
2208 Doing so has the potential for an infinite recursion if there are
2214 Doing so has the potential for an infinite recursion if there are
2209 exceptions thrown in the process. This fixes a strange crash
2215 exceptions thrown in the process. This fixes a strange crash
2210 reported by Philippe MULLER <muller-AT-irit.fr>.
2216 reported by Philippe MULLER <muller-AT-irit.fr>.
2211
2217
2212 2004-12-09 Fernando Perez <fperez@colorado.edu>
2218 2004-12-09 Fernando Perez <fperez@colorado.edu>
2213
2219
2214 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2220 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2215 to reflect new names in matplotlib, which now expose the
2221 to reflect new names in matplotlib, which now expose the
2216 matlab-compatible interface via a pylab module instead of the
2222 matlab-compatible interface via a pylab module instead of the
2217 'matlab' name. The new code is backwards compatible, so users of
2223 'matlab' name. The new code is backwards compatible, so users of
2218 all matplotlib versions are OK. Patch by J. Hunter.
2224 all matplotlib versions are OK. Patch by J. Hunter.
2219
2225
2220 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2226 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2221 of __init__ docstrings for instances (class docstrings are already
2227 of __init__ docstrings for instances (class docstrings are already
2222 automatically printed). Instances with customized docstrings
2228 automatically printed). Instances with customized docstrings
2223 (indep. of the class) are also recognized and all 3 separate
2229 (indep. of the class) are also recognized and all 3 separate
2224 docstrings are printed (instance, class, constructor). After some
2230 docstrings are printed (instance, class, constructor). After some
2225 comments/suggestions by J. Hunter.
2231 comments/suggestions by J. Hunter.
2226
2232
2227 2004-12-05 Fernando Perez <fperez@colorado.edu>
2233 2004-12-05 Fernando Perez <fperez@colorado.edu>
2228
2234
2229 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2235 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2230 warnings when tab-completion fails and triggers an exception.
2236 warnings when tab-completion fails and triggers an exception.
2231
2237
2232 2004-12-03 Fernando Perez <fperez@colorado.edu>
2238 2004-12-03 Fernando Perez <fperez@colorado.edu>
2233
2239
2234 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2240 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2235 be triggered when using 'run -p'. An incorrect option flag was
2241 be triggered when using 'run -p'. An incorrect option flag was
2236 being set ('d' instead of 'D').
2242 being set ('d' instead of 'D').
2237 (manpage): fix missing escaped \- sign.
2243 (manpage): fix missing escaped \- sign.
2238
2244
2239 2004-11-30 *** Released version 0.6.5
2245 2004-11-30 *** Released version 0.6.5
2240
2246
2241 2004-11-30 Fernando Perez <fperez@colorado.edu>
2247 2004-11-30 Fernando Perez <fperez@colorado.edu>
2242
2248
2243 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2249 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2244 setting with -d option.
2250 setting with -d option.
2245
2251
2246 * setup.py (docfiles): Fix problem where the doc glob I was using
2252 * setup.py (docfiles): Fix problem where the doc glob I was using
2247 was COMPLETELY BROKEN. It was giving the right files by pure
2253 was COMPLETELY BROKEN. It was giving the right files by pure
2248 accident, but failed once I tried to include ipython.el. Note:
2254 accident, but failed once I tried to include ipython.el. Note:
2249 glob() does NOT allow you to do exclusion on multiple endings!
2255 glob() does NOT allow you to do exclusion on multiple endings!
2250
2256
2251 2004-11-29 Fernando Perez <fperez@colorado.edu>
2257 2004-11-29 Fernando Perez <fperez@colorado.edu>
2252
2258
2253 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2259 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2254 the manpage as the source. Better formatting & consistency.
2260 the manpage as the source. Better formatting & consistency.
2255
2261
2256 * IPython/Magic.py (magic_run): Added new -d option, to run
2262 * IPython/Magic.py (magic_run): Added new -d option, to run
2257 scripts under the control of the python pdb debugger. Note that
2263 scripts under the control of the python pdb debugger. Note that
2258 this required changing the %prun option -d to -D, to avoid a clash
2264 this required changing the %prun option -d to -D, to avoid a clash
2259 (since %run must pass options to %prun, and getopt is too dumb to
2265 (since %run must pass options to %prun, and getopt is too dumb to
2260 handle options with string values with embedded spaces). Thanks
2266 handle options with string values with embedded spaces). Thanks
2261 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2267 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2262 (magic_who_ls): added type matching to %who and %whos, so that one
2268 (magic_who_ls): added type matching to %who and %whos, so that one
2263 can filter their output to only include variables of certain
2269 can filter their output to only include variables of certain
2264 types. Another suggestion by Matthew.
2270 types. Another suggestion by Matthew.
2265 (magic_whos): Added memory summaries in kb and Mb for arrays.
2271 (magic_whos): Added memory summaries in kb and Mb for arrays.
2266 (magic_who): Improve formatting (break lines every 9 vars).
2272 (magic_who): Improve formatting (break lines every 9 vars).
2267
2273
2268 2004-11-28 Fernando Perez <fperez@colorado.edu>
2274 2004-11-28 Fernando Perez <fperez@colorado.edu>
2269
2275
2270 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2276 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2271 cache when empty lines were present.
2277 cache when empty lines were present.
2272
2278
2273 2004-11-24 Fernando Perez <fperez@colorado.edu>
2279 2004-11-24 Fernando Perez <fperez@colorado.edu>
2274
2280
2275 * IPython/usage.py (__doc__): document the re-activated threading
2281 * IPython/usage.py (__doc__): document the re-activated threading
2276 options for WX and GTK.
2282 options for WX and GTK.
2277
2283
2278 2004-11-23 Fernando Perez <fperez@colorado.edu>
2284 2004-11-23 Fernando Perez <fperez@colorado.edu>
2279
2285
2280 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2286 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2281 the -wthread and -gthread options, along with a new -tk one to try
2287 the -wthread and -gthread options, along with a new -tk one to try
2282 and coordinate Tk threading with wx/gtk. The tk support is very
2288 and coordinate Tk threading with wx/gtk. The tk support is very
2283 platform dependent, since it seems to require Tcl and Tk to be
2289 platform dependent, since it seems to require Tcl and Tk to be
2284 built with threads (Fedora1/2 appears NOT to have it, but in
2290 built with threads (Fedora1/2 appears NOT to have it, but in
2285 Prabhu's Debian boxes it works OK). But even with some Tk
2291 Prabhu's Debian boxes it works OK). But even with some Tk
2286 limitations, this is a great improvement.
2292 limitations, this is a great improvement.
2287
2293
2288 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2294 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2289 info in user prompts. Patch by Prabhu.
2295 info in user prompts. Patch by Prabhu.
2290
2296
2291 2004-11-18 Fernando Perez <fperez@colorado.edu>
2297 2004-11-18 Fernando Perez <fperez@colorado.edu>
2292
2298
2293 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2299 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2294 EOFErrors and bail, to avoid infinite loops if a non-terminating
2300 EOFErrors and bail, to avoid infinite loops if a non-terminating
2295 file is fed into ipython. Patch submitted in issue 19 by user,
2301 file is fed into ipython. Patch submitted in issue 19 by user,
2296 many thanks.
2302 many thanks.
2297
2303
2298 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2304 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2299 autoquote/parens in continuation prompts, which can cause lots of
2305 autoquote/parens in continuation prompts, which can cause lots of
2300 problems. Closes roundup issue 20.
2306 problems. Closes roundup issue 20.
2301
2307
2302 2004-11-17 Fernando Perez <fperez@colorado.edu>
2308 2004-11-17 Fernando Perez <fperez@colorado.edu>
2303
2309
2304 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2310 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2305 reported as debian bug #280505. I'm not sure my local changelog
2311 reported as debian bug #280505. I'm not sure my local changelog
2306 entry has the proper debian format (Jack?).
2312 entry has the proper debian format (Jack?).
2307
2313
2308 2004-11-08 *** Released version 0.6.4
2314 2004-11-08 *** Released version 0.6.4
2309
2315
2310 2004-11-08 Fernando Perez <fperez@colorado.edu>
2316 2004-11-08 Fernando Perez <fperez@colorado.edu>
2311
2317
2312 * IPython/iplib.py (init_readline): Fix exit message for Windows
2318 * IPython/iplib.py (init_readline): Fix exit message for Windows
2313 when readline is active. Thanks to a report by Eric Jones
2319 when readline is active. Thanks to a report by Eric Jones
2314 <eric-AT-enthought.com>.
2320 <eric-AT-enthought.com>.
2315
2321
2316 2004-11-07 Fernando Perez <fperez@colorado.edu>
2322 2004-11-07 Fernando Perez <fperez@colorado.edu>
2317
2323
2318 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2324 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2319 sometimes seen by win2k/cygwin users.
2325 sometimes seen by win2k/cygwin users.
2320
2326
2321 2004-11-06 Fernando Perez <fperez@colorado.edu>
2327 2004-11-06 Fernando Perez <fperez@colorado.edu>
2322
2328
2323 * IPython/iplib.py (interact): Change the handling of %Exit from
2329 * IPython/iplib.py (interact): Change the handling of %Exit from
2324 trying to propagate a SystemExit to an internal ipython flag.
2330 trying to propagate a SystemExit to an internal ipython flag.
2325 This is less elegant than using Python's exception mechanism, but
2331 This is less elegant than using Python's exception mechanism, but
2326 I can't get that to work reliably with threads, so under -pylab
2332 I can't get that to work reliably with threads, so under -pylab
2327 %Exit was hanging IPython. Cross-thread exception handling is
2333 %Exit was hanging IPython. Cross-thread exception handling is
2328 really a bitch. Thaks to a bug report by Stephen Walton
2334 really a bitch. Thaks to a bug report by Stephen Walton
2329 <stephen.walton-AT-csun.edu>.
2335 <stephen.walton-AT-csun.edu>.
2330
2336
2331 2004-11-04 Fernando Perez <fperez@colorado.edu>
2337 2004-11-04 Fernando Perez <fperez@colorado.edu>
2332
2338
2333 * IPython/iplib.py (raw_input_original): store a pointer to the
2339 * IPython/iplib.py (raw_input_original): store a pointer to the
2334 true raw_input to harden against code which can modify it
2340 true raw_input to harden against code which can modify it
2335 (wx.py.PyShell does this and would otherwise crash ipython).
2341 (wx.py.PyShell does this and would otherwise crash ipython).
2336 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2342 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2337
2343
2338 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2344 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2339 Ctrl-C problem, which does not mess up the input line.
2345 Ctrl-C problem, which does not mess up the input line.
2340
2346
2341 2004-11-03 Fernando Perez <fperez@colorado.edu>
2347 2004-11-03 Fernando Perez <fperez@colorado.edu>
2342
2348
2343 * IPython/Release.py: Changed licensing to BSD, in all files.
2349 * IPython/Release.py: Changed licensing to BSD, in all files.
2344 (name): lowercase name for tarball/RPM release.
2350 (name): lowercase name for tarball/RPM release.
2345
2351
2346 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2352 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2347 use throughout ipython.
2353 use throughout ipython.
2348
2354
2349 * IPython/Magic.py (Magic._ofind): Switch to using the new
2355 * IPython/Magic.py (Magic._ofind): Switch to using the new
2350 OInspect.getdoc() function.
2356 OInspect.getdoc() function.
2351
2357
2352 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2358 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2353 of the line currently being canceled via Ctrl-C. It's extremely
2359 of the line currently being canceled via Ctrl-C. It's extremely
2354 ugly, but I don't know how to do it better (the problem is one of
2360 ugly, but I don't know how to do it better (the problem is one of
2355 handling cross-thread exceptions).
2361 handling cross-thread exceptions).
2356
2362
2357 2004-10-28 Fernando Perez <fperez@colorado.edu>
2363 2004-10-28 Fernando Perez <fperez@colorado.edu>
2358
2364
2359 * IPython/Shell.py (signal_handler): add signal handlers to trap
2365 * IPython/Shell.py (signal_handler): add signal handlers to trap
2360 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2366 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2361 report by Francesc Alted.
2367 report by Francesc Alted.
2362
2368
2363 2004-10-21 Fernando Perez <fperez@colorado.edu>
2369 2004-10-21 Fernando Perez <fperez@colorado.edu>
2364
2370
2365 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2371 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2366 to % for pysh syntax extensions.
2372 to % for pysh syntax extensions.
2367
2373
2368 2004-10-09 Fernando Perez <fperez@colorado.edu>
2374 2004-10-09 Fernando Perez <fperez@colorado.edu>
2369
2375
2370 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2376 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2371 arrays to print a more useful summary, without calling str(arr).
2377 arrays to print a more useful summary, without calling str(arr).
2372 This avoids the problem of extremely lengthy computations which
2378 This avoids the problem of extremely lengthy computations which
2373 occur if arr is large, and appear to the user as a system lockup
2379 occur if arr is large, and appear to the user as a system lockup
2374 with 100% cpu activity. After a suggestion by Kristian Sandberg
2380 with 100% cpu activity. After a suggestion by Kristian Sandberg
2375 <Kristian.Sandberg@colorado.edu>.
2381 <Kristian.Sandberg@colorado.edu>.
2376 (Magic.__init__): fix bug in global magic escapes not being
2382 (Magic.__init__): fix bug in global magic escapes not being
2377 correctly set.
2383 correctly set.
2378
2384
2379 2004-10-08 Fernando Perez <fperez@colorado.edu>
2385 2004-10-08 Fernando Perez <fperez@colorado.edu>
2380
2386
2381 * IPython/Magic.py (__license__): change to absolute imports of
2387 * IPython/Magic.py (__license__): change to absolute imports of
2382 ipython's own internal packages, to start adapting to the absolute
2388 ipython's own internal packages, to start adapting to the absolute
2383 import requirement of PEP-328.
2389 import requirement of PEP-328.
2384
2390
2385 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2391 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2386 files, and standardize author/license marks through the Release
2392 files, and standardize author/license marks through the Release
2387 module instead of having per/file stuff (except for files with
2393 module instead of having per/file stuff (except for files with
2388 particular licenses, like the MIT/PSF-licensed codes).
2394 particular licenses, like the MIT/PSF-licensed codes).
2389
2395
2390 * IPython/Debugger.py: remove dead code for python 2.1
2396 * IPython/Debugger.py: remove dead code for python 2.1
2391
2397
2392 2004-10-04 Fernando Perez <fperez@colorado.edu>
2398 2004-10-04 Fernando Perez <fperez@colorado.edu>
2393
2399
2394 * IPython/iplib.py (ipmagic): New function for accessing magics
2400 * IPython/iplib.py (ipmagic): New function for accessing magics
2395 via a normal python function call.
2401 via a normal python function call.
2396
2402
2397 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2403 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2398 from '@' to '%', to accomodate the new @decorator syntax of python
2404 from '@' to '%', to accomodate the new @decorator syntax of python
2399 2.4.
2405 2.4.
2400
2406
2401 2004-09-29 Fernando Perez <fperez@colorado.edu>
2407 2004-09-29 Fernando Perez <fperez@colorado.edu>
2402
2408
2403 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2409 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2404 matplotlib.use to prevent running scripts which try to switch
2410 matplotlib.use to prevent running scripts which try to switch
2405 interactive backends from within ipython. This will just crash
2411 interactive backends from within ipython. This will just crash
2406 the python interpreter, so we can't allow it (but a detailed error
2412 the python interpreter, so we can't allow it (but a detailed error
2407 is given to the user).
2413 is given to the user).
2408
2414
2409 2004-09-28 Fernando Perez <fperez@colorado.edu>
2415 2004-09-28 Fernando Perez <fperez@colorado.edu>
2410
2416
2411 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2417 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2412 matplotlib-related fixes so that using @run with non-matplotlib
2418 matplotlib-related fixes so that using @run with non-matplotlib
2413 scripts doesn't pop up spurious plot windows. This requires
2419 scripts doesn't pop up spurious plot windows. This requires
2414 matplotlib >= 0.63, where I had to make some changes as well.
2420 matplotlib >= 0.63, where I had to make some changes as well.
2415
2421
2416 * IPython/ipmaker.py (make_IPython): update version requirement to
2422 * IPython/ipmaker.py (make_IPython): update version requirement to
2417 python 2.2.
2423 python 2.2.
2418
2424
2419 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2425 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2420 banner arg for embedded customization.
2426 banner arg for embedded customization.
2421
2427
2422 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2428 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2423 explicit uses of __IP as the IPython's instance name. Now things
2429 explicit uses of __IP as the IPython's instance name. Now things
2424 are properly handled via the shell.name value. The actual code
2430 are properly handled via the shell.name value. The actual code
2425 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2431 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2426 is much better than before. I'll clean things completely when the
2432 is much better than before. I'll clean things completely when the
2427 magic stuff gets a real overhaul.
2433 magic stuff gets a real overhaul.
2428
2434
2429 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2435 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2430 minor changes to debian dir.
2436 minor changes to debian dir.
2431
2437
2432 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2438 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2433 pointer to the shell itself in the interactive namespace even when
2439 pointer to the shell itself in the interactive namespace even when
2434 a user-supplied dict is provided. This is needed for embedding
2440 a user-supplied dict is provided. This is needed for embedding
2435 purposes (found by tests with Michel Sanner).
2441 purposes (found by tests with Michel Sanner).
2436
2442
2437 2004-09-27 Fernando Perez <fperez@colorado.edu>
2443 2004-09-27 Fernando Perez <fperez@colorado.edu>
2438
2444
2439 * IPython/UserConfig/ipythonrc: remove []{} from
2445 * IPython/UserConfig/ipythonrc: remove []{} from
2440 readline_remove_delims, so that things like [modname.<TAB> do
2446 readline_remove_delims, so that things like [modname.<TAB> do
2441 proper completion. This disables [].TAB, but that's a less common
2447 proper completion. This disables [].TAB, but that's a less common
2442 case than module names in list comprehensions, for example.
2448 case than module names in list comprehensions, for example.
2443 Thanks to a report by Andrea Riciputi.
2449 Thanks to a report by Andrea Riciputi.
2444
2450
2445 2004-09-09 Fernando Perez <fperez@colorado.edu>
2451 2004-09-09 Fernando Perez <fperez@colorado.edu>
2446
2452
2447 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2453 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2448 blocking problems in win32 and osx. Fix by John.
2454 blocking problems in win32 and osx. Fix by John.
2449
2455
2450 2004-09-08 Fernando Perez <fperez@colorado.edu>
2456 2004-09-08 Fernando Perez <fperez@colorado.edu>
2451
2457
2452 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2458 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2453 for Win32 and OSX. Fix by John Hunter.
2459 for Win32 and OSX. Fix by John Hunter.
2454
2460
2455 2004-08-30 *** Released version 0.6.3
2461 2004-08-30 *** Released version 0.6.3
2456
2462
2457 2004-08-30 Fernando Perez <fperez@colorado.edu>
2463 2004-08-30 Fernando Perez <fperez@colorado.edu>
2458
2464
2459 * setup.py (isfile): Add manpages to list of dependent files to be
2465 * setup.py (isfile): Add manpages to list of dependent files to be
2460 updated.
2466 updated.
2461
2467
2462 2004-08-27 Fernando Perez <fperez@colorado.edu>
2468 2004-08-27 Fernando Perez <fperez@colorado.edu>
2463
2469
2464 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2470 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2465 for now. They don't really work with standalone WX/GTK code
2471 for now. They don't really work with standalone WX/GTK code
2466 (though matplotlib IS working fine with both of those backends).
2472 (though matplotlib IS working fine with both of those backends).
2467 This will neeed much more testing. I disabled most things with
2473 This will neeed much more testing. I disabled most things with
2468 comments, so turning it back on later should be pretty easy.
2474 comments, so turning it back on later should be pretty easy.
2469
2475
2470 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2476 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2471 autocalling of expressions like r'foo', by modifying the line
2477 autocalling of expressions like r'foo', by modifying the line
2472 split regexp. Closes
2478 split regexp. Closes
2473 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2479 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2474 Riley <ipythonbugs-AT-sabi.net>.
2480 Riley <ipythonbugs-AT-sabi.net>.
2475 (InteractiveShell.mainloop): honor --nobanner with banner
2481 (InteractiveShell.mainloop): honor --nobanner with banner
2476 extensions.
2482 extensions.
2477
2483
2478 * IPython/Shell.py: Significant refactoring of all classes, so
2484 * IPython/Shell.py: Significant refactoring of all classes, so
2479 that we can really support ALL matplotlib backends and threading
2485 that we can really support ALL matplotlib backends and threading
2480 models (John spotted a bug with Tk which required this). Now we
2486 models (John spotted a bug with Tk which required this). Now we
2481 should support single-threaded, WX-threads and GTK-threads, both
2487 should support single-threaded, WX-threads and GTK-threads, both
2482 for generic code and for matplotlib.
2488 for generic code and for matplotlib.
2483
2489
2484 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2490 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2485 -pylab, to simplify things for users. Will also remove the pylab
2491 -pylab, to simplify things for users. Will also remove the pylab
2486 profile, since now all of matplotlib configuration is directly
2492 profile, since now all of matplotlib configuration is directly
2487 handled here. This also reduces startup time.
2493 handled here. This also reduces startup time.
2488
2494
2489 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2495 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2490 shell wasn't being correctly called. Also in IPShellWX.
2496 shell wasn't being correctly called. Also in IPShellWX.
2491
2497
2492 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2498 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2493 fine-tune banner.
2499 fine-tune banner.
2494
2500
2495 * IPython/numutils.py (spike): Deprecate these spike functions,
2501 * IPython/numutils.py (spike): Deprecate these spike functions,
2496 delete (long deprecated) gnuplot_exec handler.
2502 delete (long deprecated) gnuplot_exec handler.
2497
2503
2498 2004-08-26 Fernando Perez <fperez@colorado.edu>
2504 2004-08-26 Fernando Perez <fperez@colorado.edu>
2499
2505
2500 * ipython.1: Update for threading options, plus some others which
2506 * ipython.1: Update for threading options, plus some others which
2501 were missing.
2507 were missing.
2502
2508
2503 * IPython/ipmaker.py (__call__): Added -wthread option for
2509 * IPython/ipmaker.py (__call__): Added -wthread option for
2504 wxpython thread handling. Make sure threading options are only
2510 wxpython thread handling. Make sure threading options are only
2505 valid at the command line.
2511 valid at the command line.
2506
2512
2507 * scripts/ipython: moved shell selection into a factory function
2513 * scripts/ipython: moved shell selection into a factory function
2508 in Shell.py, to keep the starter script to a minimum.
2514 in Shell.py, to keep the starter script to a minimum.
2509
2515
2510 2004-08-25 Fernando Perez <fperez@colorado.edu>
2516 2004-08-25 Fernando Perez <fperez@colorado.edu>
2511
2517
2512 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2518 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2513 John. Along with some recent changes he made to matplotlib, the
2519 John. Along with some recent changes he made to matplotlib, the
2514 next versions of both systems should work very well together.
2520 next versions of both systems should work very well together.
2515
2521
2516 2004-08-24 Fernando Perez <fperez@colorado.edu>
2522 2004-08-24 Fernando Perez <fperez@colorado.edu>
2517
2523
2518 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2524 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2519 tried to switch the profiling to using hotshot, but I'm getting
2525 tried to switch the profiling to using hotshot, but I'm getting
2520 strange errors from prof.runctx() there. I may be misreading the
2526 strange errors from prof.runctx() there. I may be misreading the
2521 docs, but it looks weird. For now the profiling code will
2527 docs, but it looks weird. For now the profiling code will
2522 continue to use the standard profiler.
2528 continue to use the standard profiler.
2523
2529
2524 2004-08-23 Fernando Perez <fperez@colorado.edu>
2530 2004-08-23 Fernando Perez <fperez@colorado.edu>
2525
2531
2526 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2532 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2527 threaded shell, by John Hunter. It's not quite ready yet, but
2533 threaded shell, by John Hunter. It's not quite ready yet, but
2528 close.
2534 close.
2529
2535
2530 2004-08-22 Fernando Perez <fperez@colorado.edu>
2536 2004-08-22 Fernando Perez <fperez@colorado.edu>
2531
2537
2532 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2538 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2533 in Magic and ultraTB.
2539 in Magic and ultraTB.
2534
2540
2535 * ipython.1: document threading options in manpage.
2541 * ipython.1: document threading options in manpage.
2536
2542
2537 * scripts/ipython: Changed name of -thread option to -gthread,
2543 * scripts/ipython: Changed name of -thread option to -gthread,
2538 since this is GTK specific. I want to leave the door open for a
2544 since this is GTK specific. I want to leave the door open for a
2539 -wthread option for WX, which will most likely be necessary. This
2545 -wthread option for WX, which will most likely be necessary. This
2540 change affects usage and ipmaker as well.
2546 change affects usage and ipmaker as well.
2541
2547
2542 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2548 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2543 handle the matplotlib shell issues. Code by John Hunter
2549 handle the matplotlib shell issues. Code by John Hunter
2544 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2550 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2545 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2551 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2546 broken (and disabled for end users) for now, but it puts the
2552 broken (and disabled for end users) for now, but it puts the
2547 infrastructure in place.
2553 infrastructure in place.
2548
2554
2549 2004-08-21 Fernando Perez <fperez@colorado.edu>
2555 2004-08-21 Fernando Perez <fperez@colorado.edu>
2550
2556
2551 * ipythonrc-pylab: Add matplotlib support.
2557 * ipythonrc-pylab: Add matplotlib support.
2552
2558
2553 * matplotlib_config.py: new files for matplotlib support, part of
2559 * matplotlib_config.py: new files for matplotlib support, part of
2554 the pylab profile.
2560 the pylab profile.
2555
2561
2556 * IPython/usage.py (__doc__): documented the threading options.
2562 * IPython/usage.py (__doc__): documented the threading options.
2557
2563
2558 2004-08-20 Fernando Perez <fperez@colorado.edu>
2564 2004-08-20 Fernando Perez <fperez@colorado.edu>
2559
2565
2560 * ipython: Modified the main calling routine to handle the -thread
2566 * ipython: Modified the main calling routine to handle the -thread
2561 and -mpthread options. This needs to be done as a top-level hack,
2567 and -mpthread options. This needs to be done as a top-level hack,
2562 because it determines which class to instantiate for IPython
2568 because it determines which class to instantiate for IPython
2563 itself.
2569 itself.
2564
2570
2565 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2571 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2566 classes to support multithreaded GTK operation without blocking,
2572 classes to support multithreaded GTK operation without blocking,
2567 and matplotlib with all backends. This is a lot of still very
2573 and matplotlib with all backends. This is a lot of still very
2568 experimental code, and threads are tricky. So it may still have a
2574 experimental code, and threads are tricky. So it may still have a
2569 few rough edges... This code owes a lot to
2575 few rough edges... This code owes a lot to
2570 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2576 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2571 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2577 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2572 to John Hunter for all the matplotlib work.
2578 to John Hunter for all the matplotlib work.
2573
2579
2574 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2580 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2575 options for gtk thread and matplotlib support.
2581 options for gtk thread and matplotlib support.
2576
2582
2577 2004-08-16 Fernando Perez <fperez@colorado.edu>
2583 2004-08-16 Fernando Perez <fperez@colorado.edu>
2578
2584
2579 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2585 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2580 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2586 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2581 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2587 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2582
2588
2583 2004-08-11 Fernando Perez <fperez@colorado.edu>
2589 2004-08-11 Fernando Perez <fperez@colorado.edu>
2584
2590
2585 * setup.py (isfile): Fix build so documentation gets updated for
2591 * setup.py (isfile): Fix build so documentation gets updated for
2586 rpms (it was only done for .tgz builds).
2592 rpms (it was only done for .tgz builds).
2587
2593
2588 2004-08-10 Fernando Perez <fperez@colorado.edu>
2594 2004-08-10 Fernando Perez <fperez@colorado.edu>
2589
2595
2590 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2596 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2591
2597
2592 * iplib.py : Silence syntax error exceptions in tab-completion.
2598 * iplib.py : Silence syntax error exceptions in tab-completion.
2593
2599
2594 2004-08-05 Fernando Perez <fperez@colorado.edu>
2600 2004-08-05 Fernando Perez <fperez@colorado.edu>
2595
2601
2596 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2602 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2597 'color off' mark for continuation prompts. This was causing long
2603 'color off' mark for continuation prompts. This was causing long
2598 continuation lines to mis-wrap.
2604 continuation lines to mis-wrap.
2599
2605
2600 2004-08-01 Fernando Perez <fperez@colorado.edu>
2606 2004-08-01 Fernando Perez <fperez@colorado.edu>
2601
2607
2602 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2608 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2603 for building ipython to be a parameter. All this is necessary
2609 for building ipython to be a parameter. All this is necessary
2604 right now to have a multithreaded version, but this insane
2610 right now to have a multithreaded version, but this insane
2605 non-design will be cleaned up soon. For now, it's a hack that
2611 non-design will be cleaned up soon. For now, it's a hack that
2606 works.
2612 works.
2607
2613
2608 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2614 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2609 args in various places. No bugs so far, but it's a dangerous
2615 args in various places. No bugs so far, but it's a dangerous
2610 practice.
2616 practice.
2611
2617
2612 2004-07-31 Fernando Perez <fperez@colorado.edu>
2618 2004-07-31 Fernando Perez <fperez@colorado.edu>
2613
2619
2614 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2620 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2615 fix completion of files with dots in their names under most
2621 fix completion of files with dots in their names under most
2616 profiles (pysh was OK because the completion order is different).
2622 profiles (pysh was OK because the completion order is different).
2617
2623
2618 2004-07-27 Fernando Perez <fperez@colorado.edu>
2624 2004-07-27 Fernando Perez <fperez@colorado.edu>
2619
2625
2620 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2626 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2621 keywords manually, b/c the one in keyword.py was removed in python
2627 keywords manually, b/c the one in keyword.py was removed in python
2622 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2628 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2623 This is NOT a bug under python 2.3 and earlier.
2629 This is NOT a bug under python 2.3 and earlier.
2624
2630
2625 2004-07-26 Fernando Perez <fperez@colorado.edu>
2631 2004-07-26 Fernando Perez <fperez@colorado.edu>
2626
2632
2627 * IPython/ultraTB.py (VerboseTB.text): Add another
2633 * IPython/ultraTB.py (VerboseTB.text): Add another
2628 linecache.checkcache() call to try to prevent inspect.py from
2634 linecache.checkcache() call to try to prevent inspect.py from
2629 crashing under python 2.3. I think this fixes
2635 crashing under python 2.3. I think this fixes
2630 http://www.scipy.net/roundup/ipython/issue17.
2636 http://www.scipy.net/roundup/ipython/issue17.
2631
2637
2632 2004-07-26 *** Released version 0.6.2
2638 2004-07-26 *** Released version 0.6.2
2633
2639
2634 2004-07-26 Fernando Perez <fperez@colorado.edu>
2640 2004-07-26 Fernando Perez <fperez@colorado.edu>
2635
2641
2636 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2642 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2637 fail for any number.
2643 fail for any number.
2638 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2644 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2639 empty bookmarks.
2645 empty bookmarks.
2640
2646
2641 2004-07-26 *** Released version 0.6.1
2647 2004-07-26 *** Released version 0.6.1
2642
2648
2643 2004-07-26 Fernando Perez <fperez@colorado.edu>
2649 2004-07-26 Fernando Perez <fperez@colorado.edu>
2644
2650
2645 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2651 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2646
2652
2647 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2653 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2648 escaping '()[]{}' in filenames.
2654 escaping '()[]{}' in filenames.
2649
2655
2650 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2656 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2651 Python 2.2 users who lack a proper shlex.split.
2657 Python 2.2 users who lack a proper shlex.split.
2652
2658
2653 2004-07-19 Fernando Perez <fperez@colorado.edu>
2659 2004-07-19 Fernando Perez <fperez@colorado.edu>
2654
2660
2655 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2661 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2656 for reading readline's init file. I follow the normal chain:
2662 for reading readline's init file. I follow the normal chain:
2657 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2663 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2658 report by Mike Heeter. This closes
2664 report by Mike Heeter. This closes
2659 http://www.scipy.net/roundup/ipython/issue16.
2665 http://www.scipy.net/roundup/ipython/issue16.
2660
2666
2661 2004-07-18 Fernando Perez <fperez@colorado.edu>
2667 2004-07-18 Fernando Perez <fperez@colorado.edu>
2662
2668
2663 * IPython/iplib.py (__init__): Add better handling of '\' under
2669 * IPython/iplib.py (__init__): Add better handling of '\' under
2664 Win32 for filenames. After a patch by Ville.
2670 Win32 for filenames. After a patch by Ville.
2665
2671
2666 2004-07-17 Fernando Perez <fperez@colorado.edu>
2672 2004-07-17 Fernando Perez <fperez@colorado.edu>
2667
2673
2668 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2674 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2669 autocalling would be triggered for 'foo is bar' if foo is
2675 autocalling would be triggered for 'foo is bar' if foo is
2670 callable. I also cleaned up the autocall detection code to use a
2676 callable. I also cleaned up the autocall detection code to use a
2671 regexp, which is faster. Bug reported by Alexander Schmolck.
2677 regexp, which is faster. Bug reported by Alexander Schmolck.
2672
2678
2673 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2679 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2674 '?' in them would confuse the help system. Reported by Alex
2680 '?' in them would confuse the help system. Reported by Alex
2675 Schmolck.
2681 Schmolck.
2676
2682
2677 2004-07-16 Fernando Perez <fperez@colorado.edu>
2683 2004-07-16 Fernando Perez <fperez@colorado.edu>
2678
2684
2679 * IPython/GnuplotInteractive.py (__all__): added plot2.
2685 * IPython/GnuplotInteractive.py (__all__): added plot2.
2680
2686
2681 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2687 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2682 plotting dictionaries, lists or tuples of 1d arrays.
2688 plotting dictionaries, lists or tuples of 1d arrays.
2683
2689
2684 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2690 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2685 optimizations.
2691 optimizations.
2686
2692
2687 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2693 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2688 the information which was there from Janko's original IPP code:
2694 the information which was there from Janko's original IPP code:
2689
2695
2690 03.05.99 20:53 porto.ifm.uni-kiel.de
2696 03.05.99 20:53 porto.ifm.uni-kiel.de
2691 --Started changelog.
2697 --Started changelog.
2692 --make clear do what it say it does
2698 --make clear do what it say it does
2693 --added pretty output of lines from inputcache
2699 --added pretty output of lines from inputcache
2694 --Made Logger a mixin class, simplifies handling of switches
2700 --Made Logger a mixin class, simplifies handling of switches
2695 --Added own completer class. .string<TAB> expands to last history
2701 --Added own completer class. .string<TAB> expands to last history
2696 line which starts with string. The new expansion is also present
2702 line which starts with string. The new expansion is also present
2697 with Ctrl-r from the readline library. But this shows, who this
2703 with Ctrl-r from the readline library. But this shows, who this
2698 can be done for other cases.
2704 can be done for other cases.
2699 --Added convention that all shell functions should accept a
2705 --Added convention that all shell functions should accept a
2700 parameter_string This opens the door for different behaviour for
2706 parameter_string This opens the door for different behaviour for
2701 each function. @cd is a good example of this.
2707 each function. @cd is a good example of this.
2702
2708
2703 04.05.99 12:12 porto.ifm.uni-kiel.de
2709 04.05.99 12:12 porto.ifm.uni-kiel.de
2704 --added logfile rotation
2710 --added logfile rotation
2705 --added new mainloop method which freezes first the namespace
2711 --added new mainloop method which freezes first the namespace
2706
2712
2707 07.05.99 21:24 porto.ifm.uni-kiel.de
2713 07.05.99 21:24 porto.ifm.uni-kiel.de
2708 --added the docreader classes. Now there is a help system.
2714 --added the docreader classes. Now there is a help system.
2709 -This is only a first try. Currently it's not easy to put new
2715 -This is only a first try. Currently it's not easy to put new
2710 stuff in the indices. But this is the way to go. Info would be
2716 stuff in the indices. But this is the way to go. Info would be
2711 better, but HTML is every where and not everybody has an info
2717 better, but HTML is every where and not everybody has an info
2712 system installed and it's not so easy to change html-docs to info.
2718 system installed and it's not so easy to change html-docs to info.
2713 --added global logfile option
2719 --added global logfile option
2714 --there is now a hook for object inspection method pinfo needs to
2720 --there is now a hook for object inspection method pinfo needs to
2715 be provided for this. Can be reached by two '??'.
2721 be provided for this. Can be reached by two '??'.
2716
2722
2717 08.05.99 20:51 porto.ifm.uni-kiel.de
2723 08.05.99 20:51 porto.ifm.uni-kiel.de
2718 --added a README
2724 --added a README
2719 --bug in rc file. Something has changed so functions in the rc
2725 --bug in rc file. Something has changed so functions in the rc
2720 file need to reference the shell and not self. Not clear if it's a
2726 file need to reference the shell and not self. Not clear if it's a
2721 bug or feature.
2727 bug or feature.
2722 --changed rc file for new behavior
2728 --changed rc file for new behavior
2723
2729
2724 2004-07-15 Fernando Perez <fperez@colorado.edu>
2730 2004-07-15 Fernando Perez <fperez@colorado.edu>
2725
2731
2726 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2732 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2727 cache was falling out of sync in bizarre manners when multi-line
2733 cache was falling out of sync in bizarre manners when multi-line
2728 input was present. Minor optimizations and cleanup.
2734 input was present. Minor optimizations and cleanup.
2729
2735
2730 (Logger): Remove old Changelog info for cleanup. This is the
2736 (Logger): Remove old Changelog info for cleanup. This is the
2731 information which was there from Janko's original code:
2737 information which was there from Janko's original code:
2732
2738
2733 Changes to Logger: - made the default log filename a parameter
2739 Changes to Logger: - made the default log filename a parameter
2734
2740
2735 - put a check for lines beginning with !@? in log(). Needed
2741 - put a check for lines beginning with !@? in log(). Needed
2736 (even if the handlers properly log their lines) for mid-session
2742 (even if the handlers properly log their lines) for mid-session
2737 logging activation to work properly. Without this, lines logged
2743 logging activation to work properly. Without this, lines logged
2738 in mid session, which get read from the cache, would end up
2744 in mid session, which get read from the cache, would end up
2739 'bare' (with !@? in the open) in the log. Now they are caught
2745 'bare' (with !@? in the open) in the log. Now they are caught
2740 and prepended with a #.
2746 and prepended with a #.
2741
2747
2742 * IPython/iplib.py (InteractiveShell.init_readline): added check
2748 * IPython/iplib.py (InteractiveShell.init_readline): added check
2743 in case MagicCompleter fails to be defined, so we don't crash.
2749 in case MagicCompleter fails to be defined, so we don't crash.
2744
2750
2745 2004-07-13 Fernando Perez <fperez@colorado.edu>
2751 2004-07-13 Fernando Perez <fperez@colorado.edu>
2746
2752
2747 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2753 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2748 of EPS if the requested filename ends in '.eps'.
2754 of EPS if the requested filename ends in '.eps'.
2749
2755
2750 2004-07-04 Fernando Perez <fperez@colorado.edu>
2756 2004-07-04 Fernando Perez <fperez@colorado.edu>
2751
2757
2752 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2758 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2753 escaping of quotes when calling the shell.
2759 escaping of quotes when calling the shell.
2754
2760
2755 2004-07-02 Fernando Perez <fperez@colorado.edu>
2761 2004-07-02 Fernando Perez <fperez@colorado.edu>
2756
2762
2757 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2763 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2758 gettext not working because we were clobbering '_'. Fixes
2764 gettext not working because we were clobbering '_'. Fixes
2759 http://www.scipy.net/roundup/ipython/issue6.
2765 http://www.scipy.net/roundup/ipython/issue6.
2760
2766
2761 2004-07-01 Fernando Perez <fperez@colorado.edu>
2767 2004-07-01 Fernando Perez <fperez@colorado.edu>
2762
2768
2763 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2769 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2764 into @cd. Patch by Ville.
2770 into @cd. Patch by Ville.
2765
2771
2766 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2772 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2767 new function to store things after ipmaker runs. Patch by Ville.
2773 new function to store things after ipmaker runs. Patch by Ville.
2768 Eventually this will go away once ipmaker is removed and the class
2774 Eventually this will go away once ipmaker is removed and the class
2769 gets cleaned up, but for now it's ok. Key functionality here is
2775 gets cleaned up, but for now it's ok. Key functionality here is
2770 the addition of the persistent storage mechanism, a dict for
2776 the addition of the persistent storage mechanism, a dict for
2771 keeping data across sessions (for now just bookmarks, but more can
2777 keeping data across sessions (for now just bookmarks, but more can
2772 be implemented later).
2778 be implemented later).
2773
2779
2774 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2780 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2775 persistent across sections. Patch by Ville, I modified it
2781 persistent across sections. Patch by Ville, I modified it
2776 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2782 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2777 added a '-l' option to list all bookmarks.
2783 added a '-l' option to list all bookmarks.
2778
2784
2779 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2785 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2780 center for cleanup. Registered with atexit.register(). I moved
2786 center for cleanup. Registered with atexit.register(). I moved
2781 here the old exit_cleanup(). After a patch by Ville.
2787 here the old exit_cleanup(). After a patch by Ville.
2782
2788
2783 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2789 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2784 characters in the hacked shlex_split for python 2.2.
2790 characters in the hacked shlex_split for python 2.2.
2785
2791
2786 * IPython/iplib.py (file_matches): more fixes to filenames with
2792 * IPython/iplib.py (file_matches): more fixes to filenames with
2787 whitespace in them. It's not perfect, but limitations in python's
2793 whitespace in them. It's not perfect, but limitations in python's
2788 readline make it impossible to go further.
2794 readline make it impossible to go further.
2789
2795
2790 2004-06-29 Fernando Perez <fperez@colorado.edu>
2796 2004-06-29 Fernando Perez <fperez@colorado.edu>
2791
2797
2792 * IPython/iplib.py (file_matches): escape whitespace correctly in
2798 * IPython/iplib.py (file_matches): escape whitespace correctly in
2793 filename completions. Bug reported by Ville.
2799 filename completions. Bug reported by Ville.
2794
2800
2795 2004-06-28 Fernando Perez <fperez@colorado.edu>
2801 2004-06-28 Fernando Perez <fperez@colorado.edu>
2796
2802
2797 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2803 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2798 the history file will be called 'history-PROFNAME' (or just
2804 the history file will be called 'history-PROFNAME' (or just
2799 'history' if no profile is loaded). I was getting annoyed at
2805 'history' if no profile is loaded). I was getting annoyed at
2800 getting my Numerical work history clobbered by pysh sessions.
2806 getting my Numerical work history clobbered by pysh sessions.
2801
2807
2802 * IPython/iplib.py (InteractiveShell.__init__): Internal
2808 * IPython/iplib.py (InteractiveShell.__init__): Internal
2803 getoutputerror() function so that we can honor the system_verbose
2809 getoutputerror() function so that we can honor the system_verbose
2804 flag for _all_ system calls. I also added escaping of #
2810 flag for _all_ system calls. I also added escaping of #
2805 characters here to avoid confusing Itpl.
2811 characters here to avoid confusing Itpl.
2806
2812
2807 * IPython/Magic.py (shlex_split): removed call to shell in
2813 * IPython/Magic.py (shlex_split): removed call to shell in
2808 parse_options and replaced it with shlex.split(). The annoying
2814 parse_options and replaced it with shlex.split(). The annoying
2809 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2815 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2810 to backport it from 2.3, with several frail hacks (the shlex
2816 to backport it from 2.3, with several frail hacks (the shlex
2811 module is rather limited in 2.2). Thanks to a suggestion by Ville
2817 module is rather limited in 2.2). Thanks to a suggestion by Ville
2812 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2818 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2813 problem.
2819 problem.
2814
2820
2815 (Magic.magic_system_verbose): new toggle to print the actual
2821 (Magic.magic_system_verbose): new toggle to print the actual
2816 system calls made by ipython. Mainly for debugging purposes.
2822 system calls made by ipython. Mainly for debugging purposes.
2817
2823
2818 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2824 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2819 doesn't support persistence. Reported (and fix suggested) by
2825 doesn't support persistence. Reported (and fix suggested) by
2820 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2826 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2821
2827
2822 2004-06-26 Fernando Perez <fperez@colorado.edu>
2828 2004-06-26 Fernando Perez <fperez@colorado.edu>
2823
2829
2824 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2830 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2825 continue prompts.
2831 continue prompts.
2826
2832
2827 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2833 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2828 function (basically a big docstring) and a few more things here to
2834 function (basically a big docstring) and a few more things here to
2829 speedup startup. pysh.py is now very lightweight. We want because
2835 speedup startup. pysh.py is now very lightweight. We want because
2830 it gets execfile'd, while InterpreterExec gets imported, so
2836 it gets execfile'd, while InterpreterExec gets imported, so
2831 byte-compilation saves time.
2837 byte-compilation saves time.
2832
2838
2833 2004-06-25 Fernando Perez <fperez@colorado.edu>
2839 2004-06-25 Fernando Perez <fperez@colorado.edu>
2834
2840
2835 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2841 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2836 -NUM', which was recently broken.
2842 -NUM', which was recently broken.
2837
2843
2838 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2844 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2839 in multi-line input (but not !!, which doesn't make sense there).
2845 in multi-line input (but not !!, which doesn't make sense there).
2840
2846
2841 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2847 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2842 It's just too useful, and people can turn it off in the less
2848 It's just too useful, and people can turn it off in the less
2843 common cases where it's a problem.
2849 common cases where it's a problem.
2844
2850
2845 2004-06-24 Fernando Perez <fperez@colorado.edu>
2851 2004-06-24 Fernando Perez <fperez@colorado.edu>
2846
2852
2847 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2853 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2848 special syntaxes (like alias calling) is now allied in multi-line
2854 special syntaxes (like alias calling) is now allied in multi-line
2849 input. This is still _very_ experimental, but it's necessary for
2855 input. This is still _very_ experimental, but it's necessary for
2850 efficient shell usage combining python looping syntax with system
2856 efficient shell usage combining python looping syntax with system
2851 calls. For now it's restricted to aliases, I don't think it
2857 calls. For now it's restricted to aliases, I don't think it
2852 really even makes sense to have this for magics.
2858 really even makes sense to have this for magics.
2853
2859
2854 2004-06-23 Fernando Perez <fperez@colorado.edu>
2860 2004-06-23 Fernando Perez <fperez@colorado.edu>
2855
2861
2856 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2862 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2857 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2863 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2858
2864
2859 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2865 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2860 extensions under Windows (after code sent by Gary Bishop). The
2866 extensions under Windows (after code sent by Gary Bishop). The
2861 extensions considered 'executable' are stored in IPython's rc
2867 extensions considered 'executable' are stored in IPython's rc
2862 structure as win_exec_ext.
2868 structure as win_exec_ext.
2863
2869
2864 * IPython/genutils.py (shell): new function, like system() but
2870 * IPython/genutils.py (shell): new function, like system() but
2865 without return value. Very useful for interactive shell work.
2871 without return value. Very useful for interactive shell work.
2866
2872
2867 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2873 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2868 delete aliases.
2874 delete aliases.
2869
2875
2870 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2876 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2871 sure that the alias table doesn't contain python keywords.
2877 sure that the alias table doesn't contain python keywords.
2872
2878
2873 2004-06-21 Fernando Perez <fperez@colorado.edu>
2879 2004-06-21 Fernando Perez <fperez@colorado.edu>
2874
2880
2875 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2881 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2876 non-existent items are found in $PATH. Reported by Thorsten.
2882 non-existent items are found in $PATH. Reported by Thorsten.
2877
2883
2878 2004-06-20 Fernando Perez <fperez@colorado.edu>
2884 2004-06-20 Fernando Perez <fperez@colorado.edu>
2879
2885
2880 * IPython/iplib.py (complete): modified the completer so that the
2886 * IPython/iplib.py (complete): modified the completer so that the
2881 order of priorities can be easily changed at runtime.
2887 order of priorities can be easily changed at runtime.
2882
2888
2883 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2889 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2884 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2890 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2885
2891
2886 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2892 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2887 expand Python variables prepended with $ in all system calls. The
2893 expand Python variables prepended with $ in all system calls. The
2888 same was done to InteractiveShell.handle_shell_escape. Now all
2894 same was done to InteractiveShell.handle_shell_escape. Now all
2889 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2895 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2890 expansion of python variables and expressions according to the
2896 expansion of python variables and expressions according to the
2891 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2897 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2892
2898
2893 Though PEP-215 has been rejected, a similar (but simpler) one
2899 Though PEP-215 has been rejected, a similar (but simpler) one
2894 seems like it will go into Python 2.4, PEP-292 -
2900 seems like it will go into Python 2.4, PEP-292 -
2895 http://www.python.org/peps/pep-0292.html.
2901 http://www.python.org/peps/pep-0292.html.
2896
2902
2897 I'll keep the full syntax of PEP-215, since IPython has since the
2903 I'll keep the full syntax of PEP-215, since IPython has since the
2898 start used Ka-Ping Yee's reference implementation discussed there
2904 start used Ka-Ping Yee's reference implementation discussed there
2899 (Itpl), and I actually like the powerful semantics it offers.
2905 (Itpl), and I actually like the powerful semantics it offers.
2900
2906
2901 In order to access normal shell variables, the $ has to be escaped
2907 In order to access normal shell variables, the $ has to be escaped
2902 via an extra $. For example:
2908 via an extra $. For example:
2903
2909
2904 In [7]: PATH='a python variable'
2910 In [7]: PATH='a python variable'
2905
2911
2906 In [8]: !echo $PATH
2912 In [8]: !echo $PATH
2907 a python variable
2913 a python variable
2908
2914
2909 In [9]: !echo $$PATH
2915 In [9]: !echo $$PATH
2910 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2916 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2911
2917
2912 (Magic.parse_options): escape $ so the shell doesn't evaluate
2918 (Magic.parse_options): escape $ so the shell doesn't evaluate
2913 things prematurely.
2919 things prematurely.
2914
2920
2915 * IPython/iplib.py (InteractiveShell.call_alias): added the
2921 * IPython/iplib.py (InteractiveShell.call_alias): added the
2916 ability for aliases to expand python variables via $.
2922 ability for aliases to expand python variables via $.
2917
2923
2918 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2924 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2919 system, now there's a @rehash/@rehashx pair of magics. These work
2925 system, now there's a @rehash/@rehashx pair of magics. These work
2920 like the csh rehash command, and can be invoked at any time. They
2926 like the csh rehash command, and can be invoked at any time. They
2921 build a table of aliases to everything in the user's $PATH
2927 build a table of aliases to everything in the user's $PATH
2922 (@rehash uses everything, @rehashx is slower but only adds
2928 (@rehash uses everything, @rehashx is slower but only adds
2923 executable files). With this, the pysh.py-based shell profile can
2929 executable files). With this, the pysh.py-based shell profile can
2924 now simply call rehash upon startup, and full access to all
2930 now simply call rehash upon startup, and full access to all
2925 programs in the user's path is obtained.
2931 programs in the user's path is obtained.
2926
2932
2927 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2933 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2928 functionality is now fully in place. I removed the old dynamic
2934 functionality is now fully in place. I removed the old dynamic
2929 code generation based approach, in favor of a much lighter one
2935 code generation based approach, in favor of a much lighter one
2930 based on a simple dict. The advantage is that this allows me to
2936 based on a simple dict. The advantage is that this allows me to
2931 now have thousands of aliases with negligible cost (unthinkable
2937 now have thousands of aliases with negligible cost (unthinkable
2932 with the old system).
2938 with the old system).
2933
2939
2934 2004-06-19 Fernando Perez <fperez@colorado.edu>
2940 2004-06-19 Fernando Perez <fperez@colorado.edu>
2935
2941
2936 * IPython/iplib.py (__init__): extended MagicCompleter class to
2942 * IPython/iplib.py (__init__): extended MagicCompleter class to
2937 also complete (last in priority) on user aliases.
2943 also complete (last in priority) on user aliases.
2938
2944
2939 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2945 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2940 call to eval.
2946 call to eval.
2941 (ItplNS.__init__): Added a new class which functions like Itpl,
2947 (ItplNS.__init__): Added a new class which functions like Itpl,
2942 but allows configuring the namespace for the evaluation to occur
2948 but allows configuring the namespace for the evaluation to occur
2943 in.
2949 in.
2944
2950
2945 2004-06-18 Fernando Perez <fperez@colorado.edu>
2951 2004-06-18 Fernando Perez <fperez@colorado.edu>
2946
2952
2947 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2953 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2948 better message when 'exit' or 'quit' are typed (a common newbie
2954 better message when 'exit' or 'quit' are typed (a common newbie
2949 confusion).
2955 confusion).
2950
2956
2951 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2957 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2952 check for Windows users.
2958 check for Windows users.
2953
2959
2954 * IPython/iplib.py (InteractiveShell.user_setup): removed
2960 * IPython/iplib.py (InteractiveShell.user_setup): removed
2955 disabling of colors for Windows. I'll test at runtime and issue a
2961 disabling of colors for Windows. I'll test at runtime and issue a
2956 warning if Gary's readline isn't found, as to nudge users to
2962 warning if Gary's readline isn't found, as to nudge users to
2957 download it.
2963 download it.
2958
2964
2959 2004-06-16 Fernando Perez <fperez@colorado.edu>
2965 2004-06-16 Fernando Perez <fperez@colorado.edu>
2960
2966
2961 * IPython/genutils.py (Stream.__init__): changed to print errors
2967 * IPython/genutils.py (Stream.__init__): changed to print errors
2962 to sys.stderr. I had a circular dependency here. Now it's
2968 to sys.stderr. I had a circular dependency here. Now it's
2963 possible to run ipython as IDLE's shell (consider this pre-alpha,
2969 possible to run ipython as IDLE's shell (consider this pre-alpha,
2964 since true stdout things end up in the starting terminal instead
2970 since true stdout things end up in the starting terminal instead
2965 of IDLE's out).
2971 of IDLE's out).
2966
2972
2967 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
2973 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
2968 users who haven't # updated their prompt_in2 definitions. Remove
2974 users who haven't # updated their prompt_in2 definitions. Remove
2969 eventually.
2975 eventually.
2970 (multiple_replace): added credit to original ASPN recipe.
2976 (multiple_replace): added credit to original ASPN recipe.
2971
2977
2972 2004-06-15 Fernando Perez <fperez@colorado.edu>
2978 2004-06-15 Fernando Perez <fperez@colorado.edu>
2973
2979
2974 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
2980 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
2975 list of auto-defined aliases.
2981 list of auto-defined aliases.
2976
2982
2977 2004-06-13 Fernando Perez <fperez@colorado.edu>
2983 2004-06-13 Fernando Perez <fperez@colorado.edu>
2978
2984
2979 * setup.py (scriptfiles): Don't trigger win_post_install unless an
2985 * setup.py (scriptfiles): Don't trigger win_post_install unless an
2980 install was really requested (so setup.py can be used for other
2986 install was really requested (so setup.py can be used for other
2981 things under Windows).
2987 things under Windows).
2982
2988
2983 2004-06-10 Fernando Perez <fperez@colorado.edu>
2989 2004-06-10 Fernando Perez <fperez@colorado.edu>
2984
2990
2985 * IPython/Logger.py (Logger.create_log): Manually remove any old
2991 * IPython/Logger.py (Logger.create_log): Manually remove any old
2986 backup, since os.remove may fail under Windows. Fixes bug
2992 backup, since os.remove may fail under Windows. Fixes bug
2987 reported by Thorsten.
2993 reported by Thorsten.
2988
2994
2989 2004-06-09 Fernando Perez <fperez@colorado.edu>
2995 2004-06-09 Fernando Perez <fperez@colorado.edu>
2990
2996
2991 * examples/example-embed.py: fixed all references to %n (replaced
2997 * examples/example-embed.py: fixed all references to %n (replaced
2992 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
2998 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
2993 for all examples and the manual as well.
2999 for all examples and the manual as well.
2994
3000
2995 2004-06-08 Fernando Perez <fperez@colorado.edu>
3001 2004-06-08 Fernando Perez <fperez@colorado.edu>
2996
3002
2997 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3003 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
2998 alignment and color management. All 3 prompt subsystems now
3004 alignment and color management. All 3 prompt subsystems now
2999 inherit from BasePrompt.
3005 inherit from BasePrompt.
3000
3006
3001 * tools/release: updates for windows installer build and tag rpms
3007 * tools/release: updates for windows installer build and tag rpms
3002 with python version (since paths are fixed).
3008 with python version (since paths are fixed).
3003
3009
3004 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3010 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3005 which will become eventually obsolete. Also fixed the default
3011 which will become eventually obsolete. Also fixed the default
3006 prompt_in2 to use \D, so at least new users start with the correct
3012 prompt_in2 to use \D, so at least new users start with the correct
3007 defaults.
3013 defaults.
3008 WARNING: Users with existing ipythonrc files will need to apply
3014 WARNING: Users with existing ipythonrc files will need to apply
3009 this fix manually!
3015 this fix manually!
3010
3016
3011 * setup.py: make windows installer (.exe). This is finally the
3017 * setup.py: make windows installer (.exe). This is finally the
3012 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3018 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3013 which I hadn't included because it required Python 2.3 (or recent
3019 which I hadn't included because it required Python 2.3 (or recent
3014 distutils).
3020 distutils).
3015
3021
3016 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3022 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3017 usage of new '\D' escape.
3023 usage of new '\D' escape.
3018
3024
3019 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3025 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3020 lacks os.getuid())
3026 lacks os.getuid())
3021 (CachedOutput.set_colors): Added the ability to turn coloring
3027 (CachedOutput.set_colors): Added the ability to turn coloring
3022 on/off with @colors even for manually defined prompt colors. It
3028 on/off with @colors even for manually defined prompt colors. It
3023 uses a nasty global, but it works safely and via the generic color
3029 uses a nasty global, but it works safely and via the generic color
3024 handling mechanism.
3030 handling mechanism.
3025 (Prompt2.__init__): Introduced new escape '\D' for continuation
3031 (Prompt2.__init__): Introduced new escape '\D' for continuation
3026 prompts. It represents the counter ('\#') as dots.
3032 prompts. It represents the counter ('\#') as dots.
3027 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3033 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3028 need to update their ipythonrc files and replace '%n' with '\D' in
3034 need to update their ipythonrc files and replace '%n' with '\D' in
3029 their prompt_in2 settings everywhere. Sorry, but there's
3035 their prompt_in2 settings everywhere. Sorry, but there's
3030 otherwise no clean way to get all prompts to properly align. The
3036 otherwise no clean way to get all prompts to properly align. The
3031 ipythonrc shipped with IPython has been updated.
3037 ipythonrc shipped with IPython has been updated.
3032
3038
3033 2004-06-07 Fernando Perez <fperez@colorado.edu>
3039 2004-06-07 Fernando Perez <fperez@colorado.edu>
3034
3040
3035 * setup.py (isfile): Pass local_icons option to latex2html, so the
3041 * setup.py (isfile): Pass local_icons option to latex2html, so the
3036 resulting HTML file is self-contained. Thanks to
3042 resulting HTML file is self-contained. Thanks to
3037 dryice-AT-liu.com.cn for the tip.
3043 dryice-AT-liu.com.cn for the tip.
3038
3044
3039 * pysh.py: I created a new profile 'shell', which implements a
3045 * pysh.py: I created a new profile 'shell', which implements a
3040 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3046 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3041 system shell, nor will it become one anytime soon. It's mainly
3047 system shell, nor will it become one anytime soon. It's mainly
3042 meant to illustrate the use of the new flexible bash-like prompts.
3048 meant to illustrate the use of the new flexible bash-like prompts.
3043 I guess it could be used by hardy souls for true shell management,
3049 I guess it could be used by hardy souls for true shell management,
3044 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3050 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3045 profile. This uses the InterpreterExec extension provided by
3051 profile. This uses the InterpreterExec extension provided by
3046 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3052 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3047
3053
3048 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3054 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3049 auto-align itself with the length of the previous input prompt
3055 auto-align itself with the length of the previous input prompt
3050 (taking into account the invisible color escapes).
3056 (taking into account the invisible color escapes).
3051 (CachedOutput.__init__): Large restructuring of this class. Now
3057 (CachedOutput.__init__): Large restructuring of this class. Now
3052 all three prompts (primary1, primary2, output) are proper objects,
3058 all three prompts (primary1, primary2, output) are proper objects,
3053 managed by the 'parent' CachedOutput class. The code is still a
3059 managed by the 'parent' CachedOutput class. The code is still a
3054 bit hackish (all prompts share state via a pointer to the cache),
3060 bit hackish (all prompts share state via a pointer to the cache),
3055 but it's overall far cleaner than before.
3061 but it's overall far cleaner than before.
3056
3062
3057 * IPython/genutils.py (getoutputerror): modified to add verbose,
3063 * IPython/genutils.py (getoutputerror): modified to add verbose,
3058 debug and header options. This makes the interface of all getout*
3064 debug and header options. This makes the interface of all getout*
3059 functions uniform.
3065 functions uniform.
3060 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3066 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3061
3067
3062 * IPython/Magic.py (Magic.default_option): added a function to
3068 * IPython/Magic.py (Magic.default_option): added a function to
3063 allow registering default options for any magic command. This
3069 allow registering default options for any magic command. This
3064 makes it easy to have profiles which customize the magics globally
3070 makes it easy to have profiles which customize the magics globally
3065 for a certain use. The values set through this function are
3071 for a certain use. The values set through this function are
3066 picked up by the parse_options() method, which all magics should
3072 picked up by the parse_options() method, which all magics should
3067 use to parse their options.
3073 use to parse their options.
3068
3074
3069 * IPython/genutils.py (warn): modified the warnings framework to
3075 * IPython/genutils.py (warn): modified the warnings framework to
3070 use the Term I/O class. I'm trying to slowly unify all of
3076 use the Term I/O class. I'm trying to slowly unify all of
3071 IPython's I/O operations to pass through Term.
3077 IPython's I/O operations to pass through Term.
3072
3078
3073 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3079 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3074 the secondary prompt to correctly match the length of the primary
3080 the secondary prompt to correctly match the length of the primary
3075 one for any prompt. Now multi-line code will properly line up
3081 one for any prompt. Now multi-line code will properly line up
3076 even for path dependent prompts, such as the new ones available
3082 even for path dependent prompts, such as the new ones available
3077 via the prompt_specials.
3083 via the prompt_specials.
3078
3084
3079 2004-06-06 Fernando Perez <fperez@colorado.edu>
3085 2004-06-06 Fernando Perez <fperez@colorado.edu>
3080
3086
3081 * IPython/Prompts.py (prompt_specials): Added the ability to have
3087 * IPython/Prompts.py (prompt_specials): Added the ability to have
3082 bash-like special sequences in the prompts, which get
3088 bash-like special sequences in the prompts, which get
3083 automatically expanded. Things like hostname, current working
3089 automatically expanded. Things like hostname, current working
3084 directory and username are implemented already, but it's easy to
3090 directory and username are implemented already, but it's easy to
3085 add more in the future. Thanks to a patch by W.J. van der Laan
3091 add more in the future. Thanks to a patch by W.J. van der Laan
3086 <gnufnork-AT-hetdigitalegat.nl>
3092 <gnufnork-AT-hetdigitalegat.nl>
3087 (prompt_specials): Added color support for prompt strings, so
3093 (prompt_specials): Added color support for prompt strings, so
3088 users can define arbitrary color setups for their prompts.
3094 users can define arbitrary color setups for their prompts.
3089
3095
3090 2004-06-05 Fernando Perez <fperez@colorado.edu>
3096 2004-06-05 Fernando Perez <fperez@colorado.edu>
3091
3097
3092 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3098 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3093 code to load Gary Bishop's readline and configure it
3099 code to load Gary Bishop's readline and configure it
3094 automatically. Thanks to Gary for help on this.
3100 automatically. Thanks to Gary for help on this.
3095
3101
3096 2004-06-01 Fernando Perez <fperez@colorado.edu>
3102 2004-06-01 Fernando Perez <fperez@colorado.edu>
3097
3103
3098 * IPython/Logger.py (Logger.create_log): fix bug for logging
3104 * IPython/Logger.py (Logger.create_log): fix bug for logging
3099 with no filename (previous fix was incomplete).
3105 with no filename (previous fix was incomplete).
3100
3106
3101 2004-05-25 Fernando Perez <fperez@colorado.edu>
3107 2004-05-25 Fernando Perez <fperez@colorado.edu>
3102
3108
3103 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3109 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3104 parens would get passed to the shell.
3110 parens would get passed to the shell.
3105
3111
3106 2004-05-20 Fernando Perez <fperez@colorado.edu>
3112 2004-05-20 Fernando Perez <fperez@colorado.edu>
3107
3113
3108 * IPython/Magic.py (Magic.magic_prun): changed default profile
3114 * IPython/Magic.py (Magic.magic_prun): changed default profile
3109 sort order to 'time' (the more common profiling need).
3115 sort order to 'time' (the more common profiling need).
3110
3116
3111 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3117 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3112 so that source code shown is guaranteed in sync with the file on
3118 so that source code shown is guaranteed in sync with the file on
3113 disk (also changed in psource). Similar fix to the one for
3119 disk (also changed in psource). Similar fix to the one for
3114 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3120 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3115 <yann.ledu-AT-noos.fr>.
3121 <yann.ledu-AT-noos.fr>.
3116
3122
3117 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3123 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3118 with a single option would not be correctly parsed. Closes
3124 with a single option would not be correctly parsed. Closes
3119 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3125 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3120 introduced in 0.6.0 (on 2004-05-06).
3126 introduced in 0.6.0 (on 2004-05-06).
3121
3127
3122 2004-05-13 *** Released version 0.6.0
3128 2004-05-13 *** Released version 0.6.0
3123
3129
3124 2004-05-13 Fernando Perez <fperez@colorado.edu>
3130 2004-05-13 Fernando Perez <fperez@colorado.edu>
3125
3131
3126 * debian/: Added debian/ directory to CVS, so that debian support
3132 * debian/: Added debian/ directory to CVS, so that debian support
3127 is publicly accessible. The debian package is maintained by Jack
3133 is publicly accessible. The debian package is maintained by Jack
3128 Moffit <jack-AT-xiph.org>.
3134 Moffit <jack-AT-xiph.org>.
3129
3135
3130 * Documentation: included the notes about an ipython-based system
3136 * Documentation: included the notes about an ipython-based system
3131 shell (the hypothetical 'pysh') into the new_design.pdf document,
3137 shell (the hypothetical 'pysh') into the new_design.pdf document,
3132 so that these ideas get distributed to users along with the
3138 so that these ideas get distributed to users along with the
3133 official documentation.
3139 official documentation.
3134
3140
3135 2004-05-10 Fernando Perez <fperez@colorado.edu>
3141 2004-05-10 Fernando Perez <fperez@colorado.edu>
3136
3142
3137 * IPython/Logger.py (Logger.create_log): fix recently introduced
3143 * IPython/Logger.py (Logger.create_log): fix recently introduced
3138 bug (misindented line) where logstart would fail when not given an
3144 bug (misindented line) where logstart would fail when not given an
3139 explicit filename.
3145 explicit filename.
3140
3146
3141 2004-05-09 Fernando Perez <fperez@colorado.edu>
3147 2004-05-09 Fernando Perez <fperez@colorado.edu>
3142
3148
3143 * IPython/Magic.py (Magic.parse_options): skip system call when
3149 * IPython/Magic.py (Magic.parse_options): skip system call when
3144 there are no options to look for. Faster, cleaner for the common
3150 there are no options to look for. Faster, cleaner for the common
3145 case.
3151 case.
3146
3152
3147 * Documentation: many updates to the manual: describing Windows
3153 * Documentation: many updates to the manual: describing Windows
3148 support better, Gnuplot updates, credits, misc small stuff. Also
3154 support better, Gnuplot updates, credits, misc small stuff. Also
3149 updated the new_design doc a bit.
3155 updated the new_design doc a bit.
3150
3156
3151 2004-05-06 *** Released version 0.6.0.rc1
3157 2004-05-06 *** Released version 0.6.0.rc1
3152
3158
3153 2004-05-06 Fernando Perez <fperez@colorado.edu>
3159 2004-05-06 Fernando Perez <fperez@colorado.edu>
3154
3160
3155 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3161 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3156 operations to use the vastly more efficient list/''.join() method.
3162 operations to use the vastly more efficient list/''.join() method.
3157 (FormattedTB.text): Fix
3163 (FormattedTB.text): Fix
3158 http://www.scipy.net/roundup/ipython/issue12 - exception source
3164 http://www.scipy.net/roundup/ipython/issue12 - exception source
3159 extract not updated after reload. Thanks to Mike Salib
3165 extract not updated after reload. Thanks to Mike Salib
3160 <msalib-AT-mit.edu> for pinning the source of the problem.
3166 <msalib-AT-mit.edu> for pinning the source of the problem.
3161 Fortunately, the solution works inside ipython and doesn't require
3167 Fortunately, the solution works inside ipython and doesn't require
3162 any changes to python proper.
3168 any changes to python proper.
3163
3169
3164 * IPython/Magic.py (Magic.parse_options): Improved to process the
3170 * IPython/Magic.py (Magic.parse_options): Improved to process the
3165 argument list as a true shell would (by actually using the
3171 argument list as a true shell would (by actually using the
3166 underlying system shell). This way, all @magics automatically get
3172 underlying system shell). This way, all @magics automatically get
3167 shell expansion for variables. Thanks to a comment by Alex
3173 shell expansion for variables. Thanks to a comment by Alex
3168 Schmolck.
3174 Schmolck.
3169
3175
3170 2004-04-04 Fernando Perez <fperez@colorado.edu>
3176 2004-04-04 Fernando Perez <fperez@colorado.edu>
3171
3177
3172 * IPython/iplib.py (InteractiveShell.interact): Added a special
3178 * IPython/iplib.py (InteractiveShell.interact): Added a special
3173 trap for a debugger quit exception, which is basically impossible
3179 trap for a debugger quit exception, which is basically impossible
3174 to handle by normal mechanisms, given what pdb does to the stack.
3180 to handle by normal mechanisms, given what pdb does to the stack.
3175 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3181 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3176
3182
3177 2004-04-03 Fernando Perez <fperez@colorado.edu>
3183 2004-04-03 Fernando Perez <fperez@colorado.edu>
3178
3184
3179 * IPython/genutils.py (Term): Standardized the names of the Term
3185 * IPython/genutils.py (Term): Standardized the names of the Term
3180 class streams to cin/cout/cerr, following C++ naming conventions
3186 class streams to cin/cout/cerr, following C++ naming conventions
3181 (I can't use in/out/err because 'in' is not a valid attribute
3187 (I can't use in/out/err because 'in' is not a valid attribute
3182 name).
3188 name).
3183
3189
3184 * IPython/iplib.py (InteractiveShell.interact): don't increment
3190 * IPython/iplib.py (InteractiveShell.interact): don't increment
3185 the prompt if there's no user input. By Daniel 'Dang' Griffith
3191 the prompt if there's no user input. By Daniel 'Dang' Griffith
3186 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3192 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3187 Francois Pinard.
3193 Francois Pinard.
3188
3194
3189 2004-04-02 Fernando Perez <fperez@colorado.edu>
3195 2004-04-02 Fernando Perez <fperez@colorado.edu>
3190
3196
3191 * IPython/genutils.py (Stream.__init__): Modified to survive at
3197 * IPython/genutils.py (Stream.__init__): Modified to survive at
3192 least importing in contexts where stdin/out/err aren't true file
3198 least importing in contexts where stdin/out/err aren't true file
3193 objects, such as PyCrust (they lack fileno() and mode). However,
3199 objects, such as PyCrust (they lack fileno() and mode). However,
3194 the recovery facilities which rely on these things existing will
3200 the recovery facilities which rely on these things existing will
3195 not work.
3201 not work.
3196
3202
3197 2004-04-01 Fernando Perez <fperez@colorado.edu>
3203 2004-04-01 Fernando Perez <fperez@colorado.edu>
3198
3204
3199 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3205 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3200 use the new getoutputerror() function, so it properly
3206 use the new getoutputerror() function, so it properly
3201 distinguishes stdout/err.
3207 distinguishes stdout/err.
3202
3208
3203 * IPython/genutils.py (getoutputerror): added a function to
3209 * IPython/genutils.py (getoutputerror): added a function to
3204 capture separately the standard output and error of a command.
3210 capture separately the standard output and error of a command.
3205 After a comment from dang on the mailing lists. This code is
3211 After a comment from dang on the mailing lists. This code is
3206 basically a modified version of commands.getstatusoutput(), from
3212 basically a modified version of commands.getstatusoutput(), from
3207 the standard library.
3213 the standard library.
3208
3214
3209 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3215 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3210 '!!' as a special syntax (shorthand) to access @sx.
3216 '!!' as a special syntax (shorthand) to access @sx.
3211
3217
3212 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3218 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3213 command and return its output as a list split on '\n'.
3219 command and return its output as a list split on '\n'.
3214
3220
3215 2004-03-31 Fernando Perez <fperez@colorado.edu>
3221 2004-03-31 Fernando Perez <fperez@colorado.edu>
3216
3222
3217 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3223 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3218 method to dictionaries used as FakeModule instances if they lack
3224 method to dictionaries used as FakeModule instances if they lack
3219 it. At least pydoc in python2.3 breaks for runtime-defined
3225 it. At least pydoc in python2.3 breaks for runtime-defined
3220 functions without this hack. At some point I need to _really_
3226 functions without this hack. At some point I need to _really_
3221 understand what FakeModule is doing, because it's a gross hack.
3227 understand what FakeModule is doing, because it's a gross hack.
3222 But it solves Arnd's problem for now...
3228 But it solves Arnd's problem for now...
3223
3229
3224 2004-02-27 Fernando Perez <fperez@colorado.edu>
3230 2004-02-27 Fernando Perez <fperez@colorado.edu>
3225
3231
3226 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3232 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3227 mode would behave erratically. Also increased the number of
3233 mode would behave erratically. Also increased the number of
3228 possible logs in rotate mod to 999. Thanks to Rod Holland
3234 possible logs in rotate mod to 999. Thanks to Rod Holland
3229 <rhh@StructureLABS.com> for the report and fixes.
3235 <rhh@StructureLABS.com> for the report and fixes.
3230
3236
3231 2004-02-26 Fernando Perez <fperez@colorado.edu>
3237 2004-02-26 Fernando Perez <fperez@colorado.edu>
3232
3238
3233 * IPython/genutils.py (page): Check that the curses module really
3239 * IPython/genutils.py (page): Check that the curses module really
3234 has the initscr attribute before trying to use it. For some
3240 has the initscr attribute before trying to use it. For some
3235 reason, the Solaris curses module is missing this. I think this
3241 reason, the Solaris curses module is missing this. I think this
3236 should be considered a Solaris python bug, but I'm not sure.
3242 should be considered a Solaris python bug, but I'm not sure.
3237
3243
3238 2004-01-17 Fernando Perez <fperez@colorado.edu>
3244 2004-01-17 Fernando Perez <fperez@colorado.edu>
3239
3245
3240 * IPython/genutils.py (Stream.__init__): Changes to try to make
3246 * IPython/genutils.py (Stream.__init__): Changes to try to make
3241 ipython robust against stdin/out/err being closed by the user.
3247 ipython robust against stdin/out/err being closed by the user.
3242 This is 'user error' (and blocks a normal python session, at least
3248 This is 'user error' (and blocks a normal python session, at least
3243 the stdout case). However, Ipython should be able to survive such
3249 the stdout case). However, Ipython should be able to survive such
3244 instances of abuse as gracefully as possible. To simplify the
3250 instances of abuse as gracefully as possible. To simplify the
3245 coding and maintain compatibility with Gary Bishop's Term
3251 coding and maintain compatibility with Gary Bishop's Term
3246 contributions, I've made use of classmethods for this. I think
3252 contributions, I've made use of classmethods for this. I think
3247 this introduces a dependency on python 2.2.
3253 this introduces a dependency on python 2.2.
3248
3254
3249 2004-01-13 Fernando Perez <fperez@colorado.edu>
3255 2004-01-13 Fernando Perez <fperez@colorado.edu>
3250
3256
3251 * IPython/numutils.py (exp_safe): simplified the code a bit and
3257 * IPython/numutils.py (exp_safe): simplified the code a bit and
3252 removed the need for importing the kinds module altogether.
3258 removed the need for importing the kinds module altogether.
3253
3259
3254 2004-01-06 Fernando Perez <fperez@colorado.edu>
3260 2004-01-06 Fernando Perez <fperez@colorado.edu>
3255
3261
3256 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3262 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3257 a magic function instead, after some community feedback. No
3263 a magic function instead, after some community feedback. No
3258 special syntax will exist for it, but its name is deliberately
3264 special syntax will exist for it, but its name is deliberately
3259 very short.
3265 very short.
3260
3266
3261 2003-12-20 Fernando Perez <fperez@colorado.edu>
3267 2003-12-20 Fernando Perez <fperez@colorado.edu>
3262
3268
3263 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3269 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3264 new functionality, to automagically assign the result of a shell
3270 new functionality, to automagically assign the result of a shell
3265 command to a variable. I'll solicit some community feedback on
3271 command to a variable. I'll solicit some community feedback on
3266 this before making it permanent.
3272 this before making it permanent.
3267
3273
3268 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3274 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3269 requested about callables for which inspect couldn't obtain a
3275 requested about callables for which inspect couldn't obtain a
3270 proper argspec. Thanks to a crash report sent by Etienne
3276 proper argspec. Thanks to a crash report sent by Etienne
3271 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3277 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3272
3278
3273 2003-12-09 Fernando Perez <fperez@colorado.edu>
3279 2003-12-09 Fernando Perez <fperez@colorado.edu>
3274
3280
3275 * IPython/genutils.py (page): patch for the pager to work across
3281 * IPython/genutils.py (page): patch for the pager to work across
3276 various versions of Windows. By Gary Bishop.
3282 various versions of Windows. By Gary Bishop.
3277
3283
3278 2003-12-04 Fernando Perez <fperez@colorado.edu>
3284 2003-12-04 Fernando Perez <fperez@colorado.edu>
3279
3285
3280 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3286 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3281 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3287 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3282 While I tested this and it looks ok, there may still be corner
3288 While I tested this and it looks ok, there may still be corner
3283 cases I've missed.
3289 cases I've missed.
3284
3290
3285 2003-12-01 Fernando Perez <fperez@colorado.edu>
3291 2003-12-01 Fernando Perez <fperez@colorado.edu>
3286
3292
3287 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3293 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3288 where a line like 'p,q=1,2' would fail because the automagic
3294 where a line like 'p,q=1,2' would fail because the automagic
3289 system would be triggered for @p.
3295 system would be triggered for @p.
3290
3296
3291 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3297 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3292 cleanups, code unmodified.
3298 cleanups, code unmodified.
3293
3299
3294 * IPython/genutils.py (Term): added a class for IPython to handle
3300 * IPython/genutils.py (Term): added a class for IPython to handle
3295 output. In most cases it will just be a proxy for stdout/err, but
3301 output. In most cases it will just be a proxy for stdout/err, but
3296 having this allows modifications to be made for some platforms,
3302 having this allows modifications to be made for some platforms,
3297 such as handling color escapes under Windows. All of this code
3303 such as handling color escapes under Windows. All of this code
3298 was contributed by Gary Bishop, with minor modifications by me.
3304 was contributed by Gary Bishop, with minor modifications by me.
3299 The actual changes affect many files.
3305 The actual changes affect many files.
3300
3306
3301 2003-11-30 Fernando Perez <fperez@colorado.edu>
3307 2003-11-30 Fernando Perez <fperez@colorado.edu>
3302
3308
3303 * IPython/iplib.py (file_matches): new completion code, courtesy
3309 * IPython/iplib.py (file_matches): new completion code, courtesy
3304 of Jeff Collins. This enables filename completion again under
3310 of Jeff Collins. This enables filename completion again under
3305 python 2.3, which disabled it at the C level.
3311 python 2.3, which disabled it at the C level.
3306
3312
3307 2003-11-11 Fernando Perez <fperez@colorado.edu>
3313 2003-11-11 Fernando Perez <fperez@colorado.edu>
3308
3314
3309 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3315 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3310 for Numeric.array(map(...)), but often convenient.
3316 for Numeric.array(map(...)), but often convenient.
3311
3317
3312 2003-11-05 Fernando Perez <fperez@colorado.edu>
3318 2003-11-05 Fernando Perez <fperez@colorado.edu>
3313
3319
3314 * IPython/numutils.py (frange): Changed a call from int() to
3320 * IPython/numutils.py (frange): Changed a call from int() to
3315 int(round()) to prevent a problem reported with arange() in the
3321 int(round()) to prevent a problem reported with arange() in the
3316 numpy list.
3322 numpy list.
3317
3323
3318 2003-10-06 Fernando Perez <fperez@colorado.edu>
3324 2003-10-06 Fernando Perez <fperez@colorado.edu>
3319
3325
3320 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3326 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3321 prevent crashes if sys lacks an argv attribute (it happens with
3327 prevent crashes if sys lacks an argv attribute (it happens with
3322 embedded interpreters which build a bare-bones sys module).
3328 embedded interpreters which build a bare-bones sys module).
3323 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3329 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3324
3330
3325 2003-09-24 Fernando Perez <fperez@colorado.edu>
3331 2003-09-24 Fernando Perez <fperez@colorado.edu>
3326
3332
3327 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3333 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3328 to protect against poorly written user objects where __getattr__
3334 to protect against poorly written user objects where __getattr__
3329 raises exceptions other than AttributeError. Thanks to a bug
3335 raises exceptions other than AttributeError. Thanks to a bug
3330 report by Oliver Sander <osander-AT-gmx.de>.
3336 report by Oliver Sander <osander-AT-gmx.de>.
3331
3337
3332 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3338 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3333 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3339 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3334
3340
3335 2003-09-09 Fernando Perez <fperez@colorado.edu>
3341 2003-09-09 Fernando Perez <fperez@colorado.edu>
3336
3342
3337 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3343 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3338 unpacking a list whith a callable as first element would
3344 unpacking a list whith a callable as first element would
3339 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3345 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3340 Collins.
3346 Collins.
3341
3347
3342 2003-08-25 *** Released version 0.5.0
3348 2003-08-25 *** Released version 0.5.0
3343
3349
3344 2003-08-22 Fernando Perez <fperez@colorado.edu>
3350 2003-08-22 Fernando Perez <fperez@colorado.edu>
3345
3351
3346 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3352 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3347 improperly defined user exceptions. Thanks to feedback from Mark
3353 improperly defined user exceptions. Thanks to feedback from Mark
3348 Russell <mrussell-AT-verio.net>.
3354 Russell <mrussell-AT-verio.net>.
3349
3355
3350 2003-08-20 Fernando Perez <fperez@colorado.edu>
3356 2003-08-20 Fernando Perez <fperez@colorado.edu>
3351
3357
3352 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3358 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3353 printing so that it would print multi-line string forms starting
3359 printing so that it would print multi-line string forms starting
3354 with a new line. This way the formatting is better respected for
3360 with a new line. This way the formatting is better respected for
3355 objects which work hard to make nice string forms.
3361 objects which work hard to make nice string forms.
3356
3362
3357 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3363 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3358 autocall would overtake data access for objects with both
3364 autocall would overtake data access for objects with both
3359 __getitem__ and __call__.
3365 __getitem__ and __call__.
3360
3366
3361 2003-08-19 *** Released version 0.5.0-rc1
3367 2003-08-19 *** Released version 0.5.0-rc1
3362
3368
3363 2003-08-19 Fernando Perez <fperez@colorado.edu>
3369 2003-08-19 Fernando Perez <fperez@colorado.edu>
3364
3370
3365 * IPython/deep_reload.py (load_tail): single tiny change here
3371 * IPython/deep_reload.py (load_tail): single tiny change here
3366 seems to fix the long-standing bug of dreload() failing to work
3372 seems to fix the long-standing bug of dreload() failing to work
3367 for dotted names. But this module is pretty tricky, so I may have
3373 for dotted names. But this module is pretty tricky, so I may have
3368 missed some subtlety. Needs more testing!.
3374 missed some subtlety. Needs more testing!.
3369
3375
3370 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3376 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3371 exceptions which have badly implemented __str__ methods.
3377 exceptions which have badly implemented __str__ methods.
3372 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3378 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3373 which I've been getting reports about from Python 2.3 users. I
3379 which I've been getting reports about from Python 2.3 users. I
3374 wish I had a simple test case to reproduce the problem, so I could
3380 wish I had a simple test case to reproduce the problem, so I could
3375 either write a cleaner workaround or file a bug report if
3381 either write a cleaner workaround or file a bug report if
3376 necessary.
3382 necessary.
3377
3383
3378 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3384 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3379 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3385 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3380 a bug report by Tjabo Kloppenburg.
3386 a bug report by Tjabo Kloppenburg.
3381
3387
3382 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3388 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3383 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3389 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3384 seems rather unstable. Thanks to a bug report by Tjabo
3390 seems rather unstable. Thanks to a bug report by Tjabo
3385 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3391 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3386
3392
3387 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3393 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3388 this out soon because of the critical fixes in the inner loop for
3394 this out soon because of the critical fixes in the inner loop for
3389 generators.
3395 generators.
3390
3396
3391 * IPython/Magic.py (Magic.getargspec): removed. This (and
3397 * IPython/Magic.py (Magic.getargspec): removed. This (and
3392 _get_def) have been obsoleted by OInspect for a long time, I
3398 _get_def) have been obsoleted by OInspect for a long time, I
3393 hadn't noticed that they were dead code.
3399 hadn't noticed that they were dead code.
3394 (Magic._ofind): restored _ofind functionality for a few literals
3400 (Magic._ofind): restored _ofind functionality for a few literals
3395 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3401 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3396 for things like "hello".capitalize?, since that would require a
3402 for things like "hello".capitalize?, since that would require a
3397 potentially dangerous eval() again.
3403 potentially dangerous eval() again.
3398
3404
3399 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3405 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3400 logic a bit more to clean up the escapes handling and minimize the
3406 logic a bit more to clean up the escapes handling and minimize the
3401 use of _ofind to only necessary cases. The interactive 'feel' of
3407 use of _ofind to only necessary cases. The interactive 'feel' of
3402 IPython should have improved quite a bit with the changes in
3408 IPython should have improved quite a bit with the changes in
3403 _prefilter and _ofind (besides being far safer than before).
3409 _prefilter and _ofind (besides being far safer than before).
3404
3410
3405 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3411 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3406 obscure, never reported). Edit would fail to find the object to
3412 obscure, never reported). Edit would fail to find the object to
3407 edit under some circumstances.
3413 edit under some circumstances.
3408 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3414 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3409 which were causing double-calling of generators. Those eval calls
3415 which were causing double-calling of generators. Those eval calls
3410 were _very_ dangerous, since code with side effects could be
3416 were _very_ dangerous, since code with side effects could be
3411 triggered. As they say, 'eval is evil'... These were the
3417 triggered. As they say, 'eval is evil'... These were the
3412 nastiest evals in IPython. Besides, _ofind is now far simpler,
3418 nastiest evals in IPython. Besides, _ofind is now far simpler,
3413 and it should also be quite a bit faster. Its use of inspect is
3419 and it should also be quite a bit faster. Its use of inspect is
3414 also safer, so perhaps some of the inspect-related crashes I've
3420 also safer, so perhaps some of the inspect-related crashes I've
3415 seen lately with Python 2.3 might be taken care of. That will
3421 seen lately with Python 2.3 might be taken care of. That will
3416 need more testing.
3422 need more testing.
3417
3423
3418 2003-08-17 Fernando Perez <fperez@colorado.edu>
3424 2003-08-17 Fernando Perez <fperez@colorado.edu>
3419
3425
3420 * IPython/iplib.py (InteractiveShell._prefilter): significant
3426 * IPython/iplib.py (InteractiveShell._prefilter): significant
3421 simplifications to the logic for handling user escapes. Faster
3427 simplifications to the logic for handling user escapes. Faster
3422 and simpler code.
3428 and simpler code.
3423
3429
3424 2003-08-14 Fernando Perez <fperez@colorado.edu>
3430 2003-08-14 Fernando Perez <fperez@colorado.edu>
3425
3431
3426 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3432 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3427 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3433 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3428 but it should be quite a bit faster. And the recursive version
3434 but it should be quite a bit faster. And the recursive version
3429 generated O(log N) intermediate storage for all rank>1 arrays,
3435 generated O(log N) intermediate storage for all rank>1 arrays,
3430 even if they were contiguous.
3436 even if they were contiguous.
3431 (l1norm): Added this function.
3437 (l1norm): Added this function.
3432 (norm): Added this function for arbitrary norms (including
3438 (norm): Added this function for arbitrary norms (including
3433 l-infinity). l1 and l2 are still special cases for convenience
3439 l-infinity). l1 and l2 are still special cases for convenience
3434 and speed.
3440 and speed.
3435
3441
3436 2003-08-03 Fernando Perez <fperez@colorado.edu>
3442 2003-08-03 Fernando Perez <fperez@colorado.edu>
3437
3443
3438 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3444 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3439 exceptions, which now raise PendingDeprecationWarnings in Python
3445 exceptions, which now raise PendingDeprecationWarnings in Python
3440 2.3. There were some in Magic and some in Gnuplot2.
3446 2.3. There were some in Magic and some in Gnuplot2.
3441
3447
3442 2003-06-30 Fernando Perez <fperez@colorado.edu>
3448 2003-06-30 Fernando Perez <fperez@colorado.edu>
3443
3449
3444 * IPython/genutils.py (page): modified to call curses only for
3450 * IPython/genutils.py (page): modified to call curses only for
3445 terminals where TERM=='xterm'. After problems under many other
3451 terminals where TERM=='xterm'. After problems under many other
3446 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3452 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3447
3453
3448 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3454 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3449 would be triggered when readline was absent. This was just an old
3455 would be triggered when readline was absent. This was just an old
3450 debugging statement I'd forgotten to take out.
3456 debugging statement I'd forgotten to take out.
3451
3457
3452 2003-06-20 Fernando Perez <fperez@colorado.edu>
3458 2003-06-20 Fernando Perez <fperez@colorado.edu>
3453
3459
3454 * IPython/genutils.py (clock): modified to return only user time
3460 * IPython/genutils.py (clock): modified to return only user time
3455 (not counting system time), after a discussion on scipy. While
3461 (not counting system time), after a discussion on scipy. While
3456 system time may be a useful quantity occasionally, it may much
3462 system time may be a useful quantity occasionally, it may much
3457 more easily be skewed by occasional swapping or other similar
3463 more easily be skewed by occasional swapping or other similar
3458 activity.
3464 activity.
3459
3465
3460 2003-06-05 Fernando Perez <fperez@colorado.edu>
3466 2003-06-05 Fernando Perez <fperez@colorado.edu>
3461
3467
3462 * IPython/numutils.py (identity): new function, for building
3468 * IPython/numutils.py (identity): new function, for building
3463 arbitrary rank Kronecker deltas (mostly backwards compatible with
3469 arbitrary rank Kronecker deltas (mostly backwards compatible with
3464 Numeric.identity)
3470 Numeric.identity)
3465
3471
3466 2003-06-03 Fernando Perez <fperez@colorado.edu>
3472 2003-06-03 Fernando Perez <fperez@colorado.edu>
3467
3473
3468 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3474 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3469 arguments passed to magics with spaces, to allow trailing '\' to
3475 arguments passed to magics with spaces, to allow trailing '\' to
3470 work normally (mainly for Windows users).
3476 work normally (mainly for Windows users).
3471
3477
3472 2003-05-29 Fernando Perez <fperez@colorado.edu>
3478 2003-05-29 Fernando Perez <fperez@colorado.edu>
3473
3479
3474 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3480 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3475 instead of pydoc.help. This fixes a bizarre behavior where
3481 instead of pydoc.help. This fixes a bizarre behavior where
3476 printing '%s' % locals() would trigger the help system. Now
3482 printing '%s' % locals() would trigger the help system. Now
3477 ipython behaves like normal python does.
3483 ipython behaves like normal python does.
3478
3484
3479 Note that if one does 'from pydoc import help', the bizarre
3485 Note that if one does 'from pydoc import help', the bizarre
3480 behavior returns, but this will also happen in normal python, so
3486 behavior returns, but this will also happen in normal python, so
3481 it's not an ipython bug anymore (it has to do with how pydoc.help
3487 it's not an ipython bug anymore (it has to do with how pydoc.help
3482 is implemented).
3488 is implemented).
3483
3489
3484 2003-05-22 Fernando Perez <fperez@colorado.edu>
3490 2003-05-22 Fernando Perez <fperez@colorado.edu>
3485
3491
3486 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3492 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3487 return [] instead of None when nothing matches, also match to end
3493 return [] instead of None when nothing matches, also match to end
3488 of line. Patch by Gary Bishop.
3494 of line. Patch by Gary Bishop.
3489
3495
3490 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3496 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3491 protection as before, for files passed on the command line. This
3497 protection as before, for files passed on the command line. This
3492 prevents the CrashHandler from kicking in if user files call into
3498 prevents the CrashHandler from kicking in if user files call into
3493 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3499 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3494 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3500 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3495
3501
3496 2003-05-20 *** Released version 0.4.0
3502 2003-05-20 *** Released version 0.4.0
3497
3503
3498 2003-05-20 Fernando Perez <fperez@colorado.edu>
3504 2003-05-20 Fernando Perez <fperez@colorado.edu>
3499
3505
3500 * setup.py: added support for manpages. It's a bit hackish b/c of
3506 * setup.py: added support for manpages. It's a bit hackish b/c of
3501 a bug in the way the bdist_rpm distutils target handles gzipped
3507 a bug in the way the bdist_rpm distutils target handles gzipped
3502 manpages, but it works. After a patch by Jack.
3508 manpages, but it works. After a patch by Jack.
3503
3509
3504 2003-05-19 Fernando Perez <fperez@colorado.edu>
3510 2003-05-19 Fernando Perez <fperez@colorado.edu>
3505
3511
3506 * IPython/numutils.py: added a mockup of the kinds module, since
3512 * IPython/numutils.py: added a mockup of the kinds module, since
3507 it was recently removed from Numeric. This way, numutils will
3513 it was recently removed from Numeric. This way, numutils will
3508 work for all users even if they are missing kinds.
3514 work for all users even if they are missing kinds.
3509
3515
3510 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3516 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3511 failure, which can occur with SWIG-wrapped extensions. After a
3517 failure, which can occur with SWIG-wrapped extensions. After a
3512 crash report from Prabhu.
3518 crash report from Prabhu.
3513
3519
3514 2003-05-16 Fernando Perez <fperez@colorado.edu>
3520 2003-05-16 Fernando Perez <fperez@colorado.edu>
3515
3521
3516 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3522 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3517 protect ipython from user code which may call directly
3523 protect ipython from user code which may call directly
3518 sys.excepthook (this looks like an ipython crash to the user, even
3524 sys.excepthook (this looks like an ipython crash to the user, even
3519 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3525 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3520 This is especially important to help users of WxWindows, but may
3526 This is especially important to help users of WxWindows, but may
3521 also be useful in other cases.
3527 also be useful in other cases.
3522
3528
3523 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3529 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3524 an optional tb_offset to be specified, and to preserve exception
3530 an optional tb_offset to be specified, and to preserve exception
3525 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3531 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3526
3532
3527 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3533 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3528
3534
3529 2003-05-15 Fernando Perez <fperez@colorado.edu>
3535 2003-05-15 Fernando Perez <fperez@colorado.edu>
3530
3536
3531 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3537 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3532 installing for a new user under Windows.
3538 installing for a new user under Windows.
3533
3539
3534 2003-05-12 Fernando Perez <fperez@colorado.edu>
3540 2003-05-12 Fernando Perez <fperez@colorado.edu>
3535
3541
3536 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3542 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3537 handler for Emacs comint-based lines. Currently it doesn't do
3543 handler for Emacs comint-based lines. Currently it doesn't do
3538 much (but importantly, it doesn't update the history cache). In
3544 much (but importantly, it doesn't update the history cache). In
3539 the future it may be expanded if Alex needs more functionality
3545 the future it may be expanded if Alex needs more functionality
3540 there.
3546 there.
3541
3547
3542 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3548 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3543 info to crash reports.
3549 info to crash reports.
3544
3550
3545 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3551 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3546 just like Python's -c. Also fixed crash with invalid -color
3552 just like Python's -c. Also fixed crash with invalid -color
3547 option value at startup. Thanks to Will French
3553 option value at startup. Thanks to Will French
3548 <wfrench-AT-bestweb.net> for the bug report.
3554 <wfrench-AT-bestweb.net> for the bug report.
3549
3555
3550 2003-05-09 Fernando Perez <fperez@colorado.edu>
3556 2003-05-09 Fernando Perez <fperez@colorado.edu>
3551
3557
3552 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3558 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3553 to EvalDict (it's a mapping, after all) and simplified its code
3559 to EvalDict (it's a mapping, after all) and simplified its code
3554 quite a bit, after a nice discussion on c.l.py where Gustavo
3560 quite a bit, after a nice discussion on c.l.py where Gustavo
3555 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3561 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3556
3562
3557 2003-04-30 Fernando Perez <fperez@colorado.edu>
3563 2003-04-30 Fernando Perez <fperez@colorado.edu>
3558
3564
3559 * IPython/genutils.py (timings_out): modified it to reduce its
3565 * IPython/genutils.py (timings_out): modified it to reduce its
3560 overhead in the common reps==1 case.
3566 overhead in the common reps==1 case.
3561
3567
3562 2003-04-29 Fernando Perez <fperez@colorado.edu>
3568 2003-04-29 Fernando Perez <fperez@colorado.edu>
3563
3569
3564 * IPython/genutils.py (timings_out): Modified to use the resource
3570 * IPython/genutils.py (timings_out): Modified to use the resource
3565 module, which avoids the wraparound problems of time.clock().
3571 module, which avoids the wraparound problems of time.clock().
3566
3572
3567 2003-04-17 *** Released version 0.2.15pre4
3573 2003-04-17 *** Released version 0.2.15pre4
3568
3574
3569 2003-04-17 Fernando Perez <fperez@colorado.edu>
3575 2003-04-17 Fernando Perez <fperez@colorado.edu>
3570
3576
3571 * setup.py (scriptfiles): Split windows-specific stuff over to a
3577 * setup.py (scriptfiles): Split windows-specific stuff over to a
3572 separate file, in an attempt to have a Windows GUI installer.
3578 separate file, in an attempt to have a Windows GUI installer.
3573 That didn't work, but part of the groundwork is done.
3579 That didn't work, but part of the groundwork is done.
3574
3580
3575 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3581 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3576 indent/unindent with 4 spaces. Particularly useful in combination
3582 indent/unindent with 4 spaces. Particularly useful in combination
3577 with the new auto-indent option.
3583 with the new auto-indent option.
3578
3584
3579 2003-04-16 Fernando Perez <fperez@colorado.edu>
3585 2003-04-16 Fernando Perez <fperez@colorado.edu>
3580
3586
3581 * IPython/Magic.py: various replacements of self.rc for
3587 * IPython/Magic.py: various replacements of self.rc for
3582 self.shell.rc. A lot more remains to be done to fully disentangle
3588 self.shell.rc. A lot more remains to be done to fully disentangle
3583 this class from the main Shell class.
3589 this class from the main Shell class.
3584
3590
3585 * IPython/GnuplotRuntime.py: added checks for mouse support so
3591 * IPython/GnuplotRuntime.py: added checks for mouse support so
3586 that we don't try to enable it if the current gnuplot doesn't
3592 that we don't try to enable it if the current gnuplot doesn't
3587 really support it. Also added checks so that we don't try to
3593 really support it. Also added checks so that we don't try to
3588 enable persist under Windows (where Gnuplot doesn't recognize the
3594 enable persist under Windows (where Gnuplot doesn't recognize the
3589 option).
3595 option).
3590
3596
3591 * IPython/iplib.py (InteractiveShell.interact): Added optional
3597 * IPython/iplib.py (InteractiveShell.interact): Added optional
3592 auto-indenting code, after a patch by King C. Shu
3598 auto-indenting code, after a patch by King C. Shu
3593 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3599 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3594 get along well with pasting indented code. If I ever figure out
3600 get along well with pasting indented code. If I ever figure out
3595 how to make that part go well, it will become on by default.
3601 how to make that part go well, it will become on by default.
3596
3602
3597 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3603 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3598 crash ipython if there was an unmatched '%' in the user's prompt
3604 crash ipython if there was an unmatched '%' in the user's prompt
3599 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3605 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3600
3606
3601 * IPython/iplib.py (InteractiveShell.interact): removed the
3607 * IPython/iplib.py (InteractiveShell.interact): removed the
3602 ability to ask the user whether he wants to crash or not at the
3608 ability to ask the user whether he wants to crash or not at the
3603 'last line' exception handler. Calling functions at that point
3609 'last line' exception handler. Calling functions at that point
3604 changes the stack, and the error reports would have incorrect
3610 changes the stack, and the error reports would have incorrect
3605 tracebacks.
3611 tracebacks.
3606
3612
3607 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3613 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3608 pass through a peger a pretty-printed form of any object. After a
3614 pass through a peger a pretty-printed form of any object. After a
3609 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3615 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3610
3616
3611 2003-04-14 Fernando Perez <fperez@colorado.edu>
3617 2003-04-14 Fernando Perez <fperez@colorado.edu>
3612
3618
3613 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3619 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3614 all files in ~ would be modified at first install (instead of
3620 all files in ~ would be modified at first install (instead of
3615 ~/.ipython). This could be potentially disastrous, as the
3621 ~/.ipython). This could be potentially disastrous, as the
3616 modification (make line-endings native) could damage binary files.
3622 modification (make line-endings native) could damage binary files.
3617
3623
3618 2003-04-10 Fernando Perez <fperez@colorado.edu>
3624 2003-04-10 Fernando Perez <fperez@colorado.edu>
3619
3625
3620 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3626 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3621 handle only lines which are invalid python. This now means that
3627 handle only lines which are invalid python. This now means that
3622 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3628 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3623 for the bug report.
3629 for the bug report.
3624
3630
3625 2003-04-01 Fernando Perez <fperez@colorado.edu>
3631 2003-04-01 Fernando Perez <fperez@colorado.edu>
3626
3632
3627 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3633 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3628 where failing to set sys.last_traceback would crash pdb.pm().
3634 where failing to set sys.last_traceback would crash pdb.pm().
3629 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3635 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3630 report.
3636 report.
3631
3637
3632 2003-03-25 Fernando Perez <fperez@colorado.edu>
3638 2003-03-25 Fernando Perez <fperez@colorado.edu>
3633
3639
3634 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3640 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3635 before printing it (it had a lot of spurious blank lines at the
3641 before printing it (it had a lot of spurious blank lines at the
3636 end).
3642 end).
3637
3643
3638 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3644 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3639 output would be sent 21 times! Obviously people don't use this
3645 output would be sent 21 times! Obviously people don't use this
3640 too often, or I would have heard about it.
3646 too often, or I would have heard about it.
3641
3647
3642 2003-03-24 Fernando Perez <fperez@colorado.edu>
3648 2003-03-24 Fernando Perez <fperez@colorado.edu>
3643
3649
3644 * setup.py (scriptfiles): renamed the data_files parameter from
3650 * setup.py (scriptfiles): renamed the data_files parameter from
3645 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3651 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3646 for the patch.
3652 for the patch.
3647
3653
3648 2003-03-20 Fernando Perez <fperez@colorado.edu>
3654 2003-03-20 Fernando Perez <fperez@colorado.edu>
3649
3655
3650 * IPython/genutils.py (error): added error() and fatal()
3656 * IPython/genutils.py (error): added error() and fatal()
3651 functions.
3657 functions.
3652
3658
3653 2003-03-18 *** Released version 0.2.15pre3
3659 2003-03-18 *** Released version 0.2.15pre3
3654
3660
3655 2003-03-18 Fernando Perez <fperez@colorado.edu>
3661 2003-03-18 Fernando Perez <fperez@colorado.edu>
3656
3662
3657 * setupext/install_data_ext.py
3663 * setupext/install_data_ext.py
3658 (install_data_ext.initialize_options): Class contributed by Jack
3664 (install_data_ext.initialize_options): Class contributed by Jack
3659 Moffit for fixing the old distutils hack. He is sending this to
3665 Moffit for fixing the old distutils hack. He is sending this to
3660 the distutils folks so in the future we may not need it as a
3666 the distutils folks so in the future we may not need it as a
3661 private fix.
3667 private fix.
3662
3668
3663 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3669 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3664 changes for Debian packaging. See his patch for full details.
3670 changes for Debian packaging. See his patch for full details.
3665 The old distutils hack of making the ipythonrc* files carry a
3671 The old distutils hack of making the ipythonrc* files carry a
3666 bogus .py extension is gone, at last. Examples were moved to a
3672 bogus .py extension is gone, at last. Examples were moved to a
3667 separate subdir under doc/, and the separate executable scripts
3673 separate subdir under doc/, and the separate executable scripts
3668 now live in their own directory. Overall a great cleanup. The
3674 now live in their own directory. Overall a great cleanup. The
3669 manual was updated to use the new files, and setup.py has been
3675 manual was updated to use the new files, and setup.py has been
3670 fixed for this setup.
3676 fixed for this setup.
3671
3677
3672 * IPython/PyColorize.py (Parser.usage): made non-executable and
3678 * IPython/PyColorize.py (Parser.usage): made non-executable and
3673 created a pycolor wrapper around it to be included as a script.
3679 created a pycolor wrapper around it to be included as a script.
3674
3680
3675 2003-03-12 *** Released version 0.2.15pre2
3681 2003-03-12 *** Released version 0.2.15pre2
3676
3682
3677 2003-03-12 Fernando Perez <fperez@colorado.edu>
3683 2003-03-12 Fernando Perez <fperez@colorado.edu>
3678
3684
3679 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3685 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3680 long-standing problem with garbage characters in some terminals.
3686 long-standing problem with garbage characters in some terminals.
3681 The issue was really that the \001 and \002 escapes must _only_ be
3687 The issue was really that the \001 and \002 escapes must _only_ be
3682 passed to input prompts (which call readline), but _never_ to
3688 passed to input prompts (which call readline), but _never_ to
3683 normal text to be printed on screen. I changed ColorANSI to have
3689 normal text to be printed on screen. I changed ColorANSI to have
3684 two classes: TermColors and InputTermColors, each with the
3690 two classes: TermColors and InputTermColors, each with the
3685 appropriate escapes for input prompts or normal text. The code in
3691 appropriate escapes for input prompts or normal text. The code in
3686 Prompts.py got slightly more complicated, but this very old and
3692 Prompts.py got slightly more complicated, but this very old and
3687 annoying bug is finally fixed.
3693 annoying bug is finally fixed.
3688
3694
3689 All the credit for nailing down the real origin of this problem
3695 All the credit for nailing down the real origin of this problem
3690 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3696 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3691 *Many* thanks to him for spending quite a bit of effort on this.
3697 *Many* thanks to him for spending quite a bit of effort on this.
3692
3698
3693 2003-03-05 *** Released version 0.2.15pre1
3699 2003-03-05 *** Released version 0.2.15pre1
3694
3700
3695 2003-03-03 Fernando Perez <fperez@colorado.edu>
3701 2003-03-03 Fernando Perez <fperez@colorado.edu>
3696
3702
3697 * IPython/FakeModule.py: Moved the former _FakeModule to a
3703 * IPython/FakeModule.py: Moved the former _FakeModule to a
3698 separate file, because it's also needed by Magic (to fix a similar
3704 separate file, because it's also needed by Magic (to fix a similar
3699 pickle-related issue in @run).
3705 pickle-related issue in @run).
3700
3706
3701 2003-03-02 Fernando Perez <fperez@colorado.edu>
3707 2003-03-02 Fernando Perez <fperez@colorado.edu>
3702
3708
3703 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3709 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3704 the autocall option at runtime.
3710 the autocall option at runtime.
3705 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3711 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3706 across Magic.py to start separating Magic from InteractiveShell.
3712 across Magic.py to start separating Magic from InteractiveShell.
3707 (Magic._ofind): Fixed to return proper namespace for dotted
3713 (Magic._ofind): Fixed to return proper namespace for dotted
3708 names. Before, a dotted name would always return 'not currently
3714 names. Before, a dotted name would always return 'not currently
3709 defined', because it would find the 'parent'. s.x would be found,
3715 defined', because it would find the 'parent'. s.x would be found,
3710 but since 'x' isn't defined by itself, it would get confused.
3716 but since 'x' isn't defined by itself, it would get confused.
3711 (Magic.magic_run): Fixed pickling problems reported by Ralf
3717 (Magic.magic_run): Fixed pickling problems reported by Ralf
3712 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3718 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3713 that I'd used when Mike Heeter reported similar issues at the
3719 that I'd used when Mike Heeter reported similar issues at the
3714 top-level, but now for @run. It boils down to injecting the
3720 top-level, but now for @run. It boils down to injecting the
3715 namespace where code is being executed with something that looks
3721 namespace where code is being executed with something that looks
3716 enough like a module to fool pickle.dump(). Since a pickle stores
3722 enough like a module to fool pickle.dump(). Since a pickle stores
3717 a named reference to the importing module, we need this for
3723 a named reference to the importing module, we need this for
3718 pickles to save something sensible.
3724 pickles to save something sensible.
3719
3725
3720 * IPython/ipmaker.py (make_IPython): added an autocall option.
3726 * IPython/ipmaker.py (make_IPython): added an autocall option.
3721
3727
3722 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3728 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3723 the auto-eval code. Now autocalling is an option, and the code is
3729 the auto-eval code. Now autocalling is an option, and the code is
3724 also vastly safer. There is no more eval() involved at all.
3730 also vastly safer. There is no more eval() involved at all.
3725
3731
3726 2003-03-01 Fernando Perez <fperez@colorado.edu>
3732 2003-03-01 Fernando Perez <fperez@colorado.edu>
3727
3733
3728 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3734 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3729 dict with named keys instead of a tuple.
3735 dict with named keys instead of a tuple.
3730
3736
3731 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3737 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3732
3738
3733 * setup.py (make_shortcut): Fixed message about directories
3739 * setup.py (make_shortcut): Fixed message about directories
3734 created during Windows installation (the directories were ok, just
3740 created during Windows installation (the directories were ok, just
3735 the printed message was misleading). Thanks to Chris Liechti
3741 the printed message was misleading). Thanks to Chris Liechti
3736 <cliechti-AT-gmx.net> for the heads up.
3742 <cliechti-AT-gmx.net> for the heads up.
3737
3743
3738 2003-02-21 Fernando Perez <fperez@colorado.edu>
3744 2003-02-21 Fernando Perez <fperez@colorado.edu>
3739
3745
3740 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3746 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3741 of ValueError exception when checking for auto-execution. This
3747 of ValueError exception when checking for auto-execution. This
3742 one is raised by things like Numeric arrays arr.flat when the
3748 one is raised by things like Numeric arrays arr.flat when the
3743 array is non-contiguous.
3749 array is non-contiguous.
3744
3750
3745 2003-01-31 Fernando Perez <fperez@colorado.edu>
3751 2003-01-31 Fernando Perez <fperez@colorado.edu>
3746
3752
3747 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3753 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3748 not return any value at all (even though the command would get
3754 not return any value at all (even though the command would get
3749 executed).
3755 executed).
3750 (xsys): Flush stdout right after printing the command to ensure
3756 (xsys): Flush stdout right after printing the command to ensure
3751 proper ordering of commands and command output in the total
3757 proper ordering of commands and command output in the total
3752 output.
3758 output.
3753 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3759 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3754 system/getoutput as defaults. The old ones are kept for
3760 system/getoutput as defaults. The old ones are kept for
3755 compatibility reasons, so no code which uses this library needs
3761 compatibility reasons, so no code which uses this library needs
3756 changing.
3762 changing.
3757
3763
3758 2003-01-27 *** Released version 0.2.14
3764 2003-01-27 *** Released version 0.2.14
3759
3765
3760 2003-01-25 Fernando Perez <fperez@colorado.edu>
3766 2003-01-25 Fernando Perez <fperez@colorado.edu>
3761
3767
3762 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3768 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3763 functions defined in previous edit sessions could not be re-edited
3769 functions defined in previous edit sessions could not be re-edited
3764 (because the temp files were immediately removed). Now temp files
3770 (because the temp files were immediately removed). Now temp files
3765 are removed only at IPython's exit.
3771 are removed only at IPython's exit.
3766 (Magic.magic_run): Improved @run to perform shell-like expansions
3772 (Magic.magic_run): Improved @run to perform shell-like expansions
3767 on its arguments (~users and $VARS). With this, @run becomes more
3773 on its arguments (~users and $VARS). With this, @run becomes more
3768 like a normal command-line.
3774 like a normal command-line.
3769
3775
3770 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3776 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3771 bugs related to embedding and cleaned up that code. A fairly
3777 bugs related to embedding and cleaned up that code. A fairly
3772 important one was the impossibility to access the global namespace
3778 important one was the impossibility to access the global namespace
3773 through the embedded IPython (only local variables were visible).
3779 through the embedded IPython (only local variables were visible).
3774
3780
3775 2003-01-14 Fernando Perez <fperez@colorado.edu>
3781 2003-01-14 Fernando Perez <fperez@colorado.edu>
3776
3782
3777 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3783 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3778 auto-calling to be a bit more conservative. Now it doesn't get
3784 auto-calling to be a bit more conservative. Now it doesn't get
3779 triggered if any of '!=()<>' are in the rest of the input line, to
3785 triggered if any of '!=()<>' are in the rest of the input line, to
3780 allow comparing callables. Thanks to Alex for the heads up.
3786 allow comparing callables. Thanks to Alex for the heads up.
3781
3787
3782 2003-01-07 Fernando Perez <fperez@colorado.edu>
3788 2003-01-07 Fernando Perez <fperez@colorado.edu>
3783
3789
3784 * IPython/genutils.py (page): fixed estimation of the number of
3790 * IPython/genutils.py (page): fixed estimation of the number of
3785 lines in a string to be paged to simply count newlines. This
3791 lines in a string to be paged to simply count newlines. This
3786 prevents over-guessing due to embedded escape sequences. A better
3792 prevents over-guessing due to embedded escape sequences. A better
3787 long-term solution would involve stripping out the control chars
3793 long-term solution would involve stripping out the control chars
3788 for the count, but it's potentially so expensive I just don't
3794 for the count, but it's potentially so expensive I just don't
3789 think it's worth doing.
3795 think it's worth doing.
3790
3796
3791 2002-12-19 *** Released version 0.2.14pre50
3797 2002-12-19 *** Released version 0.2.14pre50
3792
3798
3793 2002-12-19 Fernando Perez <fperez@colorado.edu>
3799 2002-12-19 Fernando Perez <fperez@colorado.edu>
3794
3800
3795 * tools/release (version): Changed release scripts to inform
3801 * tools/release (version): Changed release scripts to inform
3796 Andrea and build a NEWS file with a list of recent changes.
3802 Andrea and build a NEWS file with a list of recent changes.
3797
3803
3798 * IPython/ColorANSI.py (__all__): changed terminal detection
3804 * IPython/ColorANSI.py (__all__): changed terminal detection
3799 code. Seems to work better for xterms without breaking
3805 code. Seems to work better for xterms without breaking
3800 konsole. Will need more testing to determine if WinXP and Mac OSX
3806 konsole. Will need more testing to determine if WinXP and Mac OSX
3801 also work ok.
3807 also work ok.
3802
3808
3803 2002-12-18 *** Released version 0.2.14pre49
3809 2002-12-18 *** Released version 0.2.14pre49
3804
3810
3805 2002-12-18 Fernando Perez <fperez@colorado.edu>
3811 2002-12-18 Fernando Perez <fperez@colorado.edu>
3806
3812
3807 * Docs: added new info about Mac OSX, from Andrea.
3813 * Docs: added new info about Mac OSX, from Andrea.
3808
3814
3809 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3815 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3810 allow direct plotting of python strings whose format is the same
3816 allow direct plotting of python strings whose format is the same
3811 of gnuplot data files.
3817 of gnuplot data files.
3812
3818
3813 2002-12-16 Fernando Perez <fperez@colorado.edu>
3819 2002-12-16 Fernando Perez <fperez@colorado.edu>
3814
3820
3815 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3821 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3816 value of exit question to be acknowledged.
3822 value of exit question to be acknowledged.
3817
3823
3818 2002-12-03 Fernando Perez <fperez@colorado.edu>
3824 2002-12-03 Fernando Perez <fperez@colorado.edu>
3819
3825
3820 * IPython/ipmaker.py: removed generators, which had been added
3826 * IPython/ipmaker.py: removed generators, which had been added
3821 by mistake in an earlier debugging run. This was causing trouble
3827 by mistake in an earlier debugging run. This was causing trouble
3822 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3828 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3823 for pointing this out.
3829 for pointing this out.
3824
3830
3825 2002-11-17 Fernando Perez <fperez@colorado.edu>
3831 2002-11-17 Fernando Perez <fperez@colorado.edu>
3826
3832
3827 * Manual: updated the Gnuplot section.
3833 * Manual: updated the Gnuplot section.
3828
3834
3829 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3835 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3830 a much better split of what goes in Runtime and what goes in
3836 a much better split of what goes in Runtime and what goes in
3831 Interactive.
3837 Interactive.
3832
3838
3833 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3839 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3834 being imported from iplib.
3840 being imported from iplib.
3835
3841
3836 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3842 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3837 for command-passing. Now the global Gnuplot instance is called
3843 for command-passing. Now the global Gnuplot instance is called
3838 'gp' instead of 'g', which was really a far too fragile and
3844 'gp' instead of 'g', which was really a far too fragile and
3839 common name.
3845 common name.
3840
3846
3841 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3847 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3842 bounding boxes generated by Gnuplot for square plots.
3848 bounding boxes generated by Gnuplot for square plots.
3843
3849
3844 * IPython/genutils.py (popkey): new function added. I should
3850 * IPython/genutils.py (popkey): new function added. I should
3845 suggest this on c.l.py as a dict method, it seems useful.
3851 suggest this on c.l.py as a dict method, it seems useful.
3846
3852
3847 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3853 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3848 to transparently handle PostScript generation. MUCH better than
3854 to transparently handle PostScript generation. MUCH better than
3849 the previous plot_eps/replot_eps (which I removed now). The code
3855 the previous plot_eps/replot_eps (which I removed now). The code
3850 is also fairly clean and well documented now (including
3856 is also fairly clean and well documented now (including
3851 docstrings).
3857 docstrings).
3852
3858
3853 2002-11-13 Fernando Perez <fperez@colorado.edu>
3859 2002-11-13 Fernando Perez <fperez@colorado.edu>
3854
3860
3855 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3861 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3856 (inconsistent with options).
3862 (inconsistent with options).
3857
3863
3858 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3864 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3859 manually disabled, I don't know why. Fixed it.
3865 manually disabled, I don't know why. Fixed it.
3860 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3866 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3861 eps output.
3867 eps output.
3862
3868
3863 2002-11-12 Fernando Perez <fperez@colorado.edu>
3869 2002-11-12 Fernando Perez <fperez@colorado.edu>
3864
3870
3865 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3871 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3866 don't propagate up to caller. Fixes crash reported by François
3872 don't propagate up to caller. Fixes crash reported by François
3867 Pinard.
3873 Pinard.
3868
3874
3869 2002-11-09 Fernando Perez <fperez@colorado.edu>
3875 2002-11-09 Fernando Perez <fperez@colorado.edu>
3870
3876
3871 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3877 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3872 history file for new users.
3878 history file for new users.
3873 (make_IPython): fixed bug where initial install would leave the
3879 (make_IPython): fixed bug where initial install would leave the
3874 user running in the .ipython dir.
3880 user running in the .ipython dir.
3875 (make_IPython): fixed bug where config dir .ipython would be
3881 (make_IPython): fixed bug where config dir .ipython would be
3876 created regardless of the given -ipythondir option. Thanks to Cory
3882 created regardless of the given -ipythondir option. Thanks to Cory
3877 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3883 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3878
3884
3879 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3885 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3880 type confirmations. Will need to use it in all of IPython's code
3886 type confirmations. Will need to use it in all of IPython's code
3881 consistently.
3887 consistently.
3882
3888
3883 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3889 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3884 context to print 31 lines instead of the default 5. This will make
3890 context to print 31 lines instead of the default 5. This will make
3885 the crash reports extremely detailed in case the problem is in
3891 the crash reports extremely detailed in case the problem is in
3886 libraries I don't have access to.
3892 libraries I don't have access to.
3887
3893
3888 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3894 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3889 line of defense' code to still crash, but giving users fair
3895 line of defense' code to still crash, but giving users fair
3890 warning. I don't want internal errors to go unreported: if there's
3896 warning. I don't want internal errors to go unreported: if there's
3891 an internal problem, IPython should crash and generate a full
3897 an internal problem, IPython should crash and generate a full
3892 report.
3898 report.
3893
3899
3894 2002-11-08 Fernando Perez <fperez@colorado.edu>
3900 2002-11-08 Fernando Perez <fperez@colorado.edu>
3895
3901
3896 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3902 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3897 otherwise uncaught exceptions which can appear if people set
3903 otherwise uncaught exceptions which can appear if people set
3898 sys.stdout to something badly broken. Thanks to a crash report
3904 sys.stdout to something badly broken. Thanks to a crash report
3899 from henni-AT-mail.brainbot.com.
3905 from henni-AT-mail.brainbot.com.
3900
3906
3901 2002-11-04 Fernando Perez <fperez@colorado.edu>
3907 2002-11-04 Fernando Perez <fperez@colorado.edu>
3902
3908
3903 * IPython/iplib.py (InteractiveShell.interact): added
3909 * IPython/iplib.py (InteractiveShell.interact): added
3904 __IPYTHON__active to the builtins. It's a flag which goes on when
3910 __IPYTHON__active to the builtins. It's a flag which goes on when
3905 the interaction starts and goes off again when it stops. This
3911 the interaction starts and goes off again when it stops. This
3906 allows embedding code to detect being inside IPython. Before this
3912 allows embedding code to detect being inside IPython. Before this
3907 was done via __IPYTHON__, but that only shows that an IPython
3913 was done via __IPYTHON__, but that only shows that an IPython
3908 instance has been created.
3914 instance has been created.
3909
3915
3910 * IPython/Magic.py (Magic.magic_env): I realized that in a
3916 * IPython/Magic.py (Magic.magic_env): I realized that in a
3911 UserDict, instance.data holds the data as a normal dict. So I
3917 UserDict, instance.data holds the data as a normal dict. So I
3912 modified @env to return os.environ.data instead of rebuilding a
3918 modified @env to return os.environ.data instead of rebuilding a
3913 dict by hand.
3919 dict by hand.
3914
3920
3915 2002-11-02 Fernando Perez <fperez@colorado.edu>
3921 2002-11-02 Fernando Perez <fperez@colorado.edu>
3916
3922
3917 * IPython/genutils.py (warn): changed so that level 1 prints no
3923 * IPython/genutils.py (warn): changed so that level 1 prints no
3918 header. Level 2 is now the default (with 'WARNING' header, as
3924 header. Level 2 is now the default (with 'WARNING' header, as
3919 before). I think I tracked all places where changes were needed in
3925 before). I think I tracked all places where changes were needed in
3920 IPython, but outside code using the old level numbering may have
3926 IPython, but outside code using the old level numbering may have
3921 broken.
3927 broken.
3922
3928
3923 * IPython/iplib.py (InteractiveShell.runcode): added this to
3929 * IPython/iplib.py (InteractiveShell.runcode): added this to
3924 handle the tracebacks in SystemExit traps correctly. The previous
3930 handle the tracebacks in SystemExit traps correctly. The previous
3925 code (through interact) was printing more of the stack than
3931 code (through interact) was printing more of the stack than
3926 necessary, showing IPython internal code to the user.
3932 necessary, showing IPython internal code to the user.
3927
3933
3928 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3934 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3929 default. Now that the default at the confirmation prompt is yes,
3935 default. Now that the default at the confirmation prompt is yes,
3930 it's not so intrusive. François' argument that ipython sessions
3936 it's not so intrusive. François' argument that ipython sessions
3931 tend to be complex enough not to lose them from an accidental C-d,
3937 tend to be complex enough not to lose them from an accidental C-d,
3932 is a valid one.
3938 is a valid one.
3933
3939
3934 * IPython/iplib.py (InteractiveShell.interact): added a
3940 * IPython/iplib.py (InteractiveShell.interact): added a
3935 showtraceback() call to the SystemExit trap, and modified the exit
3941 showtraceback() call to the SystemExit trap, and modified the exit
3936 confirmation to have yes as the default.
3942 confirmation to have yes as the default.
3937
3943
3938 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3944 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3939 this file. It's been gone from the code for a long time, this was
3945 this file. It's been gone from the code for a long time, this was
3940 simply leftover junk.
3946 simply leftover junk.
3941
3947
3942 2002-11-01 Fernando Perez <fperez@colorado.edu>
3948 2002-11-01 Fernando Perez <fperez@colorado.edu>
3943
3949
3944 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3950 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3945 added. If set, IPython now traps EOF and asks for
3951 added. If set, IPython now traps EOF and asks for
3946 confirmation. After a request by François Pinard.
3952 confirmation. After a request by François Pinard.
3947
3953
3948 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3954 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3949 of @abort, and with a new (better) mechanism for handling the
3955 of @abort, and with a new (better) mechanism for handling the
3950 exceptions.
3956 exceptions.
3951
3957
3952 2002-10-27 Fernando Perez <fperez@colorado.edu>
3958 2002-10-27 Fernando Perez <fperez@colorado.edu>
3953
3959
3954 * IPython/usage.py (__doc__): updated the --help information and
3960 * IPython/usage.py (__doc__): updated the --help information and
3955 the ipythonrc file to indicate that -log generates
3961 the ipythonrc file to indicate that -log generates
3956 ./ipython.log. Also fixed the corresponding info in @logstart.
3962 ./ipython.log. Also fixed the corresponding info in @logstart.
3957 This and several other fixes in the manuals thanks to reports by
3963 This and several other fixes in the manuals thanks to reports by
3958 François Pinard <pinard-AT-iro.umontreal.ca>.
3964 François Pinard <pinard-AT-iro.umontreal.ca>.
3959
3965
3960 * IPython/Logger.py (Logger.switch_log): Fixed error message to
3966 * IPython/Logger.py (Logger.switch_log): Fixed error message to
3961 refer to @logstart (instead of @log, which doesn't exist).
3967 refer to @logstart (instead of @log, which doesn't exist).
3962
3968
3963 * IPython/iplib.py (InteractiveShell._prefilter): fixed
3969 * IPython/iplib.py (InteractiveShell._prefilter): fixed
3964 AttributeError crash. Thanks to Christopher Armstrong
3970 AttributeError crash. Thanks to Christopher Armstrong
3965 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
3971 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
3966 introduced recently (in 0.2.14pre37) with the fix to the eval
3972 introduced recently (in 0.2.14pre37) with the fix to the eval
3967 problem mentioned below.
3973 problem mentioned below.
3968
3974
3969 2002-10-17 Fernando Perez <fperez@colorado.edu>
3975 2002-10-17 Fernando Perez <fperez@colorado.edu>
3970
3976
3971 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
3977 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
3972 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
3978 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
3973
3979
3974 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
3980 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
3975 this function to fix a problem reported by Alex Schmolck. He saw
3981 this function to fix a problem reported by Alex Schmolck. He saw
3976 it with list comprehensions and generators, which were getting
3982 it with list comprehensions and generators, which were getting
3977 called twice. The real problem was an 'eval' call in testing for
3983 called twice. The real problem was an 'eval' call in testing for
3978 automagic which was evaluating the input line silently.
3984 automagic which was evaluating the input line silently.
3979
3985
3980 This is a potentially very nasty bug, if the input has side
3986 This is a potentially very nasty bug, if the input has side
3981 effects which must not be repeated. The code is much cleaner now,
3987 effects which must not be repeated. The code is much cleaner now,
3982 without any blanket 'except' left and with a regexp test for
3988 without any blanket 'except' left and with a regexp test for
3983 actual function names.
3989 actual function names.
3984
3990
3985 But an eval remains, which I'm not fully comfortable with. I just
3991 But an eval remains, which I'm not fully comfortable with. I just
3986 don't know how to find out if an expression could be a callable in
3992 don't know how to find out if an expression could be a callable in
3987 the user's namespace without doing an eval on the string. However
3993 the user's namespace without doing an eval on the string. However
3988 that string is now much more strictly checked so that no code
3994 that string is now much more strictly checked so that no code
3989 slips by, so the eval should only happen for things that can
3995 slips by, so the eval should only happen for things that can
3990 really be only function/method names.
3996 really be only function/method names.
3991
3997
3992 2002-10-15 Fernando Perez <fperez@colorado.edu>
3998 2002-10-15 Fernando Perez <fperez@colorado.edu>
3993
3999
3994 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4000 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
3995 OSX information to main manual, removed README_Mac_OSX file from
4001 OSX information to main manual, removed README_Mac_OSX file from
3996 distribution. Also updated credits for recent additions.
4002 distribution. Also updated credits for recent additions.
3997
4003
3998 2002-10-10 Fernando Perez <fperez@colorado.edu>
4004 2002-10-10 Fernando Perez <fperez@colorado.edu>
3999
4005
4000 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4006 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4001 terminal-related issues. Many thanks to Andrea Riciputi
4007 terminal-related issues. Many thanks to Andrea Riciputi
4002 <andrea.riciputi-AT-libero.it> for writing it.
4008 <andrea.riciputi-AT-libero.it> for writing it.
4003
4009
4004 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4010 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4005 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4011 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4006
4012
4007 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4013 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4008 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4014 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4009 <syver-en-AT-online.no> who both submitted patches for this problem.
4015 <syver-en-AT-online.no> who both submitted patches for this problem.
4010
4016
4011 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4017 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4012 global embedding to make sure that things don't overwrite user
4018 global embedding to make sure that things don't overwrite user
4013 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4019 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4014
4020
4015 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4021 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4016 compatibility. Thanks to Hayden Callow
4022 compatibility. Thanks to Hayden Callow
4017 <h.callow-AT-elec.canterbury.ac.nz>
4023 <h.callow-AT-elec.canterbury.ac.nz>
4018
4024
4019 2002-10-04 Fernando Perez <fperez@colorado.edu>
4025 2002-10-04 Fernando Perez <fperez@colorado.edu>
4020
4026
4021 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4027 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4022 Gnuplot.File objects.
4028 Gnuplot.File objects.
4023
4029
4024 2002-07-23 Fernando Perez <fperez@colorado.edu>
4030 2002-07-23 Fernando Perez <fperez@colorado.edu>
4025
4031
4026 * IPython/genutils.py (timing): Added timings() and timing() for
4032 * IPython/genutils.py (timing): Added timings() and timing() for
4027 quick access to the most commonly needed data, the execution
4033 quick access to the most commonly needed data, the execution
4028 times. Old timing() renamed to timings_out().
4034 times. Old timing() renamed to timings_out().
4029
4035
4030 2002-07-18 Fernando Perez <fperez@colorado.edu>
4036 2002-07-18 Fernando Perez <fperez@colorado.edu>
4031
4037
4032 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4038 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4033 bug with nested instances disrupting the parent's tab completion.
4039 bug with nested instances disrupting the parent's tab completion.
4034
4040
4035 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4041 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4036 all_completions code to begin the emacs integration.
4042 all_completions code to begin the emacs integration.
4037
4043
4038 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4044 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4039 argument to allow titling individual arrays when plotting.
4045 argument to allow titling individual arrays when plotting.
4040
4046
4041 2002-07-15 Fernando Perez <fperez@colorado.edu>
4047 2002-07-15 Fernando Perez <fperez@colorado.edu>
4042
4048
4043 * setup.py (make_shortcut): changed to retrieve the value of
4049 * setup.py (make_shortcut): changed to retrieve the value of
4044 'Program Files' directory from the registry (this value changes in
4050 'Program Files' directory from the registry (this value changes in
4045 non-english versions of Windows). Thanks to Thomas Fanslau
4051 non-english versions of Windows). Thanks to Thomas Fanslau
4046 <tfanslau-AT-gmx.de> for the report.
4052 <tfanslau-AT-gmx.de> for the report.
4047
4053
4048 2002-07-10 Fernando Perez <fperez@colorado.edu>
4054 2002-07-10 Fernando Perez <fperez@colorado.edu>
4049
4055
4050 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4056 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4051 a bug in pdb, which crashes if a line with only whitespace is
4057 a bug in pdb, which crashes if a line with only whitespace is
4052 entered. Bug report submitted to sourceforge.
4058 entered. Bug report submitted to sourceforge.
4053
4059
4054 2002-07-09 Fernando Perez <fperez@colorado.edu>
4060 2002-07-09 Fernando Perez <fperez@colorado.edu>
4055
4061
4056 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4062 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4057 reporting exceptions (it's a bug in inspect.py, I just set a
4063 reporting exceptions (it's a bug in inspect.py, I just set a
4058 workaround).
4064 workaround).
4059
4065
4060 2002-07-08 Fernando Perez <fperez@colorado.edu>
4066 2002-07-08 Fernando Perez <fperez@colorado.edu>
4061
4067
4062 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4068 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4063 __IPYTHON__ in __builtins__ to show up in user_ns.
4069 __IPYTHON__ in __builtins__ to show up in user_ns.
4064
4070
4065 2002-07-03 Fernando Perez <fperez@colorado.edu>
4071 2002-07-03 Fernando Perez <fperez@colorado.edu>
4066
4072
4067 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4073 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4068 name from @gp_set_instance to @gp_set_default.
4074 name from @gp_set_instance to @gp_set_default.
4069
4075
4070 * IPython/ipmaker.py (make_IPython): default editor value set to
4076 * IPython/ipmaker.py (make_IPython): default editor value set to
4071 '0' (a string), to match the rc file. Otherwise will crash when
4077 '0' (a string), to match the rc file. Otherwise will crash when
4072 .strip() is called on it.
4078 .strip() is called on it.
4073
4079
4074
4080
4075 2002-06-28 Fernando Perez <fperez@colorado.edu>
4081 2002-06-28 Fernando Perez <fperez@colorado.edu>
4076
4082
4077 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4083 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4078 of files in current directory when a file is executed via
4084 of files in current directory when a file is executed via
4079 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4085 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4080
4086
4081 * setup.py (manfiles): fix for rpm builds, submitted by RA
4087 * setup.py (manfiles): fix for rpm builds, submitted by RA
4082 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4088 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4083
4089
4084 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4090 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4085 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4091 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4086 string!). A. Schmolck caught this one.
4092 string!). A. Schmolck caught this one.
4087
4093
4088 2002-06-27 Fernando Perez <fperez@colorado.edu>
4094 2002-06-27 Fernando Perez <fperez@colorado.edu>
4089
4095
4090 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4096 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4091 defined files at the cmd line. __name__ wasn't being set to
4097 defined files at the cmd line. __name__ wasn't being set to
4092 __main__.
4098 __main__.
4093
4099
4094 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4100 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4095 regular lists and tuples besides Numeric arrays.
4101 regular lists and tuples besides Numeric arrays.
4096
4102
4097 * IPython/Prompts.py (CachedOutput.__call__): Added output
4103 * IPython/Prompts.py (CachedOutput.__call__): Added output
4098 supression for input ending with ';'. Similar to Mathematica and
4104 supression for input ending with ';'. Similar to Mathematica and
4099 Matlab. The _* vars and Out[] list are still updated, just like
4105 Matlab. The _* vars and Out[] list are still updated, just like
4100 Mathematica behaves.
4106 Mathematica behaves.
4101
4107
4102 2002-06-25 Fernando Perez <fperez@colorado.edu>
4108 2002-06-25 Fernando Perez <fperez@colorado.edu>
4103
4109
4104 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4110 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4105 .ini extensions for profiels under Windows.
4111 .ini extensions for profiels under Windows.
4106
4112
4107 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4113 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4108 string form. Fix contributed by Alexander Schmolck
4114 string form. Fix contributed by Alexander Schmolck
4109 <a.schmolck-AT-gmx.net>
4115 <a.schmolck-AT-gmx.net>
4110
4116
4111 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4117 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4112 pre-configured Gnuplot instance.
4118 pre-configured Gnuplot instance.
4113
4119
4114 2002-06-21 Fernando Perez <fperez@colorado.edu>
4120 2002-06-21 Fernando Perez <fperez@colorado.edu>
4115
4121
4116 * IPython/numutils.py (exp_safe): new function, works around the
4122 * IPython/numutils.py (exp_safe): new function, works around the
4117 underflow problems in Numeric.
4123 underflow problems in Numeric.
4118 (log2): New fn. Safe log in base 2: returns exact integer answer
4124 (log2): New fn. Safe log in base 2: returns exact integer answer
4119 for exact integer powers of 2.
4125 for exact integer powers of 2.
4120
4126
4121 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4127 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4122 properly.
4128 properly.
4123
4129
4124 2002-06-20 Fernando Perez <fperez@colorado.edu>
4130 2002-06-20 Fernando Perez <fperez@colorado.edu>
4125
4131
4126 * IPython/genutils.py (timing): new function like
4132 * IPython/genutils.py (timing): new function like
4127 Mathematica's. Similar to time_test, but returns more info.
4133 Mathematica's. Similar to time_test, but returns more info.
4128
4134
4129 2002-06-18 Fernando Perez <fperez@colorado.edu>
4135 2002-06-18 Fernando Perez <fperez@colorado.edu>
4130
4136
4131 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4137 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4132 according to Mike Heeter's suggestions.
4138 according to Mike Heeter's suggestions.
4133
4139
4134 2002-06-16 Fernando Perez <fperez@colorado.edu>
4140 2002-06-16 Fernando Perez <fperez@colorado.edu>
4135
4141
4136 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4142 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4137 system. GnuplotMagic is gone as a user-directory option. New files
4143 system. GnuplotMagic is gone as a user-directory option. New files
4138 make it easier to use all the gnuplot stuff both from external
4144 make it easier to use all the gnuplot stuff both from external
4139 programs as well as from IPython. Had to rewrite part of
4145 programs as well as from IPython. Had to rewrite part of
4140 hardcopy() b/c of a strange bug: often the ps files simply don't
4146 hardcopy() b/c of a strange bug: often the ps files simply don't
4141 get created, and require a repeat of the command (often several
4147 get created, and require a repeat of the command (often several
4142 times).
4148 times).
4143
4149
4144 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4150 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4145 resolve output channel at call time, so that if sys.stderr has
4151 resolve output channel at call time, so that if sys.stderr has
4146 been redirected by user this gets honored.
4152 been redirected by user this gets honored.
4147
4153
4148 2002-06-13 Fernando Perez <fperez@colorado.edu>
4154 2002-06-13 Fernando Perez <fperez@colorado.edu>
4149
4155
4150 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4156 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4151 IPShell. Kept a copy with the old names to avoid breaking people's
4157 IPShell. Kept a copy with the old names to avoid breaking people's
4152 embedded code.
4158 embedded code.
4153
4159
4154 * IPython/ipython: simplified it to the bare minimum after
4160 * IPython/ipython: simplified it to the bare minimum after
4155 Holger's suggestions. Added info about how to use it in
4161 Holger's suggestions. Added info about how to use it in
4156 PYTHONSTARTUP.
4162 PYTHONSTARTUP.
4157
4163
4158 * IPython/Shell.py (IPythonShell): changed the options passing
4164 * IPython/Shell.py (IPythonShell): changed the options passing
4159 from a string with funky %s replacements to a straight list. Maybe
4165 from a string with funky %s replacements to a straight list. Maybe
4160 a bit more typing, but it follows sys.argv conventions, so there's
4166 a bit more typing, but it follows sys.argv conventions, so there's
4161 less special-casing to remember.
4167 less special-casing to remember.
4162
4168
4163 2002-06-12 Fernando Perez <fperez@colorado.edu>
4169 2002-06-12 Fernando Perez <fperez@colorado.edu>
4164
4170
4165 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4171 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4166 command. Thanks to a suggestion by Mike Heeter.
4172 command. Thanks to a suggestion by Mike Heeter.
4167 (Magic.magic_pfile): added behavior to look at filenames if given
4173 (Magic.magic_pfile): added behavior to look at filenames if given
4168 arg is not a defined object.
4174 arg is not a defined object.
4169 (Magic.magic_save): New @save function to save code snippets. Also
4175 (Magic.magic_save): New @save function to save code snippets. Also
4170 a Mike Heeter idea.
4176 a Mike Heeter idea.
4171
4177
4172 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4178 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4173 plot() and replot(). Much more convenient now, especially for
4179 plot() and replot(). Much more convenient now, especially for
4174 interactive use.
4180 interactive use.
4175
4181
4176 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4182 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4177 filenames.
4183 filenames.
4178
4184
4179 2002-06-02 Fernando Perez <fperez@colorado.edu>
4185 2002-06-02 Fernando Perez <fperez@colorado.edu>
4180
4186
4181 * IPython/Struct.py (Struct.__init__): modified to admit
4187 * IPython/Struct.py (Struct.__init__): modified to admit
4182 initialization via another struct.
4188 initialization via another struct.
4183
4189
4184 * IPython/genutils.py (SystemExec.__init__): New stateful
4190 * IPython/genutils.py (SystemExec.__init__): New stateful
4185 interface to xsys and bq. Useful for writing system scripts.
4191 interface to xsys and bq. Useful for writing system scripts.
4186
4192
4187 2002-05-30 Fernando Perez <fperez@colorado.edu>
4193 2002-05-30 Fernando Perez <fperez@colorado.edu>
4188
4194
4189 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4195 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4190 documents. This will make the user download smaller (it's getting
4196 documents. This will make the user download smaller (it's getting
4191 too big).
4197 too big).
4192
4198
4193 2002-05-29 Fernando Perez <fperez@colorado.edu>
4199 2002-05-29 Fernando Perez <fperez@colorado.edu>
4194
4200
4195 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4201 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4196 fix problems with shelve and pickle. Seems to work, but I don't
4202 fix problems with shelve and pickle. Seems to work, but I don't
4197 know if corner cases break it. Thanks to Mike Heeter
4203 know if corner cases break it. Thanks to Mike Heeter
4198 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4204 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4199
4205
4200 2002-05-24 Fernando Perez <fperez@colorado.edu>
4206 2002-05-24 Fernando Perez <fperez@colorado.edu>
4201
4207
4202 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4208 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4203 macros having broken.
4209 macros having broken.
4204
4210
4205 2002-05-21 Fernando Perez <fperez@colorado.edu>
4211 2002-05-21 Fernando Perez <fperez@colorado.edu>
4206
4212
4207 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4213 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4208 introduced logging bug: all history before logging started was
4214 introduced logging bug: all history before logging started was
4209 being written one character per line! This came from the redesign
4215 being written one character per line! This came from the redesign
4210 of the input history as a special list which slices to strings,
4216 of the input history as a special list which slices to strings,
4211 not to lists.
4217 not to lists.
4212
4218
4213 2002-05-20 Fernando Perez <fperez@colorado.edu>
4219 2002-05-20 Fernando Perez <fperez@colorado.edu>
4214
4220
4215 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4221 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4216 be an attribute of all classes in this module. The design of these
4222 be an attribute of all classes in this module. The design of these
4217 classes needs some serious overhauling.
4223 classes needs some serious overhauling.
4218
4224
4219 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4225 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4220 which was ignoring '_' in option names.
4226 which was ignoring '_' in option names.
4221
4227
4222 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4228 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4223 'Verbose_novars' to 'Context' and made it the new default. It's a
4229 'Verbose_novars' to 'Context' and made it the new default. It's a
4224 bit more readable and also safer than verbose.
4230 bit more readable and also safer than verbose.
4225
4231
4226 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4232 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4227 triple-quoted strings.
4233 triple-quoted strings.
4228
4234
4229 * IPython/OInspect.py (__all__): new module exposing the object
4235 * IPython/OInspect.py (__all__): new module exposing the object
4230 introspection facilities. Now the corresponding magics are dummy
4236 introspection facilities. Now the corresponding magics are dummy
4231 wrappers around this. Having this module will make it much easier
4237 wrappers around this. Having this module will make it much easier
4232 to put these functions into our modified pdb.
4238 to put these functions into our modified pdb.
4233 This new object inspector system uses the new colorizing module,
4239 This new object inspector system uses the new colorizing module,
4234 so source code and other things are nicely syntax highlighted.
4240 so source code and other things are nicely syntax highlighted.
4235
4241
4236 2002-05-18 Fernando Perez <fperez@colorado.edu>
4242 2002-05-18 Fernando Perez <fperez@colorado.edu>
4237
4243
4238 * IPython/ColorANSI.py: Split the coloring tools into a separate
4244 * IPython/ColorANSI.py: Split the coloring tools into a separate
4239 module so I can use them in other code easier (they were part of
4245 module so I can use them in other code easier (they were part of
4240 ultraTB).
4246 ultraTB).
4241
4247
4242 2002-05-17 Fernando Perez <fperez@colorado.edu>
4248 2002-05-17 Fernando Perez <fperez@colorado.edu>
4243
4249
4244 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4250 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4245 fixed it to set the global 'g' also to the called instance, as
4251 fixed it to set the global 'g' also to the called instance, as
4246 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4252 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4247 user's 'g' variables).
4253 user's 'g' variables).
4248
4254
4249 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4255 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4250 global variables (aliases to _ih,_oh) so that users which expect
4256 global variables (aliases to _ih,_oh) so that users which expect
4251 In[5] or Out[7] to work aren't unpleasantly surprised.
4257 In[5] or Out[7] to work aren't unpleasantly surprised.
4252 (InputList.__getslice__): new class to allow executing slices of
4258 (InputList.__getslice__): new class to allow executing slices of
4253 input history directly. Very simple class, complements the use of
4259 input history directly. Very simple class, complements the use of
4254 macros.
4260 macros.
4255
4261
4256 2002-05-16 Fernando Perez <fperez@colorado.edu>
4262 2002-05-16 Fernando Perez <fperez@colorado.edu>
4257
4263
4258 * setup.py (docdirbase): make doc directory be just doc/IPython
4264 * setup.py (docdirbase): make doc directory be just doc/IPython
4259 without version numbers, it will reduce clutter for users.
4265 without version numbers, it will reduce clutter for users.
4260
4266
4261 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4267 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4262 execfile call to prevent possible memory leak. See for details:
4268 execfile call to prevent possible memory leak. See for details:
4263 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4269 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4264
4270
4265 2002-05-15 Fernando Perez <fperez@colorado.edu>
4271 2002-05-15 Fernando Perez <fperez@colorado.edu>
4266
4272
4267 * IPython/Magic.py (Magic.magic_psource): made the object
4273 * IPython/Magic.py (Magic.magic_psource): made the object
4268 introspection names be more standard: pdoc, pdef, pfile and
4274 introspection names be more standard: pdoc, pdef, pfile and
4269 psource. They all print/page their output, and it makes
4275 psource. They all print/page their output, and it makes
4270 remembering them easier. Kept old names for compatibility as
4276 remembering them easier. Kept old names for compatibility as
4271 aliases.
4277 aliases.
4272
4278
4273 2002-05-14 Fernando Perez <fperez@colorado.edu>
4279 2002-05-14 Fernando Perez <fperez@colorado.edu>
4274
4280
4275 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4281 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4276 what the mouse problem was. The trick is to use gnuplot with temp
4282 what the mouse problem was. The trick is to use gnuplot with temp
4277 files and NOT with pipes (for data communication), because having
4283 files and NOT with pipes (for data communication), because having
4278 both pipes and the mouse on is bad news.
4284 both pipes and the mouse on is bad news.
4279
4285
4280 2002-05-13 Fernando Perez <fperez@colorado.edu>
4286 2002-05-13 Fernando Perez <fperez@colorado.edu>
4281
4287
4282 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4288 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4283 bug. Information would be reported about builtins even when
4289 bug. Information would be reported about builtins even when
4284 user-defined functions overrode them.
4290 user-defined functions overrode them.
4285
4291
4286 2002-05-11 Fernando Perez <fperez@colorado.edu>
4292 2002-05-11 Fernando Perez <fperez@colorado.edu>
4287
4293
4288 * IPython/__init__.py (__all__): removed FlexCompleter from
4294 * IPython/__init__.py (__all__): removed FlexCompleter from
4289 __all__ so that things don't fail in platforms without readline.
4295 __all__ so that things don't fail in platforms without readline.
4290
4296
4291 2002-05-10 Fernando Perez <fperez@colorado.edu>
4297 2002-05-10 Fernando Perez <fperez@colorado.edu>
4292
4298
4293 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4299 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4294 it requires Numeric, effectively making Numeric a dependency for
4300 it requires Numeric, effectively making Numeric a dependency for
4295 IPython.
4301 IPython.
4296
4302
4297 * Released 0.2.13
4303 * Released 0.2.13
4298
4304
4299 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4305 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4300 profiler interface. Now all the major options from the profiler
4306 profiler interface. Now all the major options from the profiler
4301 module are directly supported in IPython, both for single
4307 module are directly supported in IPython, both for single
4302 expressions (@prun) and for full programs (@run -p).
4308 expressions (@prun) and for full programs (@run -p).
4303
4309
4304 2002-05-09 Fernando Perez <fperez@colorado.edu>
4310 2002-05-09 Fernando Perez <fperez@colorado.edu>
4305
4311
4306 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4312 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4307 magic properly formatted for screen.
4313 magic properly formatted for screen.
4308
4314
4309 * setup.py (make_shortcut): Changed things to put pdf version in
4315 * setup.py (make_shortcut): Changed things to put pdf version in
4310 doc/ instead of doc/manual (had to change lyxport a bit).
4316 doc/ instead of doc/manual (had to change lyxport a bit).
4311
4317
4312 * IPython/Magic.py (Profile.string_stats): made profile runs go
4318 * IPython/Magic.py (Profile.string_stats): made profile runs go
4313 through pager (they are long and a pager allows searching, saving,
4319 through pager (they are long and a pager allows searching, saving,
4314 etc.)
4320 etc.)
4315
4321
4316 2002-05-08 Fernando Perez <fperez@colorado.edu>
4322 2002-05-08 Fernando Perez <fperez@colorado.edu>
4317
4323
4318 * Released 0.2.12
4324 * Released 0.2.12
4319
4325
4320 2002-05-06 Fernando Perez <fperez@colorado.edu>
4326 2002-05-06 Fernando Perez <fperez@colorado.edu>
4321
4327
4322 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4328 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4323 introduced); 'hist n1 n2' was broken.
4329 introduced); 'hist n1 n2' was broken.
4324 (Magic.magic_pdb): added optional on/off arguments to @pdb
4330 (Magic.magic_pdb): added optional on/off arguments to @pdb
4325 (Magic.magic_run): added option -i to @run, which executes code in
4331 (Magic.magic_run): added option -i to @run, which executes code in
4326 the IPython namespace instead of a clean one. Also added @irun as
4332 the IPython namespace instead of a clean one. Also added @irun as
4327 an alias to @run -i.
4333 an alias to @run -i.
4328
4334
4329 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4335 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4330 fixed (it didn't really do anything, the namespaces were wrong).
4336 fixed (it didn't really do anything, the namespaces were wrong).
4331
4337
4332 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4338 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4333
4339
4334 * IPython/__init__.py (__all__): Fixed package namespace, now
4340 * IPython/__init__.py (__all__): Fixed package namespace, now
4335 'import IPython' does give access to IPython.<all> as
4341 'import IPython' does give access to IPython.<all> as
4336 expected. Also renamed __release__ to Release.
4342 expected. Also renamed __release__ to Release.
4337
4343
4338 * IPython/Debugger.py (__license__): created new Pdb class which
4344 * IPython/Debugger.py (__license__): created new Pdb class which
4339 functions like a drop-in for the normal pdb.Pdb but does NOT
4345 functions like a drop-in for the normal pdb.Pdb but does NOT
4340 import readline by default. This way it doesn't muck up IPython's
4346 import readline by default. This way it doesn't muck up IPython's
4341 readline handling, and now tab-completion finally works in the
4347 readline handling, and now tab-completion finally works in the
4342 debugger -- sort of. It completes things globally visible, but the
4348 debugger -- sort of. It completes things globally visible, but the
4343 completer doesn't track the stack as pdb walks it. That's a bit
4349 completer doesn't track the stack as pdb walks it. That's a bit
4344 tricky, and I'll have to implement it later.
4350 tricky, and I'll have to implement it later.
4345
4351
4346 2002-05-05 Fernando Perez <fperez@colorado.edu>
4352 2002-05-05 Fernando Perez <fperez@colorado.edu>
4347
4353
4348 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4354 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4349 magic docstrings when printed via ? (explicit \'s were being
4355 magic docstrings when printed via ? (explicit \'s were being
4350 printed).
4356 printed).
4351
4357
4352 * IPython/ipmaker.py (make_IPython): fixed namespace
4358 * IPython/ipmaker.py (make_IPython): fixed namespace
4353 identification bug. Now variables loaded via logs or command-line
4359 identification bug. Now variables loaded via logs or command-line
4354 files are recognized in the interactive namespace by @who.
4360 files are recognized in the interactive namespace by @who.
4355
4361
4356 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4362 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4357 log replay system stemming from the string form of Structs.
4363 log replay system stemming from the string form of Structs.
4358
4364
4359 * IPython/Magic.py (Macro.__init__): improved macros to properly
4365 * IPython/Magic.py (Macro.__init__): improved macros to properly
4360 handle magic commands in them.
4366 handle magic commands in them.
4361 (Magic.magic_logstart): usernames are now expanded so 'logstart
4367 (Magic.magic_logstart): usernames are now expanded so 'logstart
4362 ~/mylog' now works.
4368 ~/mylog' now works.
4363
4369
4364 * IPython/iplib.py (complete): fixed bug where paths starting with
4370 * IPython/iplib.py (complete): fixed bug where paths starting with
4365 '/' would be completed as magic names.
4371 '/' would be completed as magic names.
4366
4372
4367 2002-05-04 Fernando Perez <fperez@colorado.edu>
4373 2002-05-04 Fernando Perez <fperez@colorado.edu>
4368
4374
4369 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4375 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4370 allow running full programs under the profiler's control.
4376 allow running full programs under the profiler's control.
4371
4377
4372 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4378 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4373 mode to report exceptions verbosely but without formatting
4379 mode to report exceptions verbosely but without formatting
4374 variables. This addresses the issue of ipython 'freezing' (it's
4380 variables. This addresses the issue of ipython 'freezing' (it's
4375 not frozen, but caught in an expensive formatting loop) when huge
4381 not frozen, but caught in an expensive formatting loop) when huge
4376 variables are in the context of an exception.
4382 variables are in the context of an exception.
4377 (VerboseTB.text): Added '--->' markers at line where exception was
4383 (VerboseTB.text): Added '--->' markers at line where exception was
4378 triggered. Much clearer to read, especially in NoColor modes.
4384 triggered. Much clearer to read, especially in NoColor modes.
4379
4385
4380 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4386 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4381 implemented in reverse when changing to the new parse_options().
4387 implemented in reverse when changing to the new parse_options().
4382
4388
4383 2002-05-03 Fernando Perez <fperez@colorado.edu>
4389 2002-05-03 Fernando Perez <fperez@colorado.edu>
4384
4390
4385 * IPython/Magic.py (Magic.parse_options): new function so that
4391 * IPython/Magic.py (Magic.parse_options): new function so that
4386 magics can parse options easier.
4392 magics can parse options easier.
4387 (Magic.magic_prun): new function similar to profile.run(),
4393 (Magic.magic_prun): new function similar to profile.run(),
4388 suggested by Chris Hart.
4394 suggested by Chris Hart.
4389 (Magic.magic_cd): fixed behavior so that it only changes if
4395 (Magic.magic_cd): fixed behavior so that it only changes if
4390 directory actually is in history.
4396 directory actually is in history.
4391
4397
4392 * IPython/usage.py (__doc__): added information about potential
4398 * IPython/usage.py (__doc__): added information about potential
4393 slowness of Verbose exception mode when there are huge data
4399 slowness of Verbose exception mode when there are huge data
4394 structures to be formatted (thanks to Archie Paulson).
4400 structures to be formatted (thanks to Archie Paulson).
4395
4401
4396 * IPython/ipmaker.py (make_IPython): Changed default logging
4402 * IPython/ipmaker.py (make_IPython): Changed default logging
4397 (when simply called with -log) to use curr_dir/ipython.log in
4403 (when simply called with -log) to use curr_dir/ipython.log in
4398 rotate mode. Fixed crash which was occuring with -log before
4404 rotate mode. Fixed crash which was occuring with -log before
4399 (thanks to Jim Boyle).
4405 (thanks to Jim Boyle).
4400
4406
4401 2002-05-01 Fernando Perez <fperez@colorado.edu>
4407 2002-05-01 Fernando Perez <fperez@colorado.edu>
4402
4408
4403 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4409 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4404 was nasty -- though somewhat of a corner case).
4410 was nasty -- though somewhat of a corner case).
4405
4411
4406 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4412 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4407 text (was a bug).
4413 text (was a bug).
4408
4414
4409 2002-04-30 Fernando Perez <fperez@colorado.edu>
4415 2002-04-30 Fernando Perez <fperez@colorado.edu>
4410
4416
4411 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4417 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4412 a print after ^D or ^C from the user so that the In[] prompt
4418 a print after ^D or ^C from the user so that the In[] prompt
4413 doesn't over-run the gnuplot one.
4419 doesn't over-run the gnuplot one.
4414
4420
4415 2002-04-29 Fernando Perez <fperez@colorado.edu>
4421 2002-04-29 Fernando Perez <fperez@colorado.edu>
4416
4422
4417 * Released 0.2.10
4423 * Released 0.2.10
4418
4424
4419 * IPython/__release__.py (version): get date dynamically.
4425 * IPython/__release__.py (version): get date dynamically.
4420
4426
4421 * Misc. documentation updates thanks to Arnd's comments. Also ran
4427 * Misc. documentation updates thanks to Arnd's comments. Also ran
4422 a full spellcheck on the manual (hadn't been done in a while).
4428 a full spellcheck on the manual (hadn't been done in a while).
4423
4429
4424 2002-04-27 Fernando Perez <fperez@colorado.edu>
4430 2002-04-27 Fernando Perez <fperez@colorado.edu>
4425
4431
4426 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4432 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4427 starting a log in mid-session would reset the input history list.
4433 starting a log in mid-session would reset the input history list.
4428
4434
4429 2002-04-26 Fernando Perez <fperez@colorado.edu>
4435 2002-04-26 Fernando Perez <fperez@colorado.edu>
4430
4436
4431 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4437 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4432 all files were being included in an update. Now anything in
4438 all files were being included in an update. Now anything in
4433 UserConfig that matches [A-Za-z]*.py will go (this excludes
4439 UserConfig that matches [A-Za-z]*.py will go (this excludes
4434 __init__.py)
4440 __init__.py)
4435
4441
4436 2002-04-25 Fernando Perez <fperez@colorado.edu>
4442 2002-04-25 Fernando Perez <fperez@colorado.edu>
4437
4443
4438 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4444 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4439 to __builtins__ so that any form of embedded or imported code can
4445 to __builtins__ so that any form of embedded or imported code can
4440 test for being inside IPython.
4446 test for being inside IPython.
4441
4447
4442 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4448 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4443 changed to GnuplotMagic because it's now an importable module,
4449 changed to GnuplotMagic because it's now an importable module,
4444 this makes the name follow that of the standard Gnuplot module.
4450 this makes the name follow that of the standard Gnuplot module.
4445 GnuplotMagic can now be loaded at any time in mid-session.
4451 GnuplotMagic can now be loaded at any time in mid-session.
4446
4452
4447 2002-04-24 Fernando Perez <fperez@colorado.edu>
4453 2002-04-24 Fernando Perez <fperez@colorado.edu>
4448
4454
4449 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4455 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4450 the globals (IPython has its own namespace) and the
4456 the globals (IPython has its own namespace) and the
4451 PhysicalQuantity stuff is much better anyway.
4457 PhysicalQuantity stuff is much better anyway.
4452
4458
4453 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4459 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4454 embedding example to standard user directory for
4460 embedding example to standard user directory for
4455 distribution. Also put it in the manual.
4461 distribution. Also put it in the manual.
4456
4462
4457 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4463 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4458 instance as first argument (so it doesn't rely on some obscure
4464 instance as first argument (so it doesn't rely on some obscure
4459 hidden global).
4465 hidden global).
4460
4466
4461 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4467 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4462 delimiters. While it prevents ().TAB from working, it allows
4468 delimiters. While it prevents ().TAB from working, it allows
4463 completions in open (... expressions. This is by far a more common
4469 completions in open (... expressions. This is by far a more common
4464 case.
4470 case.
4465
4471
4466 2002-04-23 Fernando Perez <fperez@colorado.edu>
4472 2002-04-23 Fernando Perez <fperez@colorado.edu>
4467
4473
4468 * IPython/Extensions/InterpreterPasteInput.py: new
4474 * IPython/Extensions/InterpreterPasteInput.py: new
4469 syntax-processing module for pasting lines with >>> or ... at the
4475 syntax-processing module for pasting lines with >>> or ... at the
4470 start.
4476 start.
4471
4477
4472 * IPython/Extensions/PhysicalQ_Interactive.py
4478 * IPython/Extensions/PhysicalQ_Interactive.py
4473 (PhysicalQuantityInteractive.__int__): fixed to work with either
4479 (PhysicalQuantityInteractive.__int__): fixed to work with either
4474 Numeric or math.
4480 Numeric or math.
4475
4481
4476 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4482 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4477 provided profiles. Now we have:
4483 provided profiles. Now we have:
4478 -math -> math module as * and cmath with its own namespace.
4484 -math -> math module as * and cmath with its own namespace.
4479 -numeric -> Numeric as *, plus gnuplot & grace
4485 -numeric -> Numeric as *, plus gnuplot & grace
4480 -physics -> same as before
4486 -physics -> same as before
4481
4487
4482 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4488 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4483 user-defined magics wouldn't be found by @magic if they were
4489 user-defined magics wouldn't be found by @magic if they were
4484 defined as class methods. Also cleaned up the namespace search
4490 defined as class methods. Also cleaned up the namespace search
4485 logic and the string building (to use %s instead of many repeated
4491 logic and the string building (to use %s instead of many repeated
4486 string adds).
4492 string adds).
4487
4493
4488 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4494 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4489 of user-defined magics to operate with class methods (cleaner, in
4495 of user-defined magics to operate with class methods (cleaner, in
4490 line with the gnuplot code).
4496 line with the gnuplot code).
4491
4497
4492 2002-04-22 Fernando Perez <fperez@colorado.edu>
4498 2002-04-22 Fernando Perez <fperez@colorado.edu>
4493
4499
4494 * setup.py: updated dependency list so that manual is updated when
4500 * setup.py: updated dependency list so that manual is updated when
4495 all included files change.
4501 all included files change.
4496
4502
4497 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4503 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4498 the delimiter removal option (the fix is ugly right now).
4504 the delimiter removal option (the fix is ugly right now).
4499
4505
4500 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4506 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4501 all of the math profile (quicker loading, no conflict between
4507 all of the math profile (quicker loading, no conflict between
4502 g-9.8 and g-gnuplot).
4508 g-9.8 and g-gnuplot).
4503
4509
4504 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4510 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4505 name of post-mortem files to IPython_crash_report.txt.
4511 name of post-mortem files to IPython_crash_report.txt.
4506
4512
4507 * Cleanup/update of the docs. Added all the new readline info and
4513 * Cleanup/update of the docs. Added all the new readline info and
4508 formatted all lists as 'real lists'.
4514 formatted all lists as 'real lists'.
4509
4515
4510 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4516 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4511 tab-completion options, since the full readline parse_and_bind is
4517 tab-completion options, since the full readline parse_and_bind is
4512 now accessible.
4518 now accessible.
4513
4519
4514 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4520 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4515 handling of readline options. Now users can specify any string to
4521 handling of readline options. Now users can specify any string to
4516 be passed to parse_and_bind(), as well as the delimiters to be
4522 be passed to parse_and_bind(), as well as the delimiters to be
4517 removed.
4523 removed.
4518 (InteractiveShell.__init__): Added __name__ to the global
4524 (InteractiveShell.__init__): Added __name__ to the global
4519 namespace so that things like Itpl which rely on its existence
4525 namespace so that things like Itpl which rely on its existence
4520 don't crash.
4526 don't crash.
4521 (InteractiveShell._prefilter): Defined the default with a _ so
4527 (InteractiveShell._prefilter): Defined the default with a _ so
4522 that prefilter() is easier to override, while the default one
4528 that prefilter() is easier to override, while the default one
4523 remains available.
4529 remains available.
4524
4530
4525 2002-04-18 Fernando Perez <fperez@colorado.edu>
4531 2002-04-18 Fernando Perez <fperez@colorado.edu>
4526
4532
4527 * Added information about pdb in the docs.
4533 * Added information about pdb in the docs.
4528
4534
4529 2002-04-17 Fernando Perez <fperez@colorado.edu>
4535 2002-04-17 Fernando Perez <fperez@colorado.edu>
4530
4536
4531 * IPython/ipmaker.py (make_IPython): added rc_override option to
4537 * IPython/ipmaker.py (make_IPython): added rc_override option to
4532 allow passing config options at creation time which may override
4538 allow passing config options at creation time which may override
4533 anything set in the config files or command line. This is
4539 anything set in the config files or command line. This is
4534 particularly useful for configuring embedded instances.
4540 particularly useful for configuring embedded instances.
4535
4541
4536 2002-04-15 Fernando Perez <fperez@colorado.edu>
4542 2002-04-15 Fernando Perez <fperez@colorado.edu>
4537
4543
4538 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4544 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4539 crash embedded instances because of the input cache falling out of
4545 crash embedded instances because of the input cache falling out of
4540 sync with the output counter.
4546 sync with the output counter.
4541
4547
4542 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4548 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4543 mode which calls pdb after an uncaught exception in IPython itself.
4549 mode which calls pdb after an uncaught exception in IPython itself.
4544
4550
4545 2002-04-14 Fernando Perez <fperez@colorado.edu>
4551 2002-04-14 Fernando Perez <fperez@colorado.edu>
4546
4552
4547 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4553 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4548 readline, fix it back after each call.
4554 readline, fix it back after each call.
4549
4555
4550 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4556 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4551 method to force all access via __call__(), which guarantees that
4557 method to force all access via __call__(), which guarantees that
4552 traceback references are properly deleted.
4558 traceback references are properly deleted.
4553
4559
4554 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4560 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4555 improve printing when pprint is in use.
4561 improve printing when pprint is in use.
4556
4562
4557 2002-04-13 Fernando Perez <fperez@colorado.edu>
4563 2002-04-13 Fernando Perez <fperez@colorado.edu>
4558
4564
4559 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4565 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4560 exceptions aren't caught anymore. If the user triggers one, he
4566 exceptions aren't caught anymore. If the user triggers one, he
4561 should know why he's doing it and it should go all the way up,
4567 should know why he's doing it and it should go all the way up,
4562 just like any other exception. So now @abort will fully kill the
4568 just like any other exception. So now @abort will fully kill the
4563 embedded interpreter and the embedding code (unless that happens
4569 embedded interpreter and the embedding code (unless that happens
4564 to catch SystemExit).
4570 to catch SystemExit).
4565
4571
4566 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4572 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4567 and a debugger() method to invoke the interactive pdb debugger
4573 and a debugger() method to invoke the interactive pdb debugger
4568 after printing exception information. Also added the corresponding
4574 after printing exception information. Also added the corresponding
4569 -pdb option and @pdb magic to control this feature, and updated
4575 -pdb option and @pdb magic to control this feature, and updated
4570 the docs. After a suggestion from Christopher Hart
4576 the docs. After a suggestion from Christopher Hart
4571 (hart-AT-caltech.edu).
4577 (hart-AT-caltech.edu).
4572
4578
4573 2002-04-12 Fernando Perez <fperez@colorado.edu>
4579 2002-04-12 Fernando Perez <fperez@colorado.edu>
4574
4580
4575 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4581 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4576 the exception handlers defined by the user (not the CrashHandler)
4582 the exception handlers defined by the user (not the CrashHandler)
4577 so that user exceptions don't trigger an ipython bug report.
4583 so that user exceptions don't trigger an ipython bug report.
4578
4584
4579 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4585 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4580 configurable (it should have always been so).
4586 configurable (it should have always been so).
4581
4587
4582 2002-03-26 Fernando Perez <fperez@colorado.edu>
4588 2002-03-26 Fernando Perez <fperez@colorado.edu>
4583
4589
4584 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4590 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4585 and there to fix embedding namespace issues. This should all be
4591 and there to fix embedding namespace issues. This should all be
4586 done in a more elegant way.
4592 done in a more elegant way.
4587
4593
4588 2002-03-25 Fernando Perez <fperez@colorado.edu>
4594 2002-03-25 Fernando Perez <fperez@colorado.edu>
4589
4595
4590 * IPython/genutils.py (get_home_dir): Try to make it work under
4596 * IPython/genutils.py (get_home_dir): Try to make it work under
4591 win9x also.
4597 win9x also.
4592
4598
4593 2002-03-20 Fernando Perez <fperez@colorado.edu>
4599 2002-03-20 Fernando Perez <fperez@colorado.edu>
4594
4600
4595 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4601 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4596 sys.displayhook untouched upon __init__.
4602 sys.displayhook untouched upon __init__.
4597
4603
4598 2002-03-19 Fernando Perez <fperez@colorado.edu>
4604 2002-03-19 Fernando Perez <fperez@colorado.edu>
4599
4605
4600 * Released 0.2.9 (for embedding bug, basically).
4606 * Released 0.2.9 (for embedding bug, basically).
4601
4607
4602 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4608 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4603 exceptions so that enclosing shell's state can be restored.
4609 exceptions so that enclosing shell's state can be restored.
4604
4610
4605 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4611 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4606 naming conventions in the .ipython/ dir.
4612 naming conventions in the .ipython/ dir.
4607
4613
4608 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4614 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4609 from delimiters list so filenames with - in them get expanded.
4615 from delimiters list so filenames with - in them get expanded.
4610
4616
4611 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4617 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4612 sys.displayhook not being properly restored after an embedded call.
4618 sys.displayhook not being properly restored after an embedded call.
4613
4619
4614 2002-03-18 Fernando Perez <fperez@colorado.edu>
4620 2002-03-18 Fernando Perez <fperez@colorado.edu>
4615
4621
4616 * Released 0.2.8
4622 * Released 0.2.8
4617
4623
4618 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4624 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4619 some files weren't being included in a -upgrade.
4625 some files weren't being included in a -upgrade.
4620 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4626 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4621 on' so that the first tab completes.
4627 on' so that the first tab completes.
4622 (InteractiveShell.handle_magic): fixed bug with spaces around
4628 (InteractiveShell.handle_magic): fixed bug with spaces around
4623 quotes breaking many magic commands.
4629 quotes breaking many magic commands.
4624
4630
4625 * setup.py: added note about ignoring the syntax error messages at
4631 * setup.py: added note about ignoring the syntax error messages at
4626 installation.
4632 installation.
4627
4633
4628 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4634 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4629 streamlining the gnuplot interface, now there's only one magic @gp.
4635 streamlining the gnuplot interface, now there's only one magic @gp.
4630
4636
4631 2002-03-17 Fernando Perez <fperez@colorado.edu>
4637 2002-03-17 Fernando Perez <fperez@colorado.edu>
4632
4638
4633 * IPython/UserConfig/magic_gnuplot.py: new name for the
4639 * IPython/UserConfig/magic_gnuplot.py: new name for the
4634 example-magic_pm.py file. Much enhanced system, now with a shell
4640 example-magic_pm.py file. Much enhanced system, now with a shell
4635 for communicating directly with gnuplot, one command at a time.
4641 for communicating directly with gnuplot, one command at a time.
4636
4642
4637 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4643 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4638 setting __name__=='__main__'.
4644 setting __name__=='__main__'.
4639
4645
4640 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4646 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4641 mini-shell for accessing gnuplot from inside ipython. Should
4647 mini-shell for accessing gnuplot from inside ipython. Should
4642 extend it later for grace access too. Inspired by Arnd's
4648 extend it later for grace access too. Inspired by Arnd's
4643 suggestion.
4649 suggestion.
4644
4650
4645 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4651 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4646 calling magic functions with () in their arguments. Thanks to Arnd
4652 calling magic functions with () in their arguments. Thanks to Arnd
4647 Baecker for pointing this to me.
4653 Baecker for pointing this to me.
4648
4654
4649 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4655 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4650 infinitely for integer or complex arrays (only worked with floats).
4656 infinitely for integer or complex arrays (only worked with floats).
4651
4657
4652 2002-03-16 Fernando Perez <fperez@colorado.edu>
4658 2002-03-16 Fernando Perez <fperez@colorado.edu>
4653
4659
4654 * setup.py: Merged setup and setup_windows into a single script
4660 * setup.py: Merged setup and setup_windows into a single script
4655 which properly handles things for windows users.
4661 which properly handles things for windows users.
4656
4662
4657 2002-03-15 Fernando Perez <fperez@colorado.edu>
4663 2002-03-15 Fernando Perez <fperez@colorado.edu>
4658
4664
4659 * Big change to the manual: now the magics are all automatically
4665 * Big change to the manual: now the magics are all automatically
4660 documented. This information is generated from their docstrings
4666 documented. This information is generated from their docstrings
4661 and put in a latex file included by the manual lyx file. This way
4667 and put in a latex file included by the manual lyx file. This way
4662 we get always up to date information for the magics. The manual
4668 we get always up to date information for the magics. The manual
4663 now also has proper version information, also auto-synced.
4669 now also has proper version information, also auto-synced.
4664
4670
4665 For this to work, an undocumented --magic_docstrings option was added.
4671 For this to work, an undocumented --magic_docstrings option was added.
4666
4672
4667 2002-03-13 Fernando Perez <fperez@colorado.edu>
4673 2002-03-13 Fernando Perez <fperez@colorado.edu>
4668
4674
4669 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4675 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4670 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4676 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4671
4677
4672 2002-03-12 Fernando Perez <fperez@colorado.edu>
4678 2002-03-12 Fernando Perez <fperez@colorado.edu>
4673
4679
4674 * IPython/ultraTB.py (TermColors): changed color escapes again to
4680 * IPython/ultraTB.py (TermColors): changed color escapes again to
4675 fix the (old, reintroduced) line-wrapping bug. Basically, if
4681 fix the (old, reintroduced) line-wrapping bug. Basically, if
4676 \001..\002 aren't given in the color escapes, lines get wrapped
4682 \001..\002 aren't given in the color escapes, lines get wrapped
4677 weirdly. But giving those screws up old xterms and emacs terms. So
4683 weirdly. But giving those screws up old xterms and emacs terms. So
4678 I added some logic for emacs terms to be ok, but I can't identify old
4684 I added some logic for emacs terms to be ok, but I can't identify old
4679 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4685 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4680
4686
4681 2002-03-10 Fernando Perez <fperez@colorado.edu>
4687 2002-03-10 Fernando Perez <fperez@colorado.edu>
4682
4688
4683 * IPython/usage.py (__doc__): Various documentation cleanups and
4689 * IPython/usage.py (__doc__): Various documentation cleanups and
4684 updates, both in usage docstrings and in the manual.
4690 updates, both in usage docstrings and in the manual.
4685
4691
4686 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4692 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4687 handling of caching. Set minimum acceptabe value for having a
4693 handling of caching. Set minimum acceptabe value for having a
4688 cache at 20 values.
4694 cache at 20 values.
4689
4695
4690 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4696 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4691 install_first_time function to a method, renamed it and added an
4697 install_first_time function to a method, renamed it and added an
4692 'upgrade' mode. Now people can update their config directory with
4698 'upgrade' mode. Now people can update their config directory with
4693 a simple command line switch (-upgrade, also new).
4699 a simple command line switch (-upgrade, also new).
4694
4700
4695 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4701 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4696 @file (convenient for automagic users under Python >= 2.2).
4702 @file (convenient for automagic users under Python >= 2.2).
4697 Removed @files (it seemed more like a plural than an abbrev. of
4703 Removed @files (it seemed more like a plural than an abbrev. of
4698 'file show').
4704 'file show').
4699
4705
4700 * IPython/iplib.py (install_first_time): Fixed crash if there were
4706 * IPython/iplib.py (install_first_time): Fixed crash if there were
4701 backup files ('~') in .ipython/ install directory.
4707 backup files ('~') in .ipython/ install directory.
4702
4708
4703 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4709 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4704 system. Things look fine, but these changes are fairly
4710 system. Things look fine, but these changes are fairly
4705 intrusive. Test them for a few days.
4711 intrusive. Test them for a few days.
4706
4712
4707 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4713 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4708 the prompts system. Now all in/out prompt strings are user
4714 the prompts system. Now all in/out prompt strings are user
4709 controllable. This is particularly useful for embedding, as one
4715 controllable. This is particularly useful for embedding, as one
4710 can tag embedded instances with particular prompts.
4716 can tag embedded instances with particular prompts.
4711
4717
4712 Also removed global use of sys.ps1/2, which now allows nested
4718 Also removed global use of sys.ps1/2, which now allows nested
4713 embeddings without any problems. Added command-line options for
4719 embeddings without any problems. Added command-line options for
4714 the prompt strings.
4720 the prompt strings.
4715
4721
4716 2002-03-08 Fernando Perez <fperez@colorado.edu>
4722 2002-03-08 Fernando Perez <fperez@colorado.edu>
4717
4723
4718 * IPython/UserConfig/example-embed-short.py (ipshell): added
4724 * IPython/UserConfig/example-embed-short.py (ipshell): added
4719 example file with the bare minimum code for embedding.
4725 example file with the bare minimum code for embedding.
4720
4726
4721 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4727 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4722 functionality for the embeddable shell to be activated/deactivated
4728 functionality for the embeddable shell to be activated/deactivated
4723 either globally or at each call.
4729 either globally or at each call.
4724
4730
4725 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4731 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4726 rewriting the prompt with '--->' for auto-inputs with proper
4732 rewriting the prompt with '--->' for auto-inputs with proper
4727 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4733 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4728 this is handled by the prompts class itself, as it should.
4734 this is handled by the prompts class itself, as it should.
4729
4735
4730 2002-03-05 Fernando Perez <fperez@colorado.edu>
4736 2002-03-05 Fernando Perez <fperez@colorado.edu>
4731
4737
4732 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4738 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4733 @logstart to avoid name clashes with the math log function.
4739 @logstart to avoid name clashes with the math log function.
4734
4740
4735 * Big updates to X/Emacs section of the manual.
4741 * Big updates to X/Emacs section of the manual.
4736
4742
4737 * Removed ipython_emacs. Milan explained to me how to pass
4743 * Removed ipython_emacs. Milan explained to me how to pass
4738 arguments to ipython through Emacs. Some day I'm going to end up
4744 arguments to ipython through Emacs. Some day I'm going to end up
4739 learning some lisp...
4745 learning some lisp...
4740
4746
4741 2002-03-04 Fernando Perez <fperez@colorado.edu>
4747 2002-03-04 Fernando Perez <fperez@colorado.edu>
4742
4748
4743 * IPython/ipython_emacs: Created script to be used as the
4749 * IPython/ipython_emacs: Created script to be used as the
4744 py-python-command Emacs variable so we can pass IPython
4750 py-python-command Emacs variable so we can pass IPython
4745 parameters. I can't figure out how to tell Emacs directly to pass
4751 parameters. I can't figure out how to tell Emacs directly to pass
4746 parameters to IPython, so a dummy shell script will do it.
4752 parameters to IPython, so a dummy shell script will do it.
4747
4753
4748 Other enhancements made for things to work better under Emacs'
4754 Other enhancements made for things to work better under Emacs'
4749 various types of terminals. Many thanks to Milan Zamazal
4755 various types of terminals. Many thanks to Milan Zamazal
4750 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4756 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4751
4757
4752 2002-03-01 Fernando Perez <fperez@colorado.edu>
4758 2002-03-01 Fernando Perez <fperez@colorado.edu>
4753
4759
4754 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4760 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4755 that loading of readline is now optional. This gives better
4761 that loading of readline is now optional. This gives better
4756 control to emacs users.
4762 control to emacs users.
4757
4763
4758 * IPython/ultraTB.py (__date__): Modified color escape sequences
4764 * IPython/ultraTB.py (__date__): Modified color escape sequences
4759 and now things work fine under xterm and in Emacs' term buffers
4765 and now things work fine under xterm and in Emacs' term buffers
4760 (though not shell ones). Well, in emacs you get colors, but all
4766 (though not shell ones). Well, in emacs you get colors, but all
4761 seem to be 'light' colors (no difference between dark and light
4767 seem to be 'light' colors (no difference between dark and light
4762 ones). But the garbage chars are gone, and also in xterms. It
4768 ones). But the garbage chars are gone, and also in xterms. It
4763 seems that now I'm using 'cleaner' ansi sequences.
4769 seems that now I'm using 'cleaner' ansi sequences.
4764
4770
4765 2002-02-21 Fernando Perez <fperez@colorado.edu>
4771 2002-02-21 Fernando Perez <fperez@colorado.edu>
4766
4772
4767 * Released 0.2.7 (mainly to publish the scoping fix).
4773 * Released 0.2.7 (mainly to publish the scoping fix).
4768
4774
4769 * IPython/Logger.py (Logger.logstate): added. A corresponding
4775 * IPython/Logger.py (Logger.logstate): added. A corresponding
4770 @logstate magic was created.
4776 @logstate magic was created.
4771
4777
4772 * IPython/Magic.py: fixed nested scoping problem under Python
4778 * IPython/Magic.py: fixed nested scoping problem under Python
4773 2.1.x (automagic wasn't working).
4779 2.1.x (automagic wasn't working).
4774
4780
4775 2002-02-20 Fernando Perez <fperez@colorado.edu>
4781 2002-02-20 Fernando Perez <fperez@colorado.edu>
4776
4782
4777 * Released 0.2.6.
4783 * Released 0.2.6.
4778
4784
4779 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4785 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4780 option so that logs can come out without any headers at all.
4786 option so that logs can come out without any headers at all.
4781
4787
4782 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4788 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4783 SciPy.
4789 SciPy.
4784
4790
4785 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4791 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4786 that embedded IPython calls don't require vars() to be explicitly
4792 that embedded IPython calls don't require vars() to be explicitly
4787 passed. Now they are extracted from the caller's frame (code
4793 passed. Now they are extracted from the caller's frame (code
4788 snatched from Eric Jones' weave). Added better documentation to
4794 snatched from Eric Jones' weave). Added better documentation to
4789 the section on embedding and the example file.
4795 the section on embedding and the example file.
4790
4796
4791 * IPython/genutils.py (page): Changed so that under emacs, it just
4797 * IPython/genutils.py (page): Changed so that under emacs, it just
4792 prints the string. You can then page up and down in the emacs
4798 prints the string. You can then page up and down in the emacs
4793 buffer itself. This is how the builtin help() works.
4799 buffer itself. This is how the builtin help() works.
4794
4800
4795 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4801 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4796 macro scoping: macros need to be executed in the user's namespace
4802 macro scoping: macros need to be executed in the user's namespace
4797 to work as if they had been typed by the user.
4803 to work as if they had been typed by the user.
4798
4804
4799 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4805 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4800 execute automatically (no need to type 'exec...'). They then
4806 execute automatically (no need to type 'exec...'). They then
4801 behave like 'true macros'. The printing system was also modified
4807 behave like 'true macros'. The printing system was also modified
4802 for this to work.
4808 for this to work.
4803
4809
4804 2002-02-19 Fernando Perez <fperez@colorado.edu>
4810 2002-02-19 Fernando Perez <fperez@colorado.edu>
4805
4811
4806 * IPython/genutils.py (page_file): new function for paging files
4812 * IPython/genutils.py (page_file): new function for paging files
4807 in an OS-independent way. Also necessary for file viewing to work
4813 in an OS-independent way. Also necessary for file viewing to work
4808 well inside Emacs buffers.
4814 well inside Emacs buffers.
4809 (page): Added checks for being in an emacs buffer.
4815 (page): Added checks for being in an emacs buffer.
4810 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4816 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4811 same bug in iplib.
4817 same bug in iplib.
4812
4818
4813 2002-02-18 Fernando Perez <fperez@colorado.edu>
4819 2002-02-18 Fernando Perez <fperez@colorado.edu>
4814
4820
4815 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4821 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4816 of readline so that IPython can work inside an Emacs buffer.
4822 of readline so that IPython can work inside an Emacs buffer.
4817
4823
4818 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4824 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4819 method signatures (they weren't really bugs, but it looks cleaner
4825 method signatures (they weren't really bugs, but it looks cleaner
4820 and keeps PyChecker happy).
4826 and keeps PyChecker happy).
4821
4827
4822 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4828 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4823 for implementing various user-defined hooks. Currently only
4829 for implementing various user-defined hooks. Currently only
4824 display is done.
4830 display is done.
4825
4831
4826 * IPython/Prompts.py (CachedOutput._display): changed display
4832 * IPython/Prompts.py (CachedOutput._display): changed display
4827 functions so that they can be dynamically changed by users easily.
4833 functions so that they can be dynamically changed by users easily.
4828
4834
4829 * IPython/Extensions/numeric_formats.py (num_display): added an
4835 * IPython/Extensions/numeric_formats.py (num_display): added an
4830 extension for printing NumPy arrays in flexible manners. It
4836 extension for printing NumPy arrays in flexible manners. It
4831 doesn't do anything yet, but all the structure is in
4837 doesn't do anything yet, but all the structure is in
4832 place. Ultimately the plan is to implement output format control
4838 place. Ultimately the plan is to implement output format control
4833 like in Octave.
4839 like in Octave.
4834
4840
4835 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4841 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4836 methods are found at run-time by all the automatic machinery.
4842 methods are found at run-time by all the automatic machinery.
4837
4843
4838 2002-02-17 Fernando Perez <fperez@colorado.edu>
4844 2002-02-17 Fernando Perez <fperez@colorado.edu>
4839
4845
4840 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4846 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4841 whole file a little.
4847 whole file a little.
4842
4848
4843 * ToDo: closed this document. Now there's a new_design.lyx
4849 * ToDo: closed this document. Now there's a new_design.lyx
4844 document for all new ideas. Added making a pdf of it for the
4850 document for all new ideas. Added making a pdf of it for the
4845 end-user distro.
4851 end-user distro.
4846
4852
4847 * IPython/Logger.py (Logger.switch_log): Created this to replace
4853 * IPython/Logger.py (Logger.switch_log): Created this to replace
4848 logon() and logoff(). It also fixes a nasty crash reported by
4854 logon() and logoff(). It also fixes a nasty crash reported by
4849 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4855 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4850
4856
4851 * IPython/iplib.py (complete): got auto-completion to work with
4857 * IPython/iplib.py (complete): got auto-completion to work with
4852 automagic (I had wanted this for a long time).
4858 automagic (I had wanted this for a long time).
4853
4859
4854 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4860 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4855 to @file, since file() is now a builtin and clashes with automagic
4861 to @file, since file() is now a builtin and clashes with automagic
4856 for @file.
4862 for @file.
4857
4863
4858 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4864 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4859 of this was previously in iplib, which had grown to more than 2000
4865 of this was previously in iplib, which had grown to more than 2000
4860 lines, way too long. No new functionality, but it makes managing
4866 lines, way too long. No new functionality, but it makes managing
4861 the code a bit easier.
4867 the code a bit easier.
4862
4868
4863 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4869 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4864 information to crash reports.
4870 information to crash reports.
4865
4871
4866 2002-02-12 Fernando Perez <fperez@colorado.edu>
4872 2002-02-12 Fernando Perez <fperez@colorado.edu>
4867
4873
4868 * Released 0.2.5.
4874 * Released 0.2.5.
4869
4875
4870 2002-02-11 Fernando Perez <fperez@colorado.edu>
4876 2002-02-11 Fernando Perez <fperez@colorado.edu>
4871
4877
4872 * Wrote a relatively complete Windows installer. It puts
4878 * Wrote a relatively complete Windows installer. It puts
4873 everything in place, creates Start Menu entries and fixes the
4879 everything in place, creates Start Menu entries and fixes the
4874 color issues. Nothing fancy, but it works.
4880 color issues. Nothing fancy, but it works.
4875
4881
4876 2002-02-10 Fernando Perez <fperez@colorado.edu>
4882 2002-02-10 Fernando Perez <fperez@colorado.edu>
4877
4883
4878 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4884 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4879 os.path.expanduser() call so that we can type @run ~/myfile.py and
4885 os.path.expanduser() call so that we can type @run ~/myfile.py and
4880 have thigs work as expected.
4886 have thigs work as expected.
4881
4887
4882 * IPython/genutils.py (page): fixed exception handling so things
4888 * IPython/genutils.py (page): fixed exception handling so things
4883 work both in Unix and Windows correctly. Quitting a pager triggers
4889 work both in Unix and Windows correctly. Quitting a pager triggers
4884 an IOError/broken pipe in Unix, and in windows not finding a pager
4890 an IOError/broken pipe in Unix, and in windows not finding a pager
4885 is also an IOError, so I had to actually look at the return value
4891 is also an IOError, so I had to actually look at the return value
4886 of the exception, not just the exception itself. Should be ok now.
4892 of the exception, not just the exception itself. Should be ok now.
4887
4893
4888 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4894 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4889 modified to allow case-insensitive color scheme changes.
4895 modified to allow case-insensitive color scheme changes.
4890
4896
4891 2002-02-09 Fernando Perez <fperez@colorado.edu>
4897 2002-02-09 Fernando Perez <fperez@colorado.edu>
4892
4898
4893 * IPython/genutils.py (native_line_ends): new function to leave
4899 * IPython/genutils.py (native_line_ends): new function to leave
4894 user config files with os-native line-endings.
4900 user config files with os-native line-endings.
4895
4901
4896 * README and manual updates.
4902 * README and manual updates.
4897
4903
4898 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4904 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4899 instead of StringType to catch Unicode strings.
4905 instead of StringType to catch Unicode strings.
4900
4906
4901 * IPython/genutils.py (filefind): fixed bug for paths with
4907 * IPython/genutils.py (filefind): fixed bug for paths with
4902 embedded spaces (very common in Windows).
4908 embedded spaces (very common in Windows).
4903
4909
4904 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4910 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4905 files under Windows, so that they get automatically associated
4911 files under Windows, so that they get automatically associated
4906 with a text editor. Windows makes it a pain to handle
4912 with a text editor. Windows makes it a pain to handle
4907 extension-less files.
4913 extension-less files.
4908
4914
4909 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4915 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4910 warning about readline only occur for Posix. In Windows there's no
4916 warning about readline only occur for Posix. In Windows there's no
4911 way to get readline, so why bother with the warning.
4917 way to get readline, so why bother with the warning.
4912
4918
4913 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4919 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4914 for __str__ instead of dir(self), since dir() changed in 2.2.
4920 for __str__ instead of dir(self), since dir() changed in 2.2.
4915
4921
4916 * Ported to Windows! Tested on XP, I suspect it should work fine
4922 * Ported to Windows! Tested on XP, I suspect it should work fine
4917 on NT/2000, but I don't think it will work on 98 et al. That
4923 on NT/2000, but I don't think it will work on 98 et al. That
4918 series of Windows is such a piece of junk anyway that I won't try
4924 series of Windows is such a piece of junk anyway that I won't try
4919 porting it there. The XP port was straightforward, showed a few
4925 porting it there. The XP port was straightforward, showed a few
4920 bugs here and there (fixed all), in particular some string
4926 bugs here and there (fixed all), in particular some string
4921 handling stuff which required considering Unicode strings (which
4927 handling stuff which required considering Unicode strings (which
4922 Windows uses). This is good, but hasn't been too tested :) No
4928 Windows uses). This is good, but hasn't been too tested :) No
4923 fancy installer yet, I'll put a note in the manual so people at
4929 fancy installer yet, I'll put a note in the manual so people at
4924 least make manually a shortcut.
4930 least make manually a shortcut.
4925
4931
4926 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4932 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4927 into a single one, "colors". This now controls both prompt and
4933 into a single one, "colors". This now controls both prompt and
4928 exception color schemes, and can be changed both at startup
4934 exception color schemes, and can be changed both at startup
4929 (either via command-line switches or via ipythonrc files) and at
4935 (either via command-line switches or via ipythonrc files) and at
4930 runtime, with @colors.
4936 runtime, with @colors.
4931 (Magic.magic_run): renamed @prun to @run and removed the old
4937 (Magic.magic_run): renamed @prun to @run and removed the old
4932 @run. The two were too similar to warrant keeping both.
4938 @run. The two were too similar to warrant keeping both.
4933
4939
4934 2002-02-03 Fernando Perez <fperez@colorado.edu>
4940 2002-02-03 Fernando Perez <fperez@colorado.edu>
4935
4941
4936 * IPython/iplib.py (install_first_time): Added comment on how to
4942 * IPython/iplib.py (install_first_time): Added comment on how to
4937 configure the color options for first-time users. Put a <return>
4943 configure the color options for first-time users. Put a <return>
4938 request at the end so that small-terminal users get a chance to
4944 request at the end so that small-terminal users get a chance to
4939 read the startup info.
4945 read the startup info.
4940
4946
4941 2002-01-23 Fernando Perez <fperez@colorado.edu>
4947 2002-01-23 Fernando Perez <fperez@colorado.edu>
4942
4948
4943 * IPython/iplib.py (CachedOutput.update): Changed output memory
4949 * IPython/iplib.py (CachedOutput.update): Changed output memory
4944 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4950 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4945 input history we still use _i. Did this b/c these variable are
4951 input history we still use _i. Did this b/c these variable are
4946 very commonly used in interactive work, so the less we need to
4952 very commonly used in interactive work, so the less we need to
4947 type the better off we are.
4953 type the better off we are.
4948 (Magic.magic_prun): updated @prun to better handle the namespaces
4954 (Magic.magic_prun): updated @prun to better handle the namespaces
4949 the file will run in, including a fix for __name__ not being set
4955 the file will run in, including a fix for __name__ not being set
4950 before.
4956 before.
4951
4957
4952 2002-01-20 Fernando Perez <fperez@colorado.edu>
4958 2002-01-20 Fernando Perez <fperez@colorado.edu>
4953
4959
4954 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4960 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4955 extra garbage for Python 2.2. Need to look more carefully into
4961 extra garbage for Python 2.2. Need to look more carefully into
4956 this later.
4962 this later.
4957
4963
4958 2002-01-19 Fernando Perez <fperez@colorado.edu>
4964 2002-01-19 Fernando Perez <fperez@colorado.edu>
4959
4965
4960 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
4966 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
4961 display SyntaxError exceptions properly formatted when they occur
4967 display SyntaxError exceptions properly formatted when they occur
4962 (they can be triggered by imported code).
4968 (they can be triggered by imported code).
4963
4969
4964 2002-01-18 Fernando Perez <fperez@colorado.edu>
4970 2002-01-18 Fernando Perez <fperez@colorado.edu>
4965
4971
4966 * IPython/iplib.py (InteractiveShell.safe_execfile): now
4972 * IPython/iplib.py (InteractiveShell.safe_execfile): now
4967 SyntaxError exceptions are reported nicely formatted, instead of
4973 SyntaxError exceptions are reported nicely formatted, instead of
4968 spitting out only offset information as before.
4974 spitting out only offset information as before.
4969 (Magic.magic_prun): Added the @prun function for executing
4975 (Magic.magic_prun): Added the @prun function for executing
4970 programs with command line args inside IPython.
4976 programs with command line args inside IPython.
4971
4977
4972 2002-01-16 Fernando Perez <fperez@colorado.edu>
4978 2002-01-16 Fernando Perez <fperez@colorado.edu>
4973
4979
4974 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
4980 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
4975 to *not* include the last item given in a range. This brings their
4981 to *not* include the last item given in a range. This brings their
4976 behavior in line with Python's slicing:
4982 behavior in line with Python's slicing:
4977 a[n1:n2] -> a[n1]...a[n2-1]
4983 a[n1:n2] -> a[n1]...a[n2-1]
4978 It may be a bit less convenient, but I prefer to stick to Python's
4984 It may be a bit less convenient, but I prefer to stick to Python's
4979 conventions *everywhere*, so users never have to wonder.
4985 conventions *everywhere*, so users never have to wonder.
4980 (Magic.magic_macro): Added @macro function to ease the creation of
4986 (Magic.magic_macro): Added @macro function to ease the creation of
4981 macros.
4987 macros.
4982
4988
4983 2002-01-05 Fernando Perez <fperez@colorado.edu>
4989 2002-01-05 Fernando Perez <fperez@colorado.edu>
4984
4990
4985 * Released 0.2.4.
4991 * Released 0.2.4.
4986
4992
4987 * IPython/iplib.py (Magic.magic_pdef):
4993 * IPython/iplib.py (Magic.magic_pdef):
4988 (InteractiveShell.safe_execfile): report magic lines and error
4994 (InteractiveShell.safe_execfile): report magic lines and error
4989 lines without line numbers so one can easily copy/paste them for
4995 lines without line numbers so one can easily copy/paste them for
4990 re-execution.
4996 re-execution.
4991
4997
4992 * Updated manual with recent changes.
4998 * Updated manual with recent changes.
4993
4999
4994 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5000 * IPython/iplib.py (Magic.magic_oinfo): added constructor
4995 docstring printing when class? is called. Very handy for knowing
5001 docstring printing when class? is called. Very handy for knowing
4996 how to create class instances (as long as __init__ is well
5002 how to create class instances (as long as __init__ is well
4997 documented, of course :)
5003 documented, of course :)
4998 (Magic.magic_doc): print both class and constructor docstrings.
5004 (Magic.magic_doc): print both class and constructor docstrings.
4999 (Magic.magic_pdef): give constructor info if passed a class and
5005 (Magic.magic_pdef): give constructor info if passed a class and
5000 __call__ info for callable object instances.
5006 __call__ info for callable object instances.
5001
5007
5002 2002-01-04 Fernando Perez <fperez@colorado.edu>
5008 2002-01-04 Fernando Perez <fperez@colorado.edu>
5003
5009
5004 * Made deep_reload() off by default. It doesn't always work
5010 * Made deep_reload() off by default. It doesn't always work
5005 exactly as intended, so it's probably safer to have it off. It's
5011 exactly as intended, so it's probably safer to have it off. It's
5006 still available as dreload() anyway, so nothing is lost.
5012 still available as dreload() anyway, so nothing is lost.
5007
5013
5008 2002-01-02 Fernando Perez <fperez@colorado.edu>
5014 2002-01-02 Fernando Perez <fperez@colorado.edu>
5009
5015
5010 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5016 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5011 so I wanted an updated release).
5017 so I wanted an updated release).
5012
5018
5013 2001-12-27 Fernando Perez <fperez@colorado.edu>
5019 2001-12-27 Fernando Perez <fperez@colorado.edu>
5014
5020
5015 * IPython/iplib.py (InteractiveShell.interact): Added the original
5021 * IPython/iplib.py (InteractiveShell.interact): Added the original
5016 code from 'code.py' for this module in order to change the
5022 code from 'code.py' for this module in order to change the
5017 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5023 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5018 the history cache would break when the user hit Ctrl-C, and
5024 the history cache would break when the user hit Ctrl-C, and
5019 interact() offers no way to add any hooks to it.
5025 interact() offers no way to add any hooks to it.
5020
5026
5021 2001-12-23 Fernando Perez <fperez@colorado.edu>
5027 2001-12-23 Fernando Perez <fperez@colorado.edu>
5022
5028
5023 * setup.py: added check for 'MANIFEST' before trying to remove
5029 * setup.py: added check for 'MANIFEST' before trying to remove
5024 it. Thanks to Sean Reifschneider.
5030 it. Thanks to Sean Reifschneider.
5025
5031
5026 2001-12-22 Fernando Perez <fperez@colorado.edu>
5032 2001-12-22 Fernando Perez <fperez@colorado.edu>
5027
5033
5028 * Released 0.2.2.
5034 * Released 0.2.2.
5029
5035
5030 * Finished (reasonably) writing the manual. Later will add the
5036 * Finished (reasonably) writing the manual. Later will add the
5031 python-standard navigation stylesheets, but for the time being
5037 python-standard navigation stylesheets, but for the time being
5032 it's fairly complete. Distribution will include html and pdf
5038 it's fairly complete. Distribution will include html and pdf
5033 versions.
5039 versions.
5034
5040
5035 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5041 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5036 (MayaVi author).
5042 (MayaVi author).
5037
5043
5038 2001-12-21 Fernando Perez <fperez@colorado.edu>
5044 2001-12-21 Fernando Perez <fperez@colorado.edu>
5039
5045
5040 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5046 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5041 good public release, I think (with the manual and the distutils
5047 good public release, I think (with the manual and the distutils
5042 installer). The manual can use some work, but that can go
5048 installer). The manual can use some work, but that can go
5043 slowly. Otherwise I think it's quite nice for end users. Next
5049 slowly. Otherwise I think it's quite nice for end users. Next
5044 summer, rewrite the guts of it...
5050 summer, rewrite the guts of it...
5045
5051
5046 * Changed format of ipythonrc files to use whitespace as the
5052 * Changed format of ipythonrc files to use whitespace as the
5047 separator instead of an explicit '='. Cleaner.
5053 separator instead of an explicit '='. Cleaner.
5048
5054
5049 2001-12-20 Fernando Perez <fperez@colorado.edu>
5055 2001-12-20 Fernando Perez <fperez@colorado.edu>
5050
5056
5051 * Started a manual in LyX. For now it's just a quick merge of the
5057 * Started a manual in LyX. For now it's just a quick merge of the
5052 various internal docstrings and READMEs. Later it may grow into a
5058 various internal docstrings and READMEs. Later it may grow into a
5053 nice, full-blown manual.
5059 nice, full-blown manual.
5054
5060
5055 * Set up a distutils based installer. Installation should now be
5061 * Set up a distutils based installer. Installation should now be
5056 trivially simple for end-users.
5062 trivially simple for end-users.
5057
5063
5058 2001-12-11 Fernando Perez <fperez@colorado.edu>
5064 2001-12-11 Fernando Perez <fperez@colorado.edu>
5059
5065
5060 * Released 0.2.0. First public release, announced it at
5066 * Released 0.2.0. First public release, announced it at
5061 comp.lang.python. From now on, just bugfixes...
5067 comp.lang.python. From now on, just bugfixes...
5062
5068
5063 * Went through all the files, set copyright/license notices and
5069 * Went through all the files, set copyright/license notices and
5064 cleaned up things. Ready for release.
5070 cleaned up things. Ready for release.
5065
5071
5066 2001-12-10 Fernando Perez <fperez@colorado.edu>
5072 2001-12-10 Fernando Perez <fperez@colorado.edu>
5067
5073
5068 * Changed the first-time installer not to use tarfiles. It's more
5074 * Changed the first-time installer not to use tarfiles. It's more
5069 robust now and less unix-dependent. Also makes it easier for
5075 robust now and less unix-dependent. Also makes it easier for
5070 people to later upgrade versions.
5076 people to later upgrade versions.
5071
5077
5072 * Changed @exit to @abort to reflect the fact that it's pretty
5078 * Changed @exit to @abort to reflect the fact that it's pretty
5073 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5079 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5074 becomes significant only when IPyhton is embedded: in that case,
5080 becomes significant only when IPyhton is embedded: in that case,
5075 C-D closes IPython only, but @abort kills the enclosing program
5081 C-D closes IPython only, but @abort kills the enclosing program
5076 too (unless it had called IPython inside a try catching
5082 too (unless it had called IPython inside a try catching
5077 SystemExit).
5083 SystemExit).
5078
5084
5079 * Created Shell module which exposes the actuall IPython Shell
5085 * Created Shell module which exposes the actuall IPython Shell
5080 classes, currently the normal and the embeddable one. This at
5086 classes, currently the normal and the embeddable one. This at
5081 least offers a stable interface we won't need to change when
5087 least offers a stable interface we won't need to change when
5082 (later) the internals are rewritten. That rewrite will be confined
5088 (later) the internals are rewritten. That rewrite will be confined
5083 to iplib and ipmaker, but the Shell interface should remain as is.
5089 to iplib and ipmaker, but the Shell interface should remain as is.
5084
5090
5085 * Added embed module which offers an embeddable IPShell object,
5091 * Added embed module which offers an embeddable IPShell object,
5086 useful to fire up IPython *inside* a running program. Great for
5092 useful to fire up IPython *inside* a running program. Great for
5087 debugging or dynamical data analysis.
5093 debugging or dynamical data analysis.
5088
5094
5089 2001-12-08 Fernando Perez <fperez@colorado.edu>
5095 2001-12-08 Fernando Perez <fperez@colorado.edu>
5090
5096
5091 * Fixed small bug preventing seeing info from methods of defined
5097 * Fixed small bug preventing seeing info from methods of defined
5092 objects (incorrect namespace in _ofind()).
5098 objects (incorrect namespace in _ofind()).
5093
5099
5094 * Documentation cleanup. Moved the main usage docstrings to a
5100 * Documentation cleanup. Moved the main usage docstrings to a
5095 separate file, usage.py (cleaner to maintain, and hopefully in the
5101 separate file, usage.py (cleaner to maintain, and hopefully in the
5096 future some perlpod-like way of producing interactive, man and
5102 future some perlpod-like way of producing interactive, man and
5097 html docs out of it will be found).
5103 html docs out of it will be found).
5098
5104
5099 * Added @profile to see your profile at any time.
5105 * Added @profile to see your profile at any time.
5100
5106
5101 * Added @p as an alias for 'print'. It's especially convenient if
5107 * Added @p as an alias for 'print'. It's especially convenient if
5102 using automagic ('p x' prints x).
5108 using automagic ('p x' prints x).
5103
5109
5104 * Small cleanups and fixes after a pychecker run.
5110 * Small cleanups and fixes after a pychecker run.
5105
5111
5106 * Changed the @cd command to handle @cd - and @cd -<n> for
5112 * Changed the @cd command to handle @cd - and @cd -<n> for
5107 visiting any directory in _dh.
5113 visiting any directory in _dh.
5108
5114
5109 * Introduced _dh, a history of visited directories. @dhist prints
5115 * Introduced _dh, a history of visited directories. @dhist prints
5110 it out with numbers.
5116 it out with numbers.
5111
5117
5112 2001-12-07 Fernando Perez <fperez@colorado.edu>
5118 2001-12-07 Fernando Perez <fperez@colorado.edu>
5113
5119
5114 * Released 0.1.22
5120 * Released 0.1.22
5115
5121
5116 * Made initialization a bit more robust against invalid color
5122 * Made initialization a bit more robust against invalid color
5117 options in user input (exit, not traceback-crash).
5123 options in user input (exit, not traceback-crash).
5118
5124
5119 * Changed the bug crash reporter to write the report only in the
5125 * Changed the bug crash reporter to write the report only in the
5120 user's .ipython directory. That way IPython won't litter people's
5126 user's .ipython directory. That way IPython won't litter people's
5121 hard disks with crash files all over the place. Also print on
5127 hard disks with crash files all over the place. Also print on
5122 screen the necessary mail command.
5128 screen the necessary mail command.
5123
5129
5124 * With the new ultraTB, implemented LightBG color scheme for light
5130 * With the new ultraTB, implemented LightBG color scheme for light
5125 background terminals. A lot of people like white backgrounds, so I
5131 background terminals. A lot of people like white backgrounds, so I
5126 guess we should at least give them something readable.
5132 guess we should at least give them something readable.
5127
5133
5128 2001-12-06 Fernando Perez <fperez@colorado.edu>
5134 2001-12-06 Fernando Perez <fperez@colorado.edu>
5129
5135
5130 * Modified the structure of ultraTB. Now there's a proper class
5136 * Modified the structure of ultraTB. Now there's a proper class
5131 for tables of color schemes which allow adding schemes easily and
5137 for tables of color schemes which allow adding schemes easily and
5132 switching the active scheme without creating a new instance every
5138 switching the active scheme without creating a new instance every
5133 time (which was ridiculous). The syntax for creating new schemes
5139 time (which was ridiculous). The syntax for creating new schemes
5134 is also cleaner. I think ultraTB is finally done, with a clean
5140 is also cleaner. I think ultraTB is finally done, with a clean
5135 class structure. Names are also much cleaner (now there's proper
5141 class structure. Names are also much cleaner (now there's proper
5136 color tables, no need for every variable to also have 'color' in
5142 color tables, no need for every variable to also have 'color' in
5137 its name).
5143 its name).
5138
5144
5139 * Broke down genutils into separate files. Now genutils only
5145 * Broke down genutils into separate files. Now genutils only
5140 contains utility functions, and classes have been moved to their
5146 contains utility functions, and classes have been moved to their
5141 own files (they had enough independent functionality to warrant
5147 own files (they had enough independent functionality to warrant
5142 it): ConfigLoader, OutputTrap, Struct.
5148 it): ConfigLoader, OutputTrap, Struct.
5143
5149
5144 2001-12-05 Fernando Perez <fperez@colorado.edu>
5150 2001-12-05 Fernando Perez <fperez@colorado.edu>
5145
5151
5146 * IPython turns 21! Released version 0.1.21, as a candidate for
5152 * IPython turns 21! Released version 0.1.21, as a candidate for
5147 public consumption. If all goes well, release in a few days.
5153 public consumption. If all goes well, release in a few days.
5148
5154
5149 * Fixed path bug (files in Extensions/ directory wouldn't be found
5155 * Fixed path bug (files in Extensions/ directory wouldn't be found
5150 unless IPython/ was explicitly in sys.path).
5156 unless IPython/ was explicitly in sys.path).
5151
5157
5152 * Extended the FlexCompleter class as MagicCompleter to allow
5158 * Extended the FlexCompleter class as MagicCompleter to allow
5153 completion of @-starting lines.
5159 completion of @-starting lines.
5154
5160
5155 * Created __release__.py file as a central repository for release
5161 * Created __release__.py file as a central repository for release
5156 info that other files can read from.
5162 info that other files can read from.
5157
5163
5158 * Fixed small bug in logging: when logging was turned on in
5164 * Fixed small bug in logging: when logging was turned on in
5159 mid-session, old lines with special meanings (!@?) were being
5165 mid-session, old lines with special meanings (!@?) were being
5160 logged without the prepended comment, which is necessary since
5166 logged without the prepended comment, which is necessary since
5161 they are not truly valid python syntax. This should make session
5167 they are not truly valid python syntax. This should make session
5162 restores produce less errors.
5168 restores produce less errors.
5163
5169
5164 * The namespace cleanup forced me to make a FlexCompleter class
5170 * The namespace cleanup forced me to make a FlexCompleter class
5165 which is nothing but a ripoff of rlcompleter, but with selectable
5171 which is nothing but a ripoff of rlcompleter, but with selectable
5166 namespace (rlcompleter only works in __main__.__dict__). I'll try
5172 namespace (rlcompleter only works in __main__.__dict__). I'll try
5167 to submit a note to the authors to see if this change can be
5173 to submit a note to the authors to see if this change can be
5168 incorporated in future rlcompleter releases (Dec.6: done)
5174 incorporated in future rlcompleter releases (Dec.6: done)
5169
5175
5170 * More fixes to namespace handling. It was a mess! Now all
5176 * More fixes to namespace handling. It was a mess! Now all
5171 explicit references to __main__.__dict__ are gone (except when
5177 explicit references to __main__.__dict__ are gone (except when
5172 really needed) and everything is handled through the namespace
5178 really needed) and everything is handled through the namespace
5173 dicts in the IPython instance. We seem to be getting somewhere
5179 dicts in the IPython instance. We seem to be getting somewhere
5174 with this, finally...
5180 with this, finally...
5175
5181
5176 * Small documentation updates.
5182 * Small documentation updates.
5177
5183
5178 * Created the Extensions directory under IPython (with an
5184 * Created the Extensions directory under IPython (with an
5179 __init__.py). Put the PhysicalQ stuff there. This directory should
5185 __init__.py). Put the PhysicalQ stuff there. This directory should
5180 be used for all special-purpose extensions.
5186 be used for all special-purpose extensions.
5181
5187
5182 * File renaming:
5188 * File renaming:
5183 ipythonlib --> ipmaker
5189 ipythonlib --> ipmaker
5184 ipplib --> iplib
5190 ipplib --> iplib
5185 This makes a bit more sense in terms of what these files actually do.
5191 This makes a bit more sense in terms of what these files actually do.
5186
5192
5187 * Moved all the classes and functions in ipythonlib to ipplib, so
5193 * Moved all the classes and functions in ipythonlib to ipplib, so
5188 now ipythonlib only has make_IPython(). This will ease up its
5194 now ipythonlib only has make_IPython(). This will ease up its
5189 splitting in smaller functional chunks later.
5195 splitting in smaller functional chunks later.
5190
5196
5191 * Cleaned up (done, I think) output of @whos. Better column
5197 * Cleaned up (done, I think) output of @whos. Better column
5192 formatting, and now shows str(var) for as much as it can, which is
5198 formatting, and now shows str(var) for as much as it can, which is
5193 typically what one gets with a 'print var'.
5199 typically what one gets with a 'print var'.
5194
5200
5195 2001-12-04 Fernando Perez <fperez@colorado.edu>
5201 2001-12-04 Fernando Perez <fperez@colorado.edu>
5196
5202
5197 * Fixed namespace problems. Now builtin/IPyhton/user names get
5203 * Fixed namespace problems. Now builtin/IPyhton/user names get
5198 properly reported in their namespace. Internal namespace handling
5204 properly reported in their namespace. Internal namespace handling
5199 is finally getting decent (not perfect yet, but much better than
5205 is finally getting decent (not perfect yet, but much better than
5200 the ad-hoc mess we had).
5206 the ad-hoc mess we had).
5201
5207
5202 * Removed -exit option. If people just want to run a python
5208 * Removed -exit option. If people just want to run a python
5203 script, that's what the normal interpreter is for. Less
5209 script, that's what the normal interpreter is for. Less
5204 unnecessary options, less chances for bugs.
5210 unnecessary options, less chances for bugs.
5205
5211
5206 * Added a crash handler which generates a complete post-mortem if
5212 * Added a crash handler which generates a complete post-mortem if
5207 IPython crashes. This will help a lot in tracking bugs down the
5213 IPython crashes. This will help a lot in tracking bugs down the
5208 road.
5214 road.
5209
5215
5210 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5216 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5211 which were boud to functions being reassigned would bypass the
5217 which were boud to functions being reassigned would bypass the
5212 logger, breaking the sync of _il with the prompt counter. This
5218 logger, breaking the sync of _il with the prompt counter. This
5213 would then crash IPython later when a new line was logged.
5219 would then crash IPython later when a new line was logged.
5214
5220
5215 2001-12-02 Fernando Perez <fperez@colorado.edu>
5221 2001-12-02 Fernando Perez <fperez@colorado.edu>
5216
5222
5217 * Made IPython a package. This means people don't have to clutter
5223 * Made IPython a package. This means people don't have to clutter
5218 their sys.path with yet another directory. Changed the INSTALL
5224 their sys.path with yet another directory. Changed the INSTALL
5219 file accordingly.
5225 file accordingly.
5220
5226
5221 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5227 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5222 sorts its output (so @who shows it sorted) and @whos formats the
5228 sorts its output (so @who shows it sorted) and @whos formats the
5223 table according to the width of the first column. Nicer, easier to
5229 table according to the width of the first column. Nicer, easier to
5224 read. Todo: write a generic table_format() which takes a list of
5230 read. Todo: write a generic table_format() which takes a list of
5225 lists and prints it nicely formatted, with optional row/column
5231 lists and prints it nicely formatted, with optional row/column
5226 separators and proper padding and justification.
5232 separators and proper padding and justification.
5227
5233
5228 * Released 0.1.20
5234 * Released 0.1.20
5229
5235
5230 * Fixed bug in @log which would reverse the inputcache list (a
5236 * Fixed bug in @log which would reverse the inputcache list (a
5231 copy operation was missing).
5237 copy operation was missing).
5232
5238
5233 * Code cleanup. @config was changed to use page(). Better, since
5239 * Code cleanup. @config was changed to use page(). Better, since
5234 its output is always quite long.
5240 its output is always quite long.
5235
5241
5236 * Itpl is back as a dependency. I was having too many problems
5242 * Itpl is back as a dependency. I was having too many problems
5237 getting the parametric aliases to work reliably, and it's just
5243 getting the parametric aliases to work reliably, and it's just
5238 easier to code weird string operations with it than playing %()s
5244 easier to code weird string operations with it than playing %()s
5239 games. It's only ~6k, so I don't think it's too big a deal.
5245 games. It's only ~6k, so I don't think it's too big a deal.
5240
5246
5241 * Found (and fixed) a very nasty bug with history. !lines weren't
5247 * Found (and fixed) a very nasty bug with history. !lines weren't
5242 getting cached, and the out of sync caches would crash
5248 getting cached, and the out of sync caches would crash
5243 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5249 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5244 division of labor a bit better. Bug fixed, cleaner structure.
5250 division of labor a bit better. Bug fixed, cleaner structure.
5245
5251
5246 2001-12-01 Fernando Perez <fperez@colorado.edu>
5252 2001-12-01 Fernando Perez <fperez@colorado.edu>
5247
5253
5248 * Released 0.1.19
5254 * Released 0.1.19
5249
5255
5250 * Added option -n to @hist to prevent line number printing. Much
5256 * Added option -n to @hist to prevent line number printing. Much
5251 easier to copy/paste code this way.
5257 easier to copy/paste code this way.
5252
5258
5253 * Created global _il to hold the input list. Allows easy
5259 * Created global _il to hold the input list. Allows easy
5254 re-execution of blocks of code by slicing it (inspired by Janko's
5260 re-execution of blocks of code by slicing it (inspired by Janko's
5255 comment on 'macros').
5261 comment on 'macros').
5256
5262
5257 * Small fixes and doc updates.
5263 * Small fixes and doc updates.
5258
5264
5259 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5265 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5260 much too fragile with automagic. Handles properly multi-line
5266 much too fragile with automagic. Handles properly multi-line
5261 statements and takes parameters.
5267 statements and takes parameters.
5262
5268
5263 2001-11-30 Fernando Perez <fperez@colorado.edu>
5269 2001-11-30 Fernando Perez <fperez@colorado.edu>
5264
5270
5265 * Version 0.1.18 released.
5271 * Version 0.1.18 released.
5266
5272
5267 * Fixed nasty namespace bug in initial module imports.
5273 * Fixed nasty namespace bug in initial module imports.
5268
5274
5269 * Added copyright/license notes to all code files (except
5275 * Added copyright/license notes to all code files (except
5270 DPyGetOpt). For the time being, LGPL. That could change.
5276 DPyGetOpt). For the time being, LGPL. That could change.
5271
5277
5272 * Rewrote a much nicer README, updated INSTALL, cleaned up
5278 * Rewrote a much nicer README, updated INSTALL, cleaned up
5273 ipythonrc-* samples.
5279 ipythonrc-* samples.
5274
5280
5275 * Overall code/documentation cleanup. Basically ready for
5281 * Overall code/documentation cleanup. Basically ready for
5276 release. Only remaining thing: licence decision (LGPL?).
5282 release. Only remaining thing: licence decision (LGPL?).
5277
5283
5278 * Converted load_config to a class, ConfigLoader. Now recursion
5284 * Converted load_config to a class, ConfigLoader. Now recursion
5279 control is better organized. Doesn't include the same file twice.
5285 control is better organized. Doesn't include the same file twice.
5280
5286
5281 2001-11-29 Fernando Perez <fperez@colorado.edu>
5287 2001-11-29 Fernando Perez <fperez@colorado.edu>
5282
5288
5283 * Got input history working. Changed output history variables from
5289 * Got input history working. Changed output history variables from
5284 _p to _o so that _i is for input and _o for output. Just cleaner
5290 _p to _o so that _i is for input and _o for output. Just cleaner
5285 convention.
5291 convention.
5286
5292
5287 * Implemented parametric aliases. This pretty much allows the
5293 * Implemented parametric aliases. This pretty much allows the
5288 alias system to offer full-blown shell convenience, I think.
5294 alias system to offer full-blown shell convenience, I think.
5289
5295
5290 * Version 0.1.17 released, 0.1.18 opened.
5296 * Version 0.1.17 released, 0.1.18 opened.
5291
5297
5292 * dot_ipython/ipythonrc (alias): added documentation.
5298 * dot_ipython/ipythonrc (alias): added documentation.
5293 (xcolor): Fixed small bug (xcolors -> xcolor)
5299 (xcolor): Fixed small bug (xcolors -> xcolor)
5294
5300
5295 * Changed the alias system. Now alias is a magic command to define
5301 * Changed the alias system. Now alias is a magic command to define
5296 aliases just like the shell. Rationale: the builtin magics should
5302 aliases just like the shell. Rationale: the builtin magics should
5297 be there for things deeply connected to IPython's
5303 be there for things deeply connected to IPython's
5298 architecture. And this is a much lighter system for what I think
5304 architecture. And this is a much lighter system for what I think
5299 is the really important feature: allowing users to define quickly
5305 is the really important feature: allowing users to define quickly
5300 magics that will do shell things for them, so they can customize
5306 magics that will do shell things for them, so they can customize
5301 IPython easily to match their work habits. If someone is really
5307 IPython easily to match their work habits. If someone is really
5302 desperate to have another name for a builtin alias, they can
5308 desperate to have another name for a builtin alias, they can
5303 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5309 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5304 works.
5310 works.
5305
5311
5306 2001-11-28 Fernando Perez <fperez@colorado.edu>
5312 2001-11-28 Fernando Perez <fperez@colorado.edu>
5307
5313
5308 * Changed @file so that it opens the source file at the proper
5314 * Changed @file so that it opens the source file at the proper
5309 line. Since it uses less, if your EDITOR environment is
5315 line. Since it uses less, if your EDITOR environment is
5310 configured, typing v will immediately open your editor of choice
5316 configured, typing v will immediately open your editor of choice
5311 right at the line where the object is defined. Not as quick as
5317 right at the line where the object is defined. Not as quick as
5312 having a direct @edit command, but for all intents and purposes it
5318 having a direct @edit command, but for all intents and purposes it
5313 works. And I don't have to worry about writing @edit to deal with
5319 works. And I don't have to worry about writing @edit to deal with
5314 all the editors, less does that.
5320 all the editors, less does that.
5315
5321
5316 * Version 0.1.16 released, 0.1.17 opened.
5322 * Version 0.1.16 released, 0.1.17 opened.
5317
5323
5318 * Fixed some nasty bugs in the page/page_dumb combo that could
5324 * Fixed some nasty bugs in the page/page_dumb combo that could
5319 crash IPython.
5325 crash IPython.
5320
5326
5321 2001-11-27 Fernando Perez <fperez@colorado.edu>
5327 2001-11-27 Fernando Perez <fperez@colorado.edu>
5322
5328
5323 * Version 0.1.15 released, 0.1.16 opened.
5329 * Version 0.1.15 released, 0.1.16 opened.
5324
5330
5325 * Finally got ? and ?? to work for undefined things: now it's
5331 * Finally got ? and ?? to work for undefined things: now it's
5326 possible to type {}.get? and get information about the get method
5332 possible to type {}.get? and get information about the get method
5327 of dicts, or os.path? even if only os is defined (so technically
5333 of dicts, or os.path? even if only os is defined (so technically
5328 os.path isn't). Works at any level. For example, after import os,
5334 os.path isn't). Works at any level. For example, after import os,
5329 os?, os.path?, os.path.abspath? all work. This is great, took some
5335 os?, os.path?, os.path.abspath? all work. This is great, took some
5330 work in _ofind.
5336 work in _ofind.
5331
5337
5332 * Fixed more bugs with logging. The sanest way to do it was to add
5338 * Fixed more bugs with logging. The sanest way to do it was to add
5333 to @log a 'mode' parameter. Killed two in one shot (this mode
5339 to @log a 'mode' parameter. Killed two in one shot (this mode
5334 option was a request of Janko's). I think it's finally clean
5340 option was a request of Janko's). I think it's finally clean
5335 (famous last words).
5341 (famous last words).
5336
5342
5337 * Added a page_dumb() pager which does a decent job of paging on
5343 * Added a page_dumb() pager which does a decent job of paging on
5338 screen, if better things (like less) aren't available. One less
5344 screen, if better things (like less) aren't available. One less
5339 unix dependency (someday maybe somebody will port this to
5345 unix dependency (someday maybe somebody will port this to
5340 windows).
5346 windows).
5341
5347
5342 * Fixed problem in magic_log: would lock of logging out if log
5348 * Fixed problem in magic_log: would lock of logging out if log
5343 creation failed (because it would still think it had succeeded).
5349 creation failed (because it would still think it had succeeded).
5344
5350
5345 * Improved the page() function using curses to auto-detect screen
5351 * Improved the page() function using curses to auto-detect screen
5346 size. Now it can make a much better decision on whether to print
5352 size. Now it can make a much better decision on whether to print
5347 or page a string. Option screen_length was modified: a value 0
5353 or page a string. Option screen_length was modified: a value 0
5348 means auto-detect, and that's the default now.
5354 means auto-detect, and that's the default now.
5349
5355
5350 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5356 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5351 go out. I'll test it for a few days, then talk to Janko about
5357 go out. I'll test it for a few days, then talk to Janko about
5352 licences and announce it.
5358 licences and announce it.
5353
5359
5354 * Fixed the length of the auto-generated ---> prompt which appears
5360 * Fixed the length of the auto-generated ---> prompt which appears
5355 for auto-parens and auto-quotes. Getting this right isn't trivial,
5361 for auto-parens and auto-quotes. Getting this right isn't trivial,
5356 with all the color escapes, different prompt types and optional
5362 with all the color escapes, different prompt types and optional
5357 separators. But it seems to be working in all the combinations.
5363 separators. But it seems to be working in all the combinations.
5358
5364
5359 2001-11-26 Fernando Perez <fperez@colorado.edu>
5365 2001-11-26 Fernando Perez <fperez@colorado.edu>
5360
5366
5361 * Wrote a regexp filter to get option types from the option names
5367 * Wrote a regexp filter to get option types from the option names
5362 string. This eliminates the need to manually keep two duplicate
5368 string. This eliminates the need to manually keep two duplicate
5363 lists.
5369 lists.
5364
5370
5365 * Removed the unneeded check_option_names. Now options are handled
5371 * Removed the unneeded check_option_names. Now options are handled
5366 in a much saner manner and it's easy to visually check that things
5372 in a much saner manner and it's easy to visually check that things
5367 are ok.
5373 are ok.
5368
5374
5369 * Updated version numbers on all files I modified to carry a
5375 * Updated version numbers on all files I modified to carry a
5370 notice so Janko and Nathan have clear version markers.
5376 notice so Janko and Nathan have clear version markers.
5371
5377
5372 * Updated docstring for ultraTB with my changes. I should send
5378 * Updated docstring for ultraTB with my changes. I should send
5373 this to Nathan.
5379 this to Nathan.
5374
5380
5375 * Lots of small fixes. Ran everything through pychecker again.
5381 * Lots of small fixes. Ran everything through pychecker again.
5376
5382
5377 * Made loading of deep_reload an cmd line option. If it's not too
5383 * Made loading of deep_reload an cmd line option. If it's not too
5378 kosher, now people can just disable it. With -nodeep_reload it's
5384 kosher, now people can just disable it. With -nodeep_reload it's
5379 still available as dreload(), it just won't overwrite reload().
5385 still available as dreload(), it just won't overwrite reload().
5380
5386
5381 * Moved many options to the no| form (-opt and -noopt
5387 * Moved many options to the no| form (-opt and -noopt
5382 accepted). Cleaner.
5388 accepted). Cleaner.
5383
5389
5384 * Changed magic_log so that if called with no parameters, it uses
5390 * Changed magic_log so that if called with no parameters, it uses
5385 'rotate' mode. That way auto-generated logs aren't automatically
5391 'rotate' mode. That way auto-generated logs aren't automatically
5386 over-written. For normal logs, now a backup is made if it exists
5392 over-written. For normal logs, now a backup is made if it exists
5387 (only 1 level of backups). A new 'backup' mode was added to the
5393 (only 1 level of backups). A new 'backup' mode was added to the
5388 Logger class to support this. This was a request by Janko.
5394 Logger class to support this. This was a request by Janko.
5389
5395
5390 * Added @logoff/@logon to stop/restart an active log.
5396 * Added @logoff/@logon to stop/restart an active log.
5391
5397
5392 * Fixed a lot of bugs in log saving/replay. It was pretty
5398 * Fixed a lot of bugs in log saving/replay. It was pretty
5393 broken. Now special lines (!@,/) appear properly in the command
5399 broken. Now special lines (!@,/) appear properly in the command
5394 history after a log replay.
5400 history after a log replay.
5395
5401
5396 * Tried and failed to implement full session saving via pickle. My
5402 * Tried and failed to implement full session saving via pickle. My
5397 idea was to pickle __main__.__dict__, but modules can't be
5403 idea was to pickle __main__.__dict__, but modules can't be
5398 pickled. This would be a better alternative to replaying logs, but
5404 pickled. This would be a better alternative to replaying logs, but
5399 seems quite tricky to get to work. Changed -session to be called
5405 seems quite tricky to get to work. Changed -session to be called
5400 -logplay, which more accurately reflects what it does. And if we
5406 -logplay, which more accurately reflects what it does. And if we
5401 ever get real session saving working, -session is now available.
5407 ever get real session saving working, -session is now available.
5402
5408
5403 * Implemented color schemes for prompts also. As for tracebacks,
5409 * Implemented color schemes for prompts also. As for tracebacks,
5404 currently only NoColor and Linux are supported. But now the
5410 currently only NoColor and Linux are supported. But now the
5405 infrastructure is in place, based on a generic ColorScheme
5411 infrastructure is in place, based on a generic ColorScheme
5406 class. So writing and activating new schemes both for the prompts
5412 class. So writing and activating new schemes both for the prompts
5407 and the tracebacks should be straightforward.
5413 and the tracebacks should be straightforward.
5408
5414
5409 * Version 0.1.13 released, 0.1.14 opened.
5415 * Version 0.1.13 released, 0.1.14 opened.
5410
5416
5411 * Changed handling of options for output cache. Now counter is
5417 * Changed handling of options for output cache. Now counter is
5412 hardwired starting at 1 and one specifies the maximum number of
5418 hardwired starting at 1 and one specifies the maximum number of
5413 entries *in the outcache* (not the max prompt counter). This is
5419 entries *in the outcache* (not the max prompt counter). This is
5414 much better, since many statements won't increase the cache
5420 much better, since many statements won't increase the cache
5415 count. It also eliminated some confusing options, now there's only
5421 count. It also eliminated some confusing options, now there's only
5416 one: cache_size.
5422 one: cache_size.
5417
5423
5418 * Added 'alias' magic function and magic_alias option in the
5424 * Added 'alias' magic function and magic_alias option in the
5419 ipythonrc file. Now the user can easily define whatever names he
5425 ipythonrc file. Now the user can easily define whatever names he
5420 wants for the magic functions without having to play weird
5426 wants for the magic functions without having to play weird
5421 namespace games. This gives IPython a real shell-like feel.
5427 namespace games. This gives IPython a real shell-like feel.
5422
5428
5423 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5429 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5424 @ or not).
5430 @ or not).
5425
5431
5426 This was one of the last remaining 'visible' bugs (that I know
5432 This was one of the last remaining 'visible' bugs (that I know
5427 of). I think if I can clean up the session loading so it works
5433 of). I think if I can clean up the session loading so it works
5428 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5434 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5429 about licensing).
5435 about licensing).
5430
5436
5431 2001-11-25 Fernando Perez <fperez@colorado.edu>
5437 2001-11-25 Fernando Perez <fperez@colorado.edu>
5432
5438
5433 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5439 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5434 there's a cleaner distinction between what ? and ?? show.
5440 there's a cleaner distinction between what ? and ?? show.
5435
5441
5436 * Added screen_length option. Now the user can define his own
5442 * Added screen_length option. Now the user can define his own
5437 screen size for page() operations.
5443 screen size for page() operations.
5438
5444
5439 * Implemented magic shell-like functions with automatic code
5445 * Implemented magic shell-like functions with automatic code
5440 generation. Now adding another function is just a matter of adding
5446 generation. Now adding another function is just a matter of adding
5441 an entry to a dict, and the function is dynamically generated at
5447 an entry to a dict, and the function is dynamically generated at
5442 run-time. Python has some really cool features!
5448 run-time. Python has some really cool features!
5443
5449
5444 * Renamed many options to cleanup conventions a little. Now all
5450 * Renamed many options to cleanup conventions a little. Now all
5445 are lowercase, and only underscores where needed. Also in the code
5451 are lowercase, and only underscores where needed. Also in the code
5446 option name tables are clearer.
5452 option name tables are clearer.
5447
5453
5448 * Changed prompts a little. Now input is 'In [n]:' instead of
5454 * Changed prompts a little. Now input is 'In [n]:' instead of
5449 'In[n]:='. This allows it the numbers to be aligned with the
5455 'In[n]:='. This allows it the numbers to be aligned with the
5450 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5456 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5451 Python (it was a Mathematica thing). The '...' continuation prompt
5457 Python (it was a Mathematica thing). The '...' continuation prompt
5452 was also changed a little to align better.
5458 was also changed a little to align better.
5453
5459
5454 * Fixed bug when flushing output cache. Not all _p<n> variables
5460 * Fixed bug when flushing output cache. Not all _p<n> variables
5455 exist, so their deletion needs to be wrapped in a try:
5461 exist, so their deletion needs to be wrapped in a try:
5456
5462
5457 * Figured out how to properly use inspect.formatargspec() (it
5463 * Figured out how to properly use inspect.formatargspec() (it
5458 requires the args preceded by *). So I removed all the code from
5464 requires the args preceded by *). So I removed all the code from
5459 _get_pdef in Magic, which was just replicating that.
5465 _get_pdef in Magic, which was just replicating that.
5460
5466
5461 * Added test to prefilter to allow redefining magic function names
5467 * Added test to prefilter to allow redefining magic function names
5462 as variables. This is ok, since the @ form is always available,
5468 as variables. This is ok, since the @ form is always available,
5463 but whe should allow the user to define a variable called 'ls' if
5469 but whe should allow the user to define a variable called 'ls' if
5464 he needs it.
5470 he needs it.
5465
5471
5466 * Moved the ToDo information from README into a separate ToDo.
5472 * Moved the ToDo information from README into a separate ToDo.
5467
5473
5468 * General code cleanup and small bugfixes. I think it's close to a
5474 * General code cleanup and small bugfixes. I think it's close to a
5469 state where it can be released, obviously with a big 'beta'
5475 state where it can be released, obviously with a big 'beta'
5470 warning on it.
5476 warning on it.
5471
5477
5472 * Got the magic function split to work. Now all magics are defined
5478 * Got the magic function split to work. Now all magics are defined
5473 in a separate class. It just organizes things a bit, and now
5479 in a separate class. It just organizes things a bit, and now
5474 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5480 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5475 was too long).
5481 was too long).
5476
5482
5477 * Changed @clear to @reset to avoid potential confusions with
5483 * Changed @clear to @reset to avoid potential confusions with
5478 the shell command clear. Also renamed @cl to @clear, which does
5484 the shell command clear. Also renamed @cl to @clear, which does
5479 exactly what people expect it to from their shell experience.
5485 exactly what people expect it to from their shell experience.
5480
5486
5481 Added a check to the @reset command (since it's so
5487 Added a check to the @reset command (since it's so
5482 destructive, it's probably a good idea to ask for confirmation).
5488 destructive, it's probably a good idea to ask for confirmation).
5483 But now reset only works for full namespace resetting. Since the
5489 But now reset only works for full namespace resetting. Since the
5484 del keyword is already there for deleting a few specific
5490 del keyword is already there for deleting a few specific
5485 variables, I don't see the point of having a redundant magic
5491 variables, I don't see the point of having a redundant magic
5486 function for the same task.
5492 function for the same task.
5487
5493
5488 2001-11-24 Fernando Perez <fperez@colorado.edu>
5494 2001-11-24 Fernando Perez <fperez@colorado.edu>
5489
5495
5490 * Updated the builtin docs (esp. the ? ones).
5496 * Updated the builtin docs (esp. the ? ones).
5491
5497
5492 * Ran all the code through pychecker. Not terribly impressed with
5498 * Ran all the code through pychecker. Not terribly impressed with
5493 it: lots of spurious warnings and didn't really find anything of
5499 it: lots of spurious warnings and didn't really find anything of
5494 substance (just a few modules being imported and not used).
5500 substance (just a few modules being imported and not used).
5495
5501
5496 * Implemented the new ultraTB functionality into IPython. New
5502 * Implemented the new ultraTB functionality into IPython. New
5497 option: xcolors. This chooses color scheme. xmode now only selects
5503 option: xcolors. This chooses color scheme. xmode now only selects
5498 between Plain and Verbose. Better orthogonality.
5504 between Plain and Verbose. Better orthogonality.
5499
5505
5500 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5506 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5501 mode and color scheme for the exception handlers. Now it's
5507 mode and color scheme for the exception handlers. Now it's
5502 possible to have the verbose traceback with no coloring.
5508 possible to have the verbose traceback with no coloring.
5503
5509
5504 2001-11-23 Fernando Perez <fperez@colorado.edu>
5510 2001-11-23 Fernando Perez <fperez@colorado.edu>
5505
5511
5506 * Version 0.1.12 released, 0.1.13 opened.
5512 * Version 0.1.12 released, 0.1.13 opened.
5507
5513
5508 * Removed option to set auto-quote and auto-paren escapes by
5514 * Removed option to set auto-quote and auto-paren escapes by
5509 user. The chances of breaking valid syntax are just too high. If
5515 user. The chances of breaking valid syntax are just too high. If
5510 someone *really* wants, they can always dig into the code.
5516 someone *really* wants, they can always dig into the code.
5511
5517
5512 * Made prompt separators configurable.
5518 * Made prompt separators configurable.
5513
5519
5514 2001-11-22 Fernando Perez <fperez@colorado.edu>
5520 2001-11-22 Fernando Perez <fperez@colorado.edu>
5515
5521
5516 * Small bugfixes in many places.
5522 * Small bugfixes in many places.
5517
5523
5518 * Removed the MyCompleter class from ipplib. It seemed redundant
5524 * Removed the MyCompleter class from ipplib. It seemed redundant
5519 with the C-p,C-n history search functionality. Less code to
5525 with the C-p,C-n history search functionality. Less code to
5520 maintain.
5526 maintain.
5521
5527
5522 * Moved all the original ipython.py code into ipythonlib.py. Right
5528 * Moved all the original ipython.py code into ipythonlib.py. Right
5523 now it's just one big dump into a function called make_IPython, so
5529 now it's just one big dump into a function called make_IPython, so
5524 no real modularity has been gained. But at least it makes the
5530 no real modularity has been gained. But at least it makes the
5525 wrapper script tiny, and since ipythonlib is a module, it gets
5531 wrapper script tiny, and since ipythonlib is a module, it gets
5526 compiled and startup is much faster.
5532 compiled and startup is much faster.
5527
5533
5528 This is a reasobably 'deep' change, so we should test it for a
5534 This is a reasobably 'deep' change, so we should test it for a
5529 while without messing too much more with the code.
5535 while without messing too much more with the code.
5530
5536
5531 2001-11-21 Fernando Perez <fperez@colorado.edu>
5537 2001-11-21 Fernando Perez <fperez@colorado.edu>
5532
5538
5533 * Version 0.1.11 released, 0.1.12 opened for further work.
5539 * Version 0.1.11 released, 0.1.12 opened for further work.
5534
5540
5535 * Removed dependency on Itpl. It was only needed in one place. It
5541 * Removed dependency on Itpl. It was only needed in one place. It
5536 would be nice if this became part of python, though. It makes life
5542 would be nice if this became part of python, though. It makes life
5537 *a lot* easier in some cases.
5543 *a lot* easier in some cases.
5538
5544
5539 * Simplified the prefilter code a bit. Now all handlers are
5545 * Simplified the prefilter code a bit. Now all handlers are
5540 expected to explicitly return a value (at least a blank string).
5546 expected to explicitly return a value (at least a blank string).
5541
5547
5542 * Heavy edits in ipplib. Removed the help system altogether. Now
5548 * Heavy edits in ipplib. Removed the help system altogether. Now
5543 obj?/?? is used for inspecting objects, a magic @doc prints
5549 obj?/?? is used for inspecting objects, a magic @doc prints
5544 docstrings, and full-blown Python help is accessed via the 'help'
5550 docstrings, and full-blown Python help is accessed via the 'help'
5545 keyword. This cleans up a lot of code (less to maintain) and does
5551 keyword. This cleans up a lot of code (less to maintain) and does
5546 the job. Since 'help' is now a standard Python component, might as
5552 the job. Since 'help' is now a standard Python component, might as
5547 well use it and remove duplicate functionality.
5553 well use it and remove duplicate functionality.
5548
5554
5549 Also removed the option to use ipplib as a standalone program. By
5555 Also removed the option to use ipplib as a standalone program. By
5550 now it's too dependent on other parts of IPython to function alone.
5556 now it's too dependent on other parts of IPython to function alone.
5551
5557
5552 * Fixed bug in genutils.pager. It would crash if the pager was
5558 * Fixed bug in genutils.pager. It would crash if the pager was
5553 exited immediately after opening (broken pipe).
5559 exited immediately after opening (broken pipe).
5554
5560
5555 * Trimmed down the VerboseTB reporting a little. The header is
5561 * Trimmed down the VerboseTB reporting a little. The header is
5556 much shorter now and the repeated exception arguments at the end
5562 much shorter now and the repeated exception arguments at the end
5557 have been removed. For interactive use the old header seemed a bit
5563 have been removed. For interactive use the old header seemed a bit
5558 excessive.
5564 excessive.
5559
5565
5560 * Fixed small bug in output of @whos for variables with multi-word
5566 * Fixed small bug in output of @whos for variables with multi-word
5561 types (only first word was displayed).
5567 types (only first word was displayed).
5562
5568
5563 2001-11-17 Fernando Perez <fperez@colorado.edu>
5569 2001-11-17 Fernando Perez <fperez@colorado.edu>
5564
5570
5565 * Version 0.1.10 released, 0.1.11 opened for further work.
5571 * Version 0.1.10 released, 0.1.11 opened for further work.
5566
5572
5567 * Modified dirs and friends. dirs now *returns* the stack (not
5573 * Modified dirs and friends. dirs now *returns* the stack (not
5568 prints), so one can manipulate it as a variable. Convenient to
5574 prints), so one can manipulate it as a variable. Convenient to
5569 travel along many directories.
5575 travel along many directories.
5570
5576
5571 * Fixed bug in magic_pdef: would only work with functions with
5577 * Fixed bug in magic_pdef: would only work with functions with
5572 arguments with default values.
5578 arguments with default values.
5573
5579
5574 2001-11-14 Fernando Perez <fperez@colorado.edu>
5580 2001-11-14 Fernando Perez <fperez@colorado.edu>
5575
5581
5576 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5582 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5577 example with IPython. Various other minor fixes and cleanups.
5583 example with IPython. Various other minor fixes and cleanups.
5578
5584
5579 * Version 0.1.9 released, 0.1.10 opened for further work.
5585 * Version 0.1.9 released, 0.1.10 opened for further work.
5580
5586
5581 * Added sys.path to the list of directories searched in the
5587 * Added sys.path to the list of directories searched in the
5582 execfile= option. It used to be the current directory and the
5588 execfile= option. It used to be the current directory and the
5583 user's IPYTHONDIR only.
5589 user's IPYTHONDIR only.
5584
5590
5585 2001-11-13 Fernando Perez <fperez@colorado.edu>
5591 2001-11-13 Fernando Perez <fperez@colorado.edu>
5586
5592
5587 * Reinstated the raw_input/prefilter separation that Janko had
5593 * Reinstated the raw_input/prefilter separation that Janko had
5588 initially. This gives a more convenient setup for extending the
5594 initially. This gives a more convenient setup for extending the
5589 pre-processor from the outside: raw_input always gets a string,
5595 pre-processor from the outside: raw_input always gets a string,
5590 and prefilter has to process it. We can then redefine prefilter
5596 and prefilter has to process it. We can then redefine prefilter
5591 from the outside and implement extensions for special
5597 from the outside and implement extensions for special
5592 purposes.
5598 purposes.
5593
5599
5594 Today I got one for inputting PhysicalQuantity objects
5600 Today I got one for inputting PhysicalQuantity objects
5595 (from Scientific) without needing any function calls at
5601 (from Scientific) without needing any function calls at
5596 all. Extremely convenient, and it's all done as a user-level
5602 all. Extremely convenient, and it's all done as a user-level
5597 extension (no IPython code was touched). Now instead of:
5603 extension (no IPython code was touched). Now instead of:
5598 a = PhysicalQuantity(4.2,'m/s**2')
5604 a = PhysicalQuantity(4.2,'m/s**2')
5599 one can simply say
5605 one can simply say
5600 a = 4.2 m/s**2
5606 a = 4.2 m/s**2
5601 or even
5607 or even
5602 a = 4.2 m/s^2
5608 a = 4.2 m/s^2
5603
5609
5604 I use this, but it's also a proof of concept: IPython really is
5610 I use this, but it's also a proof of concept: IPython really is
5605 fully user-extensible, even at the level of the parsing of the
5611 fully user-extensible, even at the level of the parsing of the
5606 command line. It's not trivial, but it's perfectly doable.
5612 command line. It's not trivial, but it's perfectly doable.
5607
5613
5608 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5614 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5609 the problem of modules being loaded in the inverse order in which
5615 the problem of modules being loaded in the inverse order in which
5610 they were defined in
5616 they were defined in
5611
5617
5612 * Version 0.1.8 released, 0.1.9 opened for further work.
5618 * Version 0.1.8 released, 0.1.9 opened for further work.
5613
5619
5614 * Added magics pdef, source and file. They respectively show the
5620 * Added magics pdef, source and file. They respectively show the
5615 definition line ('prototype' in C), source code and full python
5621 definition line ('prototype' in C), source code and full python
5616 file for any callable object. The object inspector oinfo uses
5622 file for any callable object. The object inspector oinfo uses
5617 these to show the same information.
5623 these to show the same information.
5618
5624
5619 * Version 0.1.7 released, 0.1.8 opened for further work.
5625 * Version 0.1.7 released, 0.1.8 opened for further work.
5620
5626
5621 * Separated all the magic functions into a class called Magic. The
5627 * Separated all the magic functions into a class called Magic. The
5622 InteractiveShell class was becoming too big for Xemacs to handle
5628 InteractiveShell class was becoming too big for Xemacs to handle
5623 (de-indenting a line would lock it up for 10 seconds while it
5629 (de-indenting a line would lock it up for 10 seconds while it
5624 backtracked on the whole class!)
5630 backtracked on the whole class!)
5625
5631
5626 FIXME: didn't work. It can be done, but right now namespaces are
5632 FIXME: didn't work. It can be done, but right now namespaces are
5627 all messed up. Do it later (reverted it for now, so at least
5633 all messed up. Do it later (reverted it for now, so at least
5628 everything works as before).
5634 everything works as before).
5629
5635
5630 * Got the object introspection system (magic_oinfo) working! I
5636 * Got the object introspection system (magic_oinfo) working! I
5631 think this is pretty much ready for release to Janko, so he can
5637 think this is pretty much ready for release to Janko, so he can
5632 test it for a while and then announce it. Pretty much 100% of what
5638 test it for a while and then announce it. Pretty much 100% of what
5633 I wanted for the 'phase 1' release is ready. Happy, tired.
5639 I wanted for the 'phase 1' release is ready. Happy, tired.
5634
5640
5635 2001-11-12 Fernando Perez <fperez@colorado.edu>
5641 2001-11-12 Fernando Perez <fperez@colorado.edu>
5636
5642
5637 * Version 0.1.6 released, 0.1.7 opened for further work.
5643 * Version 0.1.6 released, 0.1.7 opened for further work.
5638
5644
5639 * Fixed bug in printing: it used to test for truth before
5645 * Fixed bug in printing: it used to test for truth before
5640 printing, so 0 wouldn't print. Now checks for None.
5646 printing, so 0 wouldn't print. Now checks for None.
5641
5647
5642 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5648 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5643 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5649 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5644 reaches by hand into the outputcache. Think of a better way to do
5650 reaches by hand into the outputcache. Think of a better way to do
5645 this later.
5651 this later.
5646
5652
5647 * Various small fixes thanks to Nathan's comments.
5653 * Various small fixes thanks to Nathan's comments.
5648
5654
5649 * Changed magic_pprint to magic_Pprint. This way it doesn't
5655 * Changed magic_pprint to magic_Pprint. This way it doesn't
5650 collide with pprint() and the name is consistent with the command
5656 collide with pprint() and the name is consistent with the command
5651 line option.
5657 line option.
5652
5658
5653 * Changed prompt counter behavior to be fully like
5659 * Changed prompt counter behavior to be fully like
5654 Mathematica's. That is, even input that doesn't return a result
5660 Mathematica's. That is, even input that doesn't return a result
5655 raises the prompt counter. The old behavior was kind of confusing
5661 raises the prompt counter. The old behavior was kind of confusing
5656 (getting the same prompt number several times if the operation
5662 (getting the same prompt number several times if the operation
5657 didn't return a result).
5663 didn't return a result).
5658
5664
5659 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5665 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5660
5666
5661 * Fixed -Classic mode (wasn't working anymore).
5667 * Fixed -Classic mode (wasn't working anymore).
5662
5668
5663 * Added colored prompts using Nathan's new code. Colors are
5669 * Added colored prompts using Nathan's new code. Colors are
5664 currently hardwired, they can be user-configurable. For
5670 currently hardwired, they can be user-configurable. For
5665 developers, they can be chosen in file ipythonlib.py, at the
5671 developers, they can be chosen in file ipythonlib.py, at the
5666 beginning of the CachedOutput class def.
5672 beginning of the CachedOutput class def.
5667
5673
5668 2001-11-11 Fernando Perez <fperez@colorado.edu>
5674 2001-11-11 Fernando Perez <fperez@colorado.edu>
5669
5675
5670 * Version 0.1.5 released, 0.1.6 opened for further work.
5676 * Version 0.1.5 released, 0.1.6 opened for further work.
5671
5677
5672 * Changed magic_env to *return* the environment as a dict (not to
5678 * Changed magic_env to *return* the environment as a dict (not to
5673 print it). This way it prints, but it can also be processed.
5679 print it). This way it prints, but it can also be processed.
5674
5680
5675 * Added Verbose exception reporting to interactive
5681 * Added Verbose exception reporting to interactive
5676 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5682 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5677 traceback. Had to make some changes to the ultraTB file. This is
5683 traceback. Had to make some changes to the ultraTB file. This is
5678 probably the last 'big' thing in my mental todo list. This ties
5684 probably the last 'big' thing in my mental todo list. This ties
5679 in with the next entry:
5685 in with the next entry:
5680
5686
5681 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5687 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5682 has to specify is Plain, Color or Verbose for all exception
5688 has to specify is Plain, Color or Verbose for all exception
5683 handling.
5689 handling.
5684
5690
5685 * Removed ShellServices option. All this can really be done via
5691 * Removed ShellServices option. All this can really be done via
5686 the magic system. It's easier to extend, cleaner and has automatic
5692 the magic system. It's easier to extend, cleaner and has automatic
5687 namespace protection and documentation.
5693 namespace protection and documentation.
5688
5694
5689 2001-11-09 Fernando Perez <fperez@colorado.edu>
5695 2001-11-09 Fernando Perez <fperez@colorado.edu>
5690
5696
5691 * Fixed bug in output cache flushing (missing parameter to
5697 * Fixed bug in output cache flushing (missing parameter to
5692 __init__). Other small bugs fixed (found using pychecker).
5698 __init__). Other small bugs fixed (found using pychecker).
5693
5699
5694 * Version 0.1.4 opened for bugfixing.
5700 * Version 0.1.4 opened for bugfixing.
5695
5701
5696 2001-11-07 Fernando Perez <fperez@colorado.edu>
5702 2001-11-07 Fernando Perez <fperez@colorado.edu>
5697
5703
5698 * Version 0.1.3 released, mainly because of the raw_input bug.
5704 * Version 0.1.3 released, mainly because of the raw_input bug.
5699
5705
5700 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5706 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5701 and when testing for whether things were callable, a call could
5707 and when testing for whether things were callable, a call could
5702 actually be made to certain functions. They would get called again
5708 actually be made to certain functions. They would get called again
5703 once 'really' executed, with a resulting double call. A disaster
5709 once 'really' executed, with a resulting double call. A disaster
5704 in many cases (list.reverse() would never work!).
5710 in many cases (list.reverse() would never work!).
5705
5711
5706 * Removed prefilter() function, moved its code to raw_input (which
5712 * Removed prefilter() function, moved its code to raw_input (which
5707 after all was just a near-empty caller for prefilter). This saves
5713 after all was just a near-empty caller for prefilter). This saves
5708 a function call on every prompt, and simplifies the class a tiny bit.
5714 a function call on every prompt, and simplifies the class a tiny bit.
5709
5715
5710 * Fix _ip to __ip name in magic example file.
5716 * Fix _ip to __ip name in magic example file.
5711
5717
5712 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5718 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5713 work with non-gnu versions of tar.
5719 work with non-gnu versions of tar.
5714
5720
5715 2001-11-06 Fernando Perez <fperez@colorado.edu>
5721 2001-11-06 Fernando Perez <fperez@colorado.edu>
5716
5722
5717 * Version 0.1.2. Just to keep track of the recent changes.
5723 * Version 0.1.2. Just to keep track of the recent changes.
5718
5724
5719 * Fixed nasty bug in output prompt routine. It used to check 'if
5725 * Fixed nasty bug in output prompt routine. It used to check 'if
5720 arg != None...'. Problem is, this fails if arg implements a
5726 arg != None...'. Problem is, this fails if arg implements a
5721 special comparison (__cmp__) which disallows comparing to
5727 special comparison (__cmp__) which disallows comparing to
5722 None. Found it when trying to use the PhysicalQuantity module from
5728 None. Found it when trying to use the PhysicalQuantity module from
5723 ScientificPython.
5729 ScientificPython.
5724
5730
5725 2001-11-05 Fernando Perez <fperez@colorado.edu>
5731 2001-11-05 Fernando Perez <fperez@colorado.edu>
5726
5732
5727 * Also added dirs. Now the pushd/popd/dirs family functions
5733 * Also added dirs. Now the pushd/popd/dirs family functions
5728 basically like the shell, with the added convenience of going home
5734 basically like the shell, with the added convenience of going home
5729 when called with no args.
5735 when called with no args.
5730
5736
5731 * pushd/popd slightly modified to mimic shell behavior more
5737 * pushd/popd slightly modified to mimic shell behavior more
5732 closely.
5738 closely.
5733
5739
5734 * Added env,pushd,popd from ShellServices as magic functions. I
5740 * Added env,pushd,popd from ShellServices as magic functions. I
5735 think the cleanest will be to port all desired functions from
5741 think the cleanest will be to port all desired functions from
5736 ShellServices as magics and remove ShellServices altogether. This
5742 ShellServices as magics and remove ShellServices altogether. This
5737 will provide a single, clean way of adding functionality
5743 will provide a single, clean way of adding functionality
5738 (shell-type or otherwise) to IP.
5744 (shell-type or otherwise) to IP.
5739
5745
5740 2001-11-04 Fernando Perez <fperez@colorado.edu>
5746 2001-11-04 Fernando Perez <fperez@colorado.edu>
5741
5747
5742 * Added .ipython/ directory to sys.path. This way users can keep
5748 * Added .ipython/ directory to sys.path. This way users can keep
5743 customizations there and access them via import.
5749 customizations there and access them via import.
5744
5750
5745 2001-11-03 Fernando Perez <fperez@colorado.edu>
5751 2001-11-03 Fernando Perez <fperez@colorado.edu>
5746
5752
5747 * Opened version 0.1.1 for new changes.
5753 * Opened version 0.1.1 for new changes.
5748
5754
5749 * Changed version number to 0.1.0: first 'public' release, sent to
5755 * Changed version number to 0.1.0: first 'public' release, sent to
5750 Nathan and Janko.
5756 Nathan and Janko.
5751
5757
5752 * Lots of small fixes and tweaks.
5758 * Lots of small fixes and tweaks.
5753
5759
5754 * Minor changes to whos format. Now strings are shown, snipped if
5760 * Minor changes to whos format. Now strings are shown, snipped if
5755 too long.
5761 too long.
5756
5762
5757 * Changed ShellServices to work on __main__ so they show up in @who
5763 * Changed ShellServices to work on __main__ so they show up in @who
5758
5764
5759 * Help also works with ? at the end of a line:
5765 * Help also works with ? at the end of a line:
5760 ?sin and sin?
5766 ?sin and sin?
5761 both produce the same effect. This is nice, as often I use the
5767 both produce the same effect. This is nice, as often I use the
5762 tab-complete to find the name of a method, but I used to then have
5768 tab-complete to find the name of a method, but I used to then have
5763 to go to the beginning of the line to put a ? if I wanted more
5769 to go to the beginning of the line to put a ? if I wanted more
5764 info. Now I can just add the ? and hit return. Convenient.
5770 info. Now I can just add the ? and hit return. Convenient.
5765
5771
5766 2001-11-02 Fernando Perez <fperez@colorado.edu>
5772 2001-11-02 Fernando Perez <fperez@colorado.edu>
5767
5773
5768 * Python version check (>=2.1) added.
5774 * Python version check (>=2.1) added.
5769
5775
5770 * Added LazyPython documentation. At this point the docs are quite
5776 * Added LazyPython documentation. At this point the docs are quite
5771 a mess. A cleanup is in order.
5777 a mess. A cleanup is in order.
5772
5778
5773 * Auto-installer created. For some bizarre reason, the zipfiles
5779 * Auto-installer created. For some bizarre reason, the zipfiles
5774 module isn't working on my system. So I made a tar version
5780 module isn't working on my system. So I made a tar version
5775 (hopefully the command line options in various systems won't kill
5781 (hopefully the command line options in various systems won't kill
5776 me).
5782 me).
5777
5783
5778 * Fixes to Struct in genutils. Now all dictionary-like methods are
5784 * Fixes to Struct in genutils. Now all dictionary-like methods are
5779 protected (reasonably).
5785 protected (reasonably).
5780
5786
5781 * Added pager function to genutils and changed ? to print usage
5787 * Added pager function to genutils and changed ? to print usage
5782 note through it (it was too long).
5788 note through it (it was too long).
5783
5789
5784 * Added the LazyPython functionality. Works great! I changed the
5790 * Added the LazyPython functionality. Works great! I changed the
5785 auto-quote escape to ';', it's on home row and next to '. But
5791 auto-quote escape to ';', it's on home row and next to '. But
5786 both auto-quote and auto-paren (still /) escapes are command-line
5792 both auto-quote and auto-paren (still /) escapes are command-line
5787 parameters.
5793 parameters.
5788
5794
5789
5795
5790 2001-11-01 Fernando Perez <fperez@colorado.edu>
5796 2001-11-01 Fernando Perez <fperez@colorado.edu>
5791
5797
5792 * Version changed to 0.0.7. Fairly large change: configuration now
5798 * Version changed to 0.0.7. Fairly large change: configuration now
5793 is all stored in a directory, by default .ipython. There, all
5799 is all stored in a directory, by default .ipython. There, all
5794 config files have normal looking names (not .names)
5800 config files have normal looking names (not .names)
5795
5801
5796 * Version 0.0.6 Released first to Lucas and Archie as a test
5802 * Version 0.0.6 Released first to Lucas and Archie as a test
5797 run. Since it's the first 'semi-public' release, change version to
5803 run. Since it's the first 'semi-public' release, change version to
5798 > 0.0.6 for any changes now.
5804 > 0.0.6 for any changes now.
5799
5805
5800 * Stuff I had put in the ipplib.py changelog:
5806 * Stuff I had put in the ipplib.py changelog:
5801
5807
5802 Changes to InteractiveShell:
5808 Changes to InteractiveShell:
5803
5809
5804 - Made the usage message a parameter.
5810 - Made the usage message a parameter.
5805
5811
5806 - Require the name of the shell variable to be given. It's a bit
5812 - Require the name of the shell variable to be given. It's a bit
5807 of a hack, but allows the name 'shell' not to be hardwired in the
5813 of a hack, but allows the name 'shell' not to be hardwired in the
5808 magic (@) handler, which is problematic b/c it requires
5814 magic (@) handler, which is problematic b/c it requires
5809 polluting the global namespace with 'shell'. This in turn is
5815 polluting the global namespace with 'shell'. This in turn is
5810 fragile: if a user redefines a variable called shell, things
5816 fragile: if a user redefines a variable called shell, things
5811 break.
5817 break.
5812
5818
5813 - magic @: all functions available through @ need to be defined
5819 - magic @: all functions available through @ need to be defined
5814 as magic_<name>, even though they can be called simply as
5820 as magic_<name>, even though they can be called simply as
5815 @<name>. This allows the special command @magic to gather
5821 @<name>. This allows the special command @magic to gather
5816 information automatically about all existing magic functions,
5822 information automatically about all existing magic functions,
5817 even if they are run-time user extensions, by parsing the shell
5823 even if they are run-time user extensions, by parsing the shell
5818 instance __dict__ looking for special magic_ names.
5824 instance __dict__ looking for special magic_ names.
5819
5825
5820 - mainloop: added *two* local namespace parameters. This allows
5826 - mainloop: added *two* local namespace parameters. This allows
5821 the class to differentiate between parameters which were there
5827 the class to differentiate between parameters which were there
5822 before and after command line initialization was processed. This
5828 before and after command line initialization was processed. This
5823 way, later @who can show things loaded at startup by the
5829 way, later @who can show things loaded at startup by the
5824 user. This trick was necessary to make session saving/reloading
5830 user. This trick was necessary to make session saving/reloading
5825 really work: ideally after saving/exiting/reloading a session,
5831 really work: ideally after saving/exiting/reloading a session,
5826 *everything* should look the same, including the output of @who. I
5832 *everything* should look the same, including the output of @who. I
5827 was only able to make this work with this double namespace
5833 was only able to make this work with this double namespace
5828 trick.
5834 trick.
5829
5835
5830 - added a header to the logfile which allows (almost) full
5836 - added a header to the logfile which allows (almost) full
5831 session restoring.
5837 session restoring.
5832
5838
5833 - prepend lines beginning with @ or !, with a and log
5839 - prepend lines beginning with @ or !, with a and log
5834 them. Why? !lines: may be useful to know what you did @lines:
5840 them. Why? !lines: may be useful to know what you did @lines:
5835 they may affect session state. So when restoring a session, at
5841 they may affect session state. So when restoring a session, at
5836 least inform the user of their presence. I couldn't quite get
5842 least inform the user of their presence. I couldn't quite get
5837 them to properly re-execute, but at least the user is warned.
5843 them to properly re-execute, but at least the user is warned.
5838
5844
5839 * Started ChangeLog.
5845 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now