##// END OF EJS Templates
- Close #109, completion works also when not called by readline.
fperez -
Show More
@@ -1,662 +1,673 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 import itertools
75 import itertools
76 from IPython.ipstruct import Struct
76 from IPython.ipstruct import Struct
77 from IPython import ipapi
77 from IPython import ipapi
78
78
79 import types
79 import types
80
80
81 # Python 2.4 offers sets as a builtin
81 # Python 2.4 offers sets as a builtin
82 try:
82 try:
83 set([1,2])
83 set([1,2])
84 except NameError:
84 except NameError:
85 from sets import Set as set
85 from sets import Set as set
86
86
87 from IPython.genutils import debugx
87 from IPython.genutils import debugx
88
88
89 __all__ = ['Completer','IPCompleter']
89 __all__ = ['Completer','IPCompleter']
90
90
91 def get_class_members(cls):
91 def get_class_members(cls):
92 ret = dir(cls)
92 ret = dir(cls)
93 if hasattr(cls,'__bases__'):
93 if hasattr(cls,'__bases__'):
94 for base in cls.__bases__:
94 for base in cls.__bases__:
95 ret.extend(get_class_members(base))
95 ret.extend(get_class_members(base))
96 return ret
96 return ret
97
97
98 class Completer:
98 class Completer:
99 def __init__(self,namespace=None,global_namespace=None):
99 def __init__(self,namespace=None,global_namespace=None):
100 """Create a new completer for the command line.
100 """Create a new completer for the command line.
101
101
102 Completer([namespace,global_namespace]) -> completer instance.
102 Completer([namespace,global_namespace]) -> completer instance.
103
103
104 If unspecified, the default namespace where completions are performed
104 If unspecified, the default namespace where completions are performed
105 is __main__ (technically, __main__.__dict__). Namespaces should be
105 is __main__ (technically, __main__.__dict__). Namespaces should be
106 given as dictionaries.
106 given as dictionaries.
107
107
108 An optional second namespace can be given. This allows the completer
108 An optional second namespace can be given. This allows the completer
109 to handle cases where both the local and global scopes need to be
109 to handle cases where both the local and global scopes need to be
110 distinguished.
110 distinguished.
111
111
112 Completer instances should be used as the completion mechanism of
112 Completer instances should be used as the completion mechanism of
113 readline via the set_completer() call:
113 readline via the set_completer() call:
114
114
115 readline.set_completer(Completer(my_namespace).complete)
115 readline.set_completer(Completer(my_namespace).complete)
116 """
116 """
117
117
118 # some minimal strict typechecks. For some core data structures, I
118 # some minimal strict typechecks. For some core data structures, I
119 # want actual basic python types, not just anything that looks like
119 # want actual basic python types, not just anything that looks like
120 # one. This is especially true for namespaces.
120 # one. This is especially true for namespaces.
121 for ns in (namespace,global_namespace):
121 for ns in (namespace,global_namespace):
122 if ns is not None and type(ns) != types.DictType:
122 if ns is not None and type(ns) != types.DictType:
123 raise TypeError,'namespace must be a dictionary'
123 raise TypeError,'namespace must be a dictionary'
124
124
125 # Don't bind to namespace quite yet, but flag whether the user wants a
125 # Don't bind to namespace quite yet, but flag whether the user wants a
126 # specific namespace or to use __main__.__dict__. This will allow us
126 # specific namespace or to use __main__.__dict__. This will allow us
127 # to bind to __main__.__dict__ at completion time, not now.
127 # to bind to __main__.__dict__ at completion time, not now.
128 if namespace is None:
128 if namespace is None:
129 self.use_main_ns = 1
129 self.use_main_ns = 1
130 else:
130 else:
131 self.use_main_ns = 0
131 self.use_main_ns = 0
132 self.namespace = namespace
132 self.namespace = namespace
133
133
134 # The global namespace, if given, can be bound directly
134 # The global namespace, if given, can be bound directly
135 if global_namespace is None:
135 if global_namespace is None:
136 self.global_namespace = {}
136 self.global_namespace = {}
137 else:
137 else:
138 self.global_namespace = global_namespace
138 self.global_namespace = global_namespace
139
139
140 def complete(self, text, state):
140 def complete(self, text, state):
141 """Return the next possible completion for 'text'.
141 """Return the next possible completion for 'text'.
142
142
143 This is called successively with state == 0, 1, 2, ... until it
143 This is called successively with state == 0, 1, 2, ... until it
144 returns None. The completion should begin with 'text'.
144 returns None. The completion should begin with 'text'.
145
145
146 """
146 """
147 if self.use_main_ns:
147 if self.use_main_ns:
148 self.namespace = __main__.__dict__
148 self.namespace = __main__.__dict__
149
149
150 if state == 0:
150 if state == 0:
151 if "." in text:
151 if "." in text:
152 self.matches = self.attr_matches(text)
152 self.matches = self.attr_matches(text)
153 else:
153 else:
154 self.matches = self.global_matches(text)
154 self.matches = self.global_matches(text)
155 try:
155 try:
156 return self.matches[state]
156 return self.matches[state]
157 except IndexError:
157 except IndexError:
158 return None
158 return None
159
159
160 def global_matches(self, text):
160 def global_matches(self, text):
161 """Compute matches when text is a simple name.
161 """Compute matches when text is a simple name.
162
162
163 Return a list of all keywords, built-in functions and names currently
163 Return a list of all keywords, built-in functions and names currently
164 defined in self.namespace or self.global_namespace that match.
164 defined in self.namespace or self.global_namespace that match.
165
165
166 """
166 """
167 matches = []
167 matches = []
168 match_append = matches.append
168 match_append = matches.append
169 n = len(text)
169 n = len(text)
170 for lst in [keyword.kwlist,
170 for lst in [keyword.kwlist,
171 __builtin__.__dict__.keys(),
171 __builtin__.__dict__.keys(),
172 self.namespace.keys(),
172 self.namespace.keys(),
173 self.global_namespace.keys()]:
173 self.global_namespace.keys()]:
174 for word in lst:
174 for word in lst:
175 if word[:n] == text and word != "__builtins__":
175 if word[:n] == text and word != "__builtins__":
176 match_append(word)
176 match_append(word)
177 return matches
177 return matches
178
178
179 def attr_matches(self, text):
179 def attr_matches(self, text):
180 """Compute matches when text contains a dot.
180 """Compute matches when text contains a dot.
181
181
182 Assuming the text is of the form NAME.NAME....[NAME], and is
182 Assuming the text is of the form NAME.NAME....[NAME], and is
183 evaluatable in self.namespace or self.global_namespace, it will be
183 evaluatable in self.namespace or self.global_namespace, it will be
184 evaluated and its attributes (as revealed by dir()) are used as
184 evaluated and its attributes (as revealed by dir()) are used as
185 possible completions. (For class instances, class members are are
185 possible completions. (For class instances, class members are are
186 also considered.)
186 also considered.)
187
187
188 WARNING: this can still invoke arbitrary C code, if an object
188 WARNING: this can still invoke arbitrary C code, if an object
189 with a __getattr__ hook is evaluated.
189 with a __getattr__ hook is evaluated.
190
190
191 """
191 """
192 import re
192 import re
193
193
194 # Another option, seems to work great. Catches things like ''.<tab>
194 # Another option, seems to work great. Catches things like ''.<tab>
195 m = re.match(r"(\S+(\.\w+)*)\.(\w*)$", text)
195 m = re.match(r"(\S+(\.\w+)*)\.(\w*)$", text)
196
196
197 if not m:
197 if not m:
198 return []
198 return []
199
199
200 expr, attr = m.group(1, 3)
200 expr, attr = m.group(1, 3)
201 try:
201 try:
202 object = eval(expr, self.namespace)
202 object = eval(expr, self.namespace)
203 except:
203 except:
204 try:
204 try:
205 object = eval(expr, self.global_namespace)
205 object = eval(expr, self.global_namespace)
206 except:
206 except:
207 return []
207 return []
208
208
209
209
210 # Start building the attribute list via dir(), and then complete it
210 # Start building the attribute list via dir(), and then complete it
211 # with a few extra special-purpose calls.
211 # with a few extra special-purpose calls.
212 words = dir(object)
212 words = dir(object)
213
213
214 if hasattr(object,'__class__'):
214 if hasattr(object,'__class__'):
215 words.append('__class__')
215 words.append('__class__')
216 words.extend(get_class_members(object.__class__))
216 words.extend(get_class_members(object.__class__))
217
217
218 # Some libraries (such as traits) may introduce duplicates, we want to
218 # Some libraries (such as traits) may introduce duplicates, we want to
219 # track and clean this up if it happens
219 # track and clean this up if it happens
220 may_have_dupes = False
220 may_have_dupes = False
221
221
222 # this is the 'dir' function for objects with Enthought's traits
222 # this is the 'dir' function for objects with Enthought's traits
223 if hasattr(object, 'trait_names'):
223 if hasattr(object, 'trait_names'):
224 try:
224 try:
225 words.extend(object.trait_names())
225 words.extend(object.trait_names())
226 may_have_dupes = True
226 may_have_dupes = True
227 except TypeError:
227 except TypeError:
228 # This will happen if `object` is a class and not an instance.
228 # This will happen if `object` is a class and not an instance.
229 pass
229 pass
230
230
231 # Support for PyCrust-style _getAttributeNames magic method.
231 # Support for PyCrust-style _getAttributeNames magic method.
232 if hasattr(object, '_getAttributeNames'):
232 if hasattr(object, '_getAttributeNames'):
233 try:
233 try:
234 words.extend(object._getAttributeNames())
234 words.extend(object._getAttributeNames())
235 may_have_dupes = True
235 may_have_dupes = True
236 except TypeError:
236 except TypeError:
237 # `object` is a class and not an instance. Ignore
237 # `object` is a class and not an instance. Ignore
238 # this error.
238 # this error.
239 pass
239 pass
240
240
241 if may_have_dupes:
241 if may_have_dupes:
242 # eliminate possible duplicates, as some traits may also
242 # eliminate possible duplicates, as some traits may also
243 # appear as normal attributes in the dir() call.
243 # appear as normal attributes in the dir() call.
244 words = set(words)
244 words = set(words)
245
245
246 # filter out non-string attributes which may be stuffed by dir() calls
246 # filter out non-string attributes which may be stuffed by dir() calls
247 # and poor coding in third-party modules
247 # and poor coding in third-party modules
248 words = [w for w in words
248 words = [w for w in words
249 if isinstance(w, basestring) and w != "__builtins__"]
249 if isinstance(w, basestring) and w != "__builtins__"]
250 # Build match list to return
250 # Build match list to return
251 n = len(attr)
251 n = len(attr)
252 return ["%s.%s" % (expr, w) for w in words if w[:n] == attr ]
252 return ["%s.%s" % (expr, w) for w in words if w[:n] == attr ]
253
253
254 class IPCompleter(Completer):
254 class IPCompleter(Completer):
255 """Extension of the completer class with IPython-specific features"""
255 """Extension of the completer class with IPython-specific features"""
256
256
257 def __init__(self,shell,namespace=None,global_namespace=None,
257 def __init__(self,shell,namespace=None,global_namespace=None,
258 omit__names=0,alias_table=None):
258 omit__names=0,alias_table=None):
259 """IPCompleter() -> completer
259 """IPCompleter() -> completer
260
260
261 Return a completer object suitable for use by the readline library
261 Return a completer object suitable for use by the readline library
262 via readline.set_completer().
262 via readline.set_completer().
263
263
264 Inputs:
264 Inputs:
265
265
266 - shell: a pointer to the ipython shell itself. This is needed
266 - shell: a pointer to the ipython shell itself. This is needed
267 because this completer knows about magic functions, and those can
267 because this completer knows about magic functions, and those can
268 only be accessed via the ipython instance.
268 only be accessed via the ipython instance.
269
269
270 - namespace: an optional dict where completions are performed.
270 - namespace: an optional dict where completions are performed.
271
271
272 - global_namespace: secondary optional dict for completions, to
272 - global_namespace: secondary optional dict for completions, to
273 handle cases (such as IPython embedded inside functions) where
273 handle cases (such as IPython embedded inside functions) where
274 both Python scopes are visible.
274 both Python scopes are visible.
275
275
276 - The optional omit__names parameter sets the completer to omit the
276 - The optional omit__names parameter sets the completer to omit the
277 'magic' names (__magicname__) for python objects unless the text
277 'magic' names (__magicname__) for python objects unless the text
278 to be completed explicitly starts with one or more underscores.
278 to be completed explicitly starts with one or more underscores.
279
279
280 - If alias_table is supplied, it should be a dictionary of aliases
280 - If alias_table is supplied, it should be a dictionary of aliases
281 to complete. """
281 to complete. """
282
282
283 Completer.__init__(self,namespace,global_namespace)
283 Completer.__init__(self,namespace,global_namespace)
284 self.magic_prefix = shell.name+'.magic_'
284 self.magic_prefix = shell.name+'.magic_'
285 self.magic_escape = shell.ESC_MAGIC
285 self.magic_escape = shell.ESC_MAGIC
286 self.readline = readline
286 self.readline = readline
287 delims = self.readline.get_completer_delims()
287 delims = self.readline.get_completer_delims()
288 delims = delims.replace(self.magic_escape,'')
288 delims = delims.replace(self.magic_escape,'')
289 self.readline.set_completer_delims(delims)
289 self.readline.set_completer_delims(delims)
290 self.get_line_buffer = self.readline.get_line_buffer
290 self.get_line_buffer = self.readline.get_line_buffer
291 self.omit__names = omit__names
291 self.omit__names = omit__names
292 self.merge_completions = shell.rc.readline_merge_completions
292 self.merge_completions = shell.rc.readline_merge_completions
293
293
294 if alias_table is None:
294 if alias_table is None:
295 alias_table = {}
295 alias_table = {}
296 self.alias_table = alias_table
296 self.alias_table = alias_table
297 # Regexp to split filenames with spaces in them
297 # Regexp to split filenames with spaces in them
298 self.space_name_re = re.compile(r'([^\\] )')
298 self.space_name_re = re.compile(r'([^\\] )')
299 # Hold a local ref. to glob.glob for speed
299 # Hold a local ref. to glob.glob for speed
300 self.glob = glob.glob
300 self.glob = glob.glob
301
301
302 # Determine if we are running on 'dumb' terminals, like (X)Emacs
302 # Determine if we are running on 'dumb' terminals, like (X)Emacs
303 # buffers, to avoid completion problems.
303 # buffers, to avoid completion problems.
304 term = os.environ.get('TERM','xterm')
304 term = os.environ.get('TERM','xterm')
305 self.dumb_terminal = term in ['dumb','emacs']
305 self.dumb_terminal = term in ['dumb','emacs']
306
306
307 # Special handling of backslashes needed in win32 platforms
307 # Special handling of backslashes needed in win32 platforms
308 if sys.platform == "win32":
308 if sys.platform == "win32":
309 self.clean_glob = self._clean_glob_win32
309 self.clean_glob = self._clean_glob_win32
310 else:
310 else:
311 self.clean_glob = self._clean_glob
311 self.clean_glob = self._clean_glob
312 self.matchers = [self.python_matches,
312 self.matchers = [self.python_matches,
313 self.file_matches,
313 self.file_matches,
314 self.alias_matches,
314 self.alias_matches,
315 self.python_func_kw_matches]
315 self.python_func_kw_matches]
316
316
317 # Code contributed by Alex Schmolck, for ipython/emacs integration
317 # Code contributed by Alex Schmolck, for ipython/emacs integration
318 def all_completions(self, text):
318 def all_completions(self, text):
319 """Return all possible completions for the benefit of emacs."""
319 """Return all possible completions for the benefit of emacs."""
320
320
321 completions = []
321 completions = []
322 comp_append = completions.append
322 comp_append = completions.append
323 try:
323 try:
324 for i in xrange(sys.maxint):
324 for i in xrange(sys.maxint):
325 res = self.complete(text, i)
325 res = self.complete(text, i)
326
326
327 if not res: break
327 if not res: break
328
328
329 comp_append(res)
329 comp_append(res)
330 #XXX workaround for ``notDefined.<tab>``
330 #XXX workaround for ``notDefined.<tab>``
331 except NameError:
331 except NameError:
332 pass
332 pass
333 return completions
333 return completions
334 # /end Alex Schmolck code.
334 # /end Alex Schmolck code.
335
335
336 def _clean_glob(self,text):
336 def _clean_glob(self,text):
337 return self.glob("%s*" % text)
337 return self.glob("%s*" % text)
338
338
339 def _clean_glob_win32(self,text):
339 def _clean_glob_win32(self,text):
340 return [f.replace("\\","/")
340 return [f.replace("\\","/")
341 for f in self.glob("%s*" % text)]
341 for f in self.glob("%s*" % text)]
342
342
343 def file_matches(self, text):
343 def file_matches(self, text):
344 """Match filenames, expanding ~USER type strings.
344 """Match filenames, expanding ~USER type strings.
345
345
346 Most of the seemingly convoluted logic in this completer is an
346 Most of the seemingly convoluted logic in this completer is an
347 attempt to handle filenames with spaces in them. And yet it's not
347 attempt to handle filenames with spaces in them. And yet it's not
348 quite perfect, because Python's readline doesn't expose all of the
348 quite perfect, because Python's readline doesn't expose all of the
349 GNU readline details needed for this to be done correctly.
349 GNU readline details needed for this to be done correctly.
350
350
351 For a filename with a space in it, the printed completions will be
351 For a filename with a space in it, the printed completions will be
352 only the parts after what's already been typed (instead of the
352 only the parts after what's already been typed (instead of the
353 full completions, as is normally done). I don't think with the
353 full completions, as is normally done). I don't think with the
354 current (as of Python 2.3) Python readline it's possible to do
354 current (as of Python 2.3) Python readline it's possible to do
355 better."""
355 better."""
356
356
357 #print 'Completer->file_matches: <%s>' % text # dbg
357 #print 'Completer->file_matches: <%s>' % text # dbg
358
358
359 # chars that require escaping with backslash - i.e. chars
359 # chars that require escaping with backslash - i.e. chars
360 # that readline treats incorrectly as delimiters, but we
360 # that readline treats incorrectly as delimiters, but we
361 # don't want to treat as delimiters in filename matching
361 # don't want to treat as delimiters in filename matching
362 # when escaped with backslash
362 # when escaped with backslash
363
363
364 protectables = ' ()[]{}'
364 protectables = ' ()[]{}'
365
365
366 if text.startswith('!'):
366 if text.startswith('!'):
367 text = text[1:]
367 text = text[1:]
368 text_prefix = '!'
368 text_prefix = '!'
369 else:
369 else:
370 text_prefix = ''
370 text_prefix = ''
371
371
372 def protect_filename(s):
372 def protect_filename(s):
373 return "".join([(ch in protectables and '\\' + ch or ch)
373 return "".join([(ch in protectables and '\\' + ch or ch)
374 for ch in s])
374 for ch in s])
375
375
376 def single_dir_expand(matches):
376 def single_dir_expand(matches):
377 "Recursively expand match lists containing a single dir."
377 "Recursively expand match lists containing a single dir."
378
378
379 if len(matches) == 1 and os.path.isdir(matches[0]):
379 if len(matches) == 1 and os.path.isdir(matches[0]):
380 # Takes care of links to directories also. Use '/'
380 # Takes care of links to directories also. Use '/'
381 # explicitly, even under Windows, so that name completions
381 # explicitly, even under Windows, so that name completions
382 # don't end up escaped.
382 # don't end up escaped.
383 d = matches[0]
383 d = matches[0]
384 if d[-1] in ['/','\\']:
384 if d[-1] in ['/','\\']:
385 d = d[:-1]
385 d = d[:-1]
386
386
387 subdirs = os.listdir(d)
387 subdirs = os.listdir(d)
388 if subdirs:
388 if subdirs:
389 matches = [ (d + '/' + p) for p in subdirs]
389 matches = [ (d + '/' + p) for p in subdirs]
390 return single_dir_expand(matches)
390 return single_dir_expand(matches)
391 else:
391 else:
392 return matches
392 return matches
393 else:
393 else:
394 return matches
394 return matches
395
395
396 lbuf = self.lbuf
396 lbuf = self.lbuf
397 open_quotes = 0 # track strings with open quotes
397 open_quotes = 0 # track strings with open quotes
398 try:
398 try:
399 lsplit = shlex.split(lbuf)[-1]
399 lsplit = shlex.split(lbuf)[-1]
400 except ValueError:
400 except ValueError:
401 # typically an unmatched ", or backslash without escaped char.
401 # typically an unmatched ", or backslash without escaped char.
402 if lbuf.count('"')==1:
402 if lbuf.count('"')==1:
403 open_quotes = 1
403 open_quotes = 1
404 lsplit = lbuf.split('"')[-1]
404 lsplit = lbuf.split('"')[-1]
405 elif lbuf.count("'")==1:
405 elif lbuf.count("'")==1:
406 open_quotes = 1
406 open_quotes = 1
407 lsplit = lbuf.split("'")[-1]
407 lsplit = lbuf.split("'")[-1]
408 else:
408 else:
409 return []
409 return []
410 except IndexError:
410 except IndexError:
411 # tab pressed on empty line
411 # tab pressed on empty line
412 lsplit = ""
412 lsplit = ""
413
413
414 if lsplit != protect_filename(lsplit):
414 if lsplit != protect_filename(lsplit):
415 # if protectables are found, do matching on the whole escaped
415 # if protectables are found, do matching on the whole escaped
416 # name
416 # name
417 has_protectables = 1
417 has_protectables = 1
418 text0,text = text,lsplit
418 text0,text = text,lsplit
419 else:
419 else:
420 has_protectables = 0
420 has_protectables = 0
421 text = os.path.expanduser(text)
421 text = os.path.expanduser(text)
422
422
423 if text == "":
423 if text == "":
424 return [text_prefix + protect_filename(f) for f in self.glob("*")]
424 return [text_prefix + protect_filename(f) for f in self.glob("*")]
425
425
426 m0 = self.clean_glob(text.replace('\\',''))
426 m0 = self.clean_glob(text.replace('\\',''))
427 if has_protectables:
427 if has_protectables:
428 # If we had protectables, we need to revert our changes to the
428 # If we had protectables, we need to revert our changes to the
429 # beginning of filename so that we don't double-write the part
429 # beginning of filename so that we don't double-write the part
430 # of the filename we have so far
430 # of the filename we have so far
431 len_lsplit = len(lsplit)
431 len_lsplit = len(lsplit)
432 matches = [text_prefix + text0 +
432 matches = [text_prefix + text0 +
433 protect_filename(f[len_lsplit:]) for f in m0]
433 protect_filename(f[len_lsplit:]) for f in m0]
434 else:
434 else:
435 if open_quotes:
435 if open_quotes:
436 # if we have a string with an open quote, we don't need to
436 # if we have a string with an open quote, we don't need to
437 # protect the names at all (and we _shouldn't_, as it
437 # protect the names at all (and we _shouldn't_, as it
438 # would cause bugs when the filesystem call is made).
438 # would cause bugs when the filesystem call is made).
439 matches = m0
439 matches = m0
440 else:
440 else:
441 matches = [text_prefix +
441 matches = [text_prefix +
442 protect_filename(f) for f in m0]
442 protect_filename(f) for f in m0]
443
443
444 #print 'mm',matches # dbg
444 #print 'mm',matches # dbg
445 return single_dir_expand(matches)
445 return single_dir_expand(matches)
446
446
447 def alias_matches(self, text):
447 def alias_matches(self, text):
448 """Match internal system aliases"""
448 """Match internal system aliases"""
449 #print 'Completer->alias_matches:',text,'lb',self.lbuf # dbg
449 #print 'Completer->alias_matches:',text,'lb',self.lbuf # dbg
450
450
451 # if we are not in the first 'item', alias matching
451 # if we are not in the first 'item', alias matching
452 # doesn't make sense
452 # doesn't make sense
453 if ' ' in self.lbuf:
453 if ' ' in self.lbuf:
454 return []
454 return []
455 text = os.path.expanduser(text)
455 text = os.path.expanduser(text)
456 aliases = self.alias_table.keys()
456 aliases = self.alias_table.keys()
457 if text == "":
457 if text == "":
458 return aliases
458 return aliases
459 else:
459 else:
460 return [alias for alias in aliases if alias.startswith(text)]
460 return [alias for alias in aliases if alias.startswith(text)]
461
461
462 def python_matches(self,text):
462 def python_matches(self,text):
463 """Match attributes or global python names"""
463 """Match attributes or global python names"""
464
464
465 #print 'Completer->python_matches, txt=<%s>' % text # dbg
465 #print 'Completer->python_matches, txt=<%s>' % text # dbg
466 if "." in text:
466 if "." in text:
467 try:
467 try:
468 matches = self.attr_matches(text)
468 matches = self.attr_matches(text)
469 if text.endswith('.') and self.omit__names:
469 if text.endswith('.') and self.omit__names:
470 if self.omit__names == 1:
470 if self.omit__names == 1:
471 # true if txt is _not_ a __ name, false otherwise:
471 # true if txt is _not_ a __ name, false otherwise:
472 no__name = (lambda txt:
472 no__name = (lambda txt:
473 re.match(r'.*\.__.*?__',txt) is None)
473 re.match(r'.*\.__.*?__',txt) is None)
474 else:
474 else:
475 # true if txt is _not_ a _ name, false otherwise:
475 # true if txt is _not_ a _ name, false otherwise:
476 no__name = (lambda txt:
476 no__name = (lambda txt:
477 re.match(r'.*\._.*?',txt) is None)
477 re.match(r'.*\._.*?',txt) is None)
478 matches = filter(no__name, matches)
478 matches = filter(no__name, matches)
479 except NameError:
479 except NameError:
480 # catches <undefined attributes>.<tab>
480 # catches <undefined attributes>.<tab>
481 matches = []
481 matches = []
482 else:
482 else:
483 matches = self.global_matches(text)
483 matches = self.global_matches(text)
484 # this is so completion finds magics when automagic is on:
484 # this is so completion finds magics when automagic is on:
485 if (matches == [] and
485 if (matches == [] and
486 not text.startswith(os.sep) and
486 not text.startswith(os.sep) and
487 not ' ' in self.lbuf):
487 not ' ' in self.lbuf):
488 matches = self.attr_matches(self.magic_prefix+text)
488 matches = self.attr_matches(self.magic_prefix+text)
489 return matches
489 return matches
490
490
491 def _default_arguments(self, obj):
491 def _default_arguments(self, obj):
492 """Return the list of default arguments of obj if it is callable,
492 """Return the list of default arguments of obj if it is callable,
493 or empty list otherwise."""
493 or empty list otherwise."""
494
494
495 if not (inspect.isfunction(obj) or inspect.ismethod(obj)):
495 if not (inspect.isfunction(obj) or inspect.ismethod(obj)):
496 # for classes, check for __init__,__new__
496 # for classes, check for __init__,__new__
497 if inspect.isclass(obj):
497 if inspect.isclass(obj):
498 obj = (getattr(obj,'__init__',None) or
498 obj = (getattr(obj,'__init__',None) or
499 getattr(obj,'__new__',None))
499 getattr(obj,'__new__',None))
500 # for all others, check if they are __call__able
500 # for all others, check if they are __call__able
501 elif hasattr(obj, '__call__'):
501 elif hasattr(obj, '__call__'):
502 obj = obj.__call__
502 obj = obj.__call__
503 # XXX: is there a way to handle the builtins ?
503 # XXX: is there a way to handle the builtins ?
504 try:
504 try:
505 args,_,_1,defaults = inspect.getargspec(obj)
505 args,_,_1,defaults = inspect.getargspec(obj)
506 if defaults:
506 if defaults:
507 return args[-len(defaults):]
507 return args[-len(defaults):]
508 except TypeError: pass
508 except TypeError: pass
509 return []
509 return []
510
510
511 def python_func_kw_matches(self,text):
511 def python_func_kw_matches(self,text):
512 """Match named parameters (kwargs) of the last open function"""
512 """Match named parameters (kwargs) of the last open function"""
513
513
514 if "." in text: # a parameter cannot be dotted
514 if "." in text: # a parameter cannot be dotted
515 return []
515 return []
516 try: regexp = self.__funcParamsRegex
516 try: regexp = self.__funcParamsRegex
517 except AttributeError:
517 except AttributeError:
518 regexp = self.__funcParamsRegex = re.compile(r'''
518 regexp = self.__funcParamsRegex = re.compile(r'''
519 '.*?' | # single quoted strings or
519 '.*?' | # single quoted strings or
520 ".*?" | # double quoted strings or
520 ".*?" | # double quoted strings or
521 \w+ | # identifier
521 \w+ | # identifier
522 \S # other characters
522 \S # other characters
523 ''', re.VERBOSE | re.DOTALL)
523 ''', re.VERBOSE | re.DOTALL)
524 # 1. find the nearest identifier that comes before an unclosed
524 # 1. find the nearest identifier that comes before an unclosed
525 # parenthesis e.g. for "foo (1+bar(x), pa", the candidate is "foo"
525 # parenthesis e.g. for "foo (1+bar(x), pa", the candidate is "foo"
526 tokens = regexp.findall(self.get_line_buffer())
526 tokens = regexp.findall(self.get_line_buffer())
527 tokens.reverse()
527 tokens.reverse()
528 iterTokens = iter(tokens); openPar = 0
528 iterTokens = iter(tokens); openPar = 0
529 for token in iterTokens:
529 for token in iterTokens:
530 if token == ')':
530 if token == ')':
531 openPar -= 1
531 openPar -= 1
532 elif token == '(':
532 elif token == '(':
533 openPar += 1
533 openPar += 1
534 if openPar > 0:
534 if openPar > 0:
535 # found the last unclosed parenthesis
535 # found the last unclosed parenthesis
536 break
536 break
537 else:
537 else:
538 return []
538 return []
539 # 2. Concatenate dotted names ("foo.bar" for "foo.bar(x, pa" )
539 # 2. Concatenate dotted names ("foo.bar" for "foo.bar(x, pa" )
540 ids = []
540 ids = []
541 isId = re.compile(r'\w+$').match
541 isId = re.compile(r'\w+$').match
542 while True:
542 while True:
543 try:
543 try:
544 ids.append(iterTokens.next())
544 ids.append(iterTokens.next())
545 if not isId(ids[-1]):
545 if not isId(ids[-1]):
546 ids.pop(); break
546 ids.pop(); break
547 if not iterTokens.next() == '.':
547 if not iterTokens.next() == '.':
548 break
548 break
549 except StopIteration:
549 except StopIteration:
550 break
550 break
551 # lookup the candidate callable matches either using global_matches
551 # lookup the candidate callable matches either using global_matches
552 # or attr_matches for dotted names
552 # or attr_matches for dotted names
553 if len(ids) == 1:
553 if len(ids) == 1:
554 callableMatches = self.global_matches(ids[0])
554 callableMatches = self.global_matches(ids[0])
555 else:
555 else:
556 callableMatches = self.attr_matches('.'.join(ids[::-1]))
556 callableMatches = self.attr_matches('.'.join(ids[::-1]))
557 argMatches = []
557 argMatches = []
558 for callableMatch in callableMatches:
558 for callableMatch in callableMatches:
559 try: namedArgs = self._default_arguments(eval(callableMatch,
559 try: namedArgs = self._default_arguments(eval(callableMatch,
560 self.namespace))
560 self.namespace))
561 except: continue
561 except: continue
562 for namedArg in namedArgs:
562 for namedArg in namedArgs:
563 if namedArg.startswith(text):
563 if namedArg.startswith(text):
564 argMatches.append("%s=" %namedArg)
564 argMatches.append("%s=" %namedArg)
565 return argMatches
565 return argMatches
566
566
567 def dispatch_custom_completer(self,text):
567 def dispatch_custom_completer(self,text):
568 # print "Custom! '%s' %s" % (text, self.custom_completers) # dbg
568 # print "Custom! '%s' %s" % (text, self.custom_completers) # dbg
569 line = self.full_lbuf
569 line = self.full_lbuf
570 if not line.strip():
570 if not line.strip():
571 return None
571 return None
572
572
573 event = Struct()
573 event = Struct()
574 event.line = line
574 event.line = line
575 event.symbol = text
575 event.symbol = text
576 cmd = line.split(None,1)[0]
576 cmd = line.split(None,1)[0]
577 event.command = cmd
577 event.command = cmd
578 #print "\ncustom:{%s]\n" % event # dbg
578 #print "\ncustom:{%s]\n" % event # dbg
579
579
580 # for foo etc, try also to find completer for %foo
580 # for foo etc, try also to find completer for %foo
581 if not cmd.startswith(self.magic_escape):
581 if not cmd.startswith(self.magic_escape):
582 try_magic = self.custom_completers.s_matches(
582 try_magic = self.custom_completers.s_matches(
583 self.magic_escape + cmd)
583 self.magic_escape + cmd)
584 else:
584 else:
585 try_magic = []
585 try_magic = []
586
586
587
587
588 for c in itertools.chain(
588 for c in itertools.chain(
589 self.custom_completers.s_matches(cmd),
589 self.custom_completers.s_matches(cmd),
590 try_magic,
590 try_magic,
591 self.custom_completers.flat_matches(self.lbuf)):
591 self.custom_completers.flat_matches(self.lbuf)):
592 # print "try",c # dbg
592 # print "try",c # dbg
593 try:
593 try:
594 res = c(event)
594 res = c(event)
595 return [r for r in res if r.lower().startswith(text.lower())]
595 return [r for r in res if r.lower().startswith(text.lower())]
596 except ipapi.TryNext:
596 except ipapi.TryNext:
597 pass
597 pass
598
598
599 return None
599 return None
600
600
601
601
602
602 def complete(self, text, state,line_buffer=None):
603 def complete(self, text, state):
604 """Return the next possible completion for 'text'.
603 """Return the next possible completion for 'text'.
605
604
606 This is called successively with state == 0, 1, 2, ... until it
605 This is called successively with state == 0, 1, 2, ... until it
607 returns None. The completion should begin with 'text'. """
606 returns None. The completion should begin with 'text'.
607
608 :Keywords:
609 - line_buffer: string
610 If not given, the completer attempts to obtain the current line buffer
611 via readline. This keyword allows clients which are requesting for
612 text completions in non-readline contexts to inform the completer of
613 the entire text.
614 """
608
615
609 #print '\n*** COMPLETE: <%s> (%s)' % (text,state) # dbg
616 #print '\n*** COMPLETE: <%s> (%s)' % (text,state) # dbg
610
617
611 # if there is only a tab on a line with only whitespace, instead
618 # if there is only a tab on a line with only whitespace, instead
612 # of the mostly useless 'do you want to see all million
619 # of the mostly useless 'do you want to see all million
613 # completions' message, just do the right thing and give the user
620 # completions' message, just do the right thing and give the user
614 # his tab! Incidentally, this enables pasting of tabbed text from
621 # his tab! Incidentally, this enables pasting of tabbed text from
615 # an editor (as long as autoindent is off).
622 # an editor (as long as autoindent is off).
616
623
617 # don't apply this on 'dumb' terminals, such as emacs buffers, so we
624 # don't apply this on 'dumb' terminals, such as emacs buffers, so we
618 # don't interfere with their own tab-completion mechanism.
625 # don't interfere with their own tab-completion mechanism.
619 self.full_lbuf = self.get_line_buffer()
626 if line_buffer is None:
620 self.lbuf = self.full_lbuf[:self.readline.get_endidx()]
627 self.full_lbuf = self.get_line_buffer()
621 if not (self.dumb_terminal or self.get_line_buffer().strip()):
628 else:
629 self.full_lbuf = line_buffer
630
631 if not (self.dumb_terminal or self.full_lbuf.strip()):
622 self.readline.insert_text('\t')
632 self.readline.insert_text('\t')
623 return None
633 return None
624
625
634
626 magic_escape = self.magic_escape
635 magic_escape = self.magic_escape
627 magic_prefix = self.magic_prefix
636 magic_prefix = self.magic_prefix
628
637
638 self.lbuf = self.full_lbuf[:self.readline.get_endidx()]
639
629 try:
640 try:
630 if text.startswith(magic_escape):
641 if text.startswith(magic_escape):
631 text = text.replace(magic_escape,magic_prefix)
642 text = text.replace(magic_escape,magic_prefix)
632 elif text.startswith('~'):
643 elif text.startswith('~'):
633 text = os.path.expanduser(text)
644 text = os.path.expanduser(text)
634 if state == 0:
645 if state == 0:
635 custom_res = self.dispatch_custom_completer(text)
646 custom_res = self.dispatch_custom_completer(text)
636 if custom_res is not None:
647 if custom_res is not None:
637 # did custom completers produce something?
648 # did custom completers produce something?
638 self.matches = custom_res
649 self.matches = custom_res
639 else:
650 else:
640 # Extend the list of completions with the results of each
651 # Extend the list of completions with the results of each
641 # matcher, so we return results to the user from all
652 # matcher, so we return results to the user from all
642 # namespaces.
653 # namespaces.
643 if self.merge_completions:
654 if self.merge_completions:
644 self.matches = []
655 self.matches = []
645 for matcher in self.matchers:
656 for matcher in self.matchers:
646 self.matches.extend(matcher(text))
657 self.matches.extend(matcher(text))
647 else:
658 else:
648 for matcher in self.matchers:
659 for matcher in self.matchers:
649 self.matches = matcher(text)
660 self.matches = matcher(text)
650 if self.matches:
661 if self.matches:
651 break
662 break
652
663
653 try:
664 try:
654 return self.matches[state].replace(magic_prefix,magic_escape)
665 return self.matches[state].replace(magic_prefix,magic_escape)
655 except IndexError:
666 except IndexError:
656 return None
667 return None
657 except:
668 except:
658 #from IPython.ultraTB import AutoFormattedTB; # dbg
669 #from IPython.ultraTB import AutoFormattedTB; # dbg
659 #tb=AutoFormattedTB('Verbose');tb() #dbg
670 #tb=AutoFormattedTB('Verbose');tb() #dbg
660
671
661 # If completion fails, don't annoy the user.
672 # If completion fails, don't annoy the user.
662 return None
673 return None
@@ -1,2595 +1,2596 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 2196 2007-04-02 06:02:16Z fperez $
9 $Id: iplib.py 2197 2007-04-02 07:36:55Z fperez $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
14 # Copyright (C) 2001-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 from IPython.strdispatch import StrDispatch
76 import IPython.ipapi
76 import IPython.ipapi
77
77
78 # Globals
78 # Globals
79
79
80 # 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
81 # overwrites it (like wx.py.PyShell does)
81 # overwrites it (like wx.py.PyShell does)
82 raw_input_original = raw_input
82 raw_input_original = raw_input
83
83
84 # compiled regexps for autoindent management
84 # compiled regexps for autoindent management
85 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
85 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
86
86
87
87
88 #****************************************************************************
88 #****************************************************************************
89 # Some utility function definitions
89 # Some utility function definitions
90
90
91 ini_spaces_re = re.compile(r'^(\s+)')
91 ini_spaces_re = re.compile(r'^(\s+)')
92
92
93 def num_ini_spaces(strng):
93 def num_ini_spaces(strng):
94 """Return the number of initial spaces in a string"""
94 """Return the number of initial spaces in a string"""
95
95
96 ini_spaces = ini_spaces_re.match(strng)
96 ini_spaces = ini_spaces_re.match(strng)
97 if ini_spaces:
97 if ini_spaces:
98 return ini_spaces.end()
98 return ini_spaces.end()
99 else:
99 else:
100 return 0
100 return 0
101
101
102 def softspace(file, newvalue):
102 def softspace(file, newvalue):
103 """Copied from code.py, to remove the dependency"""
103 """Copied from code.py, to remove the dependency"""
104
104
105 oldvalue = 0
105 oldvalue = 0
106 try:
106 try:
107 oldvalue = file.softspace
107 oldvalue = file.softspace
108 except AttributeError:
108 except AttributeError:
109 pass
109 pass
110 try:
110 try:
111 file.softspace = newvalue
111 file.softspace = newvalue
112 except (AttributeError, TypeError):
112 except (AttributeError, TypeError):
113 # "attribute-less object" or "read-only attributes"
113 # "attribute-less object" or "read-only attributes"
114 pass
114 pass
115 return oldvalue
115 return oldvalue
116
116
117
117
118 #****************************************************************************
118 #****************************************************************************
119 # Local use exceptions
119 # Local use exceptions
120 class SpaceInInput(exceptions.Exception): pass
120 class SpaceInInput(exceptions.Exception): pass
121
121
122
122
123 #****************************************************************************
123 #****************************************************************************
124 # Local use classes
124 # Local use classes
125 class Bunch: pass
125 class Bunch: pass
126
126
127 class Undefined: pass
127 class Undefined: pass
128
128
129 class Quitter(object):
129 class Quitter(object):
130 """Simple class to handle exit, similar to Python 2.5's.
130 """Simple class to handle exit, similar to Python 2.5's.
131
131
132 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
133 doesn't do (obviously, since it doesn't know about ipython)."""
133 doesn't do (obviously, since it doesn't know about ipython)."""
134
134
135 def __init__(self,shell,name):
135 def __init__(self,shell,name):
136 self.shell = shell
136 self.shell = shell
137 self.name = name
137 self.name = name
138
138
139 def __repr__(self):
139 def __repr__(self):
140 return 'Type %s() to exit.' % self.name
140 return 'Type %s() to exit.' % self.name
141 __str__ = __repr__
141 __str__ = __repr__
142
142
143 def __call__(self):
143 def __call__(self):
144 self.shell.exit()
144 self.shell.exit()
145
145
146 class InputList(list):
146 class InputList(list):
147 """Class to store user input.
147 """Class to store user input.
148
148
149 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
150 allowing things like (assuming 'In' is an instance):
150 allowing things like (assuming 'In' is an instance):
151
151
152 exec In[4:7]
152 exec In[4:7]
153
153
154 or
154 or
155
155
156 exec In[5:9] + In[14] + In[21:25]"""
156 exec In[5:9] + In[14] + In[21:25]"""
157
157
158 def __getslice__(self,i,j):
158 def __getslice__(self,i,j):
159 return ''.join(list.__getslice__(self,i,j))
159 return ''.join(list.__getslice__(self,i,j))
160
160
161 class SyntaxTB(ultraTB.ListTB):
161 class SyntaxTB(ultraTB.ListTB):
162 """Extension which holds some state: the last exception value"""
162 """Extension which holds some state: the last exception value"""
163
163
164 def __init__(self,color_scheme = 'NoColor'):
164 def __init__(self,color_scheme = 'NoColor'):
165 ultraTB.ListTB.__init__(self,color_scheme)
165 ultraTB.ListTB.__init__(self,color_scheme)
166 self.last_syntax_error = None
166 self.last_syntax_error = None
167
167
168 def __call__(self, etype, value, elist):
168 def __call__(self, etype, value, elist):
169 self.last_syntax_error = value
169 self.last_syntax_error = value
170 ultraTB.ListTB.__call__(self,etype,value,elist)
170 ultraTB.ListTB.__call__(self,etype,value,elist)
171
171
172 def clear_err_state(self):
172 def clear_err_state(self):
173 """Return the current error state and clear it"""
173 """Return the current error state and clear it"""
174 e = self.last_syntax_error
174 e = self.last_syntax_error
175 self.last_syntax_error = None
175 self.last_syntax_error = None
176 return e
176 return e
177
177
178 #****************************************************************************
178 #****************************************************************************
179 # Main IPython class
179 # Main IPython class
180
180
181 # 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
182 # 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
183 # 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
184 # 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.
185 #
185 #
186 # 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
187 # 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
188 # chainsaw branch.
188 # chainsaw branch.
189
189
190 # 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
191 # 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
192 # class, to prevent clashes.
192 # class, to prevent clashes.
193
193
194 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
194 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
195 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
195 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
196 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
196 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
197 # 'self.value']
197 # 'self.value']
198
198
199 class InteractiveShell(object,Magic):
199 class InteractiveShell(object,Magic):
200 """An enhanced console for Python."""
200 """An enhanced console for Python."""
201
201
202 # class attribute to indicate whether the class supports threads or not.
202 # class attribute to indicate whether the class supports threads or not.
203 # Subclasses with thread support should override this as needed.
203 # Subclasses with thread support should override this as needed.
204 isthreaded = False
204 isthreaded = False
205
205
206 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),
207 user_ns = None,user_global_ns=None,banner2='',
207 user_ns = None,user_global_ns=None,banner2='',
208 custom_exceptions=((),None),embedded=False):
208 custom_exceptions=((),None),embedded=False):
209
209
210 # log system
210 # log system
211 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
211 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
212
212
213 # some minimal strict typechecks. For some core data structures, I
213 # some minimal strict typechecks. For some core data structures, I
214 # want actual basic python types, not just anything that looks like
214 # want actual basic python types, not just anything that looks like
215 # one. This is especially true for namespaces.
215 # one. This is especially true for namespaces.
216 for ns in (user_ns,user_global_ns):
216 for ns in (user_ns,user_global_ns):
217 if ns is not None and type(ns) != types.DictType:
217 if ns is not None and type(ns) != types.DictType:
218 raise TypeError,'namespace must be a dictionary'
218 raise TypeError,'namespace must be a dictionary'
219
219
220 # Job manager (for jobs run as background threads)
220 # Job manager (for jobs run as background threads)
221 self.jobs = BackgroundJobManager()
221 self.jobs = BackgroundJobManager()
222
222
223 # Store the actual shell's name
223 # Store the actual shell's name
224 self.name = name
224 self.name = name
225
225
226 # 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
227 # global/local namespaces need to be handled differently in that case
227 # global/local namespaces need to be handled differently in that case
228 self.embedded = embedded
228 self.embedded = embedded
229
229
230 # command compiler
230 # command compiler
231 self.compile = codeop.CommandCompiler()
231 self.compile = codeop.CommandCompiler()
232
232
233 # User input buffer
233 # User input buffer
234 self.buffer = []
234 self.buffer = []
235
235
236 # Default name given in compilation of code
236 # Default name given in compilation of code
237 self.filename = '<ipython console>'
237 self.filename = '<ipython console>'
238
238
239 # 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,
240 # 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.
241 __builtin__.exit = Quitter(self,'exit')
241 __builtin__.exit = Quitter(self,'exit')
242 __builtin__.quit = Quitter(self,'quit')
242 __builtin__.quit = Quitter(self,'quit')
243
243
244 # Make an empty namespace, which extension writers can rely on both
244 # Make an empty namespace, which extension writers can rely on both
245 # 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
246 # convenient location for storing additional information and state
246 # convenient location for storing additional information and state
247 # their extensions may require, without fear of collisions with other
247 # their extensions may require, without fear of collisions with other
248 # ipython names that may develop later.
248 # ipython names that may develop later.
249 self.meta = Struct()
249 self.meta = Struct()
250
250
251 # Create the namespace where the user will operate. user_ns is
251 # Create the namespace where the user will operate. user_ns is
252 # 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
253 # 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
254 # given as the exec 'globals' argument, This is useful in embedding
254 # given as the exec 'globals' argument, This is useful in embedding
255 # situations where the ipython shell opens in a context where the
255 # situations where the ipython shell opens in a context where the
256 # distinction between locals and globals is meaningful.
256 # distinction between locals and globals is meaningful.
257
257
258 # FIXME. For some strange reason, __builtins__ is showing up at user
258 # FIXME. For some strange reason, __builtins__ is showing up at user
259 # 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
260 # should really track down where the problem is coming from. Alex
260 # should really track down where the problem is coming from. Alex
261 # Schmolck reported this problem first.
261 # Schmolck reported this problem first.
262
262
263 # A useful post by Alex Martelli on this topic:
263 # A useful post by Alex Martelli on this topic:
264 # Re: inconsistent value from __builtins__
264 # Re: inconsistent value from __builtins__
265 # Von: Alex Martelli <aleaxit@yahoo.com>
265 # Von: Alex Martelli <aleaxit@yahoo.com>
266 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
266 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
267 # Gruppen: comp.lang.python
267 # Gruppen: comp.lang.python
268
268
269 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
269 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
270 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
270 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
271 # > <type 'dict'>
271 # > <type 'dict'>
272 # > >>> print type(__builtins__)
272 # > >>> print type(__builtins__)
273 # > <type 'module'>
273 # > <type 'module'>
274 # > Is this difference in return value intentional?
274 # > Is this difference in return value intentional?
275
275
276 # Well, it's documented that '__builtins__' can be either a dictionary
276 # Well, it's documented that '__builtins__' can be either a dictionary
277 # 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
278 # 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
279 # 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
280 # should start with "import __builtin__" (note, no 's') which will
280 # should start with "import __builtin__" (note, no 's') which will
281 # definitely give you a module. Yeah, it's somewhat confusing:-(.
281 # definitely give you a module. Yeah, it's somewhat confusing:-(.
282
282
283 # 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
284 # 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
285 # properly initialized namespaces.
285 # properly initialized namespaces.
286 user_ns = IPython.ipapi.make_user_ns(user_ns)
286 user_ns = IPython.ipapi.make_user_ns(user_ns)
287 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)
288
288
289 # Assign namespaces
289 # Assign namespaces
290 # This is the namespace where all normal user variables live
290 # This is the namespace where all normal user variables live
291 self.user_ns = user_ns
291 self.user_ns = user_ns
292 # Embedded instances require a separate namespace for globals.
292 # Embedded instances require a separate namespace for globals.
293 # Normally this one is unused by non-embedded instances.
293 # Normally this one is unused by non-embedded instances.
294 self.user_global_ns = user_global_ns
294 self.user_global_ns = user_global_ns
295 # A namespace to keep track of internal data structures to prevent
295 # A namespace to keep track of internal data structures to prevent
296 # them from cluttering user-visible stuff. Will be updated later
296 # them from cluttering user-visible stuff. Will be updated later
297 self.internal_ns = {}
297 self.internal_ns = {}
298
298
299 # Namespace of system aliases. Each entry in the alias
299 # Namespace of system aliases. Each entry in the alias
300 # 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
301 # of positional arguments of the alias.
301 # of positional arguments of the alias.
302 self.alias_table = {}
302 self.alias_table = {}
303
303
304 # A table holding all the namespaces IPython deals with, so that
304 # A table holding all the namespaces IPython deals with, so that
305 # introspection facilities can search easily.
305 # introspection facilities can search easily.
306 self.ns_table = {'user':user_ns,
306 self.ns_table = {'user':user_ns,
307 'user_global':user_global_ns,
307 'user_global':user_global_ns,
308 'alias':self.alias_table,
308 'alias':self.alias_table,
309 'internal':self.internal_ns,
309 'internal':self.internal_ns,
310 'builtin':__builtin__.__dict__
310 'builtin':__builtin__.__dict__
311 }
311 }
312
312
313 # The user namespace MUST have a pointer to the shell itself.
313 # The user namespace MUST have a pointer to the shell itself.
314 self.user_ns[name] = self
314 self.user_ns[name] = self
315
315
316 # 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
317 # module but which accesses the IPython namespace, for shelve and
317 # module but which accesses the IPython namespace, for shelve and
318 # pickle to work interactively. Normally they rely on getting
318 # pickle to work interactively. Normally they rely on getting
319 # everything out of __main__, but for embedding purposes each IPython
319 # everything out of __main__, but for embedding purposes each IPython
320 # 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
321 # everything into __main__.
321 # everything into __main__.
322
322
323 # note, however, that we should only do this for non-embedded
323 # note, however, that we should only do this for non-embedded
324 # ipythons, which really mimic the __main__.__dict__ with their own
324 # ipythons, which really mimic the __main__.__dict__ with their own
325 # namespace. Embedded instances, on the other hand, should not do
325 # namespace. Embedded instances, on the other hand, should not do
326 # this because they need to manage the user local/global namespaces
326 # this because they need to manage the user local/global namespaces
327 # only, but they live within a 'normal' __main__ (meaning, they
327 # only, but they live within a 'normal' __main__ (meaning, they
328 # shouldn't overtake the execution environment of the script they're
328 # shouldn't overtake the execution environment of the script they're
329 # embedded in).
329 # embedded in).
330
330
331 if not embedded:
331 if not embedded:
332 try:
332 try:
333 main_name = self.user_ns['__name__']
333 main_name = self.user_ns['__name__']
334 except KeyError:
334 except KeyError:
335 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
335 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
336 else:
336 else:
337 #print "pickle hack in place" # dbg
337 #print "pickle hack in place" # dbg
338 #print 'main_name:',main_name # dbg
338 #print 'main_name:',main_name # dbg
339 sys.modules[main_name] = FakeModule(self.user_ns)
339 sys.modules[main_name] = FakeModule(self.user_ns)
340
340
341 # List of input with multi-line handling.
341 # List of input with multi-line handling.
342 # Fill its zero entry, user counter starts at 1
342 # Fill its zero entry, user counter starts at 1
343 self.input_hist = InputList(['\n'])
343 self.input_hist = InputList(['\n'])
344 # This one will hold the 'raw' input history, without any
344 # This one will hold the 'raw' input history, without any
345 # 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
346 # it was exactly typed in by the user, with %hist -r.
346 # it was exactly typed in by the user, with %hist -r.
347 self.input_hist_raw = InputList(['\n'])
347 self.input_hist_raw = InputList(['\n'])
348
348
349 # list of visited directories
349 # list of visited directories
350 try:
350 try:
351 self.dir_hist = [os.getcwd()]
351 self.dir_hist = [os.getcwd()]
352 except IOError, e:
352 except IOError, e:
353 self.dir_hist = []
353 self.dir_hist = []
354
354
355 # dict of output history
355 # dict of output history
356 self.output_hist = {}
356 self.output_hist = {}
357
357
358 # dict of things NOT to alias (keywords, builtins and some magics)
358 # dict of things NOT to alias (keywords, builtins and some magics)
359 no_alias = {}
359 no_alias = {}
360 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
360 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
361 for key in keyword.kwlist + no_alias_magics:
361 for key in keyword.kwlist + no_alias_magics:
362 no_alias[key] = 1
362 no_alias[key] = 1
363 no_alias.update(__builtin__.__dict__)
363 no_alias.update(__builtin__.__dict__)
364 self.no_alias = no_alias
364 self.no_alias = no_alias
365
365
366 # make global variables for user access to these
366 # make global variables for user access to these
367 self.user_ns['_ih'] = self.input_hist
367 self.user_ns['_ih'] = self.input_hist
368 self.user_ns['_oh'] = self.output_hist
368 self.user_ns['_oh'] = self.output_hist
369 self.user_ns['_dh'] = self.dir_hist
369 self.user_ns['_dh'] = self.dir_hist
370
370
371 # user aliases to input and output histories
371 # user aliases to input and output histories
372 self.user_ns['In'] = self.input_hist
372 self.user_ns['In'] = self.input_hist
373 self.user_ns['Out'] = self.output_hist
373 self.user_ns['Out'] = self.output_hist
374
374
375 # Object variable to store code object waiting execution. This is
375 # Object variable to store code object waiting execution. This is
376 # 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
377 # 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
378 # item which gets cleared once run.
378 # item which gets cleared once run.
379 self.code_to_run = None
379 self.code_to_run = None
380
380
381 # escapes for automatic behavior on the command line
381 # escapes for automatic behavior on the command line
382 self.ESC_SHELL = '!'
382 self.ESC_SHELL = '!'
383 self.ESC_HELP = '?'
383 self.ESC_HELP = '?'
384 self.ESC_MAGIC = '%'
384 self.ESC_MAGIC = '%'
385 self.ESC_QUOTE = ','
385 self.ESC_QUOTE = ','
386 self.ESC_QUOTE2 = ';'
386 self.ESC_QUOTE2 = ';'
387 self.ESC_PAREN = '/'
387 self.ESC_PAREN = '/'
388
388
389 # And their associated handlers
389 # And their associated handlers
390 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
390 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
391 self.ESC_QUOTE : self.handle_auto,
391 self.ESC_QUOTE : self.handle_auto,
392 self.ESC_QUOTE2 : self.handle_auto,
392 self.ESC_QUOTE2 : self.handle_auto,
393 self.ESC_MAGIC : self.handle_magic,
393 self.ESC_MAGIC : self.handle_magic,
394 self.ESC_HELP : self.handle_help,
394 self.ESC_HELP : self.handle_help,
395 self.ESC_SHELL : self.handle_shell_escape,
395 self.ESC_SHELL : self.handle_shell_escape,
396 }
396 }
397
397
398 # class initializations
398 # class initializations
399 Magic.__init__(self,self)
399 Magic.__init__(self,self)
400
400
401 # Python source parser/formatter for syntax highlighting
401 # Python source parser/formatter for syntax highlighting
402 pyformat = PyColorize.Parser().format
402 pyformat = PyColorize.Parser().format
403 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
403 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
404
404
405 # hooks holds pointers used for user-side customizations
405 # hooks holds pointers used for user-side customizations
406 self.hooks = Struct()
406 self.hooks = Struct()
407
407
408 self.strdispatchers = {}
408 self.strdispatchers = {}
409
409
410 # Set all default hooks, defined in the IPython.hooks module.
410 # Set all default hooks, defined in the IPython.hooks module.
411 hooks = IPython.hooks
411 hooks = IPython.hooks
412 for hook_name in hooks.__all__:
412 for hook_name in hooks.__all__:
413 # 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
414 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
414 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
415 #print "bound hook",hook_name
415 #print "bound hook",hook_name
416
416
417 # Flag to mark unconditional exit
417 # Flag to mark unconditional exit
418 self.exit_now = False
418 self.exit_now = False
419
419
420 self.usage_min = """\
420 self.usage_min = """\
421 An enhanced console for Python.
421 An enhanced console for Python.
422 Some of its features are:
422 Some of its features are:
423 - Readline support if the readline library is present.
423 - Readline support if the readline library is present.
424 - Tab completion in the local namespace.
424 - Tab completion in the local namespace.
425 - Logging of input, see command-line options.
425 - Logging of input, see command-line options.
426 - System shell escape via ! , eg !ls.
426 - System shell escape via ! , eg !ls.
427 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
427 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
428 - Keeps track of locally defined variables via %who, %whos.
428 - Keeps track of locally defined variables via %who, %whos.
429 - 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).
430 """
430 """
431 if usage: self.usage = usage
431 if usage: self.usage = usage
432 else: self.usage = self.usage_min
432 else: self.usage = self.usage_min
433
433
434 # Storage
434 # Storage
435 self.rc = rc # This will hold all configuration information
435 self.rc = rc # This will hold all configuration information
436 self.pager = 'less'
436 self.pager = 'less'
437 # temporary files used for various purposes. Deleted at exit.
437 # temporary files used for various purposes. Deleted at exit.
438 self.tempfiles = []
438 self.tempfiles = []
439
439
440 # Keep track of readline usage (later set by init_readline)
440 # Keep track of readline usage (later set by init_readline)
441 self.has_readline = False
441 self.has_readline = False
442
442
443 # template for logfile headers. It gets resolved at runtime by the
443 # template for logfile headers. It gets resolved at runtime by the
444 # logstart method.
444 # logstart method.
445 self.loghead_tpl = \
445 self.loghead_tpl = \
446 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
446 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
447 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
447 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
448 #log# opts = %s
448 #log# opts = %s
449 #log# args = %s
449 #log# args = %s
450 #log# It is safe to make manual edits below here.
450 #log# It is safe to make manual edits below here.
451 #log#-----------------------------------------------------------------------
451 #log#-----------------------------------------------------------------------
452 """
452 """
453 # for pushd/popd management
453 # for pushd/popd management
454 try:
454 try:
455 self.home_dir = get_home_dir()
455 self.home_dir = get_home_dir()
456 except HomeDirError,msg:
456 except HomeDirError,msg:
457 fatal(msg)
457 fatal(msg)
458
458
459 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
459 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
460
460
461 # Functions to call the underlying shell.
461 # Functions to call the underlying shell.
462
462
463 # The first is similar to os.system, but it doesn't return a value,
463 # 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.
464 # and it allows interpolation of variables in the user's namespace.
465 self.system = lambda cmd: \
465 self.system = lambda cmd: \
466 shell(self.var_expand(cmd,depth=2),
466 shell(self.var_expand(cmd,depth=2),
467 header=self.rc.system_header,
467 header=self.rc.system_header,
468 verbose=self.rc.system_verbose)
468 verbose=self.rc.system_verbose)
469
469
470 # These are for getoutput and getoutputerror:
470 # These are for getoutput and getoutputerror:
471 self.getoutput = lambda cmd: \
471 self.getoutput = lambda cmd: \
472 getoutput(self.var_expand(cmd,depth=2),
472 getoutput(self.var_expand(cmd,depth=2),
473 header=self.rc.system_header,
473 header=self.rc.system_header,
474 verbose=self.rc.system_verbose)
474 verbose=self.rc.system_verbose)
475
475
476 self.getoutputerror = lambda cmd: \
476 self.getoutputerror = lambda cmd: \
477 getoutputerror(self.var_expand(cmd,depth=2),
477 getoutputerror(self.var_expand(cmd,depth=2),
478 header=self.rc.system_header,
478 header=self.rc.system_header,
479 verbose=self.rc.system_verbose)
479 verbose=self.rc.system_verbose)
480
480
481 # RegExp for splitting line contents into pre-char//first
481 # RegExp for splitting line contents into pre-char//first
482 # word-method//rest. For clarity, each group in on one line.
482 # word-method//rest. For clarity, each group in on one line.
483
483
484 # 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
485 # are hardwired in.
485 # are hardwired in.
486
486
487 # 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
488 # 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
489 # evals() somewhere and end up causing side effects.
489 # evals() somewhere and end up causing side effects.
490 self.line_split = re.compile(r'^(\s*[,;/]?\s*)'
490 self.line_split = re.compile(r'^(\s*[,;/]?\s*)'
491 r'([\?\w\.]+\w*\s*)'
491 r'([\?\w\.]+\w*\s*)'
492 r'(\(?.*$)')
492 r'(\(?.*$)')
493
493
494 self.shell_line_split = re.compile(r'^(\s*)'
494 self.shell_line_split = re.compile(r'^(\s*)'
495 r'(\S*\s*)'
495 r'(\S*\s*)'
496 r'(\(?.*$)')
496 r'(\(?.*$)')
497
497
498
498
499 # A simpler regexp used as a fallback if the above doesn't work. This
499 # A simpler regexp used as a fallback if the above doesn't work. This
500 # one is more conservative in how it partitions the input. This code
500 # one is more conservative in how it partitions the input. This code
501 # can probably be cleaned up to do everything with just one regexp, but
501 # can probably be cleaned up to do everything with just one regexp, but
502 # I'm afraid of breaking something; do it once the unit tests are in
502 # I'm afraid of breaking something; do it once the unit tests are in
503 # place.
503 # place.
504 self.line_split_fallback = re.compile(r'^(\s*)'
504 self.line_split_fallback = re.compile(r'^(\s*)'
505 r'([%\!\?\w\.]*)'
505 r'([%\!\?\w\.]*)'
506 r'(.*)')
506 r'(.*)')
507
507
508 # Original re, keep around for a while in case changes break something
508 # Original re, keep around for a while in case changes break something
509 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
509 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
510 # r'(\s*[\?\w\.]+\w*\s*)'
510 # r'(\s*[\?\w\.]+\w*\s*)'
511 # r'(\(?.*$)')
511 # r'(\(?.*$)')
512
512
513 # RegExp to identify potential function names
513 # RegExp to identify potential function names
514 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
514 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
515
515
516 # RegExp to exclude strings with this start from autocalling. In
516 # RegExp to exclude strings with this start from autocalling. In
517 # particular, all binary operators should be excluded, so that if foo
517 # particular, all binary operators should be excluded, so that if foo
518 # is callable, foo OP bar doesn't become foo(OP bar), which is
518 # is callable, foo OP bar doesn't become foo(OP bar), which is
519 # invalid. The characters '!=()' don't need to be checked for, as the
519 # invalid. The characters '!=()' don't need to be checked for, as the
520 # _prefilter routine explicitely does so, to catch direct calls and
520 # _prefilter routine explicitely does so, to catch direct calls and
521 # rebindings of existing names.
521 # rebindings of existing names.
522
522
523 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
523 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
524 # it affects the rest of the group in square brackets.
524 # it affects the rest of the group in square brackets.
525 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
525 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
526 '|^is |^not |^in |^and |^or ')
526 '|^is |^not |^in |^and |^or ')
527
527
528 # try to catch also methods for stuff in lists/tuples/dicts: off
528 # try to catch also methods for stuff in lists/tuples/dicts: off
529 # (experimental). For this to work, the line_split regexp would need
529 # (experimental). For this to work, the line_split regexp would need
530 # to be modified so it wouldn't break things at '['. That line is
530 # to be modified so it wouldn't break things at '['. That line is
531 # nasty enough that I shouldn't change it until I can test it _well_.
531 # nasty enough that I shouldn't change it until I can test it _well_.
532 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
532 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
533
533
534 # keep track of where we started running (mainly for crash post-mortem)
534 # keep track of where we started running (mainly for crash post-mortem)
535 self.starting_dir = os.getcwd()
535 self.starting_dir = os.getcwd()
536
536
537 # Various switches which can be set
537 # Various switches which can be set
538 self.CACHELENGTH = 5000 # this is cheap, it's just text
538 self.CACHELENGTH = 5000 # this is cheap, it's just text
539 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
539 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
540 self.banner2 = banner2
540 self.banner2 = banner2
541
541
542 # TraceBack handlers:
542 # TraceBack handlers:
543
543
544 # Syntax error handler.
544 # Syntax error handler.
545 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
545 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
546
546
547 # The interactive one is initialized with an offset, meaning we always
547 # The interactive one is initialized with an offset, meaning we always
548 # want to remove the topmost item in the traceback, which is our own
548 # want to remove the topmost item in the traceback, which is our own
549 # internal code. Valid modes: ['Plain','Context','Verbose']
549 # internal code. Valid modes: ['Plain','Context','Verbose']
550 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
550 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
551 color_scheme='NoColor',
551 color_scheme='NoColor',
552 tb_offset = 1)
552 tb_offset = 1)
553
553
554 # IPython itself shouldn't crash. This will produce a detailed
554 # IPython itself shouldn't crash. This will produce a detailed
555 # post-mortem if it does. But we only install the crash handler for
555 # post-mortem if it does. But we only install the crash handler for
556 # non-threaded shells, the threaded ones use a normal verbose reporter
556 # non-threaded shells, the threaded ones use a normal verbose reporter
557 # and lose the crash handler. This is because exceptions in the main
557 # and lose the crash handler. This is because exceptions in the main
558 # thread (such as in GUI code) propagate directly to sys.excepthook,
558 # thread (such as in GUI code) propagate directly to sys.excepthook,
559 # and there's no point in printing crash dumps for every user exception.
559 # and there's no point in printing crash dumps for every user exception.
560 if self.isthreaded:
560 if self.isthreaded:
561 ipCrashHandler = ultraTB.FormattedTB()
561 ipCrashHandler = ultraTB.FormattedTB()
562 else:
562 else:
563 from IPython import CrashHandler
563 from IPython import CrashHandler
564 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
564 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
565 self.set_crash_handler(ipCrashHandler)
565 self.set_crash_handler(ipCrashHandler)
566
566
567 # and add any custom exception handlers the user may have specified
567 # and add any custom exception handlers the user may have specified
568 self.set_custom_exc(*custom_exceptions)
568 self.set_custom_exc(*custom_exceptions)
569
569
570 # indentation management
570 # indentation management
571 self.autoindent = False
571 self.autoindent = False
572 self.indent_current_nsp = 0
572 self.indent_current_nsp = 0
573
573
574 # Make some aliases automatically
574 # Make some aliases automatically
575 # Prepare list of shell aliases to auto-define
575 # Prepare list of shell aliases to auto-define
576 if os.name == 'posix':
576 if os.name == 'posix':
577 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
577 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
578 'mv mv -i','rm rm -i','cp cp -i',
578 'mv mv -i','rm rm -i','cp cp -i',
579 'cat cat','less less','clear clear',
579 'cat cat','less less','clear clear',
580 # a better ls
580 # a better ls
581 'ls ls -F',
581 'ls ls -F',
582 # long ls
582 # long ls
583 'll ls -lF')
583 'll ls -lF')
584 # Extra ls aliases with color, which need special treatment on BSD
584 # Extra ls aliases with color, which need special treatment on BSD
585 # variants
585 # variants
586 ls_extra = ( # color ls
586 ls_extra = ( # color ls
587 'lc ls -F -o --color',
587 'lc ls -F -o --color',
588 # ls normal files only
588 # ls normal files only
589 'lf ls -F -o --color %l | grep ^-',
589 'lf ls -F -o --color %l | grep ^-',
590 # ls symbolic links
590 # ls symbolic links
591 'lk ls -F -o --color %l | grep ^l',
591 'lk ls -F -o --color %l | grep ^l',
592 # directories or links to directories,
592 # directories or links to directories,
593 'ldir ls -F -o --color %l | grep /$',
593 'ldir ls -F -o --color %l | grep /$',
594 # things which are executable
594 # things which are executable
595 'lx ls -F -o --color %l | grep ^-..x',
595 'lx ls -F -o --color %l | grep ^-..x',
596 )
596 )
597 # The BSDs don't ship GNU ls, so they don't understand the
597 # The BSDs don't ship GNU ls, so they don't understand the
598 # --color switch out of the box
598 # --color switch out of the box
599 if 'bsd' in sys.platform:
599 if 'bsd' in sys.platform:
600 ls_extra = ( # ls normal files only
600 ls_extra = ( # ls normal files only
601 'lf ls -lF | grep ^-',
601 'lf ls -lF | grep ^-',
602 # ls symbolic links
602 # ls symbolic links
603 'lk ls -lF | grep ^l',
603 'lk ls -lF | grep ^l',
604 # directories or links to directories,
604 # directories or links to directories,
605 'ldir ls -lF | grep /$',
605 'ldir ls -lF | grep /$',
606 # things which are executable
606 # things which are executable
607 'lx ls -lF | grep ^-..x',
607 'lx ls -lF | grep ^-..x',
608 )
608 )
609 auto_alias = auto_alias + ls_extra
609 auto_alias = auto_alias + ls_extra
610 elif os.name in ['nt','dos']:
610 elif os.name in ['nt','dos']:
611 auto_alias = ('dir dir /on', 'ls dir /on',
611 auto_alias = ('dir dir /on', 'ls dir /on',
612 'ddir dir /ad /on', 'ldir dir /ad /on',
612 'ddir dir /ad /on', 'ldir dir /ad /on',
613 'mkdir mkdir','rmdir rmdir','echo echo',
613 'mkdir mkdir','rmdir rmdir','echo echo',
614 'ren ren','cls cls','copy copy')
614 'ren ren','cls cls','copy copy')
615 else:
615 else:
616 auto_alias = ()
616 auto_alias = ()
617 self.auto_alias = [s.split(None,1) for s in auto_alias]
617 self.auto_alias = [s.split(None,1) for s in auto_alias]
618 # Call the actual (public) initializer
618 # Call the actual (public) initializer
619 self.init_auto_alias()
619 self.init_auto_alias()
620
620
621 # Produce a public API instance
621 # Produce a public API instance
622 self.api = IPython.ipapi.IPApi(self)
622 self.api = IPython.ipapi.IPApi(self)
623
623
624 # track which builtins we add, so we can clean up later
624 # track which builtins we add, so we can clean up later
625 self.builtins_added = {}
625 self.builtins_added = {}
626 # This method will add the necessary builtins for operation, but
626 # This method will add the necessary builtins for operation, but
627 # tracking what it did via the builtins_added dict.
627 # tracking what it did via the builtins_added dict.
628 self.add_builtins()
628 self.add_builtins()
629
629
630 # end __init__
630 # end __init__
631
631
632 def var_expand(self,cmd,depth=0):
632 def var_expand(self,cmd,depth=0):
633 """Expand python variables in a string.
633 """Expand python variables in a string.
634
634
635 The depth argument indicates how many frames above the caller should
635 The depth argument indicates how many frames above the caller should
636 be walked to look for the local namespace where to expand variables.
636 be walked to look for the local namespace where to expand variables.
637
637
638 The global namespace for expansion is always the user's interactive
638 The global namespace for expansion is always the user's interactive
639 namespace.
639 namespace.
640 """
640 """
641
641
642 return str(ItplNS(cmd.replace('#','\#'),
642 return str(ItplNS(cmd.replace('#','\#'),
643 self.user_ns, # globals
643 self.user_ns, # globals
644 # Skip our own frame in searching for locals:
644 # Skip our own frame in searching for locals:
645 sys._getframe(depth+1).f_locals # locals
645 sys._getframe(depth+1).f_locals # locals
646 ))
646 ))
647
647
648 def pre_config_initialization(self):
648 def pre_config_initialization(self):
649 """Pre-configuration init method
649 """Pre-configuration init method
650
650
651 This is called before the configuration files are processed to
651 This is called before the configuration files are processed to
652 prepare the services the config files might need.
652 prepare the services the config files might need.
653
653
654 self.rc already has reasonable default values at this point.
654 self.rc already has reasonable default values at this point.
655 """
655 """
656 rc = self.rc
656 rc = self.rc
657
657
658 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
658 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
659
659
660 def post_config_initialization(self):
660 def post_config_initialization(self):
661 """Post configuration init method
661 """Post configuration init method
662
662
663 This is called after the configuration files have been processed to
663 This is called after the configuration files have been processed to
664 'finalize' the initialization."""
664 'finalize' the initialization."""
665
665
666 rc = self.rc
666 rc = self.rc
667
667
668 # Object inspector
668 # Object inspector
669 self.inspector = OInspect.Inspector(OInspect.InspectColors,
669 self.inspector = OInspect.Inspector(OInspect.InspectColors,
670 PyColorize.ANSICodeColors,
670 PyColorize.ANSICodeColors,
671 'NoColor',
671 'NoColor',
672 rc.object_info_string_level)
672 rc.object_info_string_level)
673
673
674 # Load readline proper
674 # Load readline proper
675 if rc.readline:
675 if rc.readline:
676 self.init_readline()
676 self.init_readline()
677
677
678 # local shortcut, this is used a LOT
678 # local shortcut, this is used a LOT
679 self.log = self.logger.log
679 self.log = self.logger.log
680
680
681 # Initialize cache, set in/out prompts and printing system
681 # Initialize cache, set in/out prompts and printing system
682 self.outputcache = CachedOutput(self,
682 self.outputcache = CachedOutput(self,
683 rc.cache_size,
683 rc.cache_size,
684 rc.pprint,
684 rc.pprint,
685 input_sep = rc.separate_in,
685 input_sep = rc.separate_in,
686 output_sep = rc.separate_out,
686 output_sep = rc.separate_out,
687 output_sep2 = rc.separate_out2,
687 output_sep2 = rc.separate_out2,
688 ps1 = rc.prompt_in1,
688 ps1 = rc.prompt_in1,
689 ps2 = rc.prompt_in2,
689 ps2 = rc.prompt_in2,
690 ps_out = rc.prompt_out,
690 ps_out = rc.prompt_out,
691 pad_left = rc.prompts_pad_left)
691 pad_left = rc.prompts_pad_left)
692
692
693 # user may have over-ridden the default print hook:
693 # user may have over-ridden the default print hook:
694 try:
694 try:
695 self.outputcache.__class__.display = self.hooks.display
695 self.outputcache.__class__.display = self.hooks.display
696 except AttributeError:
696 except AttributeError:
697 pass
697 pass
698
698
699 # I don't like assigning globally to sys, because it means when
699 # I don't like assigning globally to sys, because it means when
700 # embedding instances, each embedded instance overrides the previous
700 # embedding instances, each embedded instance overrides the previous
701 # choice. But sys.displayhook seems to be called internally by exec,
701 # choice. But sys.displayhook seems to be called internally by exec,
702 # so I don't see a way around it. We first save the original and then
702 # so I don't see a way around it. We first save the original and then
703 # overwrite it.
703 # overwrite it.
704 self.sys_displayhook = sys.displayhook
704 self.sys_displayhook = sys.displayhook
705 sys.displayhook = self.outputcache
705 sys.displayhook = self.outputcache
706
706
707 # Set user colors (don't do it in the constructor above so that it
707 # Set user colors (don't do it in the constructor above so that it
708 # doesn't crash if colors option is invalid)
708 # doesn't crash if colors option is invalid)
709 self.magic_colors(rc.colors)
709 self.magic_colors(rc.colors)
710
710
711 # Set calling of pdb on exceptions
711 # Set calling of pdb on exceptions
712 self.call_pdb = rc.pdb
712 self.call_pdb = rc.pdb
713
713
714 # Load user aliases
714 # Load user aliases
715 for alias in rc.alias:
715 for alias in rc.alias:
716 self.magic_alias(alias)
716 self.magic_alias(alias)
717 self.hooks.late_startup_hook()
717 self.hooks.late_startup_hook()
718
718
719 batchrun = False
719 batchrun = False
720 for batchfile in [path(arg) for arg in self.rc.args
720 for batchfile in [path(arg) for arg in self.rc.args
721 if arg.lower().endswith('.ipy')]:
721 if arg.lower().endswith('.ipy')]:
722 if not batchfile.isfile():
722 if not batchfile.isfile():
723 print "No such batch file:", batchfile
723 print "No such batch file:", batchfile
724 continue
724 continue
725 self.api.runlines(batchfile.text())
725 self.api.runlines(batchfile.text())
726 batchrun = True
726 batchrun = True
727 if batchrun:
727 if batchrun:
728 self.exit_now = True
728 self.exit_now = True
729
729
730 def add_builtins(self):
730 def add_builtins(self):
731 """Store ipython references into the builtin namespace.
731 """Store ipython references into the builtin namespace.
732
732
733 Some parts of ipython operate via builtins injected here, which hold a
733 Some parts of ipython operate via builtins injected here, which hold a
734 reference to IPython itself."""
734 reference to IPython itself."""
735
735
736 # TODO: deprecate all except _ip; 'jobs' should be installed
736 # TODO: deprecate all except _ip; 'jobs' should be installed
737 # by an extension and the rest are under _ip, ipalias is redundant
737 # by an extension and the rest are under _ip, ipalias is redundant
738 builtins_new = dict(__IPYTHON__ = self,
738 builtins_new = dict(__IPYTHON__ = self,
739 ip_set_hook = self.set_hook,
739 ip_set_hook = self.set_hook,
740 jobs = self.jobs,
740 jobs = self.jobs,
741 ipmagic = wrap_deprecated(self.ipmagic,'_ip.magic()'),
741 ipmagic = wrap_deprecated(self.ipmagic,'_ip.magic()'),
742 ipalias = wrap_deprecated(self.ipalias),
742 ipalias = wrap_deprecated(self.ipalias),
743 ipsystem = wrap_deprecated(self.ipsystem,'_ip.system()'),
743 ipsystem = wrap_deprecated(self.ipsystem,'_ip.system()'),
744 _ip = self.api
744 _ip = self.api
745 )
745 )
746 for biname,bival in builtins_new.items():
746 for biname,bival in builtins_new.items():
747 try:
747 try:
748 # store the orignal value so we can restore it
748 # store the orignal value so we can restore it
749 self.builtins_added[biname] = __builtin__.__dict__[biname]
749 self.builtins_added[biname] = __builtin__.__dict__[biname]
750 except KeyError:
750 except KeyError:
751 # or mark that it wasn't defined, and we'll just delete it at
751 # or mark that it wasn't defined, and we'll just delete it at
752 # cleanup
752 # cleanup
753 self.builtins_added[biname] = Undefined
753 self.builtins_added[biname] = Undefined
754 __builtin__.__dict__[biname] = bival
754 __builtin__.__dict__[biname] = bival
755
755
756 # Keep in the builtins a flag for when IPython is active. We set it
756 # Keep in the builtins a flag for when IPython is active. We set it
757 # with setdefault so that multiple nested IPythons don't clobber one
757 # with setdefault so that multiple nested IPythons don't clobber one
758 # another. Each will increase its value by one upon being activated,
758 # another. Each will increase its value by one upon being activated,
759 # which also gives us a way to determine the nesting level.
759 # which also gives us a way to determine the nesting level.
760 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
760 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
761
761
762 def clean_builtins(self):
762 def clean_builtins(self):
763 """Remove any builtins which might have been added by add_builtins, or
763 """Remove any builtins which might have been added by add_builtins, or
764 restore overwritten ones to their previous values."""
764 restore overwritten ones to their previous values."""
765 for biname,bival in self.builtins_added.items():
765 for biname,bival in self.builtins_added.items():
766 if bival is Undefined:
766 if bival is Undefined:
767 del __builtin__.__dict__[biname]
767 del __builtin__.__dict__[biname]
768 else:
768 else:
769 __builtin__.__dict__[biname] = bival
769 __builtin__.__dict__[biname] = bival
770 self.builtins_added.clear()
770 self.builtins_added.clear()
771
771
772 def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
772 def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
773 """set_hook(name,hook) -> sets an internal IPython hook.
773 """set_hook(name,hook) -> sets an internal IPython hook.
774
774
775 IPython exposes some of its internal API as user-modifiable hooks. By
775 IPython exposes some of its internal API as user-modifiable hooks. By
776 adding your function to one of these hooks, you can modify IPython's
776 adding your function to one of these hooks, you can modify IPython's
777 behavior to call at runtime your own routines."""
777 behavior to call at runtime your own routines."""
778
778
779 # At some point in the future, this should validate the hook before it
779 # At some point in the future, this should validate the hook before it
780 # accepts it. Probably at least check that the hook takes the number
780 # accepts it. Probably at least check that the hook takes the number
781 # of args it's supposed to.
781 # of args it's supposed to.
782
782
783 f = new.instancemethod(hook,self,self.__class__)
783 f = new.instancemethod(hook,self,self.__class__)
784
784
785 # check if the hook is for strdispatcher first
785 # check if the hook is for strdispatcher first
786 if str_key is not None:
786 if str_key is not None:
787 sdp = self.strdispatchers.get(name, StrDispatch())
787 sdp = self.strdispatchers.get(name, StrDispatch())
788 sdp.add_s(str_key, f, priority )
788 sdp.add_s(str_key, f, priority )
789 self.strdispatchers[name] = sdp
789 self.strdispatchers[name] = sdp
790 return
790 return
791 if re_key is not None:
791 if re_key is not None:
792 sdp = self.strdispatchers.get(name, StrDispatch())
792 sdp = self.strdispatchers.get(name, StrDispatch())
793 sdp.add_re(re.compile(re_key), f, priority )
793 sdp.add_re(re.compile(re_key), f, priority )
794 self.strdispatchers[name] = sdp
794 self.strdispatchers[name] = sdp
795 return
795 return
796
796
797 dp = getattr(self.hooks, name, None)
797 dp = getattr(self.hooks, name, None)
798 if name not in IPython.hooks.__all__:
798 if name not in IPython.hooks.__all__:
799 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
799 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
800 if not dp:
800 if not dp:
801 dp = IPython.hooks.CommandChainDispatcher()
801 dp = IPython.hooks.CommandChainDispatcher()
802
802
803 try:
803 try:
804 dp.add(f,priority)
804 dp.add(f,priority)
805 except AttributeError:
805 except AttributeError:
806 # it was not commandchain, plain old func - replace
806 # it was not commandchain, plain old func - replace
807 dp = f
807 dp = f
808
808
809 setattr(self.hooks,name, dp)
809 setattr(self.hooks,name, dp)
810
810
811
811
812 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
812 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
813
813
814 def set_crash_handler(self,crashHandler):
814 def set_crash_handler(self,crashHandler):
815 """Set the IPython crash handler.
815 """Set the IPython crash handler.
816
816
817 This must be a callable with a signature suitable for use as
817 This must be a callable with a signature suitable for use as
818 sys.excepthook."""
818 sys.excepthook."""
819
819
820 # Install the given crash handler as the Python exception hook
820 # Install the given crash handler as the Python exception hook
821 sys.excepthook = crashHandler
821 sys.excepthook = crashHandler
822
822
823 # The instance will store a pointer to this, so that runtime code
823 # The instance will store a pointer to this, so that runtime code
824 # (such as magics) can access it. This is because during the
824 # (such as magics) can access it. This is because during the
825 # read-eval loop, it gets temporarily overwritten (to deal with GUI
825 # read-eval loop, it gets temporarily overwritten (to deal with GUI
826 # frameworks).
826 # frameworks).
827 self.sys_excepthook = sys.excepthook
827 self.sys_excepthook = sys.excepthook
828
828
829
829
830 def set_custom_exc(self,exc_tuple,handler):
830 def set_custom_exc(self,exc_tuple,handler):
831 """set_custom_exc(exc_tuple,handler)
831 """set_custom_exc(exc_tuple,handler)
832
832
833 Set a custom exception handler, which will be called if any of the
833 Set a custom exception handler, which will be called if any of the
834 exceptions in exc_tuple occur in the mainloop (specifically, in the
834 exceptions in exc_tuple occur in the mainloop (specifically, in the
835 runcode() method.
835 runcode() method.
836
836
837 Inputs:
837 Inputs:
838
838
839 - exc_tuple: a *tuple* of valid exceptions to call the defined
839 - exc_tuple: a *tuple* of valid exceptions to call the defined
840 handler for. It is very important that you use a tuple, and NOT A
840 handler for. It is very important that you use a tuple, and NOT A
841 LIST here, because of the way Python's except statement works. If
841 LIST here, because of the way Python's except statement works. If
842 you only want to trap a single exception, use a singleton tuple:
842 you only want to trap a single exception, use a singleton tuple:
843
843
844 exc_tuple == (MyCustomException,)
844 exc_tuple == (MyCustomException,)
845
845
846 - handler: this must be defined as a function with the following
846 - handler: this must be defined as a function with the following
847 basic interface: def my_handler(self,etype,value,tb).
847 basic interface: def my_handler(self,etype,value,tb).
848
848
849 This will be made into an instance method (via new.instancemethod)
849 This will be made into an instance method (via new.instancemethod)
850 of IPython itself, and it will be called if any of the exceptions
850 of IPython itself, and it will be called if any of the exceptions
851 listed in the exc_tuple are caught. If the handler is None, an
851 listed in the exc_tuple are caught. If the handler is None, an
852 internal basic one is used, which just prints basic info.
852 internal basic one is used, which just prints basic info.
853
853
854 WARNING: by putting in your own exception handler into IPython's main
854 WARNING: by putting in your own exception handler into IPython's main
855 execution loop, you run a very good chance of nasty crashes. This
855 execution loop, you run a very good chance of nasty crashes. This
856 facility should only be used if you really know what you are doing."""
856 facility should only be used if you really know what you are doing."""
857
857
858 assert type(exc_tuple)==type(()) , \
858 assert type(exc_tuple)==type(()) , \
859 "The custom exceptions must be given AS A TUPLE."
859 "The custom exceptions must be given AS A TUPLE."
860
860
861 def dummy_handler(self,etype,value,tb):
861 def dummy_handler(self,etype,value,tb):
862 print '*** Simple custom exception handler ***'
862 print '*** Simple custom exception handler ***'
863 print 'Exception type :',etype
863 print 'Exception type :',etype
864 print 'Exception value:',value
864 print 'Exception value:',value
865 print 'Traceback :',tb
865 print 'Traceback :',tb
866 print 'Source code :','\n'.join(self.buffer)
866 print 'Source code :','\n'.join(self.buffer)
867
867
868 if handler is None: handler = dummy_handler
868 if handler is None: handler = dummy_handler
869
869
870 self.CustomTB = new.instancemethod(handler,self,self.__class__)
870 self.CustomTB = new.instancemethod(handler,self,self.__class__)
871 self.custom_exceptions = exc_tuple
871 self.custom_exceptions = exc_tuple
872
872
873 def set_custom_completer(self,completer,pos=0):
873 def set_custom_completer(self,completer,pos=0):
874 """set_custom_completer(completer,pos=0)
874 """set_custom_completer(completer,pos=0)
875
875
876 Adds a new custom completer function.
876 Adds a new custom completer function.
877
877
878 The position argument (defaults to 0) is the index in the completers
878 The position argument (defaults to 0) is the index in the completers
879 list where you want the completer to be inserted."""
879 list where you want the completer to be inserted."""
880
880
881 newcomp = new.instancemethod(completer,self.Completer,
881 newcomp = new.instancemethod(completer,self.Completer,
882 self.Completer.__class__)
882 self.Completer.__class__)
883 self.Completer.matchers.insert(pos,newcomp)
883 self.Completer.matchers.insert(pos,newcomp)
884
884
885 def _get_call_pdb(self):
885 def _get_call_pdb(self):
886 return self._call_pdb
886 return self._call_pdb
887
887
888 def _set_call_pdb(self,val):
888 def _set_call_pdb(self,val):
889
889
890 if val not in (0,1,False,True):
890 if val not in (0,1,False,True):
891 raise ValueError,'new call_pdb value must be boolean'
891 raise ValueError,'new call_pdb value must be boolean'
892
892
893 # store value in instance
893 # store value in instance
894 self._call_pdb = val
894 self._call_pdb = val
895
895
896 # notify the actual exception handlers
896 # notify the actual exception handlers
897 self.InteractiveTB.call_pdb = val
897 self.InteractiveTB.call_pdb = val
898 if self.isthreaded:
898 if self.isthreaded:
899 try:
899 try:
900 self.sys_excepthook.call_pdb = val
900 self.sys_excepthook.call_pdb = val
901 except:
901 except:
902 warn('Failed to activate pdb for threaded exception handler')
902 warn('Failed to activate pdb for threaded exception handler')
903
903
904 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
904 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
905 'Control auto-activation of pdb at exceptions')
905 'Control auto-activation of pdb at exceptions')
906
906
907
907
908 # These special functions get installed in the builtin namespace, to
908 # These special functions get installed in the builtin namespace, to
909 # provide programmatic (pure python) access to magics, aliases and system
909 # provide programmatic (pure python) access to magics, aliases and system
910 # calls. This is important for logging, user scripting, and more.
910 # calls. This is important for logging, user scripting, and more.
911
911
912 # We are basically exposing, via normal python functions, the three
912 # We are basically exposing, via normal python functions, the three
913 # mechanisms in which ipython offers special call modes (magics for
913 # mechanisms in which ipython offers special call modes (magics for
914 # internal control, aliases for direct system access via pre-selected
914 # internal control, aliases for direct system access via pre-selected
915 # names, and !cmd for calling arbitrary system commands).
915 # names, and !cmd for calling arbitrary system commands).
916
916
917 def ipmagic(self,arg_s):
917 def ipmagic(self,arg_s):
918 """Call a magic function by name.
918 """Call a magic function by name.
919
919
920 Input: a string containing the name of the magic function to call and any
920 Input: a string containing the name of the magic function to call and any
921 additional arguments to be passed to the magic.
921 additional arguments to be passed to the magic.
922
922
923 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
923 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
924 prompt:
924 prompt:
925
925
926 In[1]: %name -opt foo bar
926 In[1]: %name -opt foo bar
927
927
928 To call a magic without arguments, simply use ipmagic('name').
928 To call a magic without arguments, simply use ipmagic('name').
929
929
930 This provides a proper Python function to call IPython's magics in any
930 This provides a proper Python function to call IPython's magics in any
931 valid Python code you can type at the interpreter, including loops and
931 valid Python code you can type at the interpreter, including loops and
932 compound statements. It is added by IPython to the Python builtin
932 compound statements. It is added by IPython to the Python builtin
933 namespace upon initialization."""
933 namespace upon initialization."""
934
934
935 args = arg_s.split(' ',1)
935 args = arg_s.split(' ',1)
936 magic_name = args[0]
936 magic_name = args[0]
937 magic_name = magic_name.lstrip(self.ESC_MAGIC)
937 magic_name = magic_name.lstrip(self.ESC_MAGIC)
938
938
939 try:
939 try:
940 magic_args = args[1]
940 magic_args = args[1]
941 except IndexError:
941 except IndexError:
942 magic_args = ''
942 magic_args = ''
943 fn = getattr(self,'magic_'+magic_name,None)
943 fn = getattr(self,'magic_'+magic_name,None)
944 if fn is None:
944 if fn is None:
945 error("Magic function `%s` not found." % magic_name)
945 error("Magic function `%s` not found." % magic_name)
946 else:
946 else:
947 magic_args = self.var_expand(magic_args,1)
947 magic_args = self.var_expand(magic_args,1)
948 return fn(magic_args)
948 return fn(magic_args)
949
949
950 def ipalias(self,arg_s):
950 def ipalias(self,arg_s):
951 """Call an alias by name.
951 """Call an alias by name.
952
952
953 Input: a string containing the name of the alias to call and any
953 Input: a string containing the name of the alias to call and any
954 additional arguments to be passed to the magic.
954 additional arguments to be passed to the magic.
955
955
956 ipalias('name -opt foo bar') is equivalent to typing at the ipython
956 ipalias('name -opt foo bar') is equivalent to typing at the ipython
957 prompt:
957 prompt:
958
958
959 In[1]: name -opt foo bar
959 In[1]: name -opt foo bar
960
960
961 To call an alias without arguments, simply use ipalias('name').
961 To call an alias without arguments, simply use ipalias('name').
962
962
963 This provides a proper Python function to call IPython's aliases in any
963 This provides a proper Python function to call IPython's aliases in any
964 valid Python code you can type at the interpreter, including loops and
964 valid Python code you can type at the interpreter, including loops and
965 compound statements. It is added by IPython to the Python builtin
965 compound statements. It is added by IPython to the Python builtin
966 namespace upon initialization."""
966 namespace upon initialization."""
967
967
968 args = arg_s.split(' ',1)
968 args = arg_s.split(' ',1)
969 alias_name = args[0]
969 alias_name = args[0]
970 try:
970 try:
971 alias_args = args[1]
971 alias_args = args[1]
972 except IndexError:
972 except IndexError:
973 alias_args = ''
973 alias_args = ''
974 if alias_name in self.alias_table:
974 if alias_name in self.alias_table:
975 self.call_alias(alias_name,alias_args)
975 self.call_alias(alias_name,alias_args)
976 else:
976 else:
977 error("Alias `%s` not found." % alias_name)
977 error("Alias `%s` not found." % alias_name)
978
978
979 def ipsystem(self,arg_s):
979 def ipsystem(self,arg_s):
980 """Make a system call, using IPython."""
980 """Make a system call, using IPython."""
981
981
982 self.system(arg_s)
982 self.system(arg_s)
983
983
984 def complete(self,text):
984 def complete(self,text):
985 """Return a sorted list of all possible completions on text.
985 """Return a sorted list of all possible completions on text.
986
986
987 Inputs:
987 Inputs:
988
988
989 - text: a string of text to be completed on.
989 - text: a string of text to be completed on.
990
990
991 This is a wrapper around the completion mechanism, similar to what
991 This is a wrapper around the completion mechanism, similar to what
992 readline does at the command line when the TAB key is hit. By
992 readline does at the command line when the TAB key is hit. By
993 exposing it as a method, it can be used by other non-readline
993 exposing it as a method, it can be used by other non-readline
994 environments (such as GUIs) for text completion.
994 environments (such as GUIs) for text completion.
995
995
996 Simple usage example:
996 Simple usage example:
997
997
998 In [1]: x = 'hello'
998 In [1]: x = 'hello'
999
999
1000 In [2]: __IP.complete('x.l')
1000 In [2]: __IP.complete('x.l')
1001 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
1001 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
1002
1002
1003 complete = self.Completer.complete
1003 complete = self.Completer.complete
1004 state = 0
1004 state = 0
1005 # use a dict so we get unique keys, since ipyhton's multiple
1005 # use a dict so we get unique keys, since ipyhton's multiple
1006 # completers can return duplicates.
1006 # completers can return duplicates. When we make 2.4 a requirement,
1007 # start using sets instead, which are faster.
1007 comps = {}
1008 comps = {}
1008 while True:
1009 while True:
1009 newcomp = complete(text,state)
1010 newcomp = complete(text,state,line_buffer=text)
1010 if newcomp is None:
1011 if newcomp is None:
1011 break
1012 break
1012 comps[newcomp] = 1
1013 comps[newcomp] = 1
1013 state += 1
1014 state += 1
1014 outcomps = comps.keys()
1015 outcomps = comps.keys()
1015 outcomps.sort()
1016 outcomps.sort()
1016 return outcomps
1017 return outcomps
1017
1018
1018 def set_completer_frame(self, frame=None):
1019 def set_completer_frame(self, frame=None):
1019 if frame:
1020 if frame:
1020 self.Completer.namespace = frame.f_locals
1021 self.Completer.namespace = frame.f_locals
1021 self.Completer.global_namespace = frame.f_globals
1022 self.Completer.global_namespace = frame.f_globals
1022 else:
1023 else:
1023 self.Completer.namespace = self.user_ns
1024 self.Completer.namespace = self.user_ns
1024 self.Completer.global_namespace = self.user_global_ns
1025 self.Completer.global_namespace = self.user_global_ns
1025
1026
1026 def init_auto_alias(self):
1027 def init_auto_alias(self):
1027 """Define some aliases automatically.
1028 """Define some aliases automatically.
1028
1029
1029 These are ALL parameter-less aliases"""
1030 These are ALL parameter-less aliases"""
1030
1031
1031 for alias,cmd in self.auto_alias:
1032 for alias,cmd in self.auto_alias:
1032 self.alias_table[alias] = (0,cmd)
1033 self.alias_table[alias] = (0,cmd)
1033
1034
1034 def alias_table_validate(self,verbose=0):
1035 def alias_table_validate(self,verbose=0):
1035 """Update information about the alias table.
1036 """Update information about the alias table.
1036
1037
1037 In particular, make sure no Python keywords/builtins are in it."""
1038 In particular, make sure no Python keywords/builtins are in it."""
1038
1039
1039 no_alias = self.no_alias
1040 no_alias = self.no_alias
1040 for k in self.alias_table.keys():
1041 for k in self.alias_table.keys():
1041 if k in no_alias:
1042 if k in no_alias:
1042 del self.alias_table[k]
1043 del self.alias_table[k]
1043 if verbose:
1044 if verbose:
1044 print ("Deleting alias <%s>, it's a Python "
1045 print ("Deleting alias <%s>, it's a Python "
1045 "keyword or builtin." % k)
1046 "keyword or builtin." % k)
1046
1047
1047 def set_autoindent(self,value=None):
1048 def set_autoindent(self,value=None):
1048 """Set the autoindent flag, checking for readline support.
1049 """Set the autoindent flag, checking for readline support.
1049
1050
1050 If called with no arguments, it acts as a toggle."""
1051 If called with no arguments, it acts as a toggle."""
1051
1052
1052 if not self.has_readline:
1053 if not self.has_readline:
1053 if os.name == 'posix':
1054 if os.name == 'posix':
1054 warn("The auto-indent feature requires the readline library")
1055 warn("The auto-indent feature requires the readline library")
1055 self.autoindent = 0
1056 self.autoindent = 0
1056 return
1057 return
1057 if value is None:
1058 if value is None:
1058 self.autoindent = not self.autoindent
1059 self.autoindent = not self.autoindent
1059 else:
1060 else:
1060 self.autoindent = value
1061 self.autoindent = value
1061
1062
1062 def rc_set_toggle(self,rc_field,value=None):
1063 def rc_set_toggle(self,rc_field,value=None):
1063 """Set or toggle a field in IPython's rc config. structure.
1064 """Set or toggle a field in IPython's rc config. structure.
1064
1065
1065 If called with no arguments, it acts as a toggle.
1066 If called with no arguments, it acts as a toggle.
1066
1067
1067 If called with a non-existent field, the resulting AttributeError
1068 If called with a non-existent field, the resulting AttributeError
1068 exception will propagate out."""
1069 exception will propagate out."""
1069
1070
1070 rc_val = getattr(self.rc,rc_field)
1071 rc_val = getattr(self.rc,rc_field)
1071 if value is None:
1072 if value is None:
1072 value = not rc_val
1073 value = not rc_val
1073 setattr(self.rc,rc_field,value)
1074 setattr(self.rc,rc_field,value)
1074
1075
1075 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1076 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1076 """Install the user configuration directory.
1077 """Install the user configuration directory.
1077
1078
1078 Can be called when running for the first time or to upgrade the user's
1079 Can be called when running for the first time or to upgrade the user's
1079 .ipython/ directory with the mode parameter. Valid modes are 'install'
1080 .ipython/ directory with the mode parameter. Valid modes are 'install'
1080 and 'upgrade'."""
1081 and 'upgrade'."""
1081
1082
1082 def wait():
1083 def wait():
1083 try:
1084 try:
1084 raw_input("Please press <RETURN> to start IPython.")
1085 raw_input("Please press <RETURN> to start IPython.")
1085 except EOFError:
1086 except EOFError:
1086 print >> Term.cout
1087 print >> Term.cout
1087 print '*'*70
1088 print '*'*70
1088
1089
1089 cwd = os.getcwd() # remember where we started
1090 cwd = os.getcwd() # remember where we started
1090 glb = glob.glob
1091 glb = glob.glob
1091 print '*'*70
1092 print '*'*70
1092 if mode == 'install':
1093 if mode == 'install':
1093 print \
1094 print \
1094 """Welcome to IPython. I will try to create a personal configuration directory
1095 """Welcome to IPython. I will try to create a personal configuration directory
1095 where you can customize many aspects of IPython's functionality in:\n"""
1096 where you can customize many aspects of IPython's functionality in:\n"""
1096 else:
1097 else:
1097 print 'I am going to upgrade your configuration in:'
1098 print 'I am going to upgrade your configuration in:'
1098
1099
1099 print ipythondir
1100 print ipythondir
1100
1101
1101 rcdirend = os.path.join('IPython','UserConfig')
1102 rcdirend = os.path.join('IPython','UserConfig')
1102 cfg = lambda d: os.path.join(d,rcdirend)
1103 cfg = lambda d: os.path.join(d,rcdirend)
1103 try:
1104 try:
1104 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1105 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1105 except IOError:
1106 except IOError:
1106 warning = """
1107 warning = """
1107 Installation error. IPython's directory was not found.
1108 Installation error. IPython's directory was not found.
1108
1109
1109 Check the following:
1110 Check the following:
1110
1111
1111 The ipython/IPython directory should be in a directory belonging to your
1112 The ipython/IPython directory should be in a directory belonging to your
1112 PYTHONPATH environment variable (that is, it should be in a directory
1113 PYTHONPATH environment variable (that is, it should be in a directory
1113 belonging to sys.path). You can copy it explicitly there or just link to it.
1114 belonging to sys.path). You can copy it explicitly there or just link to it.
1114
1115
1115 IPython will proceed with builtin defaults.
1116 IPython will proceed with builtin defaults.
1116 """
1117 """
1117 warn(warning)
1118 warn(warning)
1118 wait()
1119 wait()
1119 return
1120 return
1120
1121
1121 if mode == 'install':
1122 if mode == 'install':
1122 try:
1123 try:
1123 shutil.copytree(rcdir,ipythondir)
1124 shutil.copytree(rcdir,ipythondir)
1124 os.chdir(ipythondir)
1125 os.chdir(ipythondir)
1125 rc_files = glb("ipythonrc*")
1126 rc_files = glb("ipythonrc*")
1126 for rc_file in rc_files:
1127 for rc_file in rc_files:
1127 os.rename(rc_file,rc_file+rc_suffix)
1128 os.rename(rc_file,rc_file+rc_suffix)
1128 except:
1129 except:
1129 warning = """
1130 warning = """
1130
1131
1131 There was a problem with the installation:
1132 There was a problem with the installation:
1132 %s
1133 %s
1133 Try to correct it or contact the developers if you think it's a bug.
1134 Try to correct it or contact the developers if you think it's a bug.
1134 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1135 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1135 warn(warning)
1136 warn(warning)
1136 wait()
1137 wait()
1137 return
1138 return
1138
1139
1139 elif mode == 'upgrade':
1140 elif mode == 'upgrade':
1140 try:
1141 try:
1141 os.chdir(ipythondir)
1142 os.chdir(ipythondir)
1142 except:
1143 except:
1143 print """
1144 print """
1144 Can not upgrade: changing to directory %s failed. Details:
1145 Can not upgrade: changing to directory %s failed. Details:
1145 %s
1146 %s
1146 """ % (ipythondir,sys.exc_info()[1])
1147 """ % (ipythondir,sys.exc_info()[1])
1147 wait()
1148 wait()
1148 return
1149 return
1149 else:
1150 else:
1150 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1151 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1151 for new_full_path in sources:
1152 for new_full_path in sources:
1152 new_filename = os.path.basename(new_full_path)
1153 new_filename = os.path.basename(new_full_path)
1153 if new_filename.startswith('ipythonrc'):
1154 if new_filename.startswith('ipythonrc'):
1154 new_filename = new_filename + rc_suffix
1155 new_filename = new_filename + rc_suffix
1155 # The config directory should only contain files, skip any
1156 # The config directory should only contain files, skip any
1156 # directories which may be there (like CVS)
1157 # directories which may be there (like CVS)
1157 if os.path.isdir(new_full_path):
1158 if os.path.isdir(new_full_path):
1158 continue
1159 continue
1159 if os.path.exists(new_filename):
1160 if os.path.exists(new_filename):
1160 old_file = new_filename+'.old'
1161 old_file = new_filename+'.old'
1161 if os.path.exists(old_file):
1162 if os.path.exists(old_file):
1162 os.remove(old_file)
1163 os.remove(old_file)
1163 os.rename(new_filename,old_file)
1164 os.rename(new_filename,old_file)
1164 shutil.copy(new_full_path,new_filename)
1165 shutil.copy(new_full_path,new_filename)
1165 else:
1166 else:
1166 raise ValueError,'unrecognized mode for install:',`mode`
1167 raise ValueError,'unrecognized mode for install:',`mode`
1167
1168
1168 # Fix line-endings to those native to each platform in the config
1169 # Fix line-endings to those native to each platform in the config
1169 # directory.
1170 # directory.
1170 try:
1171 try:
1171 os.chdir(ipythondir)
1172 os.chdir(ipythondir)
1172 except:
1173 except:
1173 print """
1174 print """
1174 Problem: changing to directory %s failed.
1175 Problem: changing to directory %s failed.
1175 Details:
1176 Details:
1176 %s
1177 %s
1177
1178
1178 Some configuration files may have incorrect line endings. This should not
1179 Some configuration files may have incorrect line endings. This should not
1179 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1180 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1180 wait()
1181 wait()
1181 else:
1182 else:
1182 for fname in glb('ipythonrc*'):
1183 for fname in glb('ipythonrc*'):
1183 try:
1184 try:
1184 native_line_ends(fname,backup=0)
1185 native_line_ends(fname,backup=0)
1185 except IOError:
1186 except IOError:
1186 pass
1187 pass
1187
1188
1188 if mode == 'install':
1189 if mode == 'install':
1189 print """
1190 print """
1190 Successful installation!
1191 Successful installation!
1191
1192
1192 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1193 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1193 IPython manual (there are both HTML and PDF versions supplied with the
1194 IPython manual (there are both HTML and PDF versions supplied with the
1194 distribution) to make sure that your system environment is properly configured
1195 distribution) to make sure that your system environment is properly configured
1195 to take advantage of IPython's features.
1196 to take advantage of IPython's features.
1196
1197
1197 Important note: the configuration system has changed! The old system is
1198 Important note: the configuration system has changed! The old system is
1198 still in place, but its setting may be partly overridden by the settings in
1199 still in place, but its setting may be partly overridden by the settings in
1199 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1200 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1200 if some of the new settings bother you.
1201 if some of the new settings bother you.
1201
1202
1202 """
1203 """
1203 else:
1204 else:
1204 print """
1205 print """
1205 Successful upgrade!
1206 Successful upgrade!
1206
1207
1207 All files in your directory:
1208 All files in your directory:
1208 %(ipythondir)s
1209 %(ipythondir)s
1209 which would have been overwritten by the upgrade were backed up with a .old
1210 which would have been overwritten by the upgrade were backed up with a .old
1210 extension. If you had made particular customizations in those files you may
1211 extension. If you had made particular customizations in those files you may
1211 want to merge them back into the new files.""" % locals()
1212 want to merge them back into the new files.""" % locals()
1212 wait()
1213 wait()
1213 os.chdir(cwd)
1214 os.chdir(cwd)
1214 # end user_setup()
1215 # end user_setup()
1215
1216
1216 def atexit_operations(self):
1217 def atexit_operations(self):
1217 """This will be executed at the time of exit.
1218 """This will be executed at the time of exit.
1218
1219
1219 Saving of persistent data should be performed here. """
1220 Saving of persistent data should be performed here. """
1220
1221
1221 #print '*** IPython exit cleanup ***' # dbg
1222 #print '*** IPython exit cleanup ***' # dbg
1222 # input history
1223 # input history
1223 self.savehist()
1224 self.savehist()
1224
1225
1225 # Cleanup all tempfiles left around
1226 # Cleanup all tempfiles left around
1226 for tfile in self.tempfiles:
1227 for tfile in self.tempfiles:
1227 try:
1228 try:
1228 os.unlink(tfile)
1229 os.unlink(tfile)
1229 except OSError:
1230 except OSError:
1230 pass
1231 pass
1231
1232
1232 # save the "persistent data" catch-all dictionary
1233 # save the "persistent data" catch-all dictionary
1233 self.hooks.shutdown_hook()
1234 self.hooks.shutdown_hook()
1234
1235
1235 def savehist(self):
1236 def savehist(self):
1236 """Save input history to a file (via readline library)."""
1237 """Save input history to a file (via readline library)."""
1237 try:
1238 try:
1238 self.readline.write_history_file(self.histfile)
1239 self.readline.write_history_file(self.histfile)
1239 except:
1240 except:
1240 print 'Unable to save IPython command history to file: ' + \
1241 print 'Unable to save IPython command history to file: ' + \
1241 `self.histfile`
1242 `self.histfile`
1242
1243
1243 def history_saving_wrapper(self, func):
1244 def history_saving_wrapper(self, func):
1244 """ Wrap func for readline history saving
1245 """ Wrap func for readline history saving
1245
1246
1246 Convert func into callable that saves & restores
1247 Convert func into callable that saves & restores
1247 history around the call """
1248 history around the call """
1248
1249
1249 if not self.has_readline:
1250 if not self.has_readline:
1250 return func
1251 return func
1251
1252
1252 def wrapper():
1253 def wrapper():
1253 self.savehist()
1254 self.savehist()
1254 try:
1255 try:
1255 func()
1256 func()
1256 finally:
1257 finally:
1257 readline.read_history_file(self.histfile)
1258 readline.read_history_file(self.histfile)
1258 return wrapper
1259 return wrapper
1259
1260
1260
1261
1261 def pre_readline(self):
1262 def pre_readline(self):
1262 """readline hook to be used at the start of each line.
1263 """readline hook to be used at the start of each line.
1263
1264
1264 Currently it handles auto-indent only."""
1265 Currently it handles auto-indent only."""
1265
1266
1266 #debugx('self.indent_current_nsp','pre_readline:')
1267 #debugx('self.indent_current_nsp','pre_readline:')
1267 self.readline.insert_text(self.indent_current_str())
1268 self.readline.insert_text(self.indent_current_str())
1268
1269
1269 def init_readline(self):
1270 def init_readline(self):
1270 """Command history completion/saving/reloading."""
1271 """Command history completion/saving/reloading."""
1271
1272
1272 import IPython.rlineimpl as readline
1273 import IPython.rlineimpl as readline
1273 if not readline.have_readline:
1274 if not readline.have_readline:
1274 self.has_readline = 0
1275 self.has_readline = 0
1275 self.readline = None
1276 self.readline = None
1276 # no point in bugging windows users with this every time:
1277 # no point in bugging windows users with this every time:
1277 warn('Readline services not available on this platform.')
1278 warn('Readline services not available on this platform.')
1278 else:
1279 else:
1279 sys.modules['readline'] = readline
1280 sys.modules['readline'] = readline
1280 import atexit
1281 import atexit
1281 from IPython.completer import IPCompleter
1282 from IPython.completer import IPCompleter
1282 self.Completer = IPCompleter(self,
1283 self.Completer = IPCompleter(self,
1283 self.user_ns,
1284 self.user_ns,
1284 self.user_global_ns,
1285 self.user_global_ns,
1285 self.rc.readline_omit__names,
1286 self.rc.readline_omit__names,
1286 self.alias_table)
1287 self.alias_table)
1287 sdisp = self.strdispatchers.get('complete_command', StrDispatch())
1288 sdisp = self.strdispatchers.get('complete_command', StrDispatch())
1288 self.strdispatchers['complete_command'] = sdisp
1289 self.strdispatchers['complete_command'] = sdisp
1289 self.Completer.custom_completers = sdisp
1290 self.Completer.custom_completers = sdisp
1290 # Platform-specific configuration
1291 # Platform-specific configuration
1291 if os.name == 'nt':
1292 if os.name == 'nt':
1292 self.readline_startup_hook = readline.set_pre_input_hook
1293 self.readline_startup_hook = readline.set_pre_input_hook
1293 else:
1294 else:
1294 self.readline_startup_hook = readline.set_startup_hook
1295 self.readline_startup_hook = readline.set_startup_hook
1295
1296
1296 # Load user's initrc file (readline config)
1297 # Load user's initrc file (readline config)
1297 inputrc_name = os.environ.get('INPUTRC')
1298 inputrc_name = os.environ.get('INPUTRC')
1298 if inputrc_name is None:
1299 if inputrc_name is None:
1299 home_dir = get_home_dir()
1300 home_dir = get_home_dir()
1300 if home_dir is not None:
1301 if home_dir is not None:
1301 inputrc_name = os.path.join(home_dir,'.inputrc')
1302 inputrc_name = os.path.join(home_dir,'.inputrc')
1302 if os.path.isfile(inputrc_name):
1303 if os.path.isfile(inputrc_name):
1303 try:
1304 try:
1304 readline.read_init_file(inputrc_name)
1305 readline.read_init_file(inputrc_name)
1305 except:
1306 except:
1306 warn('Problems reading readline initialization file <%s>'
1307 warn('Problems reading readline initialization file <%s>'
1307 % inputrc_name)
1308 % inputrc_name)
1308
1309
1309 self.has_readline = 1
1310 self.has_readline = 1
1310 self.readline = readline
1311 self.readline = readline
1311 # save this in sys so embedded copies can restore it properly
1312 # save this in sys so embedded copies can restore it properly
1312 sys.ipcompleter = self.Completer.complete
1313 sys.ipcompleter = self.Completer.complete
1313 readline.set_completer(self.Completer.complete)
1314 readline.set_completer(self.Completer.complete)
1314
1315
1315 # Configure readline according to user's prefs
1316 # Configure readline according to user's prefs
1316 for rlcommand in self.rc.readline_parse_and_bind:
1317 for rlcommand in self.rc.readline_parse_and_bind:
1317 readline.parse_and_bind(rlcommand)
1318 readline.parse_and_bind(rlcommand)
1318
1319
1319 # remove some chars from the delimiters list
1320 # remove some chars from the delimiters list
1320 delims = readline.get_completer_delims()
1321 delims = readline.get_completer_delims()
1321 delims = delims.translate(string._idmap,
1322 delims = delims.translate(string._idmap,
1322 self.rc.readline_remove_delims)
1323 self.rc.readline_remove_delims)
1323 readline.set_completer_delims(delims)
1324 readline.set_completer_delims(delims)
1324 # otherwise we end up with a monster history after a while:
1325 # otherwise we end up with a monster history after a while:
1325 readline.set_history_length(1000)
1326 readline.set_history_length(1000)
1326 try:
1327 try:
1327 #print '*** Reading readline history' # dbg
1328 #print '*** Reading readline history' # dbg
1328 readline.read_history_file(self.histfile)
1329 readline.read_history_file(self.histfile)
1329 except IOError:
1330 except IOError:
1330 pass # It doesn't exist yet.
1331 pass # It doesn't exist yet.
1331
1332
1332 atexit.register(self.atexit_operations)
1333 atexit.register(self.atexit_operations)
1333 del atexit
1334 del atexit
1334
1335
1335 # Configure auto-indent for all platforms
1336 # Configure auto-indent for all platforms
1336 self.set_autoindent(self.rc.autoindent)
1337 self.set_autoindent(self.rc.autoindent)
1337
1338
1338 def ask_yes_no(self,prompt,default=True):
1339 def ask_yes_no(self,prompt,default=True):
1339 if self.rc.quiet:
1340 if self.rc.quiet:
1340 return True
1341 return True
1341 return ask_yes_no(prompt,default)
1342 return ask_yes_no(prompt,default)
1342
1343
1343 def _should_recompile(self,e):
1344 def _should_recompile(self,e):
1344 """Utility routine for edit_syntax_error"""
1345 """Utility routine for edit_syntax_error"""
1345
1346
1346 if e.filename in ('<ipython console>','<input>','<string>',
1347 if e.filename in ('<ipython console>','<input>','<string>',
1347 '<console>','<BackgroundJob compilation>',
1348 '<console>','<BackgroundJob compilation>',
1348 None):
1349 None):
1349
1350
1350 return False
1351 return False
1351 try:
1352 try:
1352 if (self.rc.autoedit_syntax and
1353 if (self.rc.autoedit_syntax and
1353 not self.ask_yes_no('Return to editor to correct syntax error? '
1354 not self.ask_yes_no('Return to editor to correct syntax error? '
1354 '[Y/n] ','y')):
1355 '[Y/n] ','y')):
1355 return False
1356 return False
1356 except EOFError:
1357 except EOFError:
1357 return False
1358 return False
1358
1359
1359 def int0(x):
1360 def int0(x):
1360 try:
1361 try:
1361 return int(x)
1362 return int(x)
1362 except TypeError:
1363 except TypeError:
1363 return 0
1364 return 0
1364 # always pass integer line and offset values to editor hook
1365 # always pass integer line and offset values to editor hook
1365 self.hooks.fix_error_editor(e.filename,
1366 self.hooks.fix_error_editor(e.filename,
1366 int0(e.lineno),int0(e.offset),e.msg)
1367 int0(e.lineno),int0(e.offset),e.msg)
1367 return True
1368 return True
1368
1369
1369 def edit_syntax_error(self):
1370 def edit_syntax_error(self):
1370 """The bottom half of the syntax error handler called in the main loop.
1371 """The bottom half of the syntax error handler called in the main loop.
1371
1372
1372 Loop until syntax error is fixed or user cancels.
1373 Loop until syntax error is fixed or user cancels.
1373 """
1374 """
1374
1375
1375 while self.SyntaxTB.last_syntax_error:
1376 while self.SyntaxTB.last_syntax_error:
1376 # copy and clear last_syntax_error
1377 # copy and clear last_syntax_error
1377 err = self.SyntaxTB.clear_err_state()
1378 err = self.SyntaxTB.clear_err_state()
1378 if not self._should_recompile(err):
1379 if not self._should_recompile(err):
1379 return
1380 return
1380 try:
1381 try:
1381 # may set last_syntax_error again if a SyntaxError is raised
1382 # may set last_syntax_error again if a SyntaxError is raised
1382 self.safe_execfile(err.filename,self.user_ns)
1383 self.safe_execfile(err.filename,self.user_ns)
1383 except:
1384 except:
1384 self.showtraceback()
1385 self.showtraceback()
1385 else:
1386 else:
1386 try:
1387 try:
1387 f = file(err.filename)
1388 f = file(err.filename)
1388 try:
1389 try:
1389 sys.displayhook(f.read())
1390 sys.displayhook(f.read())
1390 finally:
1391 finally:
1391 f.close()
1392 f.close()
1392 except:
1393 except:
1393 self.showtraceback()
1394 self.showtraceback()
1394
1395
1395 def showsyntaxerror(self, filename=None):
1396 def showsyntaxerror(self, filename=None):
1396 """Display the syntax error that just occurred.
1397 """Display the syntax error that just occurred.
1397
1398
1398 This doesn't display a stack trace because there isn't one.
1399 This doesn't display a stack trace because there isn't one.
1399
1400
1400 If a filename is given, it is stuffed in the exception instead
1401 If a filename is given, it is stuffed in the exception instead
1401 of what was there before (because Python's parser always uses
1402 of what was there before (because Python's parser always uses
1402 "<string>" when reading from a string).
1403 "<string>" when reading from a string).
1403 """
1404 """
1404 etype, value, last_traceback = sys.exc_info()
1405 etype, value, last_traceback = sys.exc_info()
1405
1406
1406 # See note about these variables in showtraceback() below
1407 # See note about these variables in showtraceback() below
1407 sys.last_type = etype
1408 sys.last_type = etype
1408 sys.last_value = value
1409 sys.last_value = value
1409 sys.last_traceback = last_traceback
1410 sys.last_traceback = last_traceback
1410
1411
1411 if filename and etype is SyntaxError:
1412 if filename and etype is SyntaxError:
1412 # Work hard to stuff the correct filename in the exception
1413 # Work hard to stuff the correct filename in the exception
1413 try:
1414 try:
1414 msg, (dummy_filename, lineno, offset, line) = value
1415 msg, (dummy_filename, lineno, offset, line) = value
1415 except:
1416 except:
1416 # Not the format we expect; leave it alone
1417 # Not the format we expect; leave it alone
1417 pass
1418 pass
1418 else:
1419 else:
1419 # Stuff in the right filename
1420 # Stuff in the right filename
1420 try:
1421 try:
1421 # Assume SyntaxError is a class exception
1422 # Assume SyntaxError is a class exception
1422 value = SyntaxError(msg, (filename, lineno, offset, line))
1423 value = SyntaxError(msg, (filename, lineno, offset, line))
1423 except:
1424 except:
1424 # If that failed, assume SyntaxError is a string
1425 # If that failed, assume SyntaxError is a string
1425 value = msg, (filename, lineno, offset, line)
1426 value = msg, (filename, lineno, offset, line)
1426 self.SyntaxTB(etype,value,[])
1427 self.SyntaxTB(etype,value,[])
1427
1428
1428 def debugger(self,force=False):
1429 def debugger(self,force=False):
1429 """Call the pydb/pdb debugger.
1430 """Call the pydb/pdb debugger.
1430
1431
1431 Keywords:
1432 Keywords:
1432
1433
1433 - force(False): by default, this routine checks the instance call_pdb
1434 - force(False): by default, this routine checks the instance call_pdb
1434 flag and does not actually invoke the debugger if the flag is false.
1435 flag and does not actually invoke the debugger if the flag is false.
1435 The 'force' option forces the debugger to activate even if the flag
1436 The 'force' option forces the debugger to activate even if the flag
1436 is false.
1437 is false.
1437 """
1438 """
1438
1439
1439 if not (force or self.call_pdb):
1440 if not (force or self.call_pdb):
1440 return
1441 return
1441
1442
1442 if not hasattr(sys,'last_traceback'):
1443 if not hasattr(sys,'last_traceback'):
1443 error('No traceback has been produced, nothing to debug.')
1444 error('No traceback has been produced, nothing to debug.')
1444 return
1445 return
1445
1446
1446 have_pydb = False
1447 have_pydb = False
1447 # use pydb if available
1448 # use pydb if available
1448 try:
1449 try:
1449 from pydb import pm
1450 from pydb import pm
1450 have_pydb = True
1451 have_pydb = True
1451 except ImportError:
1452 except ImportError:
1452 pass
1453 pass
1453 if not have_pydb:
1454 if not have_pydb:
1454 # fallback to our internal debugger
1455 # fallback to our internal debugger
1455 pm = lambda : self.InteractiveTB.debugger(force=True)
1456 pm = lambda : self.InteractiveTB.debugger(force=True)
1456 self.history_saving_wrapper(pm)()
1457 self.history_saving_wrapper(pm)()
1457
1458
1458 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1459 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1459 """Display the exception that just occurred.
1460 """Display the exception that just occurred.
1460
1461
1461 If nothing is known about the exception, this is the method which
1462 If nothing is known about the exception, this is the method which
1462 should be used throughout the code for presenting user tracebacks,
1463 should be used throughout the code for presenting user tracebacks,
1463 rather than directly invoking the InteractiveTB object.
1464 rather than directly invoking the InteractiveTB object.
1464
1465
1465 A specific showsyntaxerror() also exists, but this method can take
1466 A specific showsyntaxerror() also exists, but this method can take
1466 care of calling it if needed, so unless you are explicitly catching a
1467 care of calling it if needed, so unless you are explicitly catching a
1467 SyntaxError exception, don't try to analyze the stack manually and
1468 SyntaxError exception, don't try to analyze the stack manually and
1468 simply call this method."""
1469 simply call this method."""
1469
1470
1470 # Though this won't be called by syntax errors in the input line,
1471 # Though this won't be called by syntax errors in the input line,
1471 # there may be SyntaxError cases whith imported code.
1472 # there may be SyntaxError cases whith imported code.
1472 if exc_tuple is None:
1473 if exc_tuple is None:
1473 etype, value, tb = sys.exc_info()
1474 etype, value, tb = sys.exc_info()
1474 else:
1475 else:
1475 etype, value, tb = exc_tuple
1476 etype, value, tb = exc_tuple
1476
1477
1477 if etype is SyntaxError:
1478 if etype is SyntaxError:
1478 self.showsyntaxerror(filename)
1479 self.showsyntaxerror(filename)
1479 else:
1480 else:
1480 # WARNING: these variables are somewhat deprecated and not
1481 # WARNING: these variables are somewhat deprecated and not
1481 # necessarily safe to use in a threaded environment, but tools
1482 # necessarily safe to use in a threaded environment, but tools
1482 # like pdb depend on their existence, so let's set them. If we
1483 # like pdb depend on their existence, so let's set them. If we
1483 # find problems in the field, we'll need to revisit their use.
1484 # find problems in the field, we'll need to revisit their use.
1484 sys.last_type = etype
1485 sys.last_type = etype
1485 sys.last_value = value
1486 sys.last_value = value
1486 sys.last_traceback = tb
1487 sys.last_traceback = tb
1487
1488
1488 if etype in self.custom_exceptions:
1489 if etype in self.custom_exceptions:
1489 self.CustomTB(etype,value,tb)
1490 self.CustomTB(etype,value,tb)
1490 else:
1491 else:
1491 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1492 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1492 if self.InteractiveTB.call_pdb and self.has_readline:
1493 if self.InteractiveTB.call_pdb and self.has_readline:
1493 # pdb mucks up readline, fix it back
1494 # pdb mucks up readline, fix it back
1494 self.readline.set_completer(self.Completer.complete)
1495 self.readline.set_completer(self.Completer.complete)
1495
1496
1496 def mainloop(self,banner=None):
1497 def mainloop(self,banner=None):
1497 """Creates the local namespace and starts the mainloop.
1498 """Creates the local namespace and starts the mainloop.
1498
1499
1499 If an optional banner argument is given, it will override the
1500 If an optional banner argument is given, it will override the
1500 internally created default banner."""
1501 internally created default banner."""
1501
1502
1502 if self.rc.c: # Emulate Python's -c option
1503 if self.rc.c: # Emulate Python's -c option
1503 self.exec_init_cmd()
1504 self.exec_init_cmd()
1504 if banner is None:
1505 if banner is None:
1505 if not self.rc.banner:
1506 if not self.rc.banner:
1506 banner = ''
1507 banner = ''
1507 # banner is string? Use it directly!
1508 # banner is string? Use it directly!
1508 elif isinstance(self.rc.banner,basestring):
1509 elif isinstance(self.rc.banner,basestring):
1509 banner = self.rc.banner
1510 banner = self.rc.banner
1510 else:
1511 else:
1511 banner = self.BANNER+self.banner2
1512 banner = self.BANNER+self.banner2
1512
1513
1513 self.interact(banner)
1514 self.interact(banner)
1514
1515
1515 def exec_init_cmd(self):
1516 def exec_init_cmd(self):
1516 """Execute a command given at the command line.
1517 """Execute a command given at the command line.
1517
1518
1518 This emulates Python's -c option."""
1519 This emulates Python's -c option."""
1519
1520
1520 #sys.argv = ['-c']
1521 #sys.argv = ['-c']
1521 self.push(self.rc.c)
1522 self.push(self.rc.c)
1522
1523
1523 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1524 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1524 """Embeds IPython into a running python program.
1525 """Embeds IPython into a running python program.
1525
1526
1526 Input:
1527 Input:
1527
1528
1528 - header: An optional header message can be specified.
1529 - header: An optional header message can be specified.
1529
1530
1530 - local_ns, global_ns: working namespaces. If given as None, the
1531 - local_ns, global_ns: working namespaces. If given as None, the
1531 IPython-initialized one is updated with __main__.__dict__, so that
1532 IPython-initialized one is updated with __main__.__dict__, so that
1532 program variables become visible but user-specific configuration
1533 program variables become visible but user-specific configuration
1533 remains possible.
1534 remains possible.
1534
1535
1535 - stack_depth: specifies how many levels in the stack to go to
1536 - stack_depth: specifies how many levels in the stack to go to
1536 looking for namespaces (when local_ns and global_ns are None). This
1537 looking for namespaces (when local_ns and global_ns are None). This
1537 allows an intermediate caller to make sure that this function gets
1538 allows an intermediate caller to make sure that this function gets
1538 the namespace from the intended level in the stack. By default (0)
1539 the namespace from the intended level in the stack. By default (0)
1539 it will get its locals and globals from the immediate caller.
1540 it will get its locals and globals from the immediate caller.
1540
1541
1541 Warning: it's possible to use this in a program which is being run by
1542 Warning: it's possible to use this in a program which is being run by
1542 IPython itself (via %run), but some funny things will happen (a few
1543 IPython itself (via %run), but some funny things will happen (a few
1543 globals get overwritten). In the future this will be cleaned up, as
1544 globals get overwritten). In the future this will be cleaned up, as
1544 there is no fundamental reason why it can't work perfectly."""
1545 there is no fundamental reason why it can't work perfectly."""
1545
1546
1546 # Get locals and globals from caller
1547 # Get locals and globals from caller
1547 if local_ns is None or global_ns is None:
1548 if local_ns is None or global_ns is None:
1548 call_frame = sys._getframe(stack_depth).f_back
1549 call_frame = sys._getframe(stack_depth).f_back
1549
1550
1550 if local_ns is None:
1551 if local_ns is None:
1551 local_ns = call_frame.f_locals
1552 local_ns = call_frame.f_locals
1552 if global_ns is None:
1553 if global_ns is None:
1553 global_ns = call_frame.f_globals
1554 global_ns = call_frame.f_globals
1554
1555
1555 # Update namespaces and fire up interpreter
1556 # Update namespaces and fire up interpreter
1556
1557
1557 # The global one is easy, we can just throw it in
1558 # The global one is easy, we can just throw it in
1558 self.user_global_ns = global_ns
1559 self.user_global_ns = global_ns
1559
1560
1560 # but the user/local one is tricky: ipython needs it to store internal
1561 # but the user/local one is tricky: ipython needs it to store internal
1561 # data, but we also need the locals. We'll copy locals in the user
1562 # data, but we also need the locals. We'll copy locals in the user
1562 # one, but will track what got copied so we can delete them at exit.
1563 # one, but will track what got copied so we can delete them at exit.
1563 # This is so that a later embedded call doesn't see locals from a
1564 # This is so that a later embedded call doesn't see locals from a
1564 # previous call (which most likely existed in a separate scope).
1565 # previous call (which most likely existed in a separate scope).
1565 local_varnames = local_ns.keys()
1566 local_varnames = local_ns.keys()
1566 self.user_ns.update(local_ns)
1567 self.user_ns.update(local_ns)
1567
1568
1568 # Patch for global embedding to make sure that things don't overwrite
1569 # Patch for global embedding to make sure that things don't overwrite
1569 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1570 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1570 # FIXME. Test this a bit more carefully (the if.. is new)
1571 # FIXME. Test this a bit more carefully (the if.. is new)
1571 if local_ns is None and global_ns is None:
1572 if local_ns is None and global_ns is None:
1572 self.user_global_ns.update(__main__.__dict__)
1573 self.user_global_ns.update(__main__.__dict__)
1573
1574
1574 # make sure the tab-completer has the correct frame information, so it
1575 # make sure the tab-completer has the correct frame information, so it
1575 # actually completes using the frame's locals/globals
1576 # actually completes using the frame's locals/globals
1576 self.set_completer_frame()
1577 self.set_completer_frame()
1577
1578
1578 # before activating the interactive mode, we need to make sure that
1579 # before activating the interactive mode, we need to make sure that
1579 # all names in the builtin namespace needed by ipython point to
1580 # all names in the builtin namespace needed by ipython point to
1580 # ourselves, and not to other instances.
1581 # ourselves, and not to other instances.
1581 self.add_builtins()
1582 self.add_builtins()
1582
1583
1583 self.interact(header)
1584 self.interact(header)
1584
1585
1585 # now, purge out the user namespace from anything we might have added
1586 # now, purge out the user namespace from anything we might have added
1586 # from the caller's local namespace
1587 # from the caller's local namespace
1587 delvar = self.user_ns.pop
1588 delvar = self.user_ns.pop
1588 for var in local_varnames:
1589 for var in local_varnames:
1589 delvar(var,None)
1590 delvar(var,None)
1590 # and clean builtins we may have overridden
1591 # and clean builtins we may have overridden
1591 self.clean_builtins()
1592 self.clean_builtins()
1592
1593
1593 def interact(self, banner=None):
1594 def interact(self, banner=None):
1594 """Closely emulate the interactive Python console.
1595 """Closely emulate the interactive Python console.
1595
1596
1596 The optional banner argument specify the banner to print
1597 The optional banner argument specify the banner to print
1597 before the first interaction; by default it prints a banner
1598 before the first interaction; by default it prints a banner
1598 similar to the one printed by the real Python interpreter,
1599 similar to the one printed by the real Python interpreter,
1599 followed by the current class name in parentheses (so as not
1600 followed by the current class name in parentheses (so as not
1600 to confuse this with the real interpreter -- since it's so
1601 to confuse this with the real interpreter -- since it's so
1601 close!).
1602 close!).
1602
1603
1603 """
1604 """
1604
1605
1605 if self.exit_now:
1606 if self.exit_now:
1606 # batch run -> do not interact
1607 # batch run -> do not interact
1607 return
1608 return
1608 cprt = 'Type "copyright", "credits" or "license" for more information.'
1609 cprt = 'Type "copyright", "credits" or "license" for more information.'
1609 if banner is None:
1610 if banner is None:
1610 self.write("Python %s on %s\n%s\n(%s)\n" %
1611 self.write("Python %s on %s\n%s\n(%s)\n" %
1611 (sys.version, sys.platform, cprt,
1612 (sys.version, sys.platform, cprt,
1612 self.__class__.__name__))
1613 self.__class__.__name__))
1613 else:
1614 else:
1614 self.write(banner)
1615 self.write(banner)
1615
1616
1616 more = 0
1617 more = 0
1617
1618
1618 # Mark activity in the builtins
1619 # Mark activity in the builtins
1619 __builtin__.__dict__['__IPYTHON__active'] += 1
1620 __builtin__.__dict__['__IPYTHON__active'] += 1
1620
1621
1621 # exit_now is set by a call to %Exit or %Quit
1622 # exit_now is set by a call to %Exit or %Quit
1622 while not self.exit_now:
1623 while not self.exit_now:
1623 if more:
1624 if more:
1624 prompt = self.hooks.generate_prompt(True)
1625 prompt = self.hooks.generate_prompt(True)
1625 if self.autoindent:
1626 if self.autoindent:
1626 self.readline_startup_hook(self.pre_readline)
1627 self.readline_startup_hook(self.pre_readline)
1627 else:
1628 else:
1628 prompt = self.hooks.generate_prompt(False)
1629 prompt = self.hooks.generate_prompt(False)
1629 try:
1630 try:
1630 line = self.raw_input(prompt,more)
1631 line = self.raw_input(prompt,more)
1631 if self.exit_now:
1632 if self.exit_now:
1632 # quick exit on sys.std[in|out] close
1633 # quick exit on sys.std[in|out] close
1633 break
1634 break
1634 if self.autoindent:
1635 if self.autoindent:
1635 self.readline_startup_hook(None)
1636 self.readline_startup_hook(None)
1636 except KeyboardInterrupt:
1637 except KeyboardInterrupt:
1637 self.write('\nKeyboardInterrupt\n')
1638 self.write('\nKeyboardInterrupt\n')
1638 self.resetbuffer()
1639 self.resetbuffer()
1639 # keep cache in sync with the prompt counter:
1640 # keep cache in sync with the prompt counter:
1640 self.outputcache.prompt_count -= 1
1641 self.outputcache.prompt_count -= 1
1641
1642
1642 if self.autoindent:
1643 if self.autoindent:
1643 self.indent_current_nsp = 0
1644 self.indent_current_nsp = 0
1644 more = 0
1645 more = 0
1645 except EOFError:
1646 except EOFError:
1646 if self.autoindent:
1647 if self.autoindent:
1647 self.readline_startup_hook(None)
1648 self.readline_startup_hook(None)
1648 self.write('\n')
1649 self.write('\n')
1649 self.exit()
1650 self.exit()
1650 except bdb.BdbQuit:
1651 except bdb.BdbQuit:
1651 warn('The Python debugger has exited with a BdbQuit exception.\n'
1652 warn('The Python debugger has exited with a BdbQuit exception.\n'
1652 'Because of how pdb handles the stack, it is impossible\n'
1653 'Because of how pdb handles the stack, it is impossible\n'
1653 'for IPython to properly format this particular exception.\n'
1654 'for IPython to properly format this particular exception.\n'
1654 'IPython will resume normal operation.')
1655 'IPython will resume normal operation.')
1655 except:
1656 except:
1656 # exceptions here are VERY RARE, but they can be triggered
1657 # exceptions here are VERY RARE, but they can be triggered
1657 # asynchronously by signal handlers, for example.
1658 # asynchronously by signal handlers, for example.
1658 self.showtraceback()
1659 self.showtraceback()
1659 else:
1660 else:
1660 more = self.push(line)
1661 more = self.push(line)
1661 if (self.SyntaxTB.last_syntax_error and
1662 if (self.SyntaxTB.last_syntax_error and
1662 self.rc.autoedit_syntax):
1663 self.rc.autoedit_syntax):
1663 self.edit_syntax_error()
1664 self.edit_syntax_error()
1664
1665
1665 # We are off again...
1666 # We are off again...
1666 __builtin__.__dict__['__IPYTHON__active'] -= 1
1667 __builtin__.__dict__['__IPYTHON__active'] -= 1
1667
1668
1668 def excepthook(self, etype, value, tb):
1669 def excepthook(self, etype, value, tb):
1669 """One more defense for GUI apps that call sys.excepthook.
1670 """One more defense for GUI apps that call sys.excepthook.
1670
1671
1671 GUI frameworks like wxPython trap exceptions and call
1672 GUI frameworks like wxPython trap exceptions and call
1672 sys.excepthook themselves. I guess this is a feature that
1673 sys.excepthook themselves. I guess this is a feature that
1673 enables them to keep running after exceptions that would
1674 enables them to keep running after exceptions that would
1674 otherwise kill their mainloop. This is a bother for IPython
1675 otherwise kill their mainloop. This is a bother for IPython
1675 which excepts to catch all of the program exceptions with a try:
1676 which excepts to catch all of the program exceptions with a try:
1676 except: statement.
1677 except: statement.
1677
1678
1678 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1679 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1679 any app directly invokes sys.excepthook, it will look to the user like
1680 any app directly invokes sys.excepthook, it will look to the user like
1680 IPython crashed. In order to work around this, we can disable the
1681 IPython crashed. In order to work around this, we can disable the
1681 CrashHandler and replace it with this excepthook instead, which prints a
1682 CrashHandler and replace it with this excepthook instead, which prints a
1682 regular traceback using our InteractiveTB. In this fashion, apps which
1683 regular traceback using our InteractiveTB. In this fashion, apps which
1683 call sys.excepthook will generate a regular-looking exception from
1684 call sys.excepthook will generate a regular-looking exception from
1684 IPython, and the CrashHandler will only be triggered by real IPython
1685 IPython, and the CrashHandler will only be triggered by real IPython
1685 crashes.
1686 crashes.
1686
1687
1687 This hook should be used sparingly, only in places which are not likely
1688 This hook should be used sparingly, only in places which are not likely
1688 to be true IPython errors.
1689 to be true IPython errors.
1689 """
1690 """
1690 self.showtraceback((etype,value,tb),tb_offset=0)
1691 self.showtraceback((etype,value,tb),tb_offset=0)
1691
1692
1692 def expand_aliases(self,fn,rest):
1693 def expand_aliases(self,fn,rest):
1693 """ Expand multiple levels of aliases:
1694 """ Expand multiple levels of aliases:
1694
1695
1695 if:
1696 if:
1696
1697
1697 alias foo bar /tmp
1698 alias foo bar /tmp
1698 alias baz foo
1699 alias baz foo
1699
1700
1700 then:
1701 then:
1701
1702
1702 baz huhhahhei -> bar /tmp huhhahhei
1703 baz huhhahhei -> bar /tmp huhhahhei
1703
1704
1704 """
1705 """
1705 line = fn + " " + rest
1706 line = fn + " " + rest
1706
1707
1707 done = Set()
1708 done = Set()
1708 while 1:
1709 while 1:
1709 pre,fn,rest = self.split_user_input(line, pattern = self.shell_line_split)
1710 pre,fn,rest = self.split_user_input(line, pattern = self.shell_line_split)
1710 # print "!",fn,"!",rest # dbg
1711 # print "!",fn,"!",rest # dbg
1711 if fn in self.alias_table:
1712 if fn in self.alias_table:
1712 if fn in done:
1713 if fn in done:
1713 warn("Cyclic alias definition, repeated '%s'" % fn)
1714 warn("Cyclic alias definition, repeated '%s'" % fn)
1714 return ""
1715 return ""
1715 done.add(fn)
1716 done.add(fn)
1716
1717
1717 l2 = self.transform_alias(fn,rest)
1718 l2 = self.transform_alias(fn,rest)
1718 # dir -> dir
1719 # dir -> dir
1719 # print "alias",line, "->",l2 #dbg
1720 # print "alias",line, "->",l2 #dbg
1720 if l2 == line:
1721 if l2 == line:
1721 break
1722 break
1722 # ls -> ls -F should not recurse forever
1723 # ls -> ls -F should not recurse forever
1723 if l2.split(None,1)[0] == line.split(None,1)[0]:
1724 if l2.split(None,1)[0] == line.split(None,1)[0]:
1724 line = l2
1725 line = l2
1725 break
1726 break
1726
1727
1727 line=l2
1728 line=l2
1728
1729
1729
1730
1730 # print "al expand to",line #dbg
1731 # print "al expand to",line #dbg
1731 else:
1732 else:
1732 break
1733 break
1733
1734
1734 return line
1735 return line
1735
1736
1736 def transform_alias(self, alias,rest=''):
1737 def transform_alias(self, alias,rest=''):
1737 """ Transform alias to system command string.
1738 """ Transform alias to system command string.
1738 """
1739 """
1739 nargs,cmd = self.alias_table[alias]
1740 nargs,cmd = self.alias_table[alias]
1740 if ' ' in cmd and os.path.isfile(cmd):
1741 if ' ' in cmd and os.path.isfile(cmd):
1741 cmd = '"%s"' % cmd
1742 cmd = '"%s"' % cmd
1742
1743
1743 # Expand the %l special to be the user's input line
1744 # Expand the %l special to be the user's input line
1744 if cmd.find('%l') >= 0:
1745 if cmd.find('%l') >= 0:
1745 cmd = cmd.replace('%l',rest)
1746 cmd = cmd.replace('%l',rest)
1746 rest = ''
1747 rest = ''
1747 if nargs==0:
1748 if nargs==0:
1748 # Simple, argument-less aliases
1749 # Simple, argument-less aliases
1749 cmd = '%s %s' % (cmd,rest)
1750 cmd = '%s %s' % (cmd,rest)
1750 else:
1751 else:
1751 # Handle aliases with positional arguments
1752 # Handle aliases with positional arguments
1752 args = rest.split(None,nargs)
1753 args = rest.split(None,nargs)
1753 if len(args)< nargs:
1754 if len(args)< nargs:
1754 error('Alias <%s> requires %s arguments, %s given.' %
1755 error('Alias <%s> requires %s arguments, %s given.' %
1755 (alias,nargs,len(args)))
1756 (alias,nargs,len(args)))
1756 return None
1757 return None
1757 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1758 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1758 # Now call the macro, evaluating in the user's namespace
1759 # Now call the macro, evaluating in the user's namespace
1759 #print 'new command: <%r>' % cmd # dbg
1760 #print 'new command: <%r>' % cmd # dbg
1760 return cmd
1761 return cmd
1761
1762
1762 def call_alias(self,alias,rest=''):
1763 def call_alias(self,alias,rest=''):
1763 """Call an alias given its name and the rest of the line.
1764 """Call an alias given its name and the rest of the line.
1764
1765
1765 This is only used to provide backwards compatibility for users of
1766 This is only used to provide backwards compatibility for users of
1766 ipalias(), use of which is not recommended for anymore."""
1767 ipalias(), use of which is not recommended for anymore."""
1767
1768
1768 # Now call the macro, evaluating in the user's namespace
1769 # Now call the macro, evaluating in the user's namespace
1769 cmd = self.transform_alias(alias, rest)
1770 cmd = self.transform_alias(alias, rest)
1770 try:
1771 try:
1771 self.system(cmd)
1772 self.system(cmd)
1772 except:
1773 except:
1773 self.showtraceback()
1774 self.showtraceback()
1774
1775
1775 def indent_current_str(self):
1776 def indent_current_str(self):
1776 """return the current level of indentation as a string"""
1777 """return the current level of indentation as a string"""
1777 return self.indent_current_nsp * ' '
1778 return self.indent_current_nsp * ' '
1778
1779
1779 def autoindent_update(self,line):
1780 def autoindent_update(self,line):
1780 """Keep track of the indent level."""
1781 """Keep track of the indent level."""
1781
1782
1782 #debugx('line')
1783 #debugx('line')
1783 #debugx('self.indent_current_nsp')
1784 #debugx('self.indent_current_nsp')
1784 if self.autoindent:
1785 if self.autoindent:
1785 if line:
1786 if line:
1786 inisp = num_ini_spaces(line)
1787 inisp = num_ini_spaces(line)
1787 if inisp < self.indent_current_nsp:
1788 if inisp < self.indent_current_nsp:
1788 self.indent_current_nsp = inisp
1789 self.indent_current_nsp = inisp
1789
1790
1790 if line[-1] == ':':
1791 if line[-1] == ':':
1791 self.indent_current_nsp += 4
1792 self.indent_current_nsp += 4
1792 elif dedent_re.match(line):
1793 elif dedent_re.match(line):
1793 self.indent_current_nsp -= 4
1794 self.indent_current_nsp -= 4
1794 else:
1795 else:
1795 self.indent_current_nsp = 0
1796 self.indent_current_nsp = 0
1796
1797
1797 def runlines(self,lines):
1798 def runlines(self,lines):
1798 """Run a string of one or more lines of source.
1799 """Run a string of one or more lines of source.
1799
1800
1800 This method is capable of running a string containing multiple source
1801 This method is capable of running a string containing multiple source
1801 lines, as if they had been entered at the IPython prompt. Since it
1802 lines, as if they had been entered at the IPython prompt. Since it
1802 exposes IPython's processing machinery, the given strings can contain
1803 exposes IPython's processing machinery, the given strings can contain
1803 magic calls (%magic), special shell access (!cmd), etc."""
1804 magic calls (%magic), special shell access (!cmd), etc."""
1804
1805
1805 # We must start with a clean buffer, in case this is run from an
1806 # We must start with a clean buffer, in case this is run from an
1806 # interactive IPython session (via a magic, for example).
1807 # interactive IPython session (via a magic, for example).
1807 self.resetbuffer()
1808 self.resetbuffer()
1808 lines = lines.split('\n')
1809 lines = lines.split('\n')
1809 more = 0
1810 more = 0
1810 for line in lines:
1811 for line in lines:
1811 # skip blank lines so we don't mess up the prompt counter, but do
1812 # skip blank lines so we don't mess up the prompt counter, but do
1812 # NOT skip even a blank line if we are in a code block (more is
1813 # NOT skip even a blank line if we are in a code block (more is
1813 # true)
1814 # true)
1814 if line or more:
1815 if line or more:
1815 more = self.push(self.prefilter(line,more))
1816 more = self.push(self.prefilter(line,more))
1816 # IPython's runsource returns None if there was an error
1817 # IPython's runsource returns None if there was an error
1817 # compiling the code. This allows us to stop processing right
1818 # compiling the code. This allows us to stop processing right
1818 # away, so the user gets the error message at the right place.
1819 # away, so the user gets the error message at the right place.
1819 if more is None:
1820 if more is None:
1820 break
1821 break
1821 # final newline in case the input didn't have it, so that the code
1822 # final newline in case the input didn't have it, so that the code
1822 # actually does get executed
1823 # actually does get executed
1823 if more:
1824 if more:
1824 self.push('\n')
1825 self.push('\n')
1825
1826
1826 def runsource(self, source, filename='<input>', symbol='single'):
1827 def runsource(self, source, filename='<input>', symbol='single'):
1827 """Compile and run some source in the interpreter.
1828 """Compile and run some source in the interpreter.
1828
1829
1829 Arguments are as for compile_command().
1830 Arguments are as for compile_command().
1830
1831
1831 One several things can happen:
1832 One several things can happen:
1832
1833
1833 1) The input is incorrect; compile_command() raised an
1834 1) The input is incorrect; compile_command() raised an
1834 exception (SyntaxError or OverflowError). A syntax traceback
1835 exception (SyntaxError or OverflowError). A syntax traceback
1835 will be printed by calling the showsyntaxerror() method.
1836 will be printed by calling the showsyntaxerror() method.
1836
1837
1837 2) The input is incomplete, and more input is required;
1838 2) The input is incomplete, and more input is required;
1838 compile_command() returned None. Nothing happens.
1839 compile_command() returned None. Nothing happens.
1839
1840
1840 3) The input is complete; compile_command() returned a code
1841 3) The input is complete; compile_command() returned a code
1841 object. The code is executed by calling self.runcode() (which
1842 object. The code is executed by calling self.runcode() (which
1842 also handles run-time exceptions, except for SystemExit).
1843 also handles run-time exceptions, except for SystemExit).
1843
1844
1844 The return value is:
1845 The return value is:
1845
1846
1846 - True in case 2
1847 - True in case 2
1847
1848
1848 - False in the other cases, unless an exception is raised, where
1849 - False in the other cases, unless an exception is raised, where
1849 None is returned instead. This can be used by external callers to
1850 None is returned instead. This can be used by external callers to
1850 know whether to continue feeding input or not.
1851 know whether to continue feeding input or not.
1851
1852
1852 The return value can be used to decide whether to use sys.ps1 or
1853 The return value can be used to decide whether to use sys.ps1 or
1853 sys.ps2 to prompt the next line."""
1854 sys.ps2 to prompt the next line."""
1854
1855
1855 # if the source code has leading blanks, add 'if 1:\n' to it
1856 # if the source code has leading blanks, add 'if 1:\n' to it
1856 # this allows execution of indented pasted code. It is tempting
1857 # this allows execution of indented pasted code. It is tempting
1857 # to add '\n' at the end of source to run commands like ' a=1'
1858 # to add '\n' at the end of source to run commands like ' a=1'
1858 # directly, but this fails for more complicated scenarios
1859 # directly, but this fails for more complicated scenarios
1859 if source[:1] in [' ', '\t']:
1860 if source[:1] in [' ', '\t']:
1860 source = 'if 1:\n%s' % source
1861 source = 'if 1:\n%s' % source
1861
1862
1862 try:
1863 try:
1863 code = self.compile(source,filename,symbol)
1864 code = self.compile(source,filename,symbol)
1864 except (OverflowError, SyntaxError, ValueError):
1865 except (OverflowError, SyntaxError, ValueError):
1865 # Case 1
1866 # Case 1
1866 self.showsyntaxerror(filename)
1867 self.showsyntaxerror(filename)
1867 return None
1868 return None
1868
1869
1869 if code is None:
1870 if code is None:
1870 # Case 2
1871 # Case 2
1871 return True
1872 return True
1872
1873
1873 # Case 3
1874 # Case 3
1874 # We store the code object so that threaded shells and
1875 # We store the code object so that threaded shells and
1875 # custom exception handlers can access all this info if needed.
1876 # custom exception handlers can access all this info if needed.
1876 # The source corresponding to this can be obtained from the
1877 # The source corresponding to this can be obtained from the
1877 # buffer attribute as '\n'.join(self.buffer).
1878 # buffer attribute as '\n'.join(self.buffer).
1878 self.code_to_run = code
1879 self.code_to_run = code
1879 # now actually execute the code object
1880 # now actually execute the code object
1880 if self.runcode(code) == 0:
1881 if self.runcode(code) == 0:
1881 return False
1882 return False
1882 else:
1883 else:
1883 return None
1884 return None
1884
1885
1885 def runcode(self,code_obj):
1886 def runcode(self,code_obj):
1886 """Execute a code object.
1887 """Execute a code object.
1887
1888
1888 When an exception occurs, self.showtraceback() is called to display a
1889 When an exception occurs, self.showtraceback() is called to display a
1889 traceback.
1890 traceback.
1890
1891
1891 Return value: a flag indicating whether the code to be run completed
1892 Return value: a flag indicating whether the code to be run completed
1892 successfully:
1893 successfully:
1893
1894
1894 - 0: successful execution.
1895 - 0: successful execution.
1895 - 1: an error occurred.
1896 - 1: an error occurred.
1896 """
1897 """
1897
1898
1898 # Set our own excepthook in case the user code tries to call it
1899 # Set our own excepthook in case the user code tries to call it
1899 # directly, so that the IPython crash handler doesn't get triggered
1900 # directly, so that the IPython crash handler doesn't get triggered
1900 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1901 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1901
1902
1902 # we save the original sys.excepthook in the instance, in case config
1903 # we save the original sys.excepthook in the instance, in case config
1903 # code (such as magics) needs access to it.
1904 # code (such as magics) needs access to it.
1904 self.sys_excepthook = old_excepthook
1905 self.sys_excepthook = old_excepthook
1905 outflag = 1 # happens in more places, so it's easier as default
1906 outflag = 1 # happens in more places, so it's easier as default
1906 try:
1907 try:
1907 try:
1908 try:
1908 # Embedded instances require separate global/local namespaces
1909 # Embedded instances require separate global/local namespaces
1909 # so they can see both the surrounding (local) namespace and
1910 # so they can see both the surrounding (local) namespace and
1910 # the module-level globals when called inside another function.
1911 # the module-level globals when called inside another function.
1911 if self.embedded:
1912 if self.embedded:
1912 exec code_obj in self.user_global_ns, self.user_ns
1913 exec code_obj in self.user_global_ns, self.user_ns
1913 # Normal (non-embedded) instances should only have a single
1914 # Normal (non-embedded) instances should only have a single
1914 # namespace for user code execution, otherwise functions won't
1915 # namespace for user code execution, otherwise functions won't
1915 # see interactive top-level globals.
1916 # see interactive top-level globals.
1916 else:
1917 else:
1917 exec code_obj in self.user_ns
1918 exec code_obj in self.user_ns
1918 finally:
1919 finally:
1919 # Reset our crash handler in place
1920 # Reset our crash handler in place
1920 sys.excepthook = old_excepthook
1921 sys.excepthook = old_excepthook
1921 except SystemExit:
1922 except SystemExit:
1922 self.resetbuffer()
1923 self.resetbuffer()
1923 self.showtraceback()
1924 self.showtraceback()
1924 warn("Type %exit or %quit to exit IPython "
1925 warn("Type %exit or %quit to exit IPython "
1925 "(%Exit or %Quit do so unconditionally).",level=1)
1926 "(%Exit or %Quit do so unconditionally).",level=1)
1926 except self.custom_exceptions:
1927 except self.custom_exceptions:
1927 etype,value,tb = sys.exc_info()
1928 etype,value,tb = sys.exc_info()
1928 self.CustomTB(etype,value,tb)
1929 self.CustomTB(etype,value,tb)
1929 except:
1930 except:
1930 self.showtraceback()
1931 self.showtraceback()
1931 else:
1932 else:
1932 outflag = 0
1933 outflag = 0
1933 if softspace(sys.stdout, 0):
1934 if softspace(sys.stdout, 0):
1934 print
1935 print
1935 # Flush out code object which has been run (and source)
1936 # Flush out code object which has been run (and source)
1936 self.code_to_run = None
1937 self.code_to_run = None
1937 return outflag
1938 return outflag
1938
1939
1939 def push(self, line):
1940 def push(self, line):
1940 """Push a line to the interpreter.
1941 """Push a line to the interpreter.
1941
1942
1942 The line should not have a trailing newline; it may have
1943 The line should not have a trailing newline; it may have
1943 internal newlines. The line is appended to a buffer and the
1944 internal newlines. The line is appended to a buffer and the
1944 interpreter's runsource() method is called with the
1945 interpreter's runsource() method is called with the
1945 concatenated contents of the buffer as source. If this
1946 concatenated contents of the buffer as source. If this
1946 indicates that the command was executed or invalid, the buffer
1947 indicates that the command was executed or invalid, the buffer
1947 is reset; otherwise, the command is incomplete, and the buffer
1948 is reset; otherwise, the command is incomplete, and the buffer
1948 is left as it was after the line was appended. The return
1949 is left as it was after the line was appended. The return
1949 value is 1 if more input is required, 0 if the line was dealt
1950 value is 1 if more input is required, 0 if the line was dealt
1950 with in some way (this is the same as runsource()).
1951 with in some way (this is the same as runsource()).
1951 """
1952 """
1952
1953
1953 # autoindent management should be done here, and not in the
1954 # autoindent management should be done here, and not in the
1954 # interactive loop, since that one is only seen by keyboard input. We
1955 # interactive loop, since that one is only seen by keyboard input. We
1955 # need this done correctly even for code run via runlines (which uses
1956 # need this done correctly even for code run via runlines (which uses
1956 # push).
1957 # push).
1957
1958
1958 #print 'push line: <%s>' % line # dbg
1959 #print 'push line: <%s>' % line # dbg
1959 for subline in line.splitlines():
1960 for subline in line.splitlines():
1960 self.autoindent_update(subline)
1961 self.autoindent_update(subline)
1961 self.buffer.append(line)
1962 self.buffer.append(line)
1962 more = self.runsource('\n'.join(self.buffer), self.filename)
1963 more = self.runsource('\n'.join(self.buffer), self.filename)
1963 if not more:
1964 if not more:
1964 self.resetbuffer()
1965 self.resetbuffer()
1965 return more
1966 return more
1966
1967
1967 def resetbuffer(self):
1968 def resetbuffer(self):
1968 """Reset the input buffer."""
1969 """Reset the input buffer."""
1969 self.buffer[:] = []
1970 self.buffer[:] = []
1970
1971
1971 def raw_input(self,prompt='',continue_prompt=False):
1972 def raw_input(self,prompt='',continue_prompt=False):
1972 """Write a prompt and read a line.
1973 """Write a prompt and read a line.
1973
1974
1974 The returned line does not include the trailing newline.
1975 The returned line does not include the trailing newline.
1975 When the user enters the EOF key sequence, EOFError is raised.
1976 When the user enters the EOF key sequence, EOFError is raised.
1976
1977
1977 Optional inputs:
1978 Optional inputs:
1978
1979
1979 - prompt(''): a string to be printed to prompt the user.
1980 - prompt(''): a string to be printed to prompt the user.
1980
1981
1981 - continue_prompt(False): whether this line is the first one or a
1982 - continue_prompt(False): whether this line is the first one or a
1982 continuation in a sequence of inputs.
1983 continuation in a sequence of inputs.
1983 """
1984 """
1984
1985
1985 try:
1986 try:
1986 line = raw_input_original(prompt).decode(sys.stdin.encoding)
1987 line = raw_input_original(prompt).decode(sys.stdin.encoding)
1987 #line = raw_input_original(prompt)
1988 #line = raw_input_original(prompt)
1988 except ValueError:
1989 except ValueError:
1989 warn("\n********\nYou or a %run:ed script called sys.stdin.close() or sys.stdout.close()!\nExiting IPython!")
1990 warn("\n********\nYou or a %run:ed script called sys.stdin.close() or sys.stdout.close()!\nExiting IPython!")
1990 self.exit_now = True
1991 self.exit_now = True
1991 return ""
1992 return ""
1992
1993
1993
1994
1994 # Try to be reasonably smart about not re-indenting pasted input more
1995 # Try to be reasonably smart about not re-indenting pasted input more
1995 # than necessary. We do this by trimming out the auto-indent initial
1996 # than necessary. We do this by trimming out the auto-indent initial
1996 # spaces, if the user's actual input started itself with whitespace.
1997 # spaces, if the user's actual input started itself with whitespace.
1997 #debugx('self.buffer[-1]')
1998 #debugx('self.buffer[-1]')
1998
1999
1999 if self.autoindent:
2000 if self.autoindent:
2000 if num_ini_spaces(line) > self.indent_current_nsp:
2001 if num_ini_spaces(line) > self.indent_current_nsp:
2001 line = line[self.indent_current_nsp:]
2002 line = line[self.indent_current_nsp:]
2002 self.indent_current_nsp = 0
2003 self.indent_current_nsp = 0
2003
2004
2004 # store the unfiltered input before the user has any chance to modify
2005 # store the unfiltered input before the user has any chance to modify
2005 # it.
2006 # it.
2006 if line.strip():
2007 if line.strip():
2007 if continue_prompt:
2008 if continue_prompt:
2008 self.input_hist_raw[-1] += '%s\n' % line
2009 self.input_hist_raw[-1] += '%s\n' % line
2009 if self.has_readline: # and some config option is set?
2010 if self.has_readline: # and some config option is set?
2010 try:
2011 try:
2011 histlen = self.readline.get_current_history_length()
2012 histlen = self.readline.get_current_history_length()
2012 newhist = self.input_hist_raw[-1].rstrip()
2013 newhist = self.input_hist_raw[-1].rstrip()
2013 self.readline.remove_history_item(histlen-1)
2014 self.readline.remove_history_item(histlen-1)
2014 self.readline.replace_history_item(histlen-2,newhist)
2015 self.readline.replace_history_item(histlen-2,newhist)
2015 except AttributeError:
2016 except AttributeError:
2016 pass # re{move,place}_history_item are new in 2.4.
2017 pass # re{move,place}_history_item are new in 2.4.
2017 else:
2018 else:
2018 self.input_hist_raw.append('%s\n' % line)
2019 self.input_hist_raw.append('%s\n' % line)
2019
2020
2020 try:
2021 try:
2021 lineout = self.prefilter(line,continue_prompt)
2022 lineout = self.prefilter(line,continue_prompt)
2022 except:
2023 except:
2023 # blanket except, in case a user-defined prefilter crashes, so it
2024 # blanket except, in case a user-defined prefilter crashes, so it
2024 # can't take all of ipython with it.
2025 # can't take all of ipython with it.
2025 self.showtraceback()
2026 self.showtraceback()
2026 return ''
2027 return ''
2027 else:
2028 else:
2028 return lineout
2029 return lineout
2029
2030
2030 def split_user_input(self,line, pattern = None):
2031 def split_user_input(self,line, pattern = None):
2031 """Split user input into pre-char, function part and rest."""
2032 """Split user input into pre-char, function part and rest."""
2032
2033
2033 if pattern is None:
2034 if pattern is None:
2034 pattern = self.line_split
2035 pattern = self.line_split
2035
2036
2036 lsplit = pattern.match(line)
2037 lsplit = pattern.match(line)
2037 if lsplit is None: # no regexp match returns None
2038 if lsplit is None: # no regexp match returns None
2038 #print "match failed for line '%s'" % line # dbg
2039 #print "match failed for line '%s'" % line # dbg
2039 try:
2040 try:
2040 iFun,theRest = line.split(None,1)
2041 iFun,theRest = line.split(None,1)
2041 except ValueError:
2042 except ValueError:
2042 #print "split failed for line '%s'" % line # dbg
2043 #print "split failed for line '%s'" % line # dbg
2043 iFun,theRest = line,''
2044 iFun,theRest = line,''
2044 pre = re.match('^(\s*)(.*)',line).groups()[0]
2045 pre = re.match('^(\s*)(.*)',line).groups()[0]
2045 else:
2046 else:
2046 pre,iFun,theRest = lsplit.groups()
2047 pre,iFun,theRest = lsplit.groups()
2047
2048
2048 # iFun has to be a valid python identifier, so it better be only pure
2049 # iFun has to be a valid python identifier, so it better be only pure
2049 #ascii, no unicode:
2050 #ascii, no unicode:
2050 try:
2051 try:
2051 iFun = iFun.encode('ascii')
2052 iFun = iFun.encode('ascii')
2052 except UnicodeEncodeError:
2053 except UnicodeEncodeError:
2053 theRest = iFun+u' '+theRest
2054 theRest = iFun+u' '+theRest
2054 iFun = u''
2055 iFun = u''
2055
2056
2056 #print 'line:<%s>' % line # dbg
2057 #print 'line:<%s>' % line # dbg
2057 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
2058 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
2058 return pre,iFun.strip(),theRest
2059 return pre,iFun.strip(),theRest
2059
2060
2060 # THIS VERSION IS BROKEN!!! It was intended to prevent spurious attribute
2061 # THIS VERSION IS BROKEN!!! It was intended to prevent spurious attribute
2061 # accesses with a more stringent check of inputs, but it introduced other
2062 # accesses with a more stringent check of inputs, but it introduced other
2062 # bugs. Disable it for now until I can properly fix it.
2063 # bugs. Disable it for now until I can properly fix it.
2063 def split_user_inputBROKEN(self,line):
2064 def split_user_inputBROKEN(self,line):
2064 """Split user input into pre-char, function part and rest."""
2065 """Split user input into pre-char, function part and rest."""
2065
2066
2066 lsplit = self.line_split.match(line)
2067 lsplit = self.line_split.match(line)
2067 if lsplit is None: # no regexp match returns None
2068 if lsplit is None: # no regexp match returns None
2068 lsplit = self.line_split_fallback.match(line)
2069 lsplit = self.line_split_fallback.match(line)
2069
2070
2070 #pre,iFun,theRest = lsplit.groups() # dbg
2071 #pre,iFun,theRest = lsplit.groups() # dbg
2071 #print 'line:<%s>' % line # dbg
2072 #print 'line:<%s>' % line # dbg
2072 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
2073 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
2073 #return pre,iFun.strip(),theRest # dbg
2074 #return pre,iFun.strip(),theRest # dbg
2074
2075
2075 return lsplit.groups()
2076 return lsplit.groups()
2076
2077
2077 def _prefilter(self, line, continue_prompt):
2078 def _prefilter(self, line, continue_prompt):
2078 """Calls different preprocessors, depending on the form of line."""
2079 """Calls different preprocessors, depending on the form of line."""
2079
2080
2080 # All handlers *must* return a value, even if it's blank ('').
2081 # All handlers *must* return a value, even if it's blank ('').
2081
2082
2082 # Lines are NOT logged here. Handlers should process the line as
2083 # Lines are NOT logged here. Handlers should process the line as
2083 # needed, update the cache AND log it (so that the input cache array
2084 # needed, update the cache AND log it (so that the input cache array
2084 # stays synced).
2085 # stays synced).
2085
2086
2086 # This function is _very_ delicate, and since it's also the one which
2087 # This function is _very_ delicate, and since it's also the one which
2087 # determines IPython's response to user input, it must be as efficient
2088 # determines IPython's response to user input, it must be as efficient
2088 # as possible. For this reason it has _many_ returns in it, trying
2089 # as possible. For this reason it has _many_ returns in it, trying
2089 # always to exit as quickly as it can figure out what it needs to do.
2090 # always to exit as quickly as it can figure out what it needs to do.
2090
2091
2091 # This function is the main responsible for maintaining IPython's
2092 # This function is the main responsible for maintaining IPython's
2092 # behavior respectful of Python's semantics. So be _very_ careful if
2093 # behavior respectful of Python's semantics. So be _very_ careful if
2093 # making changes to anything here.
2094 # making changes to anything here.
2094
2095
2095 #.....................................................................
2096 #.....................................................................
2096 # Code begins
2097 # Code begins
2097
2098
2098 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
2099 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
2099
2100
2100 # save the line away in case we crash, so the post-mortem handler can
2101 # save the line away in case we crash, so the post-mortem handler can
2101 # record it
2102 # record it
2102 self._last_input_line = line
2103 self._last_input_line = line
2103
2104
2104 #print '***line: <%s>' % line # dbg
2105 #print '***line: <%s>' % line # dbg
2105
2106
2106 # the input history needs to track even empty lines
2107 # the input history needs to track even empty lines
2107 stripped = line.strip()
2108 stripped = line.strip()
2108
2109
2109 if not stripped:
2110 if not stripped:
2110 if not continue_prompt:
2111 if not continue_prompt:
2111 self.outputcache.prompt_count -= 1
2112 self.outputcache.prompt_count -= 1
2112 return self.handle_normal(line,continue_prompt)
2113 return self.handle_normal(line,continue_prompt)
2113 #return self.handle_normal('',continue_prompt)
2114 #return self.handle_normal('',continue_prompt)
2114
2115
2115 # print '***cont',continue_prompt # dbg
2116 # print '***cont',continue_prompt # dbg
2116 # special handlers are only allowed for single line statements
2117 # special handlers are only allowed for single line statements
2117 if continue_prompt and not self.rc.multi_line_specials:
2118 if continue_prompt and not self.rc.multi_line_specials:
2118 return self.handle_normal(line,continue_prompt)
2119 return self.handle_normal(line,continue_prompt)
2119
2120
2120
2121
2121 # For the rest, we need the structure of the input
2122 # For the rest, we need the structure of the input
2122 pre,iFun,theRest = self.split_user_input(line)
2123 pre,iFun,theRest = self.split_user_input(line)
2123
2124
2124 # See whether any pre-existing handler can take care of it
2125 # See whether any pre-existing handler can take care of it
2125
2126
2126 rewritten = self.hooks.input_prefilter(stripped)
2127 rewritten = self.hooks.input_prefilter(stripped)
2127 if rewritten != stripped: # ok, some prefilter did something
2128 if rewritten != stripped: # ok, some prefilter did something
2128 rewritten = pre + rewritten # add indentation
2129 rewritten = pre + rewritten # add indentation
2129 return self.handle_normal(rewritten)
2130 return self.handle_normal(rewritten)
2130
2131
2131 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2132 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2132
2133
2133 # Next, check if we can automatically execute this thing
2134 # Next, check if we can automatically execute this thing
2134
2135
2135 # Allow ! in multi-line statements if multi_line_specials is on:
2136 # Allow ! in multi-line statements if multi_line_specials is on:
2136 if continue_prompt and self.rc.multi_line_specials and \
2137 if continue_prompt and self.rc.multi_line_specials and \
2137 iFun.startswith(self.ESC_SHELL):
2138 iFun.startswith(self.ESC_SHELL):
2138 return self.handle_shell_escape(line,continue_prompt,
2139 return self.handle_shell_escape(line,continue_prompt,
2139 pre=pre,iFun=iFun,
2140 pre=pre,iFun=iFun,
2140 theRest=theRest)
2141 theRest=theRest)
2141
2142
2142 # First check for explicit escapes in the last/first character
2143 # First check for explicit escapes in the last/first character
2143 handler = None
2144 handler = None
2144 if line[-1] == self.ESC_HELP:
2145 if line[-1] == self.ESC_HELP:
2145 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
2146 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
2146 if handler is None:
2147 if handler is None:
2147 # look at the first character of iFun, NOT of line, so we skip
2148 # look at the first character of iFun, NOT of line, so we skip
2148 # leading whitespace in multiline input
2149 # leading whitespace in multiline input
2149 handler = self.esc_handlers.get(iFun[0:1])
2150 handler = self.esc_handlers.get(iFun[0:1])
2150 if handler is not None:
2151 if handler is not None:
2151 return handler(line,continue_prompt,pre,iFun,theRest)
2152 return handler(line,continue_prompt,pre,iFun,theRest)
2152 # Emacs ipython-mode tags certain input lines
2153 # Emacs ipython-mode tags certain input lines
2153 if line.endswith('# PYTHON-MODE'):
2154 if line.endswith('# PYTHON-MODE'):
2154 return self.handle_emacs(line,continue_prompt)
2155 return self.handle_emacs(line,continue_prompt)
2155
2156
2156 # Let's try to find if the input line is a magic fn
2157 # Let's try to find if the input line is a magic fn
2157 oinfo = None
2158 oinfo = None
2158 if hasattr(self,'magic_'+iFun):
2159 if hasattr(self,'magic_'+iFun):
2159 # WARNING: _ofind uses getattr(), so it can consume generators and
2160 # WARNING: _ofind uses getattr(), so it can consume generators and
2160 # cause other side effects.
2161 # cause other side effects.
2161 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2162 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2162 if oinfo['ismagic']:
2163 if oinfo['ismagic']:
2163 # Be careful not to call magics when a variable assignment is
2164 # Be careful not to call magics when a variable assignment is
2164 # being made (ls='hi', for example)
2165 # being made (ls='hi', for example)
2165 if self.rc.automagic and \
2166 if self.rc.automagic and \
2166 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
2167 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
2167 (self.rc.multi_line_specials or not continue_prompt):
2168 (self.rc.multi_line_specials or not continue_prompt):
2168 return self.handle_magic(line,continue_prompt,
2169 return self.handle_magic(line,continue_prompt,
2169 pre,iFun,theRest)
2170 pre,iFun,theRest)
2170 else:
2171 else:
2171 return self.handle_normal(line,continue_prompt)
2172 return self.handle_normal(line,continue_prompt)
2172
2173
2173 # If the rest of the line begins with an (in)equality, assginment or
2174 # If the rest of the line begins with an (in)equality, assginment or
2174 # function call, we should not call _ofind but simply execute it.
2175 # function call, we should not call _ofind but simply execute it.
2175 # This avoids spurious geattr() accesses on objects upon assignment.
2176 # This avoids spurious geattr() accesses on objects upon assignment.
2176 #
2177 #
2177 # It also allows users to assign to either alias or magic names true
2178 # It also allows users to assign to either alias or magic names true
2178 # python variables (the magic/alias systems always take second seat to
2179 # python variables (the magic/alias systems always take second seat to
2179 # true python code).
2180 # true python code).
2180 if theRest and theRest[0] in '!=()':
2181 if theRest and theRest[0] in '!=()':
2181 return self.handle_normal(line,continue_prompt)
2182 return self.handle_normal(line,continue_prompt)
2182
2183
2183 if oinfo is None:
2184 if oinfo is None:
2184 # let's try to ensure that _oinfo is ONLY called when autocall is
2185 # let's try to ensure that _oinfo is ONLY called when autocall is
2185 # on. Since it has inevitable potential side effects, at least
2186 # on. Since it has inevitable potential side effects, at least
2186 # having autocall off should be a guarantee to the user that no
2187 # having autocall off should be a guarantee to the user that no
2187 # weird things will happen.
2188 # weird things will happen.
2188
2189
2189 if self.rc.autocall:
2190 if self.rc.autocall:
2190 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2191 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
2191 else:
2192 else:
2192 # in this case, all that's left is either an alias or
2193 # in this case, all that's left is either an alias or
2193 # processing the line normally.
2194 # processing the line normally.
2194 if iFun in self.alias_table:
2195 if iFun in self.alias_table:
2195 # if autocall is off, by not running _ofind we won't know
2196 # if autocall is off, by not running _ofind we won't know
2196 # whether the given name may also exist in one of the
2197 # whether the given name may also exist in one of the
2197 # user's namespace. At this point, it's best to do a
2198 # user's namespace. At this point, it's best to do a
2198 # quick check just to be sure that we don't let aliases
2199 # quick check just to be sure that we don't let aliases
2199 # shadow variables.
2200 # shadow variables.
2200 head = iFun.split('.',1)[0]
2201 head = iFun.split('.',1)[0]
2201 if head in self.user_ns or head in self.internal_ns \
2202 if head in self.user_ns or head in self.internal_ns \
2202 or head in __builtin__.__dict__:
2203 or head in __builtin__.__dict__:
2203 return self.handle_normal(line,continue_prompt)
2204 return self.handle_normal(line,continue_prompt)
2204 else:
2205 else:
2205 return self.handle_alias(line,continue_prompt,
2206 return self.handle_alias(line,continue_prompt,
2206 pre,iFun,theRest)
2207 pre,iFun,theRest)
2207
2208
2208 else:
2209 else:
2209 return self.handle_normal(line,continue_prompt)
2210 return self.handle_normal(line,continue_prompt)
2210
2211
2211 if not oinfo['found']:
2212 if not oinfo['found']:
2212 return self.handle_normal(line,continue_prompt)
2213 return self.handle_normal(line,continue_prompt)
2213 else:
2214 else:
2214 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2215 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2215 if oinfo['isalias']:
2216 if oinfo['isalias']:
2216 return self.handle_alias(line,continue_prompt,
2217 return self.handle_alias(line,continue_prompt,
2217 pre,iFun,theRest)
2218 pre,iFun,theRest)
2218
2219
2219 if (self.rc.autocall
2220 if (self.rc.autocall
2220 and
2221 and
2221 (
2222 (
2222 #only consider exclusion re if not "," or ";" autoquoting
2223 #only consider exclusion re if not "," or ";" autoquoting
2223 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
2224 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
2224 or pre == self.ESC_PAREN) or
2225 or pre == self.ESC_PAREN) or
2225 (not self.re_exclude_auto.match(theRest)))
2226 (not self.re_exclude_auto.match(theRest)))
2226 and
2227 and
2227 self.re_fun_name.match(iFun) and
2228 self.re_fun_name.match(iFun) and
2228 callable(oinfo['obj'])) :
2229 callable(oinfo['obj'])) :
2229 #print 'going auto' # dbg
2230 #print 'going auto' # dbg
2230 return self.handle_auto(line,continue_prompt,
2231 return self.handle_auto(line,continue_prompt,
2231 pre,iFun,theRest,oinfo['obj'])
2232 pre,iFun,theRest,oinfo['obj'])
2232 else:
2233 else:
2233 #print 'was callable?', callable(oinfo['obj']) # dbg
2234 #print 'was callable?', callable(oinfo['obj']) # dbg
2234 return self.handle_normal(line,continue_prompt)
2235 return self.handle_normal(line,continue_prompt)
2235
2236
2236 # If we get here, we have a normal Python line. Log and return.
2237 # If we get here, we have a normal Python line. Log and return.
2237 return self.handle_normal(line,continue_prompt)
2238 return self.handle_normal(line,continue_prompt)
2238
2239
2239 def _prefilter_dumb(self, line, continue_prompt):
2240 def _prefilter_dumb(self, line, continue_prompt):
2240 """simple prefilter function, for debugging"""
2241 """simple prefilter function, for debugging"""
2241 return self.handle_normal(line,continue_prompt)
2242 return self.handle_normal(line,continue_prompt)
2242
2243
2243
2244
2244 def multiline_prefilter(self, line, continue_prompt):
2245 def multiline_prefilter(self, line, continue_prompt):
2245 """ Run _prefilter for each line of input
2246 """ Run _prefilter for each line of input
2246
2247
2247 Covers cases where there are multiple lines in the user entry,
2248 Covers cases where there are multiple lines in the user entry,
2248 which is the case when the user goes back to a multiline history
2249 which is the case when the user goes back to a multiline history
2249 entry and presses enter.
2250 entry and presses enter.
2250
2251
2251 """
2252 """
2252 out = []
2253 out = []
2253 for l in line.rstrip('\n').split('\n'):
2254 for l in line.rstrip('\n').split('\n'):
2254 out.append(self._prefilter(l, continue_prompt))
2255 out.append(self._prefilter(l, continue_prompt))
2255 return '\n'.join(out)
2256 return '\n'.join(out)
2256
2257
2257 # Set the default prefilter() function (this can be user-overridden)
2258 # Set the default prefilter() function (this can be user-overridden)
2258 prefilter = multiline_prefilter
2259 prefilter = multiline_prefilter
2259
2260
2260 def handle_normal(self,line,continue_prompt=None,
2261 def handle_normal(self,line,continue_prompt=None,
2261 pre=None,iFun=None,theRest=None):
2262 pre=None,iFun=None,theRest=None):
2262 """Handle normal input lines. Use as a template for handlers."""
2263 """Handle normal input lines. Use as a template for handlers."""
2263
2264
2264 # With autoindent on, we need some way to exit the input loop, and I
2265 # With autoindent on, we need some way to exit the input loop, and I
2265 # don't want to force the user to have to backspace all the way to
2266 # don't want to force the user to have to backspace all the way to
2266 # clear the line. The rule will be in this case, that either two
2267 # clear the line. The rule will be in this case, that either two
2267 # lines of pure whitespace in a row, or a line of pure whitespace but
2268 # lines of pure whitespace in a row, or a line of pure whitespace but
2268 # of a size different to the indent level, will exit the input loop.
2269 # of a size different to the indent level, will exit the input loop.
2269
2270
2270 if (continue_prompt and self.autoindent and line.isspace() and
2271 if (continue_prompt and self.autoindent and line.isspace() and
2271 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2272 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2272 (self.buffer[-1]).isspace() )):
2273 (self.buffer[-1]).isspace() )):
2273 line = ''
2274 line = ''
2274
2275
2275 self.log(line,line,continue_prompt)
2276 self.log(line,line,continue_prompt)
2276 return line
2277 return line
2277
2278
2278 def handle_alias(self,line,continue_prompt=None,
2279 def handle_alias(self,line,continue_prompt=None,
2279 pre=None,iFun=None,theRest=None):
2280 pre=None,iFun=None,theRest=None):
2280 """Handle alias input lines. """
2281 """Handle alias input lines. """
2281
2282
2282 # pre is needed, because it carries the leading whitespace. Otherwise
2283 # pre is needed, because it carries the leading whitespace. Otherwise
2283 # aliases won't work in indented sections.
2284 # aliases won't work in indented sections.
2284 transformed = self.expand_aliases(iFun, theRest)
2285 transformed = self.expand_aliases(iFun, theRest)
2285 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
2286 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
2286 self.log(line,line_out,continue_prompt)
2287 self.log(line,line_out,continue_prompt)
2287 #print 'line out:',line_out # dbg
2288 #print 'line out:',line_out # dbg
2288 return line_out
2289 return line_out
2289
2290
2290 def handle_shell_escape(self, line, continue_prompt=None,
2291 def handle_shell_escape(self, line, continue_prompt=None,
2291 pre=None,iFun=None,theRest=None):
2292 pre=None,iFun=None,theRest=None):
2292 """Execute the line in a shell, empty return value"""
2293 """Execute the line in a shell, empty return value"""
2293
2294
2294 #print 'line in :', `line` # dbg
2295 #print 'line in :', `line` # dbg
2295 # Example of a special handler. Others follow a similar pattern.
2296 # Example of a special handler. Others follow a similar pattern.
2296 if line.lstrip().startswith('!!'):
2297 if line.lstrip().startswith('!!'):
2297 # rewrite iFun/theRest to properly hold the call to %sx and
2298 # rewrite iFun/theRest to properly hold the call to %sx and
2298 # the actual command to be executed, so handle_magic can work
2299 # the actual command to be executed, so handle_magic can work
2299 # correctly
2300 # correctly
2300 theRest = '%s %s' % (iFun[2:],theRest)
2301 theRest = '%s %s' % (iFun[2:],theRest)
2301 iFun = 'sx'
2302 iFun = 'sx'
2302 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2303 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2303 line.lstrip()[2:]),
2304 line.lstrip()[2:]),
2304 continue_prompt,pre,iFun,theRest)
2305 continue_prompt,pre,iFun,theRest)
2305 else:
2306 else:
2306 cmd=line.lstrip().lstrip('!')
2307 cmd=line.lstrip().lstrip('!')
2307 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2308 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2308 # update cache/log and return
2309 # update cache/log and return
2309 self.log(line,line_out,continue_prompt)
2310 self.log(line,line_out,continue_prompt)
2310 return line_out
2311 return line_out
2311
2312
2312 def handle_magic(self, line, continue_prompt=None,
2313 def handle_magic(self, line, continue_prompt=None,
2313 pre=None,iFun=None,theRest=None):
2314 pre=None,iFun=None,theRest=None):
2314 """Execute magic functions."""
2315 """Execute magic functions."""
2315
2316
2316
2317
2317 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2318 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2318 self.log(line,cmd,continue_prompt)
2319 self.log(line,cmd,continue_prompt)
2319 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2320 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2320 return cmd
2321 return cmd
2321
2322
2322 def handle_auto(self, line, continue_prompt=None,
2323 def handle_auto(self, line, continue_prompt=None,
2323 pre=None,iFun=None,theRest=None,obj=None):
2324 pre=None,iFun=None,theRest=None,obj=None):
2324 """Hande lines which can be auto-executed, quoting if requested."""
2325 """Hande lines which can be auto-executed, quoting if requested."""
2325
2326
2326 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2327 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2327
2328
2328 # This should only be active for single-line input!
2329 # This should only be active for single-line input!
2329 if continue_prompt:
2330 if continue_prompt:
2330 self.log(line,line,continue_prompt)
2331 self.log(line,line,continue_prompt)
2331 return line
2332 return line
2332
2333
2333 auto_rewrite = True
2334 auto_rewrite = True
2334
2335
2335 if pre == self.ESC_QUOTE:
2336 if pre == self.ESC_QUOTE:
2336 # Auto-quote splitting on whitespace
2337 # Auto-quote splitting on whitespace
2337 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2338 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2338 elif pre == self.ESC_QUOTE2:
2339 elif pre == self.ESC_QUOTE2:
2339 # Auto-quote whole string
2340 # Auto-quote whole string
2340 newcmd = '%s("%s")' % (iFun,theRest)
2341 newcmd = '%s("%s")' % (iFun,theRest)
2341 elif pre == self.ESC_PAREN:
2342 elif pre == self.ESC_PAREN:
2342 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2343 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2343 else:
2344 else:
2344 # Auto-paren.
2345 # Auto-paren.
2345 # We only apply it to argument-less calls if the autocall
2346 # We only apply it to argument-less calls if the autocall
2346 # parameter is set to 2. We only need to check that autocall is <
2347 # parameter is set to 2. We only need to check that autocall is <
2347 # 2, since this function isn't called unless it's at least 1.
2348 # 2, since this function isn't called unless it's at least 1.
2348 if not theRest and (self.rc.autocall < 2):
2349 if not theRest and (self.rc.autocall < 2):
2349 newcmd = '%s %s' % (iFun,theRest)
2350 newcmd = '%s %s' % (iFun,theRest)
2350 auto_rewrite = False
2351 auto_rewrite = False
2351 else:
2352 else:
2352 if theRest.startswith('['):
2353 if theRest.startswith('['):
2353 if hasattr(obj,'__getitem__'):
2354 if hasattr(obj,'__getitem__'):
2354 # Don't autocall in this case: item access for an object
2355 # Don't autocall in this case: item access for an object
2355 # which is BOTH callable and implements __getitem__.
2356 # which is BOTH callable and implements __getitem__.
2356 newcmd = '%s %s' % (iFun,theRest)
2357 newcmd = '%s %s' % (iFun,theRest)
2357 auto_rewrite = False
2358 auto_rewrite = False
2358 else:
2359 else:
2359 # if the object doesn't support [] access, go ahead and
2360 # if the object doesn't support [] access, go ahead and
2360 # autocall
2361 # autocall
2361 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2362 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2362 elif theRest.endswith(';'):
2363 elif theRest.endswith(';'):
2363 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2364 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2364 else:
2365 else:
2365 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2366 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2366
2367
2367 if auto_rewrite:
2368 if auto_rewrite:
2368 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2369 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2369 # log what is now valid Python, not the actual user input (without the
2370 # log what is now valid Python, not the actual user input (without the
2370 # final newline)
2371 # final newline)
2371 self.log(line,newcmd,continue_prompt)
2372 self.log(line,newcmd,continue_prompt)
2372 return newcmd
2373 return newcmd
2373
2374
2374 def handle_help(self, line, continue_prompt=None,
2375 def handle_help(self, line, continue_prompt=None,
2375 pre=None,iFun=None,theRest=None):
2376 pre=None,iFun=None,theRest=None):
2376 """Try to get some help for the object.
2377 """Try to get some help for the object.
2377
2378
2378 obj? or ?obj -> basic information.
2379 obj? or ?obj -> basic information.
2379 obj?? or ??obj -> more details.
2380 obj?? or ??obj -> more details.
2380 """
2381 """
2381
2382
2382 # We need to make sure that we don't process lines which would be
2383 # We need to make sure that we don't process lines which would be
2383 # otherwise valid python, such as "x=1 # what?"
2384 # otherwise valid python, such as "x=1 # what?"
2384 try:
2385 try:
2385 codeop.compile_command(line)
2386 codeop.compile_command(line)
2386 except SyntaxError:
2387 except SyntaxError:
2387 # We should only handle as help stuff which is NOT valid syntax
2388 # We should only handle as help stuff which is NOT valid syntax
2388 if line[0]==self.ESC_HELP:
2389 if line[0]==self.ESC_HELP:
2389 line = line[1:]
2390 line = line[1:]
2390 elif line[-1]==self.ESC_HELP:
2391 elif line[-1]==self.ESC_HELP:
2391 line = line[:-1]
2392 line = line[:-1]
2392 self.log(line,'#?'+line,continue_prompt)
2393 self.log(line,'#?'+line,continue_prompt)
2393 if line:
2394 if line:
2394 #print 'line:<%r>' % line # dbg
2395 #print 'line:<%r>' % line # dbg
2395 self.magic_pinfo(line)
2396 self.magic_pinfo(line)
2396 else:
2397 else:
2397 page(self.usage,screen_lines=self.rc.screen_length)
2398 page(self.usage,screen_lines=self.rc.screen_length)
2398 return '' # Empty string is needed here!
2399 return '' # Empty string is needed here!
2399 except:
2400 except:
2400 # Pass any other exceptions through to the normal handler
2401 # Pass any other exceptions through to the normal handler
2401 return self.handle_normal(line,continue_prompt)
2402 return self.handle_normal(line,continue_prompt)
2402 else:
2403 else:
2403 # If the code compiles ok, we should handle it normally
2404 # If the code compiles ok, we should handle it normally
2404 return self.handle_normal(line,continue_prompt)
2405 return self.handle_normal(line,continue_prompt)
2405
2406
2406 def getapi(self):
2407 def getapi(self):
2407 """ Get an IPApi object for this shell instance
2408 """ Get an IPApi object for this shell instance
2408
2409
2409 Getting an IPApi object is always preferable to accessing the shell
2410 Getting an IPApi object is always preferable to accessing the shell
2410 directly, but this holds true especially for extensions.
2411 directly, but this holds true especially for extensions.
2411
2412
2412 It should always be possible to implement an extension with IPApi
2413 It should always be possible to implement an extension with IPApi
2413 alone. If not, contact maintainer to request an addition.
2414 alone. If not, contact maintainer to request an addition.
2414
2415
2415 """
2416 """
2416 return self.api
2417 return self.api
2417
2418
2418 def handle_emacs(self,line,continue_prompt=None,
2419 def handle_emacs(self,line,continue_prompt=None,
2419 pre=None,iFun=None,theRest=None):
2420 pre=None,iFun=None,theRest=None):
2420 """Handle input lines marked by python-mode."""
2421 """Handle input lines marked by python-mode."""
2421
2422
2422 # Currently, nothing is done. Later more functionality can be added
2423 # Currently, nothing is done. Later more functionality can be added
2423 # here if needed.
2424 # here if needed.
2424
2425
2425 # The input cache shouldn't be updated
2426 # The input cache shouldn't be updated
2426
2427
2427 return line
2428 return line
2428
2429
2429 def mktempfile(self,data=None):
2430 def mktempfile(self,data=None):
2430 """Make a new tempfile and return its filename.
2431 """Make a new tempfile and return its filename.
2431
2432
2432 This makes a call to tempfile.mktemp, but it registers the created
2433 This makes a call to tempfile.mktemp, but it registers the created
2433 filename internally so ipython cleans it up at exit time.
2434 filename internally so ipython cleans it up at exit time.
2434
2435
2435 Optional inputs:
2436 Optional inputs:
2436
2437
2437 - data(None): if data is given, it gets written out to the temp file
2438 - data(None): if data is given, it gets written out to the temp file
2438 immediately, and the file is closed again."""
2439 immediately, and the file is closed again."""
2439
2440
2440 filename = tempfile.mktemp('.py','ipython_edit_')
2441 filename = tempfile.mktemp('.py','ipython_edit_')
2441 self.tempfiles.append(filename)
2442 self.tempfiles.append(filename)
2442
2443
2443 if data:
2444 if data:
2444 tmp_file = open(filename,'w')
2445 tmp_file = open(filename,'w')
2445 tmp_file.write(data)
2446 tmp_file.write(data)
2446 tmp_file.close()
2447 tmp_file.close()
2447 return filename
2448 return filename
2448
2449
2449 def write(self,data):
2450 def write(self,data):
2450 """Write a string to the default output"""
2451 """Write a string to the default output"""
2451 Term.cout.write(data)
2452 Term.cout.write(data)
2452
2453
2453 def write_err(self,data):
2454 def write_err(self,data):
2454 """Write a string to the default error output"""
2455 """Write a string to the default error output"""
2455 Term.cerr.write(data)
2456 Term.cerr.write(data)
2456
2457
2457 def exit(self):
2458 def exit(self):
2458 """Handle interactive exit.
2459 """Handle interactive exit.
2459
2460
2460 This method sets the exit_now attribute."""
2461 This method sets the exit_now attribute."""
2461
2462
2462 if self.rc.confirm_exit:
2463 if self.rc.confirm_exit:
2463 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2464 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2464 self.exit_now = True
2465 self.exit_now = True
2465 else:
2466 else:
2466 self.exit_now = True
2467 self.exit_now = True
2467
2468
2468 def safe_execfile(self,fname,*where,**kw):
2469 def safe_execfile(self,fname,*where,**kw):
2469 """A safe version of the builtin execfile().
2470 """A safe version of the builtin execfile().
2470
2471
2471 This version will never throw an exception, and knows how to handle
2472 This version will never throw an exception, and knows how to handle
2472 ipython logs as well."""
2473 ipython logs as well."""
2473
2474
2474 def syspath_cleanup():
2475 def syspath_cleanup():
2475 """Internal cleanup routine for sys.path."""
2476 """Internal cleanup routine for sys.path."""
2476 if add_dname:
2477 if add_dname:
2477 try:
2478 try:
2478 sys.path.remove(dname)
2479 sys.path.remove(dname)
2479 except ValueError:
2480 except ValueError:
2480 # For some reason the user has already removed it, ignore.
2481 # For some reason the user has already removed it, ignore.
2481 pass
2482 pass
2482
2483
2483 fname = os.path.expanduser(fname)
2484 fname = os.path.expanduser(fname)
2484
2485
2485 # Find things also in current directory. This is needed to mimic the
2486 # Find things also in current directory. This is needed to mimic the
2486 # behavior of running a script from the system command line, where
2487 # behavior of running a script from the system command line, where
2487 # Python inserts the script's directory into sys.path
2488 # Python inserts the script's directory into sys.path
2488 dname = os.path.dirname(os.path.abspath(fname))
2489 dname = os.path.dirname(os.path.abspath(fname))
2489 add_dname = False
2490 add_dname = False
2490 if dname not in sys.path:
2491 if dname not in sys.path:
2491 sys.path.insert(0,dname)
2492 sys.path.insert(0,dname)
2492 add_dname = True
2493 add_dname = True
2493
2494
2494 try:
2495 try:
2495 xfile = open(fname)
2496 xfile = open(fname)
2496 except:
2497 except:
2497 print >> Term.cerr, \
2498 print >> Term.cerr, \
2498 'Could not open file <%s> for safe execution.' % fname
2499 'Could not open file <%s> for safe execution.' % fname
2499 syspath_cleanup()
2500 syspath_cleanup()
2500 return None
2501 return None
2501
2502
2502 kw.setdefault('islog',0)
2503 kw.setdefault('islog',0)
2503 kw.setdefault('quiet',1)
2504 kw.setdefault('quiet',1)
2504 kw.setdefault('exit_ignore',0)
2505 kw.setdefault('exit_ignore',0)
2505 first = xfile.readline()
2506 first = xfile.readline()
2506 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2507 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2507 xfile.close()
2508 xfile.close()
2508 # line by line execution
2509 # line by line execution
2509 if first.startswith(loghead) or kw['islog']:
2510 if first.startswith(loghead) or kw['islog']:
2510 print 'Loading log file <%s> one line at a time...' % fname
2511 print 'Loading log file <%s> one line at a time...' % fname
2511 if kw['quiet']:
2512 if kw['quiet']:
2512 stdout_save = sys.stdout
2513 stdout_save = sys.stdout
2513 sys.stdout = StringIO.StringIO()
2514 sys.stdout = StringIO.StringIO()
2514 try:
2515 try:
2515 globs,locs = where[0:2]
2516 globs,locs = where[0:2]
2516 except:
2517 except:
2517 try:
2518 try:
2518 globs = locs = where[0]
2519 globs = locs = where[0]
2519 except:
2520 except:
2520 globs = locs = globals()
2521 globs = locs = globals()
2521 badblocks = []
2522 badblocks = []
2522
2523
2523 # we also need to identify indented blocks of code when replaying
2524 # we also need to identify indented blocks of code when replaying
2524 # logs and put them together before passing them to an exec
2525 # logs and put them together before passing them to an exec
2525 # statement. This takes a bit of regexp and look-ahead work in the
2526 # statement. This takes a bit of regexp and look-ahead work in the
2526 # file. It's easiest if we swallow the whole thing in memory
2527 # file. It's easiest if we swallow the whole thing in memory
2527 # first, and manually walk through the lines list moving the
2528 # first, and manually walk through the lines list moving the
2528 # counter ourselves.
2529 # counter ourselves.
2529 indent_re = re.compile('\s+\S')
2530 indent_re = re.compile('\s+\S')
2530 xfile = open(fname)
2531 xfile = open(fname)
2531 filelines = xfile.readlines()
2532 filelines = xfile.readlines()
2532 xfile.close()
2533 xfile.close()
2533 nlines = len(filelines)
2534 nlines = len(filelines)
2534 lnum = 0
2535 lnum = 0
2535 while lnum < nlines:
2536 while lnum < nlines:
2536 line = filelines[lnum]
2537 line = filelines[lnum]
2537 lnum += 1
2538 lnum += 1
2538 # don't re-insert logger status info into cache
2539 # don't re-insert logger status info into cache
2539 if line.startswith('#log#'):
2540 if line.startswith('#log#'):
2540 continue
2541 continue
2541 else:
2542 else:
2542 # build a block of code (maybe a single line) for execution
2543 # build a block of code (maybe a single line) for execution
2543 block = line
2544 block = line
2544 try:
2545 try:
2545 next = filelines[lnum] # lnum has already incremented
2546 next = filelines[lnum] # lnum has already incremented
2546 except:
2547 except:
2547 next = None
2548 next = None
2548 while next and indent_re.match(next):
2549 while next and indent_re.match(next):
2549 block += next
2550 block += next
2550 lnum += 1
2551 lnum += 1
2551 try:
2552 try:
2552 next = filelines[lnum]
2553 next = filelines[lnum]
2553 except:
2554 except:
2554 next = None
2555 next = None
2555 # now execute the block of one or more lines
2556 # now execute the block of one or more lines
2556 try:
2557 try:
2557 exec block in globs,locs
2558 exec block in globs,locs
2558 except SystemExit:
2559 except SystemExit:
2559 pass
2560 pass
2560 except:
2561 except:
2561 badblocks.append(block.rstrip())
2562 badblocks.append(block.rstrip())
2562 if kw['quiet']: # restore stdout
2563 if kw['quiet']: # restore stdout
2563 sys.stdout.close()
2564 sys.stdout.close()
2564 sys.stdout = stdout_save
2565 sys.stdout = stdout_save
2565 print 'Finished replaying log file <%s>' % fname
2566 print 'Finished replaying log file <%s>' % fname
2566 if badblocks:
2567 if badblocks:
2567 print >> sys.stderr, ('\nThe following lines/blocks in file '
2568 print >> sys.stderr, ('\nThe following lines/blocks in file '
2568 '<%s> reported errors:' % fname)
2569 '<%s> reported errors:' % fname)
2569
2570
2570 for badline in badblocks:
2571 for badline in badblocks:
2571 print >> sys.stderr, badline
2572 print >> sys.stderr, badline
2572 else: # regular file execution
2573 else: # regular file execution
2573 try:
2574 try:
2574 if sys.platform == 'win32':
2575 if sys.platform == 'win32':
2575 # Work around a bug in Python for Windows. The bug was
2576 # Work around a bug in Python for Windows. The bug was
2576 # fixed in in Python 2.5 r54159 and 54158, but that's still
2577 # fixed in in Python 2.5 r54159 and 54158, but that's still
2577 # SVN Python as of March/07. For details, see:
2578 # SVN Python as of March/07. For details, see:
2578 # http://projects.scipy.org/ipython/ipython/ticket/123
2579 # http://projects.scipy.org/ipython/ipython/ticket/123
2579 exec file(fname) in where[0],where[1]
2580 exec file(fname) in where[0],where[1]
2580 else:
2581 else:
2581 execfile(fname,*where)
2582 execfile(fname,*where)
2582 except SyntaxError:
2583 except SyntaxError:
2583 self.showsyntaxerror()
2584 self.showsyntaxerror()
2584 warn('Failure executing file: <%s>' % fname)
2585 warn('Failure executing file: <%s>' % fname)
2585 except SystemExit,status:
2586 except SystemExit,status:
2586 if not kw['exit_ignore']:
2587 if not kw['exit_ignore']:
2587 self.showtraceback()
2588 self.showtraceback()
2588 warn('Failure executing file: <%s>' % fname)
2589 warn('Failure executing file: <%s>' % fname)
2589 except:
2590 except:
2590 self.showtraceback()
2591 self.showtraceback()
2591 warn('Failure executing file: <%s>' % fname)
2592 warn('Failure executing file: <%s>' % fname)
2592
2593
2593 syspath_cleanup()
2594 syspath_cleanup()
2594
2595
2595 #************************* end of file <iplib.py> *****************************
2596 #************************* end of file <iplib.py> *****************************
@@ -1,6436 +1,6440 b''
1 2007-04-02 Fernando Perez <Fernando.Perez@colorado.edu>
1 2007-04-02 Fernando Perez <Fernando.Perez@colorado.edu>
2
2
3 * IPython/completer.py (IPCompleter.complete): extend the
4 complete() call API to support completions by other mechanisms
5 than readline. Closes #109.
6
3 * IPython/iplib.py (safe_execfile): add a safeguard under Win32 to
7 * IPython/iplib.py (safe_execfile): add a safeguard under Win32 to
4 protect against a bug in Python's execfile(). Closes #123.
8 protect against a bug in Python's execfile(). Closes #123.
5
9
6 2007-04-01 Fernando Perez <Fernando.Perez@colorado.edu>
10 2007-04-01 Fernando Perez <Fernando.Perez@colorado.edu>
7
11
8 * IPython/iplib.py (split_user_input): ensure that when splitting
12 * IPython/iplib.py (split_user_input): ensure that when splitting
9 user input, the part that can be treated as a python name is pure
13 user input, the part that can be treated as a python name is pure
10 ascii (Python identifiers MUST be pure ascii). Part of the
14 ascii (Python identifiers MUST be pure ascii). Part of the
11 ongoing Unicode support work.
15 ongoing Unicode support work.
12
16
13 * IPython/Prompts.py (prompt_specials_color): Add \N for the
17 * IPython/Prompts.py (prompt_specials_color): Add \N for the
14 actual prompt number, without any coloring. This allows users to
18 actual prompt number, without any coloring. This allows users to
15 produce numbered prompts with their own colors. Added after a
19 produce numbered prompts with their own colors. Added after a
16 report/request by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
20 report/request by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
17
21
18 2007-03-31 Walter Doerwald <walter@livinglogic.de>
22 2007-03-31 Walter Doerwald <walter@livinglogic.de>
19
23
20 * IPython/Extensions/igrid.py: Map the return key
24 * IPython/Extensions/igrid.py: Map the return key
21 to enter() and shift-return to enterattr().
25 to enter() and shift-return to enterattr().
22
26
23 2007-03-30 Fernando Perez <Fernando.Perez@colorado.edu>
27 2007-03-30 Fernando Perez <Fernando.Perez@colorado.edu>
24
28
25 * IPython/Magic.py (magic_psearch): add unicode support by
29 * IPython/Magic.py (magic_psearch): add unicode support by
26 encoding to ascii the input, since this routine also only deals
30 encoding to ascii the input, since this routine also only deals
27 with valid Python names. Fixes a bug reported by Stefan.
31 with valid Python names. Fixes a bug reported by Stefan.
28
32
29 2007-03-29 Fernando Perez <Fernando.Perez@colorado.edu>
33 2007-03-29 Fernando Perez <Fernando.Perez@colorado.edu>
30
34
31 * IPython/Magic.py (_inspect): convert unicode input into ascii
35 * IPython/Magic.py (_inspect): convert unicode input into ascii
32 before trying to evaluate it as a Python identifier. This fixes a
36 before trying to evaluate it as a Python identifier. This fixes a
33 problem that the new unicode support had introduced when analyzing
37 problem that the new unicode support had introduced when analyzing
34 long definition lines for functions.
38 long definition lines for functions.
35
39
36 2007-03-24 Walter Doerwald <walter@livinglogic.de>
40 2007-03-24 Walter Doerwald <walter@livinglogic.de>
37
41
38 * IPython/Extensions/igrid.py: Fix picking. Using
42 * IPython/Extensions/igrid.py: Fix picking. Using
39 igrid with wxPython 2.6 and -wthread should work now.
43 igrid with wxPython 2.6 and -wthread should work now.
40 igrid.display() simply tries to create a frame without
44 igrid.display() simply tries to create a frame without
41 an application. Only if this fails an application is created.
45 an application. Only if this fails an application is created.
42
46
43 2007-03-23 Walter Doerwald <walter@livinglogic.de>
47 2007-03-23 Walter Doerwald <walter@livinglogic.de>
44
48
45 * IPython/Extensions/path.py: Updated to version 2.2.
49 * IPython/Extensions/path.py: Updated to version 2.2.
46
50
47 2007-03-23 Ville Vainio <vivainio@gmail.com>
51 2007-03-23 Ville Vainio <vivainio@gmail.com>
48
52
49 * iplib.py: recursive alias expansion now works better, so that
53 * iplib.py: recursive alias expansion now works better, so that
50 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
54 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
51 doesn't trip up the process, if 'd' has been aliased to 'ls'.
55 doesn't trip up the process, if 'd' has been aliased to 'ls'.
52
56
53 * Extensions/ipy_gnuglobal.py added, provides %global magic
57 * Extensions/ipy_gnuglobal.py added, provides %global magic
54 for users of http://www.gnu.org/software/global
58 for users of http://www.gnu.org/software/global
55
59
56 * iplib.py: '!command /?' now doesn't invoke IPython's help system.
60 * iplib.py: '!command /?' now doesn't invoke IPython's help system.
57 Closes #52. Patch by Stefan van der Walt.
61 Closes #52. Patch by Stefan van der Walt.
58
62
59 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
63 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
60
64
61 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
65 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
62 respect the __file__ attribute when using %run. Thanks to a bug
66 respect the __file__ attribute when using %run. Thanks to a bug
63 report by Sebastian Rooks <sebastian.rooks-AT-free.fr>.
67 report by Sebastian Rooks <sebastian.rooks-AT-free.fr>.
64
68
65 2007-03-22 Fernando Perez <Fernando.Perez@colorado.edu>
69 2007-03-22 Fernando Perez <Fernando.Perez@colorado.edu>
66
70
67 * IPython/iplib.py (raw_input): Fix mishandling of unicode at
71 * IPython/iplib.py (raw_input): Fix mishandling of unicode at
68 input. Patch sent by Stefan.
72 input. Patch sent by Stefan.
69
73
70 2007-03-20 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
74 2007-03-20 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
71 * IPython/Extensions/ipy_stock_completer.py
75 * IPython/Extensions/ipy_stock_completer.py
72 shlex_split, fix bug in shlex_split. len function
76 shlex_split, fix bug in shlex_split. len function
73 call was missing in if statement. Caused shlex_split to
77 call was missing in if statement. Caused shlex_split to
74 sometimes return "" as last element.
78 sometimes return "" as last element.
75
79
76 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
80 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
77
81
78 * IPython/completer.py
82 * IPython/completer.py
79 (IPCompleter.file_matches.single_dir_expand): fix a problem
83 (IPCompleter.file_matches.single_dir_expand): fix a problem
80 reported by Stefan, where directories containign a single subdir
84 reported by Stefan, where directories containign a single subdir
81 would be completed too early.
85 would be completed too early.
82
86
83 * IPython/Shell.py (_load_pylab): Make the execution of 'from
87 * IPython/Shell.py (_load_pylab): Make the execution of 'from
84 pylab import *' when -pylab is given be optional. A new flag,
88 pylab import *' when -pylab is given be optional. A new flag,
85 pylab_import_all controls this behavior, the default is True for
89 pylab_import_all controls this behavior, the default is True for
86 backwards compatibility.
90 backwards compatibility.
87
91
88 * IPython/ultraTB.py (_formatTracebackLines): Added (slightly
92 * IPython/ultraTB.py (_formatTracebackLines): Added (slightly
89 modified) R. Bernstein's patch for fully syntax highlighted
93 modified) R. Bernstein's patch for fully syntax highlighted
90 tracebacks. The functionality is also available under ultraTB for
94 tracebacks. The functionality is also available under ultraTB for
91 non-ipython users (someone using ultraTB but outside an ipython
95 non-ipython users (someone using ultraTB but outside an ipython
92 session). They can select the color scheme by setting the
96 session). They can select the color scheme by setting the
93 module-level global DEFAULT_SCHEME. The highlight functionality
97 module-level global DEFAULT_SCHEME. The highlight functionality
94 also works when debugging.
98 also works when debugging.
95
99
96 * IPython/genutils.py (IOStream.close): small patch by
100 * IPython/genutils.py (IOStream.close): small patch by
97 R. Bernstein for improved pydb support.
101 R. Bernstein for improved pydb support.
98
102
99 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
103 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
100 DaveS <davls@telus.net> to improve support of debugging under
104 DaveS <davls@telus.net> to improve support of debugging under
101 NTEmacs, including improved pydb behavior.
105 NTEmacs, including improved pydb behavior.
102
106
103 * IPython/Magic.py (magic_prun): Fix saving of profile info for
107 * IPython/Magic.py (magic_prun): Fix saving of profile info for
104 Python 2.5, where the stats object API changed a little. Thanks
108 Python 2.5, where the stats object API changed a little. Thanks
105 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
109 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
106
110
107 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
111 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
108 Pernetty's patch to improve support for (X)Emacs under Win32.
112 Pernetty's patch to improve support for (X)Emacs under Win32.
109
113
110 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
114 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
111
115
112 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
116 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
113 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
117 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
114 a report by Nik Tautenhahn.
118 a report by Nik Tautenhahn.
115
119
116 2007-03-16 Walter Doerwald <walter@livinglogic.de>
120 2007-03-16 Walter Doerwald <walter@livinglogic.de>
117
121
118 * setup.py: Add the igrid help files to the list of data files
122 * setup.py: Add the igrid help files to the list of data files
119 to be installed alongside igrid.
123 to be installed alongside igrid.
120 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
124 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
121 Show the input object of the igrid browser as the window tile.
125 Show the input object of the igrid browser as the window tile.
122 Show the object the cursor is on in the statusbar.
126 Show the object the cursor is on in the statusbar.
123
127
124 2007-03-15 Ville Vainio <vivainio@gmail.com>
128 2007-03-15 Ville Vainio <vivainio@gmail.com>
125
129
126 * Extensions/ipy_stock_completers.py: Fixed exception
130 * Extensions/ipy_stock_completers.py: Fixed exception
127 on mismatching quotes in %run completer. Patch by
131 on mismatching quotes in %run completer. Patch by
128 JοΏ½rgen Stenarson. Closes #127.
132 JοΏ½rgen Stenarson. Closes #127.
129
133
130 2007-03-14 Ville Vainio <vivainio@gmail.com>
134 2007-03-14 Ville Vainio <vivainio@gmail.com>
131
135
132 * Extensions/ext_rehashdir.py: Do not do auto_alias
136 * Extensions/ext_rehashdir.py: Do not do auto_alias
133 in %rehashdir, it clobbers %store'd aliases.
137 in %rehashdir, it clobbers %store'd aliases.
134
138
135 * UserConfig/ipy_profile_sh.py: envpersist.py extension
139 * UserConfig/ipy_profile_sh.py: envpersist.py extension
136 (beefed up %env) imported for sh profile.
140 (beefed up %env) imported for sh profile.
137
141
138 2007-03-10 Walter Doerwald <walter@livinglogic.de>
142 2007-03-10 Walter Doerwald <walter@livinglogic.de>
139
143
140 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
144 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
141 as the default browser.
145 as the default browser.
142 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
146 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
143 As igrid displays all attributes it ever encounters, fetch() (which has
147 As igrid displays all attributes it ever encounters, fetch() (which has
144 been renamed to _fetch()) doesn't have to recalculate the display attributes
148 been renamed to _fetch()) doesn't have to recalculate the display attributes
145 every time a new item is fetched. This should speed up scrolling.
149 every time a new item is fetched. This should speed up scrolling.
146
150
147 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
151 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
148
152
149 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
153 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
150 Schmolck's recently reported tab-completion bug (my previous one
154 Schmolck's recently reported tab-completion bug (my previous one
151 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
155 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
152
156
153 2007-03-09 Walter Doerwald <walter@livinglogic.de>
157 2007-03-09 Walter Doerwald <walter@livinglogic.de>
154
158
155 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
159 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
156 Close help window if exiting igrid.
160 Close help window if exiting igrid.
157
161
158 2007-03-02 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
162 2007-03-02 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
159
163
160 * IPython/Extensions/ipy_defaults.py: Check if readline is available
164 * IPython/Extensions/ipy_defaults.py: Check if readline is available
161 before calling functions from readline.
165 before calling functions from readline.
162
166
163 2007-03-02 Walter Doerwald <walter@livinglogic.de>
167 2007-03-02 Walter Doerwald <walter@livinglogic.de>
164
168
165 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
169 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
166 igrid is a wxPython-based display object for ipipe. If your system has
170 igrid is a wxPython-based display object for ipipe. If your system has
167 wx installed igrid will be the default display. Without wx ipipe falls
171 wx installed igrid will be the default display. Without wx ipipe falls
168 back to ibrowse (which needs curses). If no curses is installed ipipe
172 back to ibrowse (which needs curses). If no curses is installed ipipe
169 falls back to idump.
173 falls back to idump.
170
174
171 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
175 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
172
176
173 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
177 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
174 my changes from yesterday, they introduced bugs. Will reactivate
178 my changes from yesterday, they introduced bugs. Will reactivate
175 once I get a correct solution, which will be much easier thanks to
179 once I get a correct solution, which will be much easier thanks to
176 Dan Milstein's new prefilter test suite.
180 Dan Milstein's new prefilter test suite.
177
181
178 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
182 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
179
183
180 * IPython/iplib.py (split_user_input): fix input splitting so we
184 * IPython/iplib.py (split_user_input): fix input splitting so we
181 don't attempt attribute accesses on things that can't possibly be
185 don't attempt attribute accesses on things that can't possibly be
182 valid Python attributes. After a bug report by Alex Schmolck.
186 valid Python attributes. After a bug report by Alex Schmolck.
183 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
187 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
184 %magic with explicit % prefix.
188 %magic with explicit % prefix.
185
189
186 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
190 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
187
191
188 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
192 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
189 avoid a DeprecationWarning from GTK.
193 avoid a DeprecationWarning from GTK.
190
194
191 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
195 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
192
196
193 * IPython/genutils.py (clock): I modified clock() to return total
197 * IPython/genutils.py (clock): I modified clock() to return total
194 time, user+system. This is a more commonly needed metric. I also
198 time, user+system. This is a more commonly needed metric. I also
195 introduced the new clocku/clocks to get only user/system time if
199 introduced the new clocku/clocks to get only user/system time if
196 one wants those instead.
200 one wants those instead.
197
201
198 ***WARNING: API CHANGE*** clock() used to return only user time,
202 ***WARNING: API CHANGE*** clock() used to return only user time,
199 so if you want exactly the same results as before, use clocku
203 so if you want exactly the same results as before, use clocku
200 instead.
204 instead.
201
205
202 2007-02-22 Ville Vainio <vivainio@gmail.com>
206 2007-02-22 Ville Vainio <vivainio@gmail.com>
203
207
204 * IPython/Extensions/ipy_p4.py: Extension for improved
208 * IPython/Extensions/ipy_p4.py: Extension for improved
205 p4 (perforce version control system) experience.
209 p4 (perforce version control system) experience.
206 Adds %p4 magic with p4 command completion and
210 Adds %p4 magic with p4 command completion and
207 automatic -G argument (marshall output as python dict)
211 automatic -G argument (marshall output as python dict)
208
212
209 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
213 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
210
214
211 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
215 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
212 stop marks.
216 stop marks.
213 (ClearingMixin): a simple mixin to easily make a Demo class clear
217 (ClearingMixin): a simple mixin to easily make a Demo class clear
214 the screen in between blocks and have empty marquees. The
218 the screen in between blocks and have empty marquees. The
215 ClearDemo and ClearIPDemo classes that use it are included.
219 ClearDemo and ClearIPDemo classes that use it are included.
216
220
217 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
221 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
218
222
219 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
223 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
220 protect against exceptions at Python shutdown time. Patch
224 protect against exceptions at Python shutdown time. Patch
221 sumbmitted to upstream.
225 sumbmitted to upstream.
222
226
223 2007-02-14 Walter Doerwald <walter@livinglogic.de>
227 2007-02-14 Walter Doerwald <walter@livinglogic.de>
224
228
225 * IPython/Extensions/ibrowse.py: If entering the first object level
229 * IPython/Extensions/ibrowse.py: If entering the first object level
226 (i.e. the object for which the browser has been started) fails,
230 (i.e. the object for which the browser has been started) fails,
227 now the error is raised directly (aborting the browser) instead of
231 now the error is raised directly (aborting the browser) instead of
228 running into an empty levels list later.
232 running into an empty levels list later.
229
233
230 2007-02-03 Walter Doerwald <walter@livinglogic.de>
234 2007-02-03 Walter Doerwald <walter@livinglogic.de>
231
235
232 * IPython/Extensions/ipipe.py: Add an xrepr implementation
236 * IPython/Extensions/ipipe.py: Add an xrepr implementation
233 for the noitem object.
237 for the noitem object.
234
238
235 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
239 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
236
240
237 * IPython/completer.py (Completer.attr_matches): Fix small
241 * IPython/completer.py (Completer.attr_matches): Fix small
238 tab-completion bug with Enthought Traits objects with units.
242 tab-completion bug with Enthought Traits objects with units.
239 Thanks to a bug report by Tom Denniston
243 Thanks to a bug report by Tom Denniston
240 <tom.denniston-AT-alum.dartmouth.org>.
244 <tom.denniston-AT-alum.dartmouth.org>.
241
245
242 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
246 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
243
247
244 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
248 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
245 bug where only .ipy or .py would be completed. Once the first
249 bug where only .ipy or .py would be completed. Once the first
246 argument to %run has been given, all completions are valid because
250 argument to %run has been given, all completions are valid because
247 they are the arguments to the script, which may well be non-python
251 they are the arguments to the script, which may well be non-python
248 filenames.
252 filenames.
249
253
250 * IPython/irunner.py (InteractiveRunner.run_source): major updates
254 * IPython/irunner.py (InteractiveRunner.run_source): major updates
251 to irunner to allow it to correctly support real doctesting of
255 to irunner to allow it to correctly support real doctesting of
252 out-of-process ipython code.
256 out-of-process ipython code.
253
257
254 * IPython/Magic.py (magic_cd): Make the setting of the terminal
258 * IPython/Magic.py (magic_cd): Make the setting of the terminal
255 title an option (-noterm_title) because it completely breaks
259 title an option (-noterm_title) because it completely breaks
256 doctesting.
260 doctesting.
257
261
258 * IPython/demo.py: fix IPythonDemo class that was not actually working.
262 * IPython/demo.py: fix IPythonDemo class that was not actually working.
259
263
260 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
264 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
261
265
262 * IPython/irunner.py (main): fix small bug where extensions were
266 * IPython/irunner.py (main): fix small bug where extensions were
263 not being correctly recognized.
267 not being correctly recognized.
264
268
265 2007-01-23 Walter Doerwald <walter@livinglogic.de>
269 2007-01-23 Walter Doerwald <walter@livinglogic.de>
266
270
267 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
271 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
268 a string containing a single line yields the string itself as the
272 a string containing a single line yields the string itself as the
269 only item.
273 only item.
270
274
271 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
275 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
272 object if it's the same as the one on the last level (This avoids
276 object if it's the same as the one on the last level (This avoids
273 infinite recursion for one line strings).
277 infinite recursion for one line strings).
274
278
275 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
279 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
276
280
277 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
281 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
278 all output streams before printing tracebacks. This ensures that
282 all output streams before printing tracebacks. This ensures that
279 user output doesn't end up interleaved with traceback output.
283 user output doesn't end up interleaved with traceback output.
280
284
281 2007-01-10 Ville Vainio <vivainio@gmail.com>
285 2007-01-10 Ville Vainio <vivainio@gmail.com>
282
286
283 * Extensions/envpersist.py: Turbocharged %env that remembers
287 * Extensions/envpersist.py: Turbocharged %env that remembers
284 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
288 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
285 "%env VISUAL=jed".
289 "%env VISUAL=jed".
286
290
287 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
291 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
288
292
289 * IPython/iplib.py (showtraceback): ensure that we correctly call
293 * IPython/iplib.py (showtraceback): ensure that we correctly call
290 custom handlers in all cases (some with pdb were slipping through,
294 custom handlers in all cases (some with pdb were slipping through,
291 but I'm not exactly sure why).
295 but I'm not exactly sure why).
292
296
293 * IPython/Debugger.py (Tracer.__init__): added new class to
297 * IPython/Debugger.py (Tracer.__init__): added new class to
294 support set_trace-like usage of IPython's enhanced debugger.
298 support set_trace-like usage of IPython's enhanced debugger.
295
299
296 2006-12-24 Ville Vainio <vivainio@gmail.com>
300 2006-12-24 Ville Vainio <vivainio@gmail.com>
297
301
298 * ipmaker.py: more informative message when ipy_user_conf
302 * ipmaker.py: more informative message when ipy_user_conf
299 import fails (suggest running %upgrade).
303 import fails (suggest running %upgrade).
300
304
301 * tools/run_ipy_in_profiler.py: Utility to see where
305 * tools/run_ipy_in_profiler.py: Utility to see where
302 the time during IPython startup is spent.
306 the time during IPython startup is spent.
303
307
304 2006-12-20 Ville Vainio <vivainio@gmail.com>
308 2006-12-20 Ville Vainio <vivainio@gmail.com>
305
309
306 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
310 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
307
311
308 * ipapi.py: Add new ipapi method, expand_alias.
312 * ipapi.py: Add new ipapi method, expand_alias.
309
313
310 * Release.py: Bump up version to 0.7.4.svn
314 * Release.py: Bump up version to 0.7.4.svn
311
315
312 2006-12-17 Ville Vainio <vivainio@gmail.com>
316 2006-12-17 Ville Vainio <vivainio@gmail.com>
313
317
314 * Extensions/jobctrl.py: Fixed &cmd arg arg...
318 * Extensions/jobctrl.py: Fixed &cmd arg arg...
315 to work properly on posix too
319 to work properly on posix too
316
320
317 * Release.py: Update revnum (version is still just 0.7.3).
321 * Release.py: Update revnum (version is still just 0.7.3).
318
322
319 2006-12-15 Ville Vainio <vivainio@gmail.com>
323 2006-12-15 Ville Vainio <vivainio@gmail.com>
320
324
321 * scripts/ipython_win_post_install: create ipython.py in
325 * scripts/ipython_win_post_install: create ipython.py in
322 prefix + "/scripts".
326 prefix + "/scripts".
323
327
324 * Release.py: Update version to 0.7.3.
328 * Release.py: Update version to 0.7.3.
325
329
326 2006-12-14 Ville Vainio <vivainio@gmail.com>
330 2006-12-14 Ville Vainio <vivainio@gmail.com>
327
331
328 * scripts/ipython_win_post_install: Overwrite old shortcuts
332 * scripts/ipython_win_post_install: Overwrite old shortcuts
329 if they already exist
333 if they already exist
330
334
331 * Release.py: release 0.7.3rc2
335 * Release.py: release 0.7.3rc2
332
336
333 2006-12-13 Ville Vainio <vivainio@gmail.com>
337 2006-12-13 Ville Vainio <vivainio@gmail.com>
334
338
335 * Branch and update Release.py for 0.7.3rc1
339 * Branch and update Release.py for 0.7.3rc1
336
340
337 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
341 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
338
342
339 * IPython/Shell.py (IPShellWX): update for current WX naming
343 * IPython/Shell.py (IPShellWX): update for current WX naming
340 conventions, to avoid a deprecation warning with current WX
344 conventions, to avoid a deprecation warning with current WX
341 versions. Thanks to a report by Danny Shevitz.
345 versions. Thanks to a report by Danny Shevitz.
342
346
343 2006-12-12 Ville Vainio <vivainio@gmail.com>
347 2006-12-12 Ville Vainio <vivainio@gmail.com>
344
348
345 * ipmaker.py: apply david cournapeau's patch to make
349 * ipmaker.py: apply david cournapeau's patch to make
346 import_some work properly even when ipythonrc does
350 import_some work properly even when ipythonrc does
347 import_some on empty list (it was an old bug!).
351 import_some on empty list (it was an old bug!).
348
352
349 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
353 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
350 Add deprecation note to ipythonrc and a url to wiki
354 Add deprecation note to ipythonrc and a url to wiki
351 in ipy_user_conf.py
355 in ipy_user_conf.py
352
356
353
357
354 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
358 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
355 as if it was typed on IPython command prompt, i.e.
359 as if it was typed on IPython command prompt, i.e.
356 as IPython script.
360 as IPython script.
357
361
358 * example-magic.py, magic_grepl.py: remove outdated examples
362 * example-magic.py, magic_grepl.py: remove outdated examples
359
363
360 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
364 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
361
365
362 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
366 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
363 is called before any exception has occurred.
367 is called before any exception has occurred.
364
368
365 2006-12-08 Ville Vainio <vivainio@gmail.com>
369 2006-12-08 Ville Vainio <vivainio@gmail.com>
366
370
367 * Extensions/ipy_stock_completers.py: fix cd completer
371 * Extensions/ipy_stock_completers.py: fix cd completer
368 to translate /'s to \'s again.
372 to translate /'s to \'s again.
369
373
370 * completer.py: prevent traceback on file completions w/
374 * completer.py: prevent traceback on file completions w/
371 backslash.
375 backslash.
372
376
373 * Release.py: Update release number to 0.7.3b3 for release
377 * Release.py: Update release number to 0.7.3b3 for release
374
378
375 2006-12-07 Ville Vainio <vivainio@gmail.com>
379 2006-12-07 Ville Vainio <vivainio@gmail.com>
376
380
377 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
381 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
378 while executing external code. Provides more shell-like behaviour
382 while executing external code. Provides more shell-like behaviour
379 and overall better response to ctrl + C / ctrl + break.
383 and overall better response to ctrl + C / ctrl + break.
380
384
381 * tools/make_tarball.py: new script to create tarball straight from svn
385 * tools/make_tarball.py: new script to create tarball straight from svn
382 (setup.py sdist doesn't work on win32).
386 (setup.py sdist doesn't work on win32).
383
387
384 * Extensions/ipy_stock_completers.py: fix cd completer to give up
388 * Extensions/ipy_stock_completers.py: fix cd completer to give up
385 on dirnames with spaces and use the default completer instead.
389 on dirnames with spaces and use the default completer instead.
386
390
387 * Revision.py: Change version to 0.7.3b2 for release.
391 * Revision.py: Change version to 0.7.3b2 for release.
388
392
389 2006-12-05 Ville Vainio <vivainio@gmail.com>
393 2006-12-05 Ville Vainio <vivainio@gmail.com>
390
394
391 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
395 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
392 pydb patch 4 (rm debug printing, py 2.5 checking)
396 pydb patch 4 (rm debug printing, py 2.5 checking)
393
397
394 2006-11-30 Walter Doerwald <walter@livinglogic.de>
398 2006-11-30 Walter Doerwald <walter@livinglogic.de>
395 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
399 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
396 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
400 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
397 "refreshfind" (mapped to "R") does the same but tries to go back to the same
401 "refreshfind" (mapped to "R") does the same but tries to go back to the same
398 object the cursor was on before the refresh. The command "markrange" is
402 object the cursor was on before the refresh. The command "markrange" is
399 mapped to "%" now.
403 mapped to "%" now.
400 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
404 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
401
405
402 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
406 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
403
407
404 * IPython/Magic.py (magic_debug): new %debug magic to activate the
408 * IPython/Magic.py (magic_debug): new %debug magic to activate the
405 interactive debugger on the last traceback, without having to call
409 interactive debugger on the last traceback, without having to call
406 %pdb and rerun your code. Made minor changes in various modules,
410 %pdb and rerun your code. Made minor changes in various modules,
407 should automatically recognize pydb if available.
411 should automatically recognize pydb if available.
408
412
409 2006-11-28 Ville Vainio <vivainio@gmail.com>
413 2006-11-28 Ville Vainio <vivainio@gmail.com>
410
414
411 * completer.py: If the text start with !, show file completions
415 * completer.py: If the text start with !, show file completions
412 properly. This helps when trying to complete command name
416 properly. This helps when trying to complete command name
413 for shell escapes.
417 for shell escapes.
414
418
415 2006-11-27 Ville Vainio <vivainio@gmail.com>
419 2006-11-27 Ville Vainio <vivainio@gmail.com>
416
420
417 * ipy_stock_completers.py: bzr completer submitted by Stefan van
421 * ipy_stock_completers.py: bzr completer submitted by Stefan van
418 der Walt. Clean up svn and hg completers by using a common
422 der Walt. Clean up svn and hg completers by using a common
419 vcs_completer.
423 vcs_completer.
420
424
421 2006-11-26 Ville Vainio <vivainio@gmail.com>
425 2006-11-26 Ville Vainio <vivainio@gmail.com>
422
426
423 * Remove ipconfig and %config; you should use _ip.options structure
427 * Remove ipconfig and %config; you should use _ip.options structure
424 directly instead!
428 directly instead!
425
429
426 * genutils.py: add wrap_deprecated function for deprecating callables
430 * genutils.py: add wrap_deprecated function for deprecating callables
427
431
428 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
432 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
429 _ip.system instead. ipalias is redundant.
433 _ip.system instead. ipalias is redundant.
430
434
431 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
435 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
432 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
436 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
433 explicit.
437 explicit.
434
438
435 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
439 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
436 completer. Try it by entering 'hg ' and pressing tab.
440 completer. Try it by entering 'hg ' and pressing tab.
437
441
438 * macro.py: Give Macro a useful __repr__ method
442 * macro.py: Give Macro a useful __repr__ method
439
443
440 * Magic.py: %whos abbreviates the typename of Macro for brevity.
444 * Magic.py: %whos abbreviates the typename of Macro for brevity.
441
445
442 2006-11-24 Walter Doerwald <walter@livinglogic.de>
446 2006-11-24 Walter Doerwald <walter@livinglogic.de>
443 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
447 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
444 we don't get a duplicate ipipe module, where registration of the xrepr
448 we don't get a duplicate ipipe module, where registration of the xrepr
445 implementation for Text is useless.
449 implementation for Text is useless.
446
450
447 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
451 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
448
452
449 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
453 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
450
454
451 2006-11-24 Ville Vainio <vivainio@gmail.com>
455 2006-11-24 Ville Vainio <vivainio@gmail.com>
452
456
453 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
457 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
454 try to use "cProfile" instead of the slower pure python
458 try to use "cProfile" instead of the slower pure python
455 "profile"
459 "profile"
456
460
457 2006-11-23 Ville Vainio <vivainio@gmail.com>
461 2006-11-23 Ville Vainio <vivainio@gmail.com>
458
462
459 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
463 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
460 Qt+IPython+Designer link in documentation.
464 Qt+IPython+Designer link in documentation.
461
465
462 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
466 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
463 correct Pdb object to %pydb.
467 correct Pdb object to %pydb.
464
468
465
469
466 2006-11-22 Walter Doerwald <walter@livinglogic.de>
470 2006-11-22 Walter Doerwald <walter@livinglogic.de>
467 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
471 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
468 generic xrepr(), otherwise the list implementation would kick in.
472 generic xrepr(), otherwise the list implementation would kick in.
469
473
470 2006-11-21 Ville Vainio <vivainio@gmail.com>
474 2006-11-21 Ville Vainio <vivainio@gmail.com>
471
475
472 * upgrade_dir.py: Now actually overwrites a nonmodified user file
476 * upgrade_dir.py: Now actually overwrites a nonmodified user file
473 with one from UserConfig.
477 with one from UserConfig.
474
478
475 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
479 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
476 it was missing which broke the sh profile.
480 it was missing which broke the sh profile.
477
481
478 * completer.py: file completer now uses explicit '/' instead
482 * completer.py: file completer now uses explicit '/' instead
479 of os.path.join, expansion of 'foo' was broken on win32
483 of os.path.join, expansion of 'foo' was broken on win32
480 if there was one directory with name 'foobar'.
484 if there was one directory with name 'foobar'.
481
485
482 * A bunch of patches from Kirill Smelkov:
486 * A bunch of patches from Kirill Smelkov:
483
487
484 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
488 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
485
489
486 * [patch 7/9] Implement %page -r (page in raw mode) -
490 * [patch 7/9] Implement %page -r (page in raw mode) -
487
491
488 * [patch 5/9] ScientificPython webpage has moved
492 * [patch 5/9] ScientificPython webpage has moved
489
493
490 * [patch 4/9] The manual mentions %ds, should be %dhist
494 * [patch 4/9] The manual mentions %ds, should be %dhist
491
495
492 * [patch 3/9] Kill old bits from %prun doc.
496 * [patch 3/9] Kill old bits from %prun doc.
493
497
494 * [patch 1/9] Fix typos here and there.
498 * [patch 1/9] Fix typos here and there.
495
499
496 2006-11-08 Ville Vainio <vivainio@gmail.com>
500 2006-11-08 Ville Vainio <vivainio@gmail.com>
497
501
498 * completer.py (attr_matches): catch all exceptions raised
502 * completer.py (attr_matches): catch all exceptions raised
499 by eval of expr with dots.
503 by eval of expr with dots.
500
504
501 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
505 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
502
506
503 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
507 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
504 input if it starts with whitespace. This allows you to paste
508 input if it starts with whitespace. This allows you to paste
505 indented input from any editor without manually having to type in
509 indented input from any editor without manually having to type in
506 the 'if 1:', which is convenient when working interactively.
510 the 'if 1:', which is convenient when working interactively.
507 Slightly modifed version of a patch by Bo Peng
511 Slightly modifed version of a patch by Bo Peng
508 <bpeng-AT-rice.edu>.
512 <bpeng-AT-rice.edu>.
509
513
510 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
514 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
511
515
512 * IPython/irunner.py (main): modified irunner so it automatically
516 * IPython/irunner.py (main): modified irunner so it automatically
513 recognizes the right runner to use based on the extension (.py for
517 recognizes the right runner to use based on the extension (.py for
514 python, .ipy for ipython and .sage for sage).
518 python, .ipy for ipython and .sage for sage).
515
519
516 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
520 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
517 visible in ipapi as ip.config(), to programatically control the
521 visible in ipapi as ip.config(), to programatically control the
518 internal rc object. There's an accompanying %config magic for
522 internal rc object. There's an accompanying %config magic for
519 interactive use, which has been enhanced to match the
523 interactive use, which has been enhanced to match the
520 funtionality in ipconfig.
524 funtionality in ipconfig.
521
525
522 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
526 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
523 so it's not just a toggle, it now takes an argument. Add support
527 so it's not just a toggle, it now takes an argument. Add support
524 for a customizable header when making system calls, as the new
528 for a customizable header when making system calls, as the new
525 system_header variable in the ipythonrc file.
529 system_header variable in the ipythonrc file.
526
530
527 2006-11-03 Walter Doerwald <walter@livinglogic.de>
531 2006-11-03 Walter Doerwald <walter@livinglogic.de>
528
532
529 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
533 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
530 generic functions (using Philip J. Eby's simplegeneric package).
534 generic functions (using Philip J. Eby's simplegeneric package).
531 This makes it possible to customize the display of third-party classes
535 This makes it possible to customize the display of third-party classes
532 without having to monkeypatch them. xiter() no longer supports a mode
536 without having to monkeypatch them. xiter() no longer supports a mode
533 argument and the XMode class has been removed. The same functionality can
537 argument and the XMode class has been removed. The same functionality can
534 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
538 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
535 One consequence of the switch to generic functions is that xrepr() and
539 One consequence of the switch to generic functions is that xrepr() and
536 xattrs() implementation must define the default value for the mode
540 xattrs() implementation must define the default value for the mode
537 argument themselves and xattrs() implementations must return real
541 argument themselves and xattrs() implementations must return real
538 descriptors.
542 descriptors.
539
543
540 * IPython/external: This new subpackage will contain all third-party
544 * IPython/external: This new subpackage will contain all third-party
541 packages that are bundled with IPython. (The first one is simplegeneric).
545 packages that are bundled with IPython. (The first one is simplegeneric).
542
546
543 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
547 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
544 directory which as been dropped in r1703.
548 directory which as been dropped in r1703.
545
549
546 * IPython/Extensions/ipipe.py (iless): Fixed.
550 * IPython/Extensions/ipipe.py (iless): Fixed.
547
551
548 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
552 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
549
553
550 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
554 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
551
555
552 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
556 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
553 handling in variable expansion so that shells and magics recognize
557 handling in variable expansion so that shells and magics recognize
554 function local scopes correctly. Bug reported by Brian.
558 function local scopes correctly. Bug reported by Brian.
555
559
556 * scripts/ipython: remove the very first entry in sys.path which
560 * scripts/ipython: remove the very first entry in sys.path which
557 Python auto-inserts for scripts, so that sys.path under IPython is
561 Python auto-inserts for scripts, so that sys.path under IPython is
558 as similar as possible to that under plain Python.
562 as similar as possible to that under plain Python.
559
563
560 * IPython/completer.py (IPCompleter.file_matches): Fix
564 * IPython/completer.py (IPCompleter.file_matches): Fix
561 tab-completion so that quotes are not closed unless the completion
565 tab-completion so that quotes are not closed unless the completion
562 is unambiguous. After a request by Stefan. Minor cleanups in
566 is unambiguous. After a request by Stefan. Minor cleanups in
563 ipy_stock_completers.
567 ipy_stock_completers.
564
568
565 2006-11-02 Ville Vainio <vivainio@gmail.com>
569 2006-11-02 Ville Vainio <vivainio@gmail.com>
566
570
567 * ipy_stock_completers.py: Add %run and %cd completers.
571 * ipy_stock_completers.py: Add %run and %cd completers.
568
572
569 * completer.py: Try running custom completer for both
573 * completer.py: Try running custom completer for both
570 "foo" and "%foo" if the command is just "foo". Ignore case
574 "foo" and "%foo" if the command is just "foo". Ignore case
571 when filtering possible completions.
575 when filtering possible completions.
572
576
573 * UserConfig/ipy_user_conf.py: install stock completers as default
577 * UserConfig/ipy_user_conf.py: install stock completers as default
574
578
575 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
579 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
576 simplified readline history save / restore through a wrapper
580 simplified readline history save / restore through a wrapper
577 function
581 function
578
582
579
583
580 2006-10-31 Ville Vainio <vivainio@gmail.com>
584 2006-10-31 Ville Vainio <vivainio@gmail.com>
581
585
582 * strdispatch.py, completer.py, ipy_stock_completers.py:
586 * strdispatch.py, completer.py, ipy_stock_completers.py:
583 Allow str_key ("command") in completer hooks. Implement
587 Allow str_key ("command") in completer hooks. Implement
584 trivial completer for 'import' (stdlib modules only). Rename
588 trivial completer for 'import' (stdlib modules only). Rename
585 ipy_linux_package_managers.py to ipy_stock_completers.py.
589 ipy_linux_package_managers.py to ipy_stock_completers.py.
586 SVN completer.
590 SVN completer.
587
591
588 * Extensions/ledit.py: %magic line editor for easily and
592 * Extensions/ledit.py: %magic line editor for easily and
589 incrementally manipulating lists of strings. The magic command
593 incrementally manipulating lists of strings. The magic command
590 name is %led.
594 name is %led.
591
595
592 2006-10-30 Ville Vainio <vivainio@gmail.com>
596 2006-10-30 Ville Vainio <vivainio@gmail.com>
593
597
594 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
598 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
595 Bernsteins's patches for pydb integration.
599 Bernsteins's patches for pydb integration.
596 http://bashdb.sourceforge.net/pydb/
600 http://bashdb.sourceforge.net/pydb/
597
601
598 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
602 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
599 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
603 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
600 custom completer hook to allow the users to implement their own
604 custom completer hook to allow the users to implement their own
601 completers. See ipy_linux_package_managers.py for example. The
605 completers. See ipy_linux_package_managers.py for example. The
602 hook name is 'complete_command'.
606 hook name is 'complete_command'.
603
607
604 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
608 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
605
609
606 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
610 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
607 Numeric leftovers.
611 Numeric leftovers.
608
612
609 * ipython.el (py-execute-region): apply Stefan's patch to fix
613 * ipython.el (py-execute-region): apply Stefan's patch to fix
610 garbled results if the python shell hasn't been previously started.
614 garbled results if the python shell hasn't been previously started.
611
615
612 * IPython/genutils.py (arg_split): moved to genutils, since it's a
616 * IPython/genutils.py (arg_split): moved to genutils, since it's a
613 pretty generic function and useful for other things.
617 pretty generic function and useful for other things.
614
618
615 * IPython/OInspect.py (getsource): Add customizable source
619 * IPython/OInspect.py (getsource): Add customizable source
616 extractor. After a request/patch form W. Stein (SAGE).
620 extractor. After a request/patch form W. Stein (SAGE).
617
621
618 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
622 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
619 window size to a more reasonable value from what pexpect does,
623 window size to a more reasonable value from what pexpect does,
620 since their choice causes wrapping bugs with long input lines.
624 since their choice causes wrapping bugs with long input lines.
621
625
622 2006-10-28 Ville Vainio <vivainio@gmail.com>
626 2006-10-28 Ville Vainio <vivainio@gmail.com>
623
627
624 * Magic.py (%run): Save and restore the readline history from
628 * Magic.py (%run): Save and restore the readline history from
625 file around %run commands to prevent side effects from
629 file around %run commands to prevent side effects from
626 %runned programs that might use readline (e.g. pydb).
630 %runned programs that might use readline (e.g. pydb).
627
631
628 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
632 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
629 invoking the pydb enhanced debugger.
633 invoking the pydb enhanced debugger.
630
634
631 2006-10-23 Walter Doerwald <walter@livinglogic.de>
635 2006-10-23 Walter Doerwald <walter@livinglogic.de>
632
636
633 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
637 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
634 call the base class method and propagate the return value to
638 call the base class method and propagate the return value to
635 ifile. This is now done by path itself.
639 ifile. This is now done by path itself.
636
640
637 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
641 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
638
642
639 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
643 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
640 api: set_crash_handler(), to expose the ability to change the
644 api: set_crash_handler(), to expose the ability to change the
641 internal crash handler.
645 internal crash handler.
642
646
643 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
647 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
644 the various parameters of the crash handler so that apps using
648 the various parameters of the crash handler so that apps using
645 IPython as their engine can customize crash handling. Ipmlemented
649 IPython as their engine can customize crash handling. Ipmlemented
646 at the request of SAGE.
650 at the request of SAGE.
647
651
648 2006-10-14 Ville Vainio <vivainio@gmail.com>
652 2006-10-14 Ville Vainio <vivainio@gmail.com>
649
653
650 * Magic.py, ipython.el: applied first "safe" part of Rocky
654 * Magic.py, ipython.el: applied first "safe" part of Rocky
651 Bernstein's patch set for pydb integration.
655 Bernstein's patch set for pydb integration.
652
656
653 * Magic.py (%unalias, %alias): %store'd aliases can now be
657 * Magic.py (%unalias, %alias): %store'd aliases can now be
654 removed with '%unalias'. %alias w/o args now shows most
658 removed with '%unalias'. %alias w/o args now shows most
655 interesting (stored / manually defined) aliases last
659 interesting (stored / manually defined) aliases last
656 where they catch the eye w/o scrolling.
660 where they catch the eye w/o scrolling.
657
661
658 * Magic.py (%rehashx), ext_rehashdir.py: files with
662 * Magic.py (%rehashx), ext_rehashdir.py: files with
659 'py' extension are always considered executable, even
663 'py' extension are always considered executable, even
660 when not in PATHEXT environment variable.
664 when not in PATHEXT environment variable.
661
665
662 2006-10-12 Ville Vainio <vivainio@gmail.com>
666 2006-10-12 Ville Vainio <vivainio@gmail.com>
663
667
664 * jobctrl.py: Add new "jobctrl" extension for spawning background
668 * jobctrl.py: Add new "jobctrl" extension for spawning background
665 processes with "&find /". 'import jobctrl' to try it out. Requires
669 processes with "&find /". 'import jobctrl' to try it out. Requires
666 'subprocess' module, standard in python 2.4+.
670 'subprocess' module, standard in python 2.4+.
667
671
668 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
672 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
669 so if foo -> bar and bar -> baz, then foo -> baz.
673 so if foo -> bar and bar -> baz, then foo -> baz.
670
674
671 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
675 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
672
676
673 * IPython/Magic.py (Magic.parse_options): add a new posix option
677 * IPython/Magic.py (Magic.parse_options): add a new posix option
674 to allow parsing of input args in magics that doesn't strip quotes
678 to allow parsing of input args in magics that doesn't strip quotes
675 (if posix=False). This also closes %timeit bug reported by
679 (if posix=False). This also closes %timeit bug reported by
676 Stefan.
680 Stefan.
677
681
678 2006-10-03 Ville Vainio <vivainio@gmail.com>
682 2006-10-03 Ville Vainio <vivainio@gmail.com>
679
683
680 * iplib.py (raw_input, interact): Return ValueError catching for
684 * iplib.py (raw_input, interact): Return ValueError catching for
681 raw_input. Fixes infinite loop for sys.stdin.close() or
685 raw_input. Fixes infinite loop for sys.stdin.close() or
682 sys.stdout.close().
686 sys.stdout.close().
683
687
684 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
688 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
685
689
686 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
690 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
687 to help in handling doctests. irunner is now pretty useful for
691 to help in handling doctests. irunner is now pretty useful for
688 running standalone scripts and simulate a full interactive session
692 running standalone scripts and simulate a full interactive session
689 in a format that can be then pasted as a doctest.
693 in a format that can be then pasted as a doctest.
690
694
691 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
695 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
692 on top of the default (useless) ones. This also fixes the nasty
696 on top of the default (useless) ones. This also fixes the nasty
693 way in which 2.5's Quitter() exits (reverted [1785]).
697 way in which 2.5's Quitter() exits (reverted [1785]).
694
698
695 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
699 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
696 2.5.
700 2.5.
697
701
698 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
702 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
699 color scheme is updated as well when color scheme is changed
703 color scheme is updated as well when color scheme is changed
700 interactively.
704 interactively.
701
705
702 2006-09-27 Ville Vainio <vivainio@gmail.com>
706 2006-09-27 Ville Vainio <vivainio@gmail.com>
703
707
704 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
708 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
705 infinite loop and just exit. It's a hack, but will do for a while.
709 infinite loop and just exit. It's a hack, but will do for a while.
706
710
707 2006-08-25 Walter Doerwald <walter@livinglogic.de>
711 2006-08-25 Walter Doerwald <walter@livinglogic.de>
708
712
709 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
713 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
710 the constructor, this makes it possible to get a list of only directories
714 the constructor, this makes it possible to get a list of only directories
711 or only files.
715 or only files.
712
716
713 2006-08-12 Ville Vainio <vivainio@gmail.com>
717 2006-08-12 Ville Vainio <vivainio@gmail.com>
714
718
715 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
719 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
716 they broke unittest
720 they broke unittest
717
721
718 2006-08-11 Ville Vainio <vivainio@gmail.com>
722 2006-08-11 Ville Vainio <vivainio@gmail.com>
719
723
720 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
724 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
721 by resolving issue properly, i.e. by inheriting FakeModule
725 by resolving issue properly, i.e. by inheriting FakeModule
722 from types.ModuleType. Pickling ipython interactive data
726 from types.ModuleType. Pickling ipython interactive data
723 should still work as usual (testing appreciated).
727 should still work as usual (testing appreciated).
724
728
725 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
729 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
726
730
727 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
731 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
728 running under python 2.3 with code from 2.4 to fix a bug with
732 running under python 2.3 with code from 2.4 to fix a bug with
729 help(). Reported by the Debian maintainers, Norbert Tretkowski
733 help(). Reported by the Debian maintainers, Norbert Tretkowski
730 <norbert-AT-tretkowski.de> and Alexandre Fayolle
734 <norbert-AT-tretkowski.de> and Alexandre Fayolle
731 <afayolle-AT-debian.org>.
735 <afayolle-AT-debian.org>.
732
736
733 2006-08-04 Walter Doerwald <walter@livinglogic.de>
737 2006-08-04 Walter Doerwald <walter@livinglogic.de>
734
738
735 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
739 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
736 (which was displaying "quit" twice).
740 (which was displaying "quit" twice).
737
741
738 2006-07-28 Walter Doerwald <walter@livinglogic.de>
742 2006-07-28 Walter Doerwald <walter@livinglogic.de>
739
743
740 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
744 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
741 the mode argument).
745 the mode argument).
742
746
743 2006-07-27 Walter Doerwald <walter@livinglogic.de>
747 2006-07-27 Walter Doerwald <walter@livinglogic.de>
744
748
745 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
749 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
746 not running under IPython.
750 not running under IPython.
747
751
748 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
752 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
749 and make it iterable (iterating over the attribute itself). Add two new
753 and make it iterable (iterating over the attribute itself). Add two new
750 magic strings for __xattrs__(): If the string starts with "-", the attribute
754 magic strings for __xattrs__(): If the string starts with "-", the attribute
751 will not be displayed in ibrowse's detail view (but it can still be
755 will not be displayed in ibrowse's detail view (but it can still be
752 iterated over). This makes it possible to add attributes that are large
756 iterated over). This makes it possible to add attributes that are large
753 lists or generator methods to the detail view. Replace magic attribute names
757 lists or generator methods to the detail view. Replace magic attribute names
754 and _attrname() and _getattr() with "descriptors": For each type of magic
758 and _attrname() and _getattr() with "descriptors": For each type of magic
755 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
759 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
756 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
760 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
757 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
761 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
758 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
762 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
759 are still supported.
763 are still supported.
760
764
761 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
765 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
762 fails in ibrowse.fetch(), the exception object is added as the last item
766 fails in ibrowse.fetch(), the exception object is added as the last item
763 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
767 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
764 a generator throws an exception midway through execution.
768 a generator throws an exception midway through execution.
765
769
766 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
770 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
767 encoding into methods.
771 encoding into methods.
768
772
769 2006-07-26 Ville Vainio <vivainio@gmail.com>
773 2006-07-26 Ville Vainio <vivainio@gmail.com>
770
774
771 * iplib.py: history now stores multiline input as single
775 * iplib.py: history now stores multiline input as single
772 history entries. Patch by Jorgen Cederlof.
776 history entries. Patch by Jorgen Cederlof.
773
777
774 2006-07-18 Walter Doerwald <walter@livinglogic.de>
778 2006-07-18 Walter Doerwald <walter@livinglogic.de>
775
779
776 * IPython/Extensions/ibrowse.py: Make cursor visible over
780 * IPython/Extensions/ibrowse.py: Make cursor visible over
777 non existing attributes.
781 non existing attributes.
778
782
779 2006-07-14 Walter Doerwald <walter@livinglogic.de>
783 2006-07-14 Walter Doerwald <walter@livinglogic.de>
780
784
781 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
785 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
782 error output of the running command doesn't mess up the screen.
786 error output of the running command doesn't mess up the screen.
783
787
784 2006-07-13 Walter Doerwald <walter@livinglogic.de>
788 2006-07-13 Walter Doerwald <walter@livinglogic.de>
785
789
786 * IPython/Extensions/ipipe.py (isort): Make isort usable without
790 * IPython/Extensions/ipipe.py (isort): Make isort usable without
787 argument. This sorts the items themselves.
791 argument. This sorts the items themselves.
788
792
789 2006-07-12 Walter Doerwald <walter@livinglogic.de>
793 2006-07-12 Walter Doerwald <walter@livinglogic.de>
790
794
791 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
795 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
792 Compile expression strings into code objects. This should speed
796 Compile expression strings into code objects. This should speed
793 up ifilter and friends somewhat.
797 up ifilter and friends somewhat.
794
798
795 2006-07-08 Ville Vainio <vivainio@gmail.com>
799 2006-07-08 Ville Vainio <vivainio@gmail.com>
796
800
797 * Magic.py: %cpaste now strips > from the beginning of lines
801 * Magic.py: %cpaste now strips > from the beginning of lines
798 to ease pasting quoted code from emails. Contributed by
802 to ease pasting quoted code from emails. Contributed by
799 Stefan van der Walt.
803 Stefan van der Walt.
800
804
801 2006-06-29 Ville Vainio <vivainio@gmail.com>
805 2006-06-29 Ville Vainio <vivainio@gmail.com>
802
806
803 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
807 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
804 mode, patch contributed by Darren Dale. NEEDS TESTING!
808 mode, patch contributed by Darren Dale. NEEDS TESTING!
805
809
806 2006-06-28 Walter Doerwald <walter@livinglogic.de>
810 2006-06-28 Walter Doerwald <walter@livinglogic.de>
807
811
808 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
812 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
809 a blue background. Fix fetching new display rows when the browser
813 a blue background. Fix fetching new display rows when the browser
810 scrolls more than a screenful (e.g. by using the goto command).
814 scrolls more than a screenful (e.g. by using the goto command).
811
815
812 2006-06-27 Ville Vainio <vivainio@gmail.com>
816 2006-06-27 Ville Vainio <vivainio@gmail.com>
813
817
814 * Magic.py (_inspect, _ofind) Apply David Huard's
818 * Magic.py (_inspect, _ofind) Apply David Huard's
815 patch for displaying the correct docstring for 'property'
819 patch for displaying the correct docstring for 'property'
816 attributes.
820 attributes.
817
821
818 2006-06-23 Walter Doerwald <walter@livinglogic.de>
822 2006-06-23 Walter Doerwald <walter@livinglogic.de>
819
823
820 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
824 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
821 commands into the methods implementing them.
825 commands into the methods implementing them.
822
826
823 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
827 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
824
828
825 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
829 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
826 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
830 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
827 autoindent support was authored by Jin Liu.
831 autoindent support was authored by Jin Liu.
828
832
829 2006-06-22 Walter Doerwald <walter@livinglogic.de>
833 2006-06-22 Walter Doerwald <walter@livinglogic.de>
830
834
831 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
835 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
832 for keymaps with a custom class that simplifies handling.
836 for keymaps with a custom class that simplifies handling.
833
837
834 2006-06-19 Walter Doerwald <walter@livinglogic.de>
838 2006-06-19 Walter Doerwald <walter@livinglogic.de>
835
839
836 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
840 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
837 resizing. This requires Python 2.5 to work.
841 resizing. This requires Python 2.5 to work.
838
842
839 2006-06-16 Walter Doerwald <walter@livinglogic.de>
843 2006-06-16 Walter Doerwald <walter@livinglogic.de>
840
844
841 * IPython/Extensions/ibrowse.py: Add two new commands to
845 * IPython/Extensions/ibrowse.py: Add two new commands to
842 ibrowse: "hideattr" (mapped to "h") hides the attribute under
846 ibrowse: "hideattr" (mapped to "h") hides the attribute under
843 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
847 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
844 attributes again. Remapped the help command to "?". Display
848 attributes again. Remapped the help command to "?". Display
845 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
849 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
846 as keys for the "home" and "end" commands. Add three new commands
850 as keys for the "home" and "end" commands. Add three new commands
847 to the input mode for "find" and friends: "delend" (CTRL-K)
851 to the input mode for "find" and friends: "delend" (CTRL-K)
848 deletes to the end of line. "incsearchup" searches upwards in the
852 deletes to the end of line. "incsearchup" searches upwards in the
849 command history for an input that starts with the text before the cursor.
853 command history for an input that starts with the text before the cursor.
850 "incsearchdown" does the same downwards. Removed a bogus mapping of
854 "incsearchdown" does the same downwards. Removed a bogus mapping of
851 the x key to "delete".
855 the x key to "delete".
852
856
853 2006-06-15 Ville Vainio <vivainio@gmail.com>
857 2006-06-15 Ville Vainio <vivainio@gmail.com>
854
858
855 * iplib.py, hooks.py: Added new generate_prompt hook that can be
859 * iplib.py, hooks.py: Added new generate_prompt hook that can be
856 used to create prompts dynamically, instead of the "old" way of
860 used to create prompts dynamically, instead of the "old" way of
857 assigning "magic" strings to prompt_in1 and prompt_in2. The old
861 assigning "magic" strings to prompt_in1 and prompt_in2. The old
858 way still works (it's invoked by the default hook), of course.
862 way still works (it's invoked by the default hook), of course.
859
863
860 * Prompts.py: added generate_output_prompt hook for altering output
864 * Prompts.py: added generate_output_prompt hook for altering output
861 prompt
865 prompt
862
866
863 * Release.py: Changed version string to 0.7.3.svn.
867 * Release.py: Changed version string to 0.7.3.svn.
864
868
865 2006-06-15 Walter Doerwald <walter@livinglogic.de>
869 2006-06-15 Walter Doerwald <walter@livinglogic.de>
866
870
867 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
871 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
868 the call to fetch() always tries to fetch enough data for at least one
872 the call to fetch() always tries to fetch enough data for at least one
869 full screen. This makes it possible to simply call moveto(0,0,True) in
873 full screen. This makes it possible to simply call moveto(0,0,True) in
870 the constructor. Fix typos and removed the obsolete goto attribute.
874 the constructor. Fix typos and removed the obsolete goto attribute.
871
875
872 2006-06-12 Ville Vainio <vivainio@gmail.com>
876 2006-06-12 Ville Vainio <vivainio@gmail.com>
873
877
874 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
878 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
875 allowing $variable interpolation within multiline statements,
879 allowing $variable interpolation within multiline statements,
876 though so far only with "sh" profile for a testing period.
880 though so far only with "sh" profile for a testing period.
877 The patch also enables splitting long commands with \ but it
881 The patch also enables splitting long commands with \ but it
878 doesn't work properly yet.
882 doesn't work properly yet.
879
883
880 2006-06-12 Walter Doerwald <walter@livinglogic.de>
884 2006-06-12 Walter Doerwald <walter@livinglogic.de>
881
885
882 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
886 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
883 input history and the position of the cursor in the input history for
887 input history and the position of the cursor in the input history for
884 the find, findbackwards and goto command.
888 the find, findbackwards and goto command.
885
889
886 2006-06-10 Walter Doerwald <walter@livinglogic.de>
890 2006-06-10 Walter Doerwald <walter@livinglogic.de>
887
891
888 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
892 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
889 implements the basic functionality of browser commands that require
893 implements the basic functionality of browser commands that require
890 input. Reimplement the goto, find and findbackwards commands as
894 input. Reimplement the goto, find and findbackwards commands as
891 subclasses of _CommandInput. Add an input history and keymaps to those
895 subclasses of _CommandInput. Add an input history and keymaps to those
892 commands. Add "\r" as a keyboard shortcut for the enterdefault and
896 commands. Add "\r" as a keyboard shortcut for the enterdefault and
893 execute commands.
897 execute commands.
894
898
895 2006-06-07 Ville Vainio <vivainio@gmail.com>
899 2006-06-07 Ville Vainio <vivainio@gmail.com>
896
900
897 * iplib.py: ipython mybatch.ipy exits ipython immediately after
901 * iplib.py: ipython mybatch.ipy exits ipython immediately after
898 running the batch files instead of leaving the session open.
902 running the batch files instead of leaving the session open.
899
903
900 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
904 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
901
905
902 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
906 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
903 the original fix was incomplete. Patch submitted by W. Maier.
907 the original fix was incomplete. Patch submitted by W. Maier.
904
908
905 2006-06-07 Ville Vainio <vivainio@gmail.com>
909 2006-06-07 Ville Vainio <vivainio@gmail.com>
906
910
907 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
911 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
908 Confirmation prompts can be supressed by 'quiet' option.
912 Confirmation prompts can be supressed by 'quiet' option.
909 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
913 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
910
914
911 2006-06-06 *** Released version 0.7.2
915 2006-06-06 *** Released version 0.7.2
912
916
913 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
917 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
914
918
915 * IPython/Release.py (version): Made 0.7.2 final for release.
919 * IPython/Release.py (version): Made 0.7.2 final for release.
916 Repo tagged and release cut.
920 Repo tagged and release cut.
917
921
918 2006-06-05 Ville Vainio <vivainio@gmail.com>
922 2006-06-05 Ville Vainio <vivainio@gmail.com>
919
923
920 * Magic.py (magic_rehashx): Honor no_alias list earlier in
924 * Magic.py (magic_rehashx): Honor no_alias list earlier in
921 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
925 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
922
926
923 * upgrade_dir.py: try import 'path' module a bit harder
927 * upgrade_dir.py: try import 'path' module a bit harder
924 (for %upgrade)
928 (for %upgrade)
925
929
926 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
930 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
927
931
928 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
932 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
929 instead of looping 20 times.
933 instead of looping 20 times.
930
934
931 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
935 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
932 correctly at initialization time. Bug reported by Krishna Mohan
936 correctly at initialization time. Bug reported by Krishna Mohan
933 Gundu <gkmohan-AT-gmail.com> on the user list.
937 Gundu <gkmohan-AT-gmail.com> on the user list.
934
938
935 * IPython/Release.py (version): Mark 0.7.2 version to start
939 * IPython/Release.py (version): Mark 0.7.2 version to start
936 testing for release on 06/06.
940 testing for release on 06/06.
937
941
938 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
942 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
939
943
940 * scripts/irunner: thin script interface so users don't have to
944 * scripts/irunner: thin script interface so users don't have to
941 find the module and call it as an executable, since modules rarely
945 find the module and call it as an executable, since modules rarely
942 live in people's PATH.
946 live in people's PATH.
943
947
944 * IPython/irunner.py (InteractiveRunner.__init__): added
948 * IPython/irunner.py (InteractiveRunner.__init__): added
945 delaybeforesend attribute to control delays with newer versions of
949 delaybeforesend attribute to control delays with newer versions of
946 pexpect. Thanks to detailed help from pexpect's author, Noah
950 pexpect. Thanks to detailed help from pexpect's author, Noah
947 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
951 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
948 correctly (it works in NoColor mode).
952 correctly (it works in NoColor mode).
949
953
950 * IPython/iplib.py (handle_normal): fix nasty crash reported on
954 * IPython/iplib.py (handle_normal): fix nasty crash reported on
951 SAGE list, from improper log() calls.
955 SAGE list, from improper log() calls.
952
956
953 2006-05-31 Ville Vainio <vivainio@gmail.com>
957 2006-05-31 Ville Vainio <vivainio@gmail.com>
954
958
955 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
959 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
956 with args in parens to work correctly with dirs that have spaces.
960 with args in parens to work correctly with dirs that have spaces.
957
961
958 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
962 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
959
963
960 * IPython/Logger.py (Logger.logstart): add option to log raw input
964 * IPython/Logger.py (Logger.logstart): add option to log raw input
961 instead of the processed one. A -r flag was added to the
965 instead of the processed one. A -r flag was added to the
962 %logstart magic used for controlling logging.
966 %logstart magic used for controlling logging.
963
967
964 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
968 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
965
969
966 * IPython/iplib.py (InteractiveShell.__init__): add check for the
970 * IPython/iplib.py (InteractiveShell.__init__): add check for the
967 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
971 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
968 recognize the option. After a bug report by Will Maier. This
972 recognize the option. After a bug report by Will Maier. This
969 closes #64 (will do it after confirmation from W. Maier).
973 closes #64 (will do it after confirmation from W. Maier).
970
974
971 * IPython/irunner.py: New module to run scripts as if manually
975 * IPython/irunner.py: New module to run scripts as if manually
972 typed into an interactive environment, based on pexpect. After a
976 typed into an interactive environment, based on pexpect. After a
973 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
977 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
974 ipython-user list. Simple unittests in the tests/ directory.
978 ipython-user list. Simple unittests in the tests/ directory.
975
979
976 * tools/release: add Will Maier, OpenBSD port maintainer, to
980 * tools/release: add Will Maier, OpenBSD port maintainer, to
977 recepients list. We are now officially part of the OpenBSD ports:
981 recepients list. We are now officially part of the OpenBSD ports:
978 http://www.openbsd.org/ports.html ! Many thanks to Will for the
982 http://www.openbsd.org/ports.html ! Many thanks to Will for the
979 work.
983 work.
980
984
981 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
985 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
982
986
983 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
987 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
984 so that it doesn't break tkinter apps.
988 so that it doesn't break tkinter apps.
985
989
986 * IPython/iplib.py (_prefilter): fix bug where aliases would
990 * IPython/iplib.py (_prefilter): fix bug where aliases would
987 shadow variables when autocall was fully off. Reported by SAGE
991 shadow variables when autocall was fully off. Reported by SAGE
988 author William Stein.
992 author William Stein.
989
993
990 * IPython/OInspect.py (Inspector.__init__): add a flag to control
994 * IPython/OInspect.py (Inspector.__init__): add a flag to control
991 at what detail level strings are computed when foo? is requested.
995 at what detail level strings are computed when foo? is requested.
992 This allows users to ask for example that the string form of an
996 This allows users to ask for example that the string form of an
993 object is only computed when foo?? is called, or even never, by
997 object is only computed when foo?? is called, or even never, by
994 setting the object_info_string_level >= 2 in the configuration
998 setting the object_info_string_level >= 2 in the configuration
995 file. This new option has been added and documented. After a
999 file. This new option has been added and documented. After a
996 request by SAGE to be able to control the printing of very large
1000 request by SAGE to be able to control the printing of very large
997 objects more easily.
1001 objects more easily.
998
1002
999 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
1003 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
1000
1004
1001 * IPython/ipmaker.py (make_IPython): remove the ipython call path
1005 * IPython/ipmaker.py (make_IPython): remove the ipython call path
1002 from sys.argv, to be 100% consistent with how Python itself works
1006 from sys.argv, to be 100% consistent with how Python itself works
1003 (as seen for example with python -i file.py). After a bug report
1007 (as seen for example with python -i file.py). After a bug report
1004 by Jeffrey Collins.
1008 by Jeffrey Collins.
1005
1009
1006 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
1010 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
1007 nasty bug which was preventing custom namespaces with -pylab,
1011 nasty bug which was preventing custom namespaces with -pylab,
1008 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
1012 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
1009 compatibility (long gone from mpl).
1013 compatibility (long gone from mpl).
1010
1014
1011 * IPython/ipapi.py (make_session): name change: create->make. We
1015 * IPython/ipapi.py (make_session): name change: create->make. We
1012 use make in other places (ipmaker,...), it's shorter and easier to
1016 use make in other places (ipmaker,...), it's shorter and easier to
1013 type and say, etc. I'm trying to clean things before 0.7.2 so
1017 type and say, etc. I'm trying to clean things before 0.7.2 so
1014 that I can keep things stable wrt to ipapi in the chainsaw branch.
1018 that I can keep things stable wrt to ipapi in the chainsaw branch.
1015
1019
1016 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
1020 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
1017 python-mode recognizes our debugger mode. Add support for
1021 python-mode recognizes our debugger mode. Add support for
1018 autoindent inside (X)emacs. After a patch sent in by Jin Liu
1022 autoindent inside (X)emacs. After a patch sent in by Jin Liu
1019 <m.liu.jin-AT-gmail.com> originally written by
1023 <m.liu.jin-AT-gmail.com> originally written by
1020 doxgen-AT-newsmth.net (with minor modifications for xemacs
1024 doxgen-AT-newsmth.net (with minor modifications for xemacs
1021 compatibility)
1025 compatibility)
1022
1026
1023 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
1027 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
1024 tracebacks when walking the stack so that the stack tracking system
1028 tracebacks when walking the stack so that the stack tracking system
1025 in emacs' python-mode can identify the frames correctly.
1029 in emacs' python-mode can identify the frames correctly.
1026
1030
1027 * IPython/ipmaker.py (make_IPython): make the internal (and
1031 * IPython/ipmaker.py (make_IPython): make the internal (and
1028 default config) autoedit_syntax value false by default. Too many
1032 default config) autoedit_syntax value false by default. Too many
1029 users have complained to me (both on and off-list) about problems
1033 users have complained to me (both on and off-list) about problems
1030 with this option being on by default, so I'm making it default to
1034 with this option being on by default, so I'm making it default to
1031 off. It can still be enabled by anyone via the usual mechanisms.
1035 off. It can still be enabled by anyone via the usual mechanisms.
1032
1036
1033 * IPython/completer.py (Completer.attr_matches): add support for
1037 * IPython/completer.py (Completer.attr_matches): add support for
1034 PyCrust-style _getAttributeNames magic method. Patch contributed
1038 PyCrust-style _getAttributeNames magic method. Patch contributed
1035 by <mscott-AT-goldenspud.com>. Closes #50.
1039 by <mscott-AT-goldenspud.com>. Closes #50.
1036
1040
1037 * IPython/iplib.py (InteractiveShell.__init__): remove the
1041 * IPython/iplib.py (InteractiveShell.__init__): remove the
1038 deletion of exit/quit from __builtin__, which can break
1042 deletion of exit/quit from __builtin__, which can break
1039 third-party tools like the Zope debugging console. The
1043 third-party tools like the Zope debugging console. The
1040 %exit/%quit magics remain. In general, it's probably a good idea
1044 %exit/%quit magics remain. In general, it's probably a good idea
1041 not to delete anything from __builtin__, since we never know what
1045 not to delete anything from __builtin__, since we never know what
1042 that will break. In any case, python now (for 2.5) will support
1046 that will break. In any case, python now (for 2.5) will support
1043 'real' exit/quit, so this issue is moot. Closes #55.
1047 'real' exit/quit, so this issue is moot. Closes #55.
1044
1048
1045 * IPython/genutils.py (with_obj): rename the 'with' function to
1049 * IPython/genutils.py (with_obj): rename the 'with' function to
1046 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
1050 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
1047 becomes a language keyword. Closes #53.
1051 becomes a language keyword. Closes #53.
1048
1052
1049 * IPython/FakeModule.py (FakeModule.__init__): add a proper
1053 * IPython/FakeModule.py (FakeModule.__init__): add a proper
1050 __file__ attribute to this so it fools more things into thinking
1054 __file__ attribute to this so it fools more things into thinking
1051 it is a real module. Closes #59.
1055 it is a real module. Closes #59.
1052
1056
1053 * IPython/Magic.py (magic_edit): add -n option to open the editor
1057 * IPython/Magic.py (magic_edit): add -n option to open the editor
1054 at a specific line number. After a patch by Stefan van der Walt.
1058 at a specific line number. After a patch by Stefan van der Walt.
1055
1059
1056 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
1060 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
1057
1061
1058 * IPython/iplib.py (edit_syntax_error): fix crash when for some
1062 * IPython/iplib.py (edit_syntax_error): fix crash when for some
1059 reason the file could not be opened. After automatic crash
1063 reason the file could not be opened. After automatic crash
1060 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
1064 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
1061 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
1065 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
1062 (_should_recompile): Don't fire editor if using %bg, since there
1066 (_should_recompile): Don't fire editor if using %bg, since there
1063 is no file in the first place. From the same report as above.
1067 is no file in the first place. From the same report as above.
1064 (raw_input): protect against faulty third-party prefilters. After
1068 (raw_input): protect against faulty third-party prefilters. After
1065 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
1069 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
1066 while running under SAGE.
1070 while running under SAGE.
1067
1071
1068 2006-05-23 Ville Vainio <vivainio@gmail.com>
1072 2006-05-23 Ville Vainio <vivainio@gmail.com>
1069
1073
1070 * ipapi.py: Stripped down ip.to_user_ns() to work only as
1074 * ipapi.py: Stripped down ip.to_user_ns() to work only as
1071 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
1075 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
1072 now returns None (again), unless dummy is specifically allowed by
1076 now returns None (again), unless dummy is specifically allowed by
1073 ipapi.get(allow_dummy=True).
1077 ipapi.get(allow_dummy=True).
1074
1078
1075 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
1079 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
1076
1080
1077 * IPython: remove all 2.2-compatibility objects and hacks from
1081 * IPython: remove all 2.2-compatibility objects and hacks from
1078 everywhere, since we only support 2.3 at this point. Docs
1082 everywhere, since we only support 2.3 at this point. Docs
1079 updated.
1083 updated.
1080
1084
1081 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
1085 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
1082 Anything requiring extra validation can be turned into a Python
1086 Anything requiring extra validation can be turned into a Python
1083 property in the future. I used a property for the db one b/c
1087 property in the future. I used a property for the db one b/c
1084 there was a nasty circularity problem with the initialization
1088 there was a nasty circularity problem with the initialization
1085 order, which right now I don't have time to clean up.
1089 order, which right now I don't have time to clean up.
1086
1090
1087 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
1091 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
1088 another locking bug reported by Jorgen. I'm not 100% sure though,
1092 another locking bug reported by Jorgen. I'm not 100% sure though,
1089 so more testing is needed...
1093 so more testing is needed...
1090
1094
1091 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
1095 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
1092
1096
1093 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
1097 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
1094 local variables from any routine in user code (typically executed
1098 local variables from any routine in user code (typically executed
1095 with %run) directly into the interactive namespace. Very useful
1099 with %run) directly into the interactive namespace. Very useful
1096 when doing complex debugging.
1100 when doing complex debugging.
1097 (IPythonNotRunning): Changed the default None object to a dummy
1101 (IPythonNotRunning): Changed the default None object to a dummy
1098 whose attributes can be queried as well as called without
1102 whose attributes can be queried as well as called without
1099 exploding, to ease writing code which works transparently both in
1103 exploding, to ease writing code which works transparently both in
1100 and out of ipython and uses some of this API.
1104 and out of ipython and uses some of this API.
1101
1105
1102 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
1106 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
1103
1107
1104 * IPython/hooks.py (result_display): Fix the fact that our display
1108 * IPython/hooks.py (result_display): Fix the fact that our display
1105 hook was using str() instead of repr(), as the default python
1109 hook was using str() instead of repr(), as the default python
1106 console does. This had gone unnoticed b/c it only happened if
1110 console does. This had gone unnoticed b/c it only happened if
1107 %Pprint was off, but the inconsistency was there.
1111 %Pprint was off, but the inconsistency was there.
1108
1112
1109 2006-05-15 Ville Vainio <vivainio@gmail.com>
1113 2006-05-15 Ville Vainio <vivainio@gmail.com>
1110
1114
1111 * Oinspect.py: Only show docstring for nonexisting/binary files
1115 * Oinspect.py: Only show docstring for nonexisting/binary files
1112 when doing object??, closing ticket #62
1116 when doing object??, closing ticket #62
1113
1117
1114 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
1118 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
1115
1119
1116 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
1120 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
1117 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
1121 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
1118 was being released in a routine which hadn't checked if it had
1122 was being released in a routine which hadn't checked if it had
1119 been the one to acquire it.
1123 been the one to acquire it.
1120
1124
1121 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
1125 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
1122
1126
1123 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
1127 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
1124
1128
1125 2006-04-11 Ville Vainio <vivainio@gmail.com>
1129 2006-04-11 Ville Vainio <vivainio@gmail.com>
1126
1130
1127 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
1131 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
1128 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
1132 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
1129 prefilters, allowing stuff like magics and aliases in the file.
1133 prefilters, allowing stuff like magics and aliases in the file.
1130
1134
1131 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
1135 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
1132 added. Supported now are "%clear in" and "%clear out" (clear input and
1136 added. Supported now are "%clear in" and "%clear out" (clear input and
1133 output history, respectively). Also fixed CachedOutput.flush to
1137 output history, respectively). Also fixed CachedOutput.flush to
1134 properly flush the output cache.
1138 properly flush the output cache.
1135
1139
1136 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
1140 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
1137 half-success (and fail explicitly).
1141 half-success (and fail explicitly).
1138
1142
1139 2006-03-28 Ville Vainio <vivainio@gmail.com>
1143 2006-03-28 Ville Vainio <vivainio@gmail.com>
1140
1144
1141 * iplib.py: Fix quoting of aliases so that only argless ones
1145 * iplib.py: Fix quoting of aliases so that only argless ones
1142 are quoted
1146 are quoted
1143
1147
1144 2006-03-28 Ville Vainio <vivainio@gmail.com>
1148 2006-03-28 Ville Vainio <vivainio@gmail.com>
1145
1149
1146 * iplib.py: Quote aliases with spaces in the name.
1150 * iplib.py: Quote aliases with spaces in the name.
1147 "c:\program files\blah\bin" is now legal alias target.
1151 "c:\program files\blah\bin" is now legal alias target.
1148
1152
1149 * ext_rehashdir.py: Space no longer allowed as arg
1153 * ext_rehashdir.py: Space no longer allowed as arg
1150 separator, since space is legal in path names.
1154 separator, since space is legal in path names.
1151
1155
1152 2006-03-16 Ville Vainio <vivainio@gmail.com>
1156 2006-03-16 Ville Vainio <vivainio@gmail.com>
1153
1157
1154 * upgrade_dir.py: Take path.py from Extensions, correcting
1158 * upgrade_dir.py: Take path.py from Extensions, correcting
1155 %upgrade magic
1159 %upgrade magic
1156
1160
1157 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
1161 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
1158
1162
1159 * hooks.py: Only enclose editor binary in quotes if legal and
1163 * hooks.py: Only enclose editor binary in quotes if legal and
1160 necessary (space in the name, and is an existing file). Fixes a bug
1164 necessary (space in the name, and is an existing file). Fixes a bug
1161 reported by Zachary Pincus.
1165 reported by Zachary Pincus.
1162
1166
1163 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
1167 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
1164
1168
1165 * Manual: thanks to a tip on proper color handling for Emacs, by
1169 * Manual: thanks to a tip on proper color handling for Emacs, by
1166 Eric J Haywiser <ejh1-AT-MIT.EDU>.
1170 Eric J Haywiser <ejh1-AT-MIT.EDU>.
1167
1171
1168 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
1172 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
1169 by applying the provided patch. Thanks to Liu Jin
1173 by applying the provided patch. Thanks to Liu Jin
1170 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
1174 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
1171 XEmacs/Linux, I'm trusting the submitter that it actually helps
1175 XEmacs/Linux, I'm trusting the submitter that it actually helps
1172 under win32/GNU Emacs. Will revisit if any problems are reported.
1176 under win32/GNU Emacs. Will revisit if any problems are reported.
1173
1177
1174 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1178 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1175
1179
1176 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
1180 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
1177 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
1181 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
1178
1182
1179 2006-03-12 Ville Vainio <vivainio@gmail.com>
1183 2006-03-12 Ville Vainio <vivainio@gmail.com>
1180
1184
1181 * Magic.py (magic_timeit): Added %timeit magic, contributed by
1185 * Magic.py (magic_timeit): Added %timeit magic, contributed by
1182 Torsten Marek.
1186 Torsten Marek.
1183
1187
1184 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1188 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1185
1189
1186 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
1190 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
1187 line ranges works again.
1191 line ranges works again.
1188
1192
1189 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
1193 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
1190
1194
1191 * IPython/iplib.py (showtraceback): add back sys.last_traceback
1195 * IPython/iplib.py (showtraceback): add back sys.last_traceback
1192 and friends, after a discussion with Zach Pincus on ipython-user.
1196 and friends, after a discussion with Zach Pincus on ipython-user.
1193 I'm not 100% sure, but after thinking about it quite a bit, it may
1197 I'm not 100% sure, but after thinking about it quite a bit, it may
1194 be OK. Testing with the multithreaded shells didn't reveal any
1198 be OK. Testing with the multithreaded shells didn't reveal any
1195 problems, but let's keep an eye out.
1199 problems, but let's keep an eye out.
1196
1200
1197 In the process, I fixed a few things which were calling
1201 In the process, I fixed a few things which were calling
1198 self.InteractiveTB() directly (like safe_execfile), which is a
1202 self.InteractiveTB() directly (like safe_execfile), which is a
1199 mistake: ALL exception reporting should be done by calling
1203 mistake: ALL exception reporting should be done by calling
1200 self.showtraceback(), which handles state and tab-completion and
1204 self.showtraceback(), which handles state and tab-completion and
1201 more.
1205 more.
1202
1206
1203 2006-03-01 Ville Vainio <vivainio@gmail.com>
1207 2006-03-01 Ville Vainio <vivainio@gmail.com>
1204
1208
1205 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
1209 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
1206 To use, do "from ipipe import *".
1210 To use, do "from ipipe import *".
1207
1211
1208 2006-02-24 Ville Vainio <vivainio@gmail.com>
1212 2006-02-24 Ville Vainio <vivainio@gmail.com>
1209
1213
1210 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
1214 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
1211 "cleanly" and safely than the older upgrade mechanism.
1215 "cleanly" and safely than the older upgrade mechanism.
1212
1216
1213 2006-02-21 Ville Vainio <vivainio@gmail.com>
1217 2006-02-21 Ville Vainio <vivainio@gmail.com>
1214
1218
1215 * Magic.py: %save works again.
1219 * Magic.py: %save works again.
1216
1220
1217 2006-02-15 Ville Vainio <vivainio@gmail.com>
1221 2006-02-15 Ville Vainio <vivainio@gmail.com>
1218
1222
1219 * Magic.py: %Pprint works again
1223 * Magic.py: %Pprint works again
1220
1224
1221 * Extensions/ipy_sane_defaults.py: Provide everything provided
1225 * Extensions/ipy_sane_defaults.py: Provide everything provided
1222 in default ipythonrc, to make it possible to have a completely empty
1226 in default ipythonrc, to make it possible to have a completely empty
1223 ipythonrc (and thus completely rc-file free configuration)
1227 ipythonrc (and thus completely rc-file free configuration)
1224
1228
1225 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
1229 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
1226
1230
1227 * IPython/hooks.py (editor): quote the call to the editor command,
1231 * IPython/hooks.py (editor): quote the call to the editor command,
1228 to allow commands with spaces in them. Problem noted by watching
1232 to allow commands with spaces in them. Problem noted by watching
1229 Ian Oswald's video about textpad under win32 at
1233 Ian Oswald's video about textpad under win32 at
1230 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
1234 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
1231
1235
1232 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
1236 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
1233 describing magics (we haven't used @ for a loong time).
1237 describing magics (we haven't used @ for a loong time).
1234
1238
1235 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
1239 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
1236 contributed by marienz to close
1240 contributed by marienz to close
1237 http://www.scipy.net/roundup/ipython/issue53.
1241 http://www.scipy.net/roundup/ipython/issue53.
1238
1242
1239 2006-02-10 Ville Vainio <vivainio@gmail.com>
1243 2006-02-10 Ville Vainio <vivainio@gmail.com>
1240
1244
1241 * genutils.py: getoutput now works in win32 too
1245 * genutils.py: getoutput now works in win32 too
1242
1246
1243 * completer.py: alias and magic completion only invoked
1247 * completer.py: alias and magic completion only invoked
1244 at the first "item" in the line, to avoid "cd %store"
1248 at the first "item" in the line, to avoid "cd %store"
1245 nonsense.
1249 nonsense.
1246
1250
1247 2006-02-09 Ville Vainio <vivainio@gmail.com>
1251 2006-02-09 Ville Vainio <vivainio@gmail.com>
1248
1252
1249 * test/*: Added a unit testing framework (finally).
1253 * test/*: Added a unit testing framework (finally).
1250 '%run runtests.py' to run test_*.
1254 '%run runtests.py' to run test_*.
1251
1255
1252 * ipapi.py: Exposed runlines and set_custom_exc
1256 * ipapi.py: Exposed runlines and set_custom_exc
1253
1257
1254 2006-02-07 Ville Vainio <vivainio@gmail.com>
1258 2006-02-07 Ville Vainio <vivainio@gmail.com>
1255
1259
1256 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
1260 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
1257 instead use "f(1 2)" as before.
1261 instead use "f(1 2)" as before.
1258
1262
1259 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
1263 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
1260
1264
1261 * IPython/demo.py (IPythonDemo): Add new classes to the demo
1265 * IPython/demo.py (IPythonDemo): Add new classes to the demo
1262 facilities, for demos processed by the IPython input filter
1266 facilities, for demos processed by the IPython input filter
1263 (IPythonDemo), and for running a script one-line-at-a-time as a
1267 (IPythonDemo), and for running a script one-line-at-a-time as a
1264 demo, both for pure Python (LineDemo) and for IPython-processed
1268 demo, both for pure Python (LineDemo) and for IPython-processed
1265 input (IPythonLineDemo). After a request by Dave Kohel, from the
1269 input (IPythonLineDemo). After a request by Dave Kohel, from the
1266 SAGE team.
1270 SAGE team.
1267 (Demo.edit): added an edit() method to the demo objects, to edit
1271 (Demo.edit): added an edit() method to the demo objects, to edit
1268 the in-memory copy of the last executed block.
1272 the in-memory copy of the last executed block.
1269
1273
1270 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
1274 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
1271 processing to %edit, %macro and %save. These commands can now be
1275 processing to %edit, %macro and %save. These commands can now be
1272 invoked on the unprocessed input as it was typed by the user
1276 invoked on the unprocessed input as it was typed by the user
1273 (without any prefilters applied). After requests by the SAGE team
1277 (without any prefilters applied). After requests by the SAGE team
1274 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1278 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1275
1279
1276 2006-02-01 Ville Vainio <vivainio@gmail.com>
1280 2006-02-01 Ville Vainio <vivainio@gmail.com>
1277
1281
1278 * setup.py, eggsetup.py: easy_install ipython==dev works
1282 * setup.py, eggsetup.py: easy_install ipython==dev works
1279 correctly now (on Linux)
1283 correctly now (on Linux)
1280
1284
1281 * ipy_user_conf,ipmaker: user config changes, removed spurious
1285 * ipy_user_conf,ipmaker: user config changes, removed spurious
1282 warnings
1286 warnings
1283
1287
1284 * iplib: if rc.banner is string, use it as is.
1288 * iplib: if rc.banner is string, use it as is.
1285
1289
1286 * Magic: %pycat accepts a string argument and pages it's contents.
1290 * Magic: %pycat accepts a string argument and pages it's contents.
1287
1291
1288
1292
1289 2006-01-30 Ville Vainio <vivainio@gmail.com>
1293 2006-01-30 Ville Vainio <vivainio@gmail.com>
1290
1294
1291 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1295 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1292 Now %store and bookmarks work through PickleShare, meaning that
1296 Now %store and bookmarks work through PickleShare, meaning that
1293 concurrent access is possible and all ipython sessions see the
1297 concurrent access is possible and all ipython sessions see the
1294 same database situation all the time, instead of snapshot of
1298 same database situation all the time, instead of snapshot of
1295 the situation when the session was started. Hence, %bookmark
1299 the situation when the session was started. Hence, %bookmark
1296 results are immediately accessible from othes sessions. The database
1300 results are immediately accessible from othes sessions. The database
1297 is also available for use by user extensions. See:
1301 is also available for use by user extensions. See:
1298 http://www.python.org/pypi/pickleshare
1302 http://www.python.org/pypi/pickleshare
1299
1303
1300 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1304 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1301
1305
1302 * aliases can now be %store'd
1306 * aliases can now be %store'd
1303
1307
1304 * path.py moved to Extensions so that pickleshare does not need
1308 * path.py moved to Extensions so that pickleshare does not need
1305 IPython-specific import. Extensions added to pythonpath right
1309 IPython-specific import. Extensions added to pythonpath right
1306 at __init__.
1310 at __init__.
1307
1311
1308 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1312 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1309 called with _ip.system and the pre-transformed command string.
1313 called with _ip.system and the pre-transformed command string.
1310
1314
1311 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1315 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1312
1316
1313 * IPython/iplib.py (interact): Fix that we were not catching
1317 * IPython/iplib.py (interact): Fix that we were not catching
1314 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1318 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1315 logic here had to change, but it's fixed now.
1319 logic here had to change, but it's fixed now.
1316
1320
1317 2006-01-29 Ville Vainio <vivainio@gmail.com>
1321 2006-01-29 Ville Vainio <vivainio@gmail.com>
1318
1322
1319 * iplib.py: Try to import pyreadline on Windows.
1323 * iplib.py: Try to import pyreadline on Windows.
1320
1324
1321 2006-01-27 Ville Vainio <vivainio@gmail.com>
1325 2006-01-27 Ville Vainio <vivainio@gmail.com>
1322
1326
1323 * iplib.py: Expose ipapi as _ip in builtin namespace.
1327 * iplib.py: Expose ipapi as _ip in builtin namespace.
1324 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1328 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1325 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1329 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1326 syntax now produce _ip.* variant of the commands.
1330 syntax now produce _ip.* variant of the commands.
1327
1331
1328 * "_ip.options().autoedit_syntax = 2" automatically throws
1332 * "_ip.options().autoedit_syntax = 2" automatically throws
1329 user to editor for syntax error correction without prompting.
1333 user to editor for syntax error correction without prompting.
1330
1334
1331 2006-01-27 Ville Vainio <vivainio@gmail.com>
1335 2006-01-27 Ville Vainio <vivainio@gmail.com>
1332
1336
1333 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1337 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1334 'ipython' at argv[0]) executed through command line.
1338 'ipython' at argv[0]) executed through command line.
1335 NOTE: this DEPRECATES calling ipython with multiple scripts
1339 NOTE: this DEPRECATES calling ipython with multiple scripts
1336 ("ipython a.py b.py c.py")
1340 ("ipython a.py b.py c.py")
1337
1341
1338 * iplib.py, hooks.py: Added configurable input prefilter,
1342 * iplib.py, hooks.py: Added configurable input prefilter,
1339 named 'input_prefilter'. See ext_rescapture.py for example
1343 named 'input_prefilter'. See ext_rescapture.py for example
1340 usage.
1344 usage.
1341
1345
1342 * ext_rescapture.py, Magic.py: Better system command output capture
1346 * ext_rescapture.py, Magic.py: Better system command output capture
1343 through 'var = !ls' (deprecates user-visible %sc). Same notation
1347 through 'var = !ls' (deprecates user-visible %sc). Same notation
1344 applies for magics, 'var = %alias' assigns alias list to var.
1348 applies for magics, 'var = %alias' assigns alias list to var.
1345
1349
1346 * ipapi.py: added meta() for accessing extension-usable data store.
1350 * ipapi.py: added meta() for accessing extension-usable data store.
1347
1351
1348 * iplib.py: added InteractiveShell.getapi(). New magics should be
1352 * iplib.py: added InteractiveShell.getapi(). New magics should be
1349 written doing self.getapi() instead of using the shell directly.
1353 written doing self.getapi() instead of using the shell directly.
1350
1354
1351 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
1355 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
1352 %store foo >> ~/myfoo.txt to store variables to files (in clean
1356 %store foo >> ~/myfoo.txt to store variables to files (in clean
1353 textual form, not a restorable pickle).
1357 textual form, not a restorable pickle).
1354
1358
1355 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
1359 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
1356
1360
1357 * usage.py, Magic.py: added %quickref
1361 * usage.py, Magic.py: added %quickref
1358
1362
1359 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
1363 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
1360
1364
1361 * GetoptErrors when invoking magics etc. with wrong args
1365 * GetoptErrors when invoking magics etc. with wrong args
1362 are now more helpful:
1366 are now more helpful:
1363 GetoptError: option -l not recognized (allowed: "qb" )
1367 GetoptError: option -l not recognized (allowed: "qb" )
1364
1368
1365 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
1369 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
1366
1370
1367 * IPython/demo.py (Demo.show): Flush stdout after each block, so
1371 * IPython/demo.py (Demo.show): Flush stdout after each block, so
1368 computationally intensive blocks don't appear to stall the demo.
1372 computationally intensive blocks don't appear to stall the demo.
1369
1373
1370 2006-01-24 Ville Vainio <vivainio@gmail.com>
1374 2006-01-24 Ville Vainio <vivainio@gmail.com>
1371
1375
1372 * iplib.py, hooks.py: 'result_display' hook can return a non-None
1376 * iplib.py, hooks.py: 'result_display' hook can return a non-None
1373 value to manipulate resulting history entry.
1377 value to manipulate resulting history entry.
1374
1378
1375 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
1379 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
1376 to instance methods of IPApi class, to make extending an embedded
1380 to instance methods of IPApi class, to make extending an embedded
1377 IPython feasible. See ext_rehashdir.py for example usage.
1381 IPython feasible. See ext_rehashdir.py for example usage.
1378
1382
1379 * Merged 1071-1076 from branches/0.7.1
1383 * Merged 1071-1076 from branches/0.7.1
1380
1384
1381
1385
1382 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
1386 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
1383
1387
1384 * tools/release (daystamp): Fix build tools to use the new
1388 * tools/release (daystamp): Fix build tools to use the new
1385 eggsetup.py script to build lightweight eggs.
1389 eggsetup.py script to build lightweight eggs.
1386
1390
1387 * Applied changesets 1062 and 1064 before 0.7.1 release.
1391 * Applied changesets 1062 and 1064 before 0.7.1 release.
1388
1392
1389 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
1393 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
1390 see the raw input history (without conversions like %ls ->
1394 see the raw input history (without conversions like %ls ->
1391 ipmagic("ls")). After a request from W. Stein, SAGE
1395 ipmagic("ls")). After a request from W. Stein, SAGE
1392 (http://modular.ucsd.edu/sage) developer. This information is
1396 (http://modular.ucsd.edu/sage) developer. This information is
1393 stored in the input_hist_raw attribute of the IPython instance, so
1397 stored in the input_hist_raw attribute of the IPython instance, so
1394 developers can access it if needed (it's an InputList instance).
1398 developers can access it if needed (it's an InputList instance).
1395
1399
1396 * Versionstring = 0.7.2.svn
1400 * Versionstring = 0.7.2.svn
1397
1401
1398 * eggsetup.py: A separate script for constructing eggs, creates
1402 * eggsetup.py: A separate script for constructing eggs, creates
1399 proper launch scripts even on Windows (an .exe file in
1403 proper launch scripts even on Windows (an .exe file in
1400 \python24\scripts).
1404 \python24\scripts).
1401
1405
1402 * ipapi.py: launch_new_instance, launch entry point needed for the
1406 * ipapi.py: launch_new_instance, launch entry point needed for the
1403 egg.
1407 egg.
1404
1408
1405 2006-01-23 Ville Vainio <vivainio@gmail.com>
1409 2006-01-23 Ville Vainio <vivainio@gmail.com>
1406
1410
1407 * Added %cpaste magic for pasting python code
1411 * Added %cpaste magic for pasting python code
1408
1412
1409 2006-01-22 Ville Vainio <vivainio@gmail.com>
1413 2006-01-22 Ville Vainio <vivainio@gmail.com>
1410
1414
1411 * Merge from branches/0.7.1 into trunk, revs 1052-1057
1415 * Merge from branches/0.7.1 into trunk, revs 1052-1057
1412
1416
1413 * Versionstring = 0.7.2.svn
1417 * Versionstring = 0.7.2.svn
1414
1418
1415 * eggsetup.py: A separate script for constructing eggs, creates
1419 * eggsetup.py: A separate script for constructing eggs, creates
1416 proper launch scripts even on Windows (an .exe file in
1420 proper launch scripts even on Windows (an .exe file in
1417 \python24\scripts).
1421 \python24\scripts).
1418
1422
1419 * ipapi.py: launch_new_instance, launch entry point needed for the
1423 * ipapi.py: launch_new_instance, launch entry point needed for the
1420 egg.
1424 egg.
1421
1425
1422 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1426 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1423
1427
1424 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1428 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1425 %pfile foo would print the file for foo even if it was a binary.
1429 %pfile foo would print the file for foo even if it was a binary.
1426 Now, extensions '.so' and '.dll' are skipped.
1430 Now, extensions '.so' and '.dll' are skipped.
1427
1431
1428 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1432 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1429 bug, where macros would fail in all threaded modes. I'm not 100%
1433 bug, where macros would fail in all threaded modes. I'm not 100%
1430 sure, so I'm going to put out an rc instead of making a release
1434 sure, so I'm going to put out an rc instead of making a release
1431 today, and wait for feedback for at least a few days.
1435 today, and wait for feedback for at least a few days.
1432
1436
1433 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1437 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1434 it...) the handling of pasting external code with autoindent on.
1438 it...) the handling of pasting external code with autoindent on.
1435 To get out of a multiline input, the rule will appear for most
1439 To get out of a multiline input, the rule will appear for most
1436 users unchanged: two blank lines or change the indent level
1440 users unchanged: two blank lines or change the indent level
1437 proposed by IPython. But there is a twist now: you can
1441 proposed by IPython. But there is a twist now: you can
1438 add/subtract only *one or two spaces*. If you add/subtract three
1442 add/subtract only *one or two spaces*. If you add/subtract three
1439 or more (unless you completely delete the line), IPython will
1443 or more (unless you completely delete the line), IPython will
1440 accept that line, and you'll need to enter a second one of pure
1444 accept that line, and you'll need to enter a second one of pure
1441 whitespace. I know it sounds complicated, but I can't find a
1445 whitespace. I know it sounds complicated, but I can't find a
1442 different solution that covers all the cases, with the right
1446 different solution that covers all the cases, with the right
1443 heuristics. Hopefully in actual use, nobody will really notice
1447 heuristics. Hopefully in actual use, nobody will really notice
1444 all these strange rules and things will 'just work'.
1448 all these strange rules and things will 'just work'.
1445
1449
1446 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1450 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1447
1451
1448 * IPython/iplib.py (interact): catch exceptions which can be
1452 * IPython/iplib.py (interact): catch exceptions which can be
1449 triggered asynchronously by signal handlers. Thanks to an
1453 triggered asynchronously by signal handlers. Thanks to an
1450 automatic crash report, submitted by Colin Kingsley
1454 automatic crash report, submitted by Colin Kingsley
1451 <tercel-AT-gentoo.org>.
1455 <tercel-AT-gentoo.org>.
1452
1456
1453 2006-01-20 Ville Vainio <vivainio@gmail.com>
1457 2006-01-20 Ville Vainio <vivainio@gmail.com>
1454
1458
1455 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1459 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1456 (%rehashdir, very useful, try it out) of how to extend ipython
1460 (%rehashdir, very useful, try it out) of how to extend ipython
1457 with new magics. Also added Extensions dir to pythonpath to make
1461 with new magics. Also added Extensions dir to pythonpath to make
1458 importing extensions easy.
1462 importing extensions easy.
1459
1463
1460 * %store now complains when trying to store interactively declared
1464 * %store now complains when trying to store interactively declared
1461 classes / instances of those classes.
1465 classes / instances of those classes.
1462
1466
1463 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1467 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1464 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1468 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1465 if they exist, and ipy_user_conf.py with some defaults is created for
1469 if they exist, and ipy_user_conf.py with some defaults is created for
1466 the user.
1470 the user.
1467
1471
1468 * Startup rehashing done by the config file, not InterpreterExec.
1472 * Startup rehashing done by the config file, not InterpreterExec.
1469 This means system commands are available even without selecting the
1473 This means system commands are available even without selecting the
1470 pysh profile. It's the sensible default after all.
1474 pysh profile. It's the sensible default after all.
1471
1475
1472 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
1476 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
1473
1477
1474 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
1478 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
1475 multiline code with autoindent on working. But I am really not
1479 multiline code with autoindent on working. But I am really not
1476 sure, so this needs more testing. Will commit a debug-enabled
1480 sure, so this needs more testing. Will commit a debug-enabled
1477 version for now, while I test it some more, so that Ville and
1481 version for now, while I test it some more, so that Ville and
1478 others may also catch any problems. Also made
1482 others may also catch any problems. Also made
1479 self.indent_current_str() a method, to ensure that there's no
1483 self.indent_current_str() a method, to ensure that there's no
1480 chance of the indent space count and the corresponding string
1484 chance of the indent space count and the corresponding string
1481 falling out of sync. All code needing the string should just call
1485 falling out of sync. All code needing the string should just call
1482 the method.
1486 the method.
1483
1487
1484 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
1488 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
1485
1489
1486 * IPython/Magic.py (magic_edit): fix check for when users don't
1490 * IPython/Magic.py (magic_edit): fix check for when users don't
1487 save their output files, the try/except was in the wrong section.
1491 save their output files, the try/except was in the wrong section.
1488
1492
1489 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1493 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1490
1494
1491 * IPython/Magic.py (magic_run): fix __file__ global missing from
1495 * IPython/Magic.py (magic_run): fix __file__ global missing from
1492 script's namespace when executed via %run. After a report by
1496 script's namespace when executed via %run. After a report by
1493 Vivian.
1497 Vivian.
1494
1498
1495 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
1499 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
1496 when using python 2.4. The parent constructor changed in 2.4, and
1500 when using python 2.4. The parent constructor changed in 2.4, and
1497 we need to track it directly (we can't call it, as it messes up
1501 we need to track it directly (we can't call it, as it messes up
1498 readline and tab-completion inside our pdb would stop working).
1502 readline and tab-completion inside our pdb would stop working).
1499 After a bug report by R. Bernstein <rocky-AT-panix.com>.
1503 After a bug report by R. Bernstein <rocky-AT-panix.com>.
1500
1504
1501 2006-01-16 Ville Vainio <vivainio@gmail.com>
1505 2006-01-16 Ville Vainio <vivainio@gmail.com>
1502
1506
1503 * Ipython/magic.py: Reverted back to old %edit functionality
1507 * Ipython/magic.py: Reverted back to old %edit functionality
1504 that returns file contents on exit.
1508 that returns file contents on exit.
1505
1509
1506 * IPython/path.py: Added Jason Orendorff's "path" module to
1510 * IPython/path.py: Added Jason Orendorff's "path" module to
1507 IPython tree, http://www.jorendorff.com/articles/python/path/.
1511 IPython tree, http://www.jorendorff.com/articles/python/path/.
1508 You can get path objects conveniently through %sc, and !!, e.g.:
1512 You can get path objects conveniently through %sc, and !!, e.g.:
1509 sc files=ls
1513 sc files=ls
1510 for p in files.paths: # or files.p
1514 for p in files.paths: # or files.p
1511 print p,p.mtime
1515 print p,p.mtime
1512
1516
1513 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
1517 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
1514 now work again without considering the exclusion regexp -
1518 now work again without considering the exclusion regexp -
1515 hence, things like ',foo my/path' turn to 'foo("my/path")'
1519 hence, things like ',foo my/path' turn to 'foo("my/path")'
1516 instead of syntax error.
1520 instead of syntax error.
1517
1521
1518
1522
1519 2006-01-14 Ville Vainio <vivainio@gmail.com>
1523 2006-01-14 Ville Vainio <vivainio@gmail.com>
1520
1524
1521 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
1525 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
1522 ipapi decorators for python 2.4 users, options() provides access to rc
1526 ipapi decorators for python 2.4 users, options() provides access to rc
1523 data.
1527 data.
1524
1528
1525 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
1529 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
1526 as path separators (even on Linux ;-). Space character after
1530 as path separators (even on Linux ;-). Space character after
1527 backslash (as yielded by tab completer) is still space;
1531 backslash (as yielded by tab completer) is still space;
1528 "%cd long\ name" works as expected.
1532 "%cd long\ name" works as expected.
1529
1533
1530 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
1534 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
1531 as "chain of command", with priority. API stays the same,
1535 as "chain of command", with priority. API stays the same,
1532 TryNext exception raised by a hook function signals that
1536 TryNext exception raised by a hook function signals that
1533 current hook failed and next hook should try handling it, as
1537 current hook failed and next hook should try handling it, as
1534 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
1538 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
1535 requested configurable display hook, which is now implemented.
1539 requested configurable display hook, which is now implemented.
1536
1540
1537 2006-01-13 Ville Vainio <vivainio@gmail.com>
1541 2006-01-13 Ville Vainio <vivainio@gmail.com>
1538
1542
1539 * IPython/platutils*.py: platform specific utility functions,
1543 * IPython/platutils*.py: platform specific utility functions,
1540 so far only set_term_title is implemented (change terminal
1544 so far only set_term_title is implemented (change terminal
1541 label in windowing systems). %cd now changes the title to
1545 label in windowing systems). %cd now changes the title to
1542 current dir.
1546 current dir.
1543
1547
1544 * IPython/Release.py: Added myself to "authors" list,
1548 * IPython/Release.py: Added myself to "authors" list,
1545 had to create new files.
1549 had to create new files.
1546
1550
1547 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
1551 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
1548 shell escape; not a known bug but had potential to be one in the
1552 shell escape; not a known bug but had potential to be one in the
1549 future.
1553 future.
1550
1554
1551 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
1555 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
1552 extension API for IPython! See the module for usage example. Fix
1556 extension API for IPython! See the module for usage example. Fix
1553 OInspect for docstring-less magic functions.
1557 OInspect for docstring-less magic functions.
1554
1558
1555
1559
1556 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
1560 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
1557
1561
1558 * IPython/iplib.py (raw_input): temporarily deactivate all
1562 * IPython/iplib.py (raw_input): temporarily deactivate all
1559 attempts at allowing pasting of code with autoindent on. It
1563 attempts at allowing pasting of code with autoindent on. It
1560 introduced bugs (reported by Prabhu) and I can't seem to find a
1564 introduced bugs (reported by Prabhu) and I can't seem to find a
1561 robust combination which works in all cases. Will have to revisit
1565 robust combination which works in all cases. Will have to revisit
1562 later.
1566 later.
1563
1567
1564 * IPython/genutils.py: remove isspace() function. We've dropped
1568 * IPython/genutils.py: remove isspace() function. We've dropped
1565 2.2 compatibility, so it's OK to use the string method.
1569 2.2 compatibility, so it's OK to use the string method.
1566
1570
1567 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1571 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1568
1572
1569 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
1573 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
1570 matching what NOT to autocall on, to include all python binary
1574 matching what NOT to autocall on, to include all python binary
1571 operators (including things like 'and', 'or', 'is' and 'in').
1575 operators (including things like 'and', 'or', 'is' and 'in').
1572 Prompted by a bug report on 'foo & bar', but I realized we had
1576 Prompted by a bug report on 'foo & bar', but I realized we had
1573 many more potential bug cases with other operators. The regexp is
1577 many more potential bug cases with other operators. The regexp is
1574 self.re_exclude_auto, it's fairly commented.
1578 self.re_exclude_auto, it's fairly commented.
1575
1579
1576 2006-01-12 Ville Vainio <vivainio@gmail.com>
1580 2006-01-12 Ville Vainio <vivainio@gmail.com>
1577
1581
1578 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
1582 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
1579 Prettified and hardened string/backslash quoting with ipsystem(),
1583 Prettified and hardened string/backslash quoting with ipsystem(),
1580 ipalias() and ipmagic(). Now even \ characters are passed to
1584 ipalias() and ipmagic(). Now even \ characters are passed to
1581 %magics, !shell escapes and aliases exactly as they are in the
1585 %magics, !shell escapes and aliases exactly as they are in the
1582 ipython command line. Should improve backslash experience,
1586 ipython command line. Should improve backslash experience,
1583 particularly in Windows (path delimiter for some commands that
1587 particularly in Windows (path delimiter for some commands that
1584 won't understand '/'), but Unix benefits as well (regexps). %cd
1588 won't understand '/'), but Unix benefits as well (regexps). %cd
1585 magic still doesn't support backslash path delimiters, though. Also
1589 magic still doesn't support backslash path delimiters, though. Also
1586 deleted all pretense of supporting multiline command strings in
1590 deleted all pretense of supporting multiline command strings in
1587 !system or %magic commands. Thanks to Jerry McRae for suggestions.
1591 !system or %magic commands. Thanks to Jerry McRae for suggestions.
1588
1592
1589 * doc/build_doc_instructions.txt added. Documentation on how to
1593 * doc/build_doc_instructions.txt added. Documentation on how to
1590 use doc/update_manual.py, added yesterday. Both files contributed
1594 use doc/update_manual.py, added yesterday. Both files contributed
1591 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1595 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
1592 doc/*.sh for deprecation at a later date.
1596 doc/*.sh for deprecation at a later date.
1593
1597
1594 * /ipython.py Added ipython.py to root directory for
1598 * /ipython.py Added ipython.py to root directory for
1595 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1599 zero-installation (tar xzvf ipython.tgz; cd ipython; python
1596 ipython.py) and development convenience (no need to keep doing
1600 ipython.py) and development convenience (no need to keep doing
1597 "setup.py install" between changes).
1601 "setup.py install" between changes).
1598
1602
1599 * Made ! and !! shell escapes work (again) in multiline expressions:
1603 * Made ! and !! shell escapes work (again) in multiline expressions:
1600 if 1:
1604 if 1:
1601 !ls
1605 !ls
1602 !!ls
1606 !!ls
1603
1607
1604 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1608 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
1605
1609
1606 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1610 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
1607 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1611 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
1608 module in case-insensitive installation. Was causing crashes
1612 module in case-insensitive installation. Was causing crashes
1609 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1613 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
1610
1614
1611 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1615 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
1612 <marienz-AT-gentoo.org>, closes
1616 <marienz-AT-gentoo.org>, closes
1613 http://www.scipy.net/roundup/ipython/issue51.
1617 http://www.scipy.net/roundup/ipython/issue51.
1614
1618
1615 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1619 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
1616
1620
1617 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1621 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
1618 problem of excessive CPU usage under *nix and keyboard lag under
1622 problem of excessive CPU usage under *nix and keyboard lag under
1619 win32.
1623 win32.
1620
1624
1621 2006-01-10 *** Released version 0.7.0
1625 2006-01-10 *** Released version 0.7.0
1622
1626
1623 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1627 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
1624
1628
1625 * IPython/Release.py (revision): tag version number to 0.7.0,
1629 * IPython/Release.py (revision): tag version number to 0.7.0,
1626 ready for release.
1630 ready for release.
1627
1631
1628 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1632 * IPython/Magic.py (magic_edit): Add print statement to %edit so
1629 it informs the user of the name of the temp. file used. This can
1633 it informs the user of the name of the temp. file used. This can
1630 help if you decide later to reuse that same file, so you know
1634 help if you decide later to reuse that same file, so you know
1631 where to copy the info from.
1635 where to copy the info from.
1632
1636
1633 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1637 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
1634
1638
1635 * setup_bdist_egg.py: little script to build an egg. Added
1639 * setup_bdist_egg.py: little script to build an egg. Added
1636 support in the release tools as well.
1640 support in the release tools as well.
1637
1641
1638 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1642 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
1639
1643
1640 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1644 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
1641 version selection (new -wxversion command line and ipythonrc
1645 version selection (new -wxversion command line and ipythonrc
1642 parameter). Patch contributed by Arnd Baecker
1646 parameter). Patch contributed by Arnd Baecker
1643 <arnd.baecker-AT-web.de>.
1647 <arnd.baecker-AT-web.de>.
1644
1648
1645 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1649 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1646 embedded instances, for variables defined at the interactive
1650 embedded instances, for variables defined at the interactive
1647 prompt of the embedded ipython. Reported by Arnd.
1651 prompt of the embedded ipython. Reported by Arnd.
1648
1652
1649 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1653 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
1650 it can be used as a (stateful) toggle, or with a direct parameter.
1654 it can be used as a (stateful) toggle, or with a direct parameter.
1651
1655
1652 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1656 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
1653 could be triggered in certain cases and cause the traceback
1657 could be triggered in certain cases and cause the traceback
1654 printer not to work.
1658 printer not to work.
1655
1659
1656 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1660 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
1657
1661
1658 * IPython/iplib.py (_should_recompile): Small fix, closes
1662 * IPython/iplib.py (_should_recompile): Small fix, closes
1659 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1663 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
1660
1664
1661 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1665 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
1662
1666
1663 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1667 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
1664 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1668 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
1665 Moad for help with tracking it down.
1669 Moad for help with tracking it down.
1666
1670
1667 * IPython/iplib.py (handle_auto): fix autocall handling for
1671 * IPython/iplib.py (handle_auto): fix autocall handling for
1668 objects which support BOTH __getitem__ and __call__ (so that f [x]
1672 objects which support BOTH __getitem__ and __call__ (so that f [x]
1669 is left alone, instead of becoming f([x]) automatically).
1673 is left alone, instead of becoming f([x]) automatically).
1670
1674
1671 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1675 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
1672 Ville's patch.
1676 Ville's patch.
1673
1677
1674 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1678 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
1675
1679
1676 * IPython/iplib.py (handle_auto): changed autocall semantics to
1680 * IPython/iplib.py (handle_auto): changed autocall semantics to
1677 include 'smart' mode, where the autocall transformation is NOT
1681 include 'smart' mode, where the autocall transformation is NOT
1678 applied if there are no arguments on the line. This allows you to
1682 applied if there are no arguments on the line. This allows you to
1679 just type 'foo' if foo is a callable to see its internal form,
1683 just type 'foo' if foo is a callable to see its internal form,
1680 instead of having it called with no arguments (typically a
1684 instead of having it called with no arguments (typically a
1681 mistake). The old 'full' autocall still exists: for that, you
1685 mistake). The old 'full' autocall still exists: for that, you
1682 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1686 need to set the 'autocall' parameter to 2 in your ipythonrc file.
1683
1687
1684 * IPython/completer.py (Completer.attr_matches): add
1688 * IPython/completer.py (Completer.attr_matches): add
1685 tab-completion support for Enthoughts' traits. After a report by
1689 tab-completion support for Enthoughts' traits. After a report by
1686 Arnd and a patch by Prabhu.
1690 Arnd and a patch by Prabhu.
1687
1691
1688 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1692 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
1689
1693
1690 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1694 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
1691 Schmolck's patch to fix inspect.getinnerframes().
1695 Schmolck's patch to fix inspect.getinnerframes().
1692
1696
1693 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1697 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
1694 for embedded instances, regarding handling of namespaces and items
1698 for embedded instances, regarding handling of namespaces and items
1695 added to the __builtin__ one. Multiple embedded instances and
1699 added to the __builtin__ one. Multiple embedded instances and
1696 recursive embeddings should work better now (though I'm not sure
1700 recursive embeddings should work better now (though I'm not sure
1697 I've got all the corner cases fixed, that code is a bit of a brain
1701 I've got all the corner cases fixed, that code is a bit of a brain
1698 twister).
1702 twister).
1699
1703
1700 * IPython/Magic.py (magic_edit): added support to edit in-memory
1704 * IPython/Magic.py (magic_edit): added support to edit in-memory
1701 macros (automatically creates the necessary temp files). %edit
1705 macros (automatically creates the necessary temp files). %edit
1702 also doesn't return the file contents anymore, it's just noise.
1706 also doesn't return the file contents anymore, it's just noise.
1703
1707
1704 * IPython/completer.py (Completer.attr_matches): revert change to
1708 * IPython/completer.py (Completer.attr_matches): revert change to
1705 complete only on attributes listed in __all__. I realized it
1709 complete only on attributes listed in __all__. I realized it
1706 cripples the tab-completion system as a tool for exploring the
1710 cripples the tab-completion system as a tool for exploring the
1707 internals of unknown libraries (it renders any non-__all__
1711 internals of unknown libraries (it renders any non-__all__
1708 attribute off-limits). I got bit by this when trying to see
1712 attribute off-limits). I got bit by this when trying to see
1709 something inside the dis module.
1713 something inside the dis module.
1710
1714
1711 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1715 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
1712
1716
1713 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1717 * IPython/iplib.py (InteractiveShell.__init__): add .meta
1714 namespace for users and extension writers to hold data in. This
1718 namespace for users and extension writers to hold data in. This
1715 follows the discussion in
1719 follows the discussion in
1716 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1720 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
1717
1721
1718 * IPython/completer.py (IPCompleter.complete): small patch to help
1722 * IPython/completer.py (IPCompleter.complete): small patch to help
1719 tab-completion under Emacs, after a suggestion by John Barnard
1723 tab-completion under Emacs, after a suggestion by John Barnard
1720 <barnarj-AT-ccf.org>.
1724 <barnarj-AT-ccf.org>.
1721
1725
1722 * IPython/Magic.py (Magic.extract_input_slices): added support for
1726 * IPython/Magic.py (Magic.extract_input_slices): added support for
1723 the slice notation in magics to use N-M to represent numbers N...M
1727 the slice notation in magics to use N-M to represent numbers N...M
1724 (closed endpoints). This is used by %macro and %save.
1728 (closed endpoints). This is used by %macro and %save.
1725
1729
1726 * IPython/completer.py (Completer.attr_matches): for modules which
1730 * IPython/completer.py (Completer.attr_matches): for modules which
1727 define __all__, complete only on those. After a patch by Jeffrey
1731 define __all__, complete only on those. After a patch by Jeffrey
1728 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1732 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
1729 speed up this routine.
1733 speed up this routine.
1730
1734
1731 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1735 * IPython/Logger.py (Logger.log): fix a history handling bug. I
1732 don't know if this is the end of it, but the behavior now is
1736 don't know if this is the end of it, but the behavior now is
1733 certainly much more correct. Note that coupled with macros,
1737 certainly much more correct. Note that coupled with macros,
1734 slightly surprising (at first) behavior may occur: a macro will in
1738 slightly surprising (at first) behavior may occur: a macro will in
1735 general expand to multiple lines of input, so upon exiting, the
1739 general expand to multiple lines of input, so upon exiting, the
1736 in/out counters will both be bumped by the corresponding amount
1740 in/out counters will both be bumped by the corresponding amount
1737 (as if the macro's contents had been typed interactively). Typing
1741 (as if the macro's contents had been typed interactively). Typing
1738 %hist will reveal the intermediate (silently processed) lines.
1742 %hist will reveal the intermediate (silently processed) lines.
1739
1743
1740 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1744 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
1741 pickle to fail (%run was overwriting __main__ and not restoring
1745 pickle to fail (%run was overwriting __main__ and not restoring
1742 it, but pickle relies on __main__ to operate).
1746 it, but pickle relies on __main__ to operate).
1743
1747
1744 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1748 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
1745 using properties, but forgot to make the main InteractiveShell
1749 using properties, but forgot to make the main InteractiveShell
1746 class a new-style class. Properties fail silently, and
1750 class a new-style class. Properties fail silently, and
1747 mysteriously, with old-style class (getters work, but
1751 mysteriously, with old-style class (getters work, but
1748 setters don't do anything).
1752 setters don't do anything).
1749
1753
1750 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1754 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1751
1755
1752 * IPython/Magic.py (magic_history): fix history reporting bug (I
1756 * IPython/Magic.py (magic_history): fix history reporting bug (I
1753 know some nasties are still there, I just can't seem to find a
1757 know some nasties are still there, I just can't seem to find a
1754 reproducible test case to track them down; the input history is
1758 reproducible test case to track them down; the input history is
1755 falling out of sync...)
1759 falling out of sync...)
1756
1760
1757 * IPython/iplib.py (handle_shell_escape): fix bug where both
1761 * IPython/iplib.py (handle_shell_escape): fix bug where both
1758 aliases and system accesses where broken for indented code (such
1762 aliases and system accesses where broken for indented code (such
1759 as loops).
1763 as loops).
1760
1764
1761 * IPython/genutils.py (shell): fix small but critical bug for
1765 * IPython/genutils.py (shell): fix small but critical bug for
1762 win32 system access.
1766 win32 system access.
1763
1767
1764 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1768 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
1765
1769
1766 * IPython/iplib.py (showtraceback): remove use of the
1770 * IPython/iplib.py (showtraceback): remove use of the
1767 sys.last_{type/value/traceback} structures, which are non
1771 sys.last_{type/value/traceback} structures, which are non
1768 thread-safe.
1772 thread-safe.
1769 (_prefilter): change control flow to ensure that we NEVER
1773 (_prefilter): change control flow to ensure that we NEVER
1770 introspect objects when autocall is off. This will guarantee that
1774 introspect objects when autocall is off. This will guarantee that
1771 having an input line of the form 'x.y', where access to attribute
1775 having an input line of the form 'x.y', where access to attribute
1772 'y' has side effects, doesn't trigger the side effect TWICE. It
1776 'y' has side effects, doesn't trigger the side effect TWICE. It
1773 is important to note that, with autocall on, these side effects
1777 is important to note that, with autocall on, these side effects
1774 can still happen.
1778 can still happen.
1775 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1779 (ipsystem): new builtin, to complete the ip{magic/alias/system}
1776 trio. IPython offers these three kinds of special calls which are
1780 trio. IPython offers these three kinds of special calls which are
1777 not python code, and it's a good thing to have their call method
1781 not python code, and it's a good thing to have their call method
1778 be accessible as pure python functions (not just special syntax at
1782 be accessible as pure python functions (not just special syntax at
1779 the command line). It gives us a better internal implementation
1783 the command line). It gives us a better internal implementation
1780 structure, as well as exposing these for user scripting more
1784 structure, as well as exposing these for user scripting more
1781 cleanly.
1785 cleanly.
1782
1786
1783 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1787 * IPython/macro.py (Macro.__init__): moved macros to a standalone
1784 file. Now that they'll be more likely to be used with the
1788 file. Now that they'll be more likely to be used with the
1785 persistance system (%store), I want to make sure their module path
1789 persistance system (%store), I want to make sure their module path
1786 doesn't change in the future, so that we don't break things for
1790 doesn't change in the future, so that we don't break things for
1787 users' persisted data.
1791 users' persisted data.
1788
1792
1789 * IPython/iplib.py (autoindent_update): move indentation
1793 * IPython/iplib.py (autoindent_update): move indentation
1790 management into the _text_ processing loop, not the keyboard
1794 management into the _text_ processing loop, not the keyboard
1791 interactive one. This is necessary to correctly process non-typed
1795 interactive one. This is necessary to correctly process non-typed
1792 multiline input (such as macros).
1796 multiline input (such as macros).
1793
1797
1794 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1798 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
1795 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1799 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
1796 which was producing problems in the resulting manual.
1800 which was producing problems in the resulting manual.
1797 (magic_whos): improve reporting of instances (show their class,
1801 (magic_whos): improve reporting of instances (show their class,
1798 instead of simply printing 'instance' which isn't terribly
1802 instead of simply printing 'instance' which isn't terribly
1799 informative).
1803 informative).
1800
1804
1801 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1805 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
1802 (minor mods) to support network shares under win32.
1806 (minor mods) to support network shares under win32.
1803
1807
1804 * IPython/winconsole.py (get_console_size): add new winconsole
1808 * IPython/winconsole.py (get_console_size): add new winconsole
1805 module and fixes to page_dumb() to improve its behavior under
1809 module and fixes to page_dumb() to improve its behavior under
1806 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1810 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
1807
1811
1808 * IPython/Magic.py (Macro): simplified Macro class to just
1812 * IPython/Magic.py (Macro): simplified Macro class to just
1809 subclass list. We've had only 2.2 compatibility for a very long
1813 subclass list. We've had only 2.2 compatibility for a very long
1810 time, yet I was still avoiding subclassing the builtin types. No
1814 time, yet I was still avoiding subclassing the builtin types. No
1811 more (I'm also starting to use properties, though I won't shift to
1815 more (I'm also starting to use properties, though I won't shift to
1812 2.3-specific features quite yet).
1816 2.3-specific features quite yet).
1813 (magic_store): added Ville's patch for lightweight variable
1817 (magic_store): added Ville's patch for lightweight variable
1814 persistence, after a request on the user list by Matt Wilkie
1818 persistence, after a request on the user list by Matt Wilkie
1815 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1819 <maphew-AT-gmail.com>. The new %store magic's docstring has full
1816 details.
1820 details.
1817
1821
1818 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1822 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1819 changed the default logfile name from 'ipython.log' to
1823 changed the default logfile name from 'ipython.log' to
1820 'ipython_log.py'. These logs are real python files, and now that
1824 'ipython_log.py'. These logs are real python files, and now that
1821 we have much better multiline support, people are more likely to
1825 we have much better multiline support, people are more likely to
1822 want to use them as such. Might as well name them correctly.
1826 want to use them as such. Might as well name them correctly.
1823
1827
1824 * IPython/Magic.py: substantial cleanup. While we can't stop
1828 * IPython/Magic.py: substantial cleanup. While we can't stop
1825 using magics as mixins, due to the existing customizations 'out
1829 using magics as mixins, due to the existing customizations 'out
1826 there' which rely on the mixin naming conventions, at least I
1830 there' which rely on the mixin naming conventions, at least I
1827 cleaned out all cross-class name usage. So once we are OK with
1831 cleaned out all cross-class name usage. So once we are OK with
1828 breaking compatibility, the two systems can be separated.
1832 breaking compatibility, the two systems can be separated.
1829
1833
1830 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1834 * IPython/Logger.py: major cleanup. This one is NOT a mixin
1831 anymore, and the class is a fair bit less hideous as well. New
1835 anymore, and the class is a fair bit less hideous as well. New
1832 features were also introduced: timestamping of input, and logging
1836 features were also introduced: timestamping of input, and logging
1833 of output results. These are user-visible with the -t and -o
1837 of output results. These are user-visible with the -t and -o
1834 options to %logstart. Closes
1838 options to %logstart. Closes
1835 http://www.scipy.net/roundup/ipython/issue11 and a request by
1839 http://www.scipy.net/roundup/ipython/issue11 and a request by
1836 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1840 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
1837
1841
1838 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1842 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
1839
1843
1840 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1844 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
1841 better handle backslashes in paths. See the thread 'More Windows
1845 better handle backslashes in paths. See the thread 'More Windows
1842 questions part 2 - \/ characters revisited' on the iypthon user
1846 questions part 2 - \/ characters revisited' on the iypthon user
1843 list:
1847 list:
1844 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1848 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
1845
1849
1846 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1850 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
1847
1851
1848 (InteractiveShell.__init__): change threaded shells to not use the
1852 (InteractiveShell.__init__): change threaded shells to not use the
1849 ipython crash handler. This was causing more problems than not,
1853 ipython crash handler. This was causing more problems than not,
1850 as exceptions in the main thread (GUI code, typically) would
1854 as exceptions in the main thread (GUI code, typically) would
1851 always show up as a 'crash', when they really weren't.
1855 always show up as a 'crash', when they really weren't.
1852
1856
1853 The colors and exception mode commands (%colors/%xmode) have been
1857 The colors and exception mode commands (%colors/%xmode) have been
1854 synchronized to also take this into account, so users can get
1858 synchronized to also take this into account, so users can get
1855 verbose exceptions for their threaded code as well. I also added
1859 verbose exceptions for their threaded code as well. I also added
1856 support for activating pdb inside this exception handler as well,
1860 support for activating pdb inside this exception handler as well,
1857 so now GUI authors can use IPython's enhanced pdb at runtime.
1861 so now GUI authors can use IPython's enhanced pdb at runtime.
1858
1862
1859 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1863 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
1860 true by default, and add it to the shipped ipythonrc file. Since
1864 true by default, and add it to the shipped ipythonrc file. Since
1861 this asks the user before proceeding, I think it's OK to make it
1865 this asks the user before proceeding, I think it's OK to make it
1862 true by default.
1866 true by default.
1863
1867
1864 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1868 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
1865 of the previous special-casing of input in the eval loop. I think
1869 of the previous special-casing of input in the eval loop. I think
1866 this is cleaner, as they really are commands and shouldn't have
1870 this is cleaner, as they really are commands and shouldn't have
1867 a special role in the middle of the core code.
1871 a special role in the middle of the core code.
1868
1872
1869 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1873 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
1870
1874
1871 * IPython/iplib.py (edit_syntax_error): added support for
1875 * IPython/iplib.py (edit_syntax_error): added support for
1872 automatically reopening the editor if the file had a syntax error
1876 automatically reopening the editor if the file had a syntax error
1873 in it. Thanks to scottt who provided the patch at:
1877 in it. Thanks to scottt who provided the patch at:
1874 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1878 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
1875 version committed).
1879 version committed).
1876
1880
1877 * IPython/iplib.py (handle_normal): add suport for multi-line
1881 * IPython/iplib.py (handle_normal): add suport for multi-line
1878 input with emtpy lines. This fixes
1882 input with emtpy lines. This fixes
1879 http://www.scipy.net/roundup/ipython/issue43 and a similar
1883 http://www.scipy.net/roundup/ipython/issue43 and a similar
1880 discussion on the user list.
1884 discussion on the user list.
1881
1885
1882 WARNING: a behavior change is necessarily introduced to support
1886 WARNING: a behavior change is necessarily introduced to support
1883 blank lines: now a single blank line with whitespace does NOT
1887 blank lines: now a single blank line with whitespace does NOT
1884 break the input loop, which means that when autoindent is on, by
1888 break the input loop, which means that when autoindent is on, by
1885 default hitting return on the next (indented) line does NOT exit.
1889 default hitting return on the next (indented) line does NOT exit.
1886
1890
1887 Instead, to exit a multiline input you can either have:
1891 Instead, to exit a multiline input you can either have:
1888
1892
1889 - TWO whitespace lines (just hit return again), or
1893 - TWO whitespace lines (just hit return again), or
1890 - a single whitespace line of a different length than provided
1894 - a single whitespace line of a different length than provided
1891 by the autoindent (add or remove a space).
1895 by the autoindent (add or remove a space).
1892
1896
1893 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1897 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
1894 module to better organize all readline-related functionality.
1898 module to better organize all readline-related functionality.
1895 I've deleted FlexCompleter and put all completion clases here.
1899 I've deleted FlexCompleter and put all completion clases here.
1896
1900
1897 * IPython/iplib.py (raw_input): improve indentation management.
1901 * IPython/iplib.py (raw_input): improve indentation management.
1898 It is now possible to paste indented code with autoindent on, and
1902 It is now possible to paste indented code with autoindent on, and
1899 the code is interpreted correctly (though it still looks bad on
1903 the code is interpreted correctly (though it still looks bad on
1900 screen, due to the line-oriented nature of ipython).
1904 screen, due to the line-oriented nature of ipython).
1901 (MagicCompleter.complete): change behavior so that a TAB key on an
1905 (MagicCompleter.complete): change behavior so that a TAB key on an
1902 otherwise empty line actually inserts a tab, instead of completing
1906 otherwise empty line actually inserts a tab, instead of completing
1903 on the entire global namespace. This makes it easier to use the
1907 on the entire global namespace. This makes it easier to use the
1904 TAB key for indentation. After a request by Hans Meine
1908 TAB key for indentation. After a request by Hans Meine
1905 <hans_meine-AT-gmx.net>
1909 <hans_meine-AT-gmx.net>
1906 (_prefilter): add support so that typing plain 'exit' or 'quit'
1910 (_prefilter): add support so that typing plain 'exit' or 'quit'
1907 does a sensible thing. Originally I tried to deviate as little as
1911 does a sensible thing. Originally I tried to deviate as little as
1908 possible from the default python behavior, but even that one may
1912 possible from the default python behavior, but even that one may
1909 change in this direction (thread on python-dev to that effect).
1913 change in this direction (thread on python-dev to that effect).
1910 Regardless, ipython should do the right thing even if CPython's
1914 Regardless, ipython should do the right thing even if CPython's
1911 '>>>' prompt doesn't.
1915 '>>>' prompt doesn't.
1912 (InteractiveShell): removed subclassing code.InteractiveConsole
1916 (InteractiveShell): removed subclassing code.InteractiveConsole
1913 class. By now we'd overridden just about all of its methods: I've
1917 class. By now we'd overridden just about all of its methods: I've
1914 copied the remaining two over, and now ipython is a standalone
1918 copied the remaining two over, and now ipython is a standalone
1915 class. This will provide a clearer picture for the chainsaw
1919 class. This will provide a clearer picture for the chainsaw
1916 branch refactoring.
1920 branch refactoring.
1917
1921
1918 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1922 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
1919
1923
1920 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1924 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
1921 failures for objects which break when dir() is called on them.
1925 failures for objects which break when dir() is called on them.
1922
1926
1923 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1927 * IPython/FlexCompleter.py (Completer.__init__): Added support for
1924 distinct local and global namespaces in the completer API. This
1928 distinct local and global namespaces in the completer API. This
1925 change allows us to properly handle completion with distinct
1929 change allows us to properly handle completion with distinct
1926 scopes, including in embedded instances (this had never really
1930 scopes, including in embedded instances (this had never really
1927 worked correctly).
1931 worked correctly).
1928
1932
1929 Note: this introduces a change in the constructor for
1933 Note: this introduces a change in the constructor for
1930 MagicCompleter, as a new global_namespace parameter is now the
1934 MagicCompleter, as a new global_namespace parameter is now the
1931 second argument (the others were bumped one position).
1935 second argument (the others were bumped one position).
1932
1936
1933 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1937 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
1934
1938
1935 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1939 * IPython/iplib.py (embed_mainloop): fix tab-completion in
1936 embedded instances (which can be done now thanks to Vivian's
1940 embedded instances (which can be done now thanks to Vivian's
1937 frame-handling fixes for pdb).
1941 frame-handling fixes for pdb).
1938 (InteractiveShell.__init__): Fix namespace handling problem in
1942 (InteractiveShell.__init__): Fix namespace handling problem in
1939 embedded instances. We were overwriting __main__ unconditionally,
1943 embedded instances. We were overwriting __main__ unconditionally,
1940 and this should only be done for 'full' (non-embedded) IPython;
1944 and this should only be done for 'full' (non-embedded) IPython;
1941 embedded instances must respect the caller's __main__. Thanks to
1945 embedded instances must respect the caller's __main__. Thanks to
1942 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1946 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
1943
1947
1944 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1948 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
1945
1949
1946 * setup.py: added download_url to setup(). This registers the
1950 * setup.py: added download_url to setup(). This registers the
1947 download address at PyPI, which is not only useful to humans
1951 download address at PyPI, which is not only useful to humans
1948 browsing the site, but is also picked up by setuptools (the Eggs
1952 browsing the site, but is also picked up by setuptools (the Eggs
1949 machinery). Thanks to Ville and R. Kern for the info/discussion
1953 machinery). Thanks to Ville and R. Kern for the info/discussion
1950 on this.
1954 on this.
1951
1955
1952 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1956 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
1953
1957
1954 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1958 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
1955 This brings a lot of nice functionality to the pdb mode, which now
1959 This brings a lot of nice functionality to the pdb mode, which now
1956 has tab-completion, syntax highlighting, and better stack handling
1960 has tab-completion, syntax highlighting, and better stack handling
1957 than before. Many thanks to Vivian De Smedt
1961 than before. Many thanks to Vivian De Smedt
1958 <vivian-AT-vdesmedt.com> for the original patches.
1962 <vivian-AT-vdesmedt.com> for the original patches.
1959
1963
1960 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1964 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
1961
1965
1962 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1966 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
1963 sequence to consistently accept the banner argument. The
1967 sequence to consistently accept the banner argument. The
1964 inconsistency was tripping SAGE, thanks to Gary Zablackis
1968 inconsistency was tripping SAGE, thanks to Gary Zablackis
1965 <gzabl-AT-yahoo.com> for the report.
1969 <gzabl-AT-yahoo.com> for the report.
1966
1970
1967 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1971 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1968
1972
1969 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1973 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1970 Fix bug where a naked 'alias' call in the ipythonrc file would
1974 Fix bug where a naked 'alias' call in the ipythonrc file would
1971 cause a crash. Bug reported by Jorgen Stenarson.
1975 cause a crash. Bug reported by Jorgen Stenarson.
1972
1976
1973 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1977 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1974
1978
1975 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1979 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1976 startup time.
1980 startup time.
1977
1981
1978 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1982 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1979 instances had introduced a bug with globals in normal code. Now
1983 instances had introduced a bug with globals in normal code. Now
1980 it's working in all cases.
1984 it's working in all cases.
1981
1985
1982 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1986 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1983 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1987 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1984 has been introduced to set the default case sensitivity of the
1988 has been introduced to set the default case sensitivity of the
1985 searches. Users can still select either mode at runtime on a
1989 searches. Users can still select either mode at runtime on a
1986 per-search basis.
1990 per-search basis.
1987
1991
1988 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1992 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1989
1993
1990 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1994 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1991 attributes in wildcard searches for subclasses. Modified version
1995 attributes in wildcard searches for subclasses. Modified version
1992 of a patch by Jorgen.
1996 of a patch by Jorgen.
1993
1997
1994 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1998 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1995
1999
1996 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
2000 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1997 embedded instances. I added a user_global_ns attribute to the
2001 embedded instances. I added a user_global_ns attribute to the
1998 InteractiveShell class to handle this.
2002 InteractiveShell class to handle this.
1999
2003
2000 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
2004 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
2001
2005
2002 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
2006 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
2003 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
2007 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
2004 (reported under win32, but may happen also in other platforms).
2008 (reported under win32, but may happen also in other platforms).
2005 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
2009 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
2006
2010
2007 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
2011 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
2008
2012
2009 * IPython/Magic.py (magic_psearch): new support for wildcard
2013 * IPython/Magic.py (magic_psearch): new support for wildcard
2010 patterns. Now, typing ?a*b will list all names which begin with a
2014 patterns. Now, typing ?a*b will list all names which begin with a
2011 and end in b, for example. The %psearch magic has full
2015 and end in b, for example. The %psearch magic has full
2012 docstrings. Many thanks to JΓΆrgen Stenarson
2016 docstrings. Many thanks to JΓΆrgen Stenarson
2013 <jorgen.stenarson-AT-bostream.nu>, author of the patches
2017 <jorgen.stenarson-AT-bostream.nu>, author of the patches
2014 implementing this functionality.
2018 implementing this functionality.
2015
2019
2016 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2020 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2017
2021
2018 * Manual: fixed long-standing annoyance of double-dashes (as in
2022 * Manual: fixed long-standing annoyance of double-dashes (as in
2019 --prefix=~, for example) being stripped in the HTML version. This
2023 --prefix=~, for example) being stripped in the HTML version. This
2020 is a latex2html bug, but a workaround was provided. Many thanks
2024 is a latex2html bug, but a workaround was provided. Many thanks
2021 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
2025 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
2022 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
2026 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
2023 rolling. This seemingly small issue had tripped a number of users
2027 rolling. This seemingly small issue had tripped a number of users
2024 when first installing, so I'm glad to see it gone.
2028 when first installing, so I'm glad to see it gone.
2025
2029
2026 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2030 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2027
2031
2028 * IPython/Extensions/numeric_formats.py: fix missing import,
2032 * IPython/Extensions/numeric_formats.py: fix missing import,
2029 reported by Stephen Walton.
2033 reported by Stephen Walton.
2030
2034
2031 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
2035 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
2032
2036
2033 * IPython/demo.py: finish demo module, fully documented now.
2037 * IPython/demo.py: finish demo module, fully documented now.
2034
2038
2035 * IPython/genutils.py (file_read): simple little utility to read a
2039 * IPython/genutils.py (file_read): simple little utility to read a
2036 file and ensure it's closed afterwards.
2040 file and ensure it's closed afterwards.
2037
2041
2038 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
2042 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
2039
2043
2040 * IPython/demo.py (Demo.__init__): added support for individually
2044 * IPython/demo.py (Demo.__init__): added support for individually
2041 tagging blocks for automatic execution.
2045 tagging blocks for automatic execution.
2042
2046
2043 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
2047 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
2044 syntax-highlighted python sources, requested by John.
2048 syntax-highlighted python sources, requested by John.
2045
2049
2046 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
2050 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
2047
2051
2048 * IPython/demo.py (Demo.again): fix bug where again() blocks after
2052 * IPython/demo.py (Demo.again): fix bug where again() blocks after
2049 finishing.
2053 finishing.
2050
2054
2051 * IPython/genutils.py (shlex_split): moved from Magic to here,
2055 * IPython/genutils.py (shlex_split): moved from Magic to here,
2052 where all 2.2 compatibility stuff lives. I needed it for demo.py.
2056 where all 2.2 compatibility stuff lives. I needed it for demo.py.
2053
2057
2054 * IPython/demo.py (Demo.__init__): added support for silent
2058 * IPython/demo.py (Demo.__init__): added support for silent
2055 blocks, improved marks as regexps, docstrings written.
2059 blocks, improved marks as regexps, docstrings written.
2056 (Demo.__init__): better docstring, added support for sys.argv.
2060 (Demo.__init__): better docstring, added support for sys.argv.
2057
2061
2058 * IPython/genutils.py (marquee): little utility used by the demo
2062 * IPython/genutils.py (marquee): little utility used by the demo
2059 code, handy in general.
2063 code, handy in general.
2060
2064
2061 * IPython/demo.py (Demo.__init__): new class for interactive
2065 * IPython/demo.py (Demo.__init__): new class for interactive
2062 demos. Not documented yet, I just wrote it in a hurry for
2066 demos. Not documented yet, I just wrote it in a hurry for
2063 scipy'05. Will docstring later.
2067 scipy'05. Will docstring later.
2064
2068
2065 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
2069 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
2066
2070
2067 * IPython/Shell.py (sigint_handler): Drastic simplification which
2071 * IPython/Shell.py (sigint_handler): Drastic simplification which
2068 also seems to make Ctrl-C work correctly across threads! This is
2072 also seems to make Ctrl-C work correctly across threads! This is
2069 so simple, that I can't beleive I'd missed it before. Needs more
2073 so simple, that I can't beleive I'd missed it before. Needs more
2070 testing, though.
2074 testing, though.
2071 (KBINT): Never mind, revert changes. I'm sure I'd tried something
2075 (KBINT): Never mind, revert changes. I'm sure I'd tried something
2072 like this before...
2076 like this before...
2073
2077
2074 * IPython/genutils.py (get_home_dir): add protection against
2078 * IPython/genutils.py (get_home_dir): add protection against
2075 non-dirs in win32 registry.
2079 non-dirs in win32 registry.
2076
2080
2077 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
2081 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
2078 bug where dict was mutated while iterating (pysh crash).
2082 bug where dict was mutated while iterating (pysh crash).
2079
2083
2080 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
2084 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
2081
2085
2082 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
2086 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
2083 spurious newlines added by this routine. After a report by
2087 spurious newlines added by this routine. After a report by
2084 F. Mantegazza.
2088 F. Mantegazza.
2085
2089
2086 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
2090 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
2087
2091
2088 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
2092 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
2089 calls. These were a leftover from the GTK 1.x days, and can cause
2093 calls. These were a leftover from the GTK 1.x days, and can cause
2090 problems in certain cases (after a report by John Hunter).
2094 problems in certain cases (after a report by John Hunter).
2091
2095
2092 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
2096 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
2093 os.getcwd() fails at init time. Thanks to patch from David Remahl
2097 os.getcwd() fails at init time. Thanks to patch from David Remahl
2094 <chmod007-AT-mac.com>.
2098 <chmod007-AT-mac.com>.
2095 (InteractiveShell.__init__): prevent certain special magics from
2099 (InteractiveShell.__init__): prevent certain special magics from
2096 being shadowed by aliases. Closes
2100 being shadowed by aliases. Closes
2097 http://www.scipy.net/roundup/ipython/issue41.
2101 http://www.scipy.net/roundup/ipython/issue41.
2098
2102
2099 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
2103 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
2100
2104
2101 * IPython/iplib.py (InteractiveShell.complete): Added new
2105 * IPython/iplib.py (InteractiveShell.complete): Added new
2102 top-level completion method to expose the completion mechanism
2106 top-level completion method to expose the completion mechanism
2103 beyond readline-based environments.
2107 beyond readline-based environments.
2104
2108
2105 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
2109 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
2106
2110
2107 * tools/ipsvnc (svnversion): fix svnversion capture.
2111 * tools/ipsvnc (svnversion): fix svnversion capture.
2108
2112
2109 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
2113 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
2110 attribute to self, which was missing. Before, it was set by a
2114 attribute to self, which was missing. Before, it was set by a
2111 routine which in certain cases wasn't being called, so the
2115 routine which in certain cases wasn't being called, so the
2112 instance could end up missing the attribute. This caused a crash.
2116 instance could end up missing the attribute. This caused a crash.
2113 Closes http://www.scipy.net/roundup/ipython/issue40.
2117 Closes http://www.scipy.net/roundup/ipython/issue40.
2114
2118
2115 2005-08-16 Fernando Perez <fperez@colorado.edu>
2119 2005-08-16 Fernando Perez <fperez@colorado.edu>
2116
2120
2117 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
2121 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
2118 contains non-string attribute. Closes
2122 contains non-string attribute. Closes
2119 http://www.scipy.net/roundup/ipython/issue38.
2123 http://www.scipy.net/roundup/ipython/issue38.
2120
2124
2121 2005-08-14 Fernando Perez <fperez@colorado.edu>
2125 2005-08-14 Fernando Perez <fperez@colorado.edu>
2122
2126
2123 * tools/ipsvnc: Minor improvements, to add changeset info.
2127 * tools/ipsvnc: Minor improvements, to add changeset info.
2124
2128
2125 2005-08-12 Fernando Perez <fperez@colorado.edu>
2129 2005-08-12 Fernando Perez <fperez@colorado.edu>
2126
2130
2127 * IPython/iplib.py (runsource): remove self.code_to_run_src
2131 * IPython/iplib.py (runsource): remove self.code_to_run_src
2128 attribute. I realized this is nothing more than
2132 attribute. I realized this is nothing more than
2129 '\n'.join(self.buffer), and having the same data in two different
2133 '\n'.join(self.buffer), and having the same data in two different
2130 places is just asking for synchronization bugs. This may impact
2134 places is just asking for synchronization bugs. This may impact
2131 people who have custom exception handlers, so I need to warn
2135 people who have custom exception handlers, so I need to warn
2132 ipython-dev about it (F. Mantegazza may use them).
2136 ipython-dev about it (F. Mantegazza may use them).
2133
2137
2134 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
2138 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
2135
2139
2136 * IPython/genutils.py: fix 2.2 compatibility (generators)
2140 * IPython/genutils.py: fix 2.2 compatibility (generators)
2137
2141
2138 2005-07-18 Fernando Perez <fperez@colorado.edu>
2142 2005-07-18 Fernando Perez <fperez@colorado.edu>
2139
2143
2140 * IPython/genutils.py (get_home_dir): fix to help users with
2144 * IPython/genutils.py (get_home_dir): fix to help users with
2141 invalid $HOME under win32.
2145 invalid $HOME under win32.
2142
2146
2143 2005-07-17 Fernando Perez <fperez@colorado.edu>
2147 2005-07-17 Fernando Perez <fperez@colorado.edu>
2144
2148
2145 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
2149 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
2146 some old hacks and clean up a bit other routines; code should be
2150 some old hacks and clean up a bit other routines; code should be
2147 simpler and a bit faster.
2151 simpler and a bit faster.
2148
2152
2149 * IPython/iplib.py (interact): removed some last-resort attempts
2153 * IPython/iplib.py (interact): removed some last-resort attempts
2150 to survive broken stdout/stderr. That code was only making it
2154 to survive broken stdout/stderr. That code was only making it
2151 harder to abstract out the i/o (necessary for gui integration),
2155 harder to abstract out the i/o (necessary for gui integration),
2152 and the crashes it could prevent were extremely rare in practice
2156 and the crashes it could prevent were extremely rare in practice
2153 (besides being fully user-induced in a pretty violent manner).
2157 (besides being fully user-induced in a pretty violent manner).
2154
2158
2155 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
2159 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
2156 Nothing major yet, but the code is simpler to read; this should
2160 Nothing major yet, but the code is simpler to read; this should
2157 make it easier to do more serious modifications in the future.
2161 make it easier to do more serious modifications in the future.
2158
2162
2159 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
2163 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
2160 which broke in .15 (thanks to a report by Ville).
2164 which broke in .15 (thanks to a report by Ville).
2161
2165
2162 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
2166 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
2163 be quite correct, I know next to nothing about unicode). This
2167 be quite correct, I know next to nothing about unicode). This
2164 will allow unicode strings to be used in prompts, amongst other
2168 will allow unicode strings to be used in prompts, amongst other
2165 cases. It also will prevent ipython from crashing when unicode
2169 cases. It also will prevent ipython from crashing when unicode
2166 shows up unexpectedly in many places. If ascii encoding fails, we
2170 shows up unexpectedly in many places. If ascii encoding fails, we
2167 assume utf_8. Currently the encoding is not a user-visible
2171 assume utf_8. Currently the encoding is not a user-visible
2168 setting, though it could be made so if there is demand for it.
2172 setting, though it could be made so if there is demand for it.
2169
2173
2170 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
2174 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
2171
2175
2172 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
2176 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
2173
2177
2174 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
2178 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
2175
2179
2176 * IPython/genutils.py: Add 2.2 compatibility here, so all other
2180 * IPython/genutils.py: Add 2.2 compatibility here, so all other
2177 code can work transparently for 2.2/2.3.
2181 code can work transparently for 2.2/2.3.
2178
2182
2179 2005-07-16 Fernando Perez <fperez@colorado.edu>
2183 2005-07-16 Fernando Perez <fperez@colorado.edu>
2180
2184
2181 * IPython/ultraTB.py (ExceptionColors): Make a global variable
2185 * IPython/ultraTB.py (ExceptionColors): Make a global variable
2182 out of the color scheme table used for coloring exception
2186 out of the color scheme table used for coloring exception
2183 tracebacks. This allows user code to add new schemes at runtime.
2187 tracebacks. This allows user code to add new schemes at runtime.
2184 This is a minimally modified version of the patch at
2188 This is a minimally modified version of the patch at
2185 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
2189 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
2186 for the contribution.
2190 for the contribution.
2187
2191
2188 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
2192 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
2189 slightly modified version of the patch in
2193 slightly modified version of the patch in
2190 http://www.scipy.net/roundup/ipython/issue34, which also allows me
2194 http://www.scipy.net/roundup/ipython/issue34, which also allows me
2191 to remove the previous try/except solution (which was costlier).
2195 to remove the previous try/except solution (which was costlier).
2192 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
2196 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
2193
2197
2194 2005-06-08 Fernando Perez <fperez@colorado.edu>
2198 2005-06-08 Fernando Perez <fperez@colorado.edu>
2195
2199
2196 * IPython/iplib.py (write/write_err): Add methods to abstract all
2200 * IPython/iplib.py (write/write_err): Add methods to abstract all
2197 I/O a bit more.
2201 I/O a bit more.
2198
2202
2199 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
2203 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
2200 warning, reported by Aric Hagberg, fix by JD Hunter.
2204 warning, reported by Aric Hagberg, fix by JD Hunter.
2201
2205
2202 2005-06-02 *** Released version 0.6.15
2206 2005-06-02 *** Released version 0.6.15
2203
2207
2204 2005-06-01 Fernando Perez <fperez@colorado.edu>
2208 2005-06-01 Fernando Perez <fperez@colorado.edu>
2205
2209
2206 * IPython/iplib.py (MagicCompleter.file_matches): Fix
2210 * IPython/iplib.py (MagicCompleter.file_matches): Fix
2207 tab-completion of filenames within open-quoted strings. Note that
2211 tab-completion of filenames within open-quoted strings. Note that
2208 this requires that in ~/.ipython/ipythonrc, users change the
2212 this requires that in ~/.ipython/ipythonrc, users change the
2209 readline delimiters configuration to read:
2213 readline delimiters configuration to read:
2210
2214
2211 readline_remove_delims -/~
2215 readline_remove_delims -/~
2212
2216
2213
2217
2214 2005-05-31 *** Released version 0.6.14
2218 2005-05-31 *** Released version 0.6.14
2215
2219
2216 2005-05-29 Fernando Perez <fperez@colorado.edu>
2220 2005-05-29 Fernando Perez <fperez@colorado.edu>
2217
2221
2218 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
2222 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
2219 with files not on the filesystem. Reported by Eliyahu Sandler
2223 with files not on the filesystem. Reported by Eliyahu Sandler
2220 <eli@gondolin.net>
2224 <eli@gondolin.net>
2221
2225
2222 2005-05-22 Fernando Perez <fperez@colorado.edu>
2226 2005-05-22 Fernando Perez <fperez@colorado.edu>
2223
2227
2224 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
2228 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
2225 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
2229 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
2226
2230
2227 2005-05-19 Fernando Perez <fperez@colorado.edu>
2231 2005-05-19 Fernando Perez <fperez@colorado.edu>
2228
2232
2229 * IPython/iplib.py (safe_execfile): close a file which could be
2233 * IPython/iplib.py (safe_execfile): close a file which could be
2230 left open (causing problems in win32, which locks open files).
2234 left open (causing problems in win32, which locks open files).
2231 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
2235 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
2232
2236
2233 2005-05-18 Fernando Perez <fperez@colorado.edu>
2237 2005-05-18 Fernando Perez <fperez@colorado.edu>
2234
2238
2235 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
2239 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
2236 keyword arguments correctly to safe_execfile().
2240 keyword arguments correctly to safe_execfile().
2237
2241
2238 2005-05-13 Fernando Perez <fperez@colorado.edu>
2242 2005-05-13 Fernando Perez <fperez@colorado.edu>
2239
2243
2240 * ipython.1: Added info about Qt to manpage, and threads warning
2244 * ipython.1: Added info about Qt to manpage, and threads warning
2241 to usage page (invoked with --help).
2245 to usage page (invoked with --help).
2242
2246
2243 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
2247 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
2244 new matcher (it goes at the end of the priority list) to do
2248 new matcher (it goes at the end of the priority list) to do
2245 tab-completion on named function arguments. Submitted by George
2249 tab-completion on named function arguments. Submitted by George
2246 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
2250 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
2247 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
2251 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
2248 for more details.
2252 for more details.
2249
2253
2250 * IPython/Magic.py (magic_run): Added new -e flag to ignore
2254 * IPython/Magic.py (magic_run): Added new -e flag to ignore
2251 SystemExit exceptions in the script being run. Thanks to a report
2255 SystemExit exceptions in the script being run. Thanks to a report
2252 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
2256 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
2253 producing very annoying behavior when running unit tests.
2257 producing very annoying behavior when running unit tests.
2254
2258
2255 2005-05-12 Fernando Perez <fperez@colorado.edu>
2259 2005-05-12 Fernando Perez <fperez@colorado.edu>
2256
2260
2257 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
2261 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
2258 which I'd broken (again) due to a changed regexp. In the process,
2262 which I'd broken (again) due to a changed regexp. In the process,
2259 added ';' as an escape to auto-quote the whole line without
2263 added ';' as an escape to auto-quote the whole line without
2260 splitting its arguments. Thanks to a report by Jerry McRae
2264 splitting its arguments. Thanks to a report by Jerry McRae
2261 <qrs0xyc02-AT-sneakemail.com>.
2265 <qrs0xyc02-AT-sneakemail.com>.
2262
2266
2263 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
2267 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
2264 possible crashes caused by a TokenError. Reported by Ed Schofield
2268 possible crashes caused by a TokenError. Reported by Ed Schofield
2265 <schofield-AT-ftw.at>.
2269 <schofield-AT-ftw.at>.
2266
2270
2267 2005-05-06 Fernando Perez <fperez@colorado.edu>
2271 2005-05-06 Fernando Perez <fperez@colorado.edu>
2268
2272
2269 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
2273 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
2270
2274
2271 2005-04-29 Fernando Perez <fperez@colorado.edu>
2275 2005-04-29 Fernando Perez <fperez@colorado.edu>
2272
2276
2273 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2277 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2274 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2278 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2275 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2279 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2276 which provides support for Qt interactive usage (similar to the
2280 which provides support for Qt interactive usage (similar to the
2277 existing one for WX and GTK). This had been often requested.
2281 existing one for WX and GTK). This had been often requested.
2278
2282
2279 2005-04-14 *** Released version 0.6.13
2283 2005-04-14 *** Released version 0.6.13
2280
2284
2281 2005-04-08 Fernando Perez <fperez@colorado.edu>
2285 2005-04-08 Fernando Perez <fperez@colorado.edu>
2282
2286
2283 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
2287 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
2284 from _ofind, which gets called on almost every input line. Now,
2288 from _ofind, which gets called on almost every input line. Now,
2285 we only try to get docstrings if they are actually going to be
2289 we only try to get docstrings if they are actually going to be
2286 used (the overhead of fetching unnecessary docstrings can be
2290 used (the overhead of fetching unnecessary docstrings can be
2287 noticeable for certain objects, such as Pyro proxies).
2291 noticeable for certain objects, such as Pyro proxies).
2288
2292
2289 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2293 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2290 for completers. For some reason I had been passing them the state
2294 for completers. For some reason I had been passing them the state
2291 variable, which completers never actually need, and was in
2295 variable, which completers never actually need, and was in
2292 conflict with the rlcompleter API. Custom completers ONLY need to
2296 conflict with the rlcompleter API. Custom completers ONLY need to
2293 take the text parameter.
2297 take the text parameter.
2294
2298
2295 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2299 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2296 work correctly in pysh. I've also moved all the logic which used
2300 work correctly in pysh. I've also moved all the logic which used
2297 to be in pysh.py here, which will prevent problems with future
2301 to be in pysh.py here, which will prevent problems with future
2298 upgrades. However, this time I must warn users to update their
2302 upgrades. However, this time I must warn users to update their
2299 pysh profile to include the line
2303 pysh profile to include the line
2300
2304
2301 import_all IPython.Extensions.InterpreterExec
2305 import_all IPython.Extensions.InterpreterExec
2302
2306
2303 because otherwise things won't work for them. They MUST also
2307 because otherwise things won't work for them. They MUST also
2304 delete pysh.py and the line
2308 delete pysh.py and the line
2305
2309
2306 execfile pysh.py
2310 execfile pysh.py
2307
2311
2308 from their ipythonrc-pysh.
2312 from their ipythonrc-pysh.
2309
2313
2310 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2314 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2311 robust in the face of objects whose dir() returns non-strings
2315 robust in the face of objects whose dir() returns non-strings
2312 (which it shouldn't, but some broken libs like ITK do). Thanks to
2316 (which it shouldn't, but some broken libs like ITK do). Thanks to
2313 a patch by John Hunter (implemented differently, though). Also
2317 a patch by John Hunter (implemented differently, though). Also
2314 minor improvements by using .extend instead of + on lists.
2318 minor improvements by using .extend instead of + on lists.
2315
2319
2316 * pysh.py:
2320 * pysh.py:
2317
2321
2318 2005-04-06 Fernando Perez <fperez@colorado.edu>
2322 2005-04-06 Fernando Perez <fperez@colorado.edu>
2319
2323
2320 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2324 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2321 by default, so that all users benefit from it. Those who don't
2325 by default, so that all users benefit from it. Those who don't
2322 want it can still turn it off.
2326 want it can still turn it off.
2323
2327
2324 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2328 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2325 config file, I'd forgotten about this, so users were getting it
2329 config file, I'd forgotten about this, so users were getting it
2326 off by default.
2330 off by default.
2327
2331
2328 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2332 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2329 consistency. Now magics can be called in multiline statements,
2333 consistency. Now magics can be called in multiline statements,
2330 and python variables can be expanded in magic calls via $var.
2334 and python variables can be expanded in magic calls via $var.
2331 This makes the magic system behave just like aliases or !system
2335 This makes the magic system behave just like aliases or !system
2332 calls.
2336 calls.
2333
2337
2334 2005-03-28 Fernando Perez <fperez@colorado.edu>
2338 2005-03-28 Fernando Perez <fperez@colorado.edu>
2335
2339
2336 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
2340 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
2337 expensive string additions for building command. Add support for
2341 expensive string additions for building command. Add support for
2338 trailing ';' when autocall is used.
2342 trailing ';' when autocall is used.
2339
2343
2340 2005-03-26 Fernando Perez <fperez@colorado.edu>
2344 2005-03-26 Fernando Perez <fperez@colorado.edu>
2341
2345
2342 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
2346 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
2343 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
2347 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
2344 ipython.el robust against prompts with any number of spaces
2348 ipython.el robust against prompts with any number of spaces
2345 (including 0) after the ':' character.
2349 (including 0) after the ':' character.
2346
2350
2347 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
2351 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
2348 continuation prompt, which misled users to think the line was
2352 continuation prompt, which misled users to think the line was
2349 already indented. Closes debian Bug#300847, reported to me by
2353 already indented. Closes debian Bug#300847, reported to me by
2350 Norbert Tretkowski <tretkowski-AT-inittab.de>.
2354 Norbert Tretkowski <tretkowski-AT-inittab.de>.
2351
2355
2352 2005-03-23 Fernando Perez <fperez@colorado.edu>
2356 2005-03-23 Fernando Perez <fperez@colorado.edu>
2353
2357
2354 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
2358 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
2355 properly aligned if they have embedded newlines.
2359 properly aligned if they have embedded newlines.
2356
2360
2357 * IPython/iplib.py (runlines): Add a public method to expose
2361 * IPython/iplib.py (runlines): Add a public method to expose
2358 IPython's code execution machinery, so that users can run strings
2362 IPython's code execution machinery, so that users can run strings
2359 as if they had been typed at the prompt interactively.
2363 as if they had been typed at the prompt interactively.
2360 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
2364 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
2361 methods which can call the system shell, but with python variable
2365 methods which can call the system shell, but with python variable
2362 expansion. The three such methods are: __IPYTHON__.system,
2366 expansion. The three such methods are: __IPYTHON__.system,
2363 .getoutput and .getoutputerror. These need to be documented in a
2367 .getoutput and .getoutputerror. These need to be documented in a
2364 'public API' section (to be written) of the manual.
2368 'public API' section (to be written) of the manual.
2365
2369
2366 2005-03-20 Fernando Perez <fperez@colorado.edu>
2370 2005-03-20 Fernando Perez <fperez@colorado.edu>
2367
2371
2368 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
2372 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
2369 for custom exception handling. This is quite powerful, and it
2373 for custom exception handling. This is quite powerful, and it
2370 allows for user-installable exception handlers which can trap
2374 allows for user-installable exception handlers which can trap
2371 custom exceptions at runtime and treat them separately from
2375 custom exceptions at runtime and treat them separately from
2372 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
2376 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
2373 Mantegazza <mantegazza-AT-ill.fr>.
2377 Mantegazza <mantegazza-AT-ill.fr>.
2374 (InteractiveShell.set_custom_completer): public API function to
2378 (InteractiveShell.set_custom_completer): public API function to
2375 add new completers at runtime.
2379 add new completers at runtime.
2376
2380
2377 2005-03-19 Fernando Perez <fperez@colorado.edu>
2381 2005-03-19 Fernando Perez <fperez@colorado.edu>
2378
2382
2379 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
2383 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
2380 allow objects which provide their docstrings via non-standard
2384 allow objects which provide their docstrings via non-standard
2381 mechanisms (like Pyro proxies) to still be inspected by ipython's
2385 mechanisms (like Pyro proxies) to still be inspected by ipython's
2382 ? system.
2386 ? system.
2383
2387
2384 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
2388 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
2385 automatic capture system. I tried quite hard to make it work
2389 automatic capture system. I tried quite hard to make it work
2386 reliably, and simply failed. I tried many combinations with the
2390 reliably, and simply failed. I tried many combinations with the
2387 subprocess module, but eventually nothing worked in all needed
2391 subprocess module, but eventually nothing worked in all needed
2388 cases (not blocking stdin for the child, duplicating stdout
2392 cases (not blocking stdin for the child, duplicating stdout
2389 without blocking, etc). The new %sc/%sx still do capture to these
2393 without blocking, etc). The new %sc/%sx still do capture to these
2390 magical list/string objects which make shell use much more
2394 magical list/string objects which make shell use much more
2391 conveninent, so not all is lost.
2395 conveninent, so not all is lost.
2392
2396
2393 XXX - FIX MANUAL for the change above!
2397 XXX - FIX MANUAL for the change above!
2394
2398
2395 (runsource): I copied code.py's runsource() into ipython to modify
2399 (runsource): I copied code.py's runsource() into ipython to modify
2396 it a bit. Now the code object and source to be executed are
2400 it a bit. Now the code object and source to be executed are
2397 stored in ipython. This makes this info accessible to third-party
2401 stored in ipython. This makes this info accessible to third-party
2398 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
2402 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
2399 Mantegazza <mantegazza-AT-ill.fr>.
2403 Mantegazza <mantegazza-AT-ill.fr>.
2400
2404
2401 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
2405 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
2402 history-search via readline (like C-p/C-n). I'd wanted this for a
2406 history-search via readline (like C-p/C-n). I'd wanted this for a
2403 long time, but only recently found out how to do it. For users
2407 long time, but only recently found out how to do it. For users
2404 who already have their ipythonrc files made and want this, just
2408 who already have their ipythonrc files made and want this, just
2405 add:
2409 add:
2406
2410
2407 readline_parse_and_bind "\e[A": history-search-backward
2411 readline_parse_and_bind "\e[A": history-search-backward
2408 readline_parse_and_bind "\e[B": history-search-forward
2412 readline_parse_and_bind "\e[B": history-search-forward
2409
2413
2410 2005-03-18 Fernando Perez <fperez@colorado.edu>
2414 2005-03-18 Fernando Perez <fperez@colorado.edu>
2411
2415
2412 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
2416 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
2413 LSString and SList classes which allow transparent conversions
2417 LSString and SList classes which allow transparent conversions
2414 between list mode and whitespace-separated string.
2418 between list mode and whitespace-separated string.
2415 (magic_r): Fix recursion problem in %r.
2419 (magic_r): Fix recursion problem in %r.
2416
2420
2417 * IPython/genutils.py (LSString): New class to be used for
2421 * IPython/genutils.py (LSString): New class to be used for
2418 automatic storage of the results of all alias/system calls in _o
2422 automatic storage of the results of all alias/system calls in _o
2419 and _e (stdout/err). These provide a .l/.list attribute which
2423 and _e (stdout/err). These provide a .l/.list attribute which
2420 does automatic splitting on newlines. This means that for most
2424 does automatic splitting on newlines. This means that for most
2421 uses, you'll never need to do capturing of output with %sc/%sx
2425 uses, you'll never need to do capturing of output with %sc/%sx
2422 anymore, since ipython keeps this always done for you. Note that
2426 anymore, since ipython keeps this always done for you. Note that
2423 only the LAST results are stored, the _o/e variables are
2427 only the LAST results are stored, the _o/e variables are
2424 overwritten on each call. If you need to save their contents
2428 overwritten on each call. If you need to save their contents
2425 further, simply bind them to any other name.
2429 further, simply bind them to any other name.
2426
2430
2427 2005-03-17 Fernando Perez <fperez@colorado.edu>
2431 2005-03-17 Fernando Perez <fperez@colorado.edu>
2428
2432
2429 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2433 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2430 prompt namespace handling.
2434 prompt namespace handling.
2431
2435
2432 2005-03-16 Fernando Perez <fperez@colorado.edu>
2436 2005-03-16 Fernando Perez <fperez@colorado.edu>
2433
2437
2434 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2438 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2435 classic prompts to be '>>> ' (final space was missing, and it
2439 classic prompts to be '>>> ' (final space was missing, and it
2436 trips the emacs python mode).
2440 trips the emacs python mode).
2437 (BasePrompt.__str__): Added safe support for dynamic prompt
2441 (BasePrompt.__str__): Added safe support for dynamic prompt
2438 strings. Now you can set your prompt string to be '$x', and the
2442 strings. Now you can set your prompt string to be '$x', and the
2439 value of x will be printed from your interactive namespace. The
2443 value of x will be printed from your interactive namespace. The
2440 interpolation syntax includes the full Itpl support, so
2444 interpolation syntax includes the full Itpl support, so
2441 ${foo()+x+bar()} is a valid prompt string now, and the function
2445 ${foo()+x+bar()} is a valid prompt string now, and the function
2442 calls will be made at runtime.
2446 calls will be made at runtime.
2443
2447
2444 2005-03-15 Fernando Perez <fperez@colorado.edu>
2448 2005-03-15 Fernando Perez <fperez@colorado.edu>
2445
2449
2446 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2450 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2447 avoid name clashes in pylab. %hist still works, it just forwards
2451 avoid name clashes in pylab. %hist still works, it just forwards
2448 the call to %history.
2452 the call to %history.
2449
2453
2450 2005-03-02 *** Released version 0.6.12
2454 2005-03-02 *** Released version 0.6.12
2451
2455
2452 2005-03-02 Fernando Perez <fperez@colorado.edu>
2456 2005-03-02 Fernando Perez <fperez@colorado.edu>
2453
2457
2454 * IPython/iplib.py (handle_magic): log magic calls properly as
2458 * IPython/iplib.py (handle_magic): log magic calls properly as
2455 ipmagic() function calls.
2459 ipmagic() function calls.
2456
2460
2457 * IPython/Magic.py (magic_time): Improved %time to support
2461 * IPython/Magic.py (magic_time): Improved %time to support
2458 statements and provide wall-clock as well as CPU time.
2462 statements and provide wall-clock as well as CPU time.
2459
2463
2460 2005-02-27 Fernando Perez <fperez@colorado.edu>
2464 2005-02-27 Fernando Perez <fperez@colorado.edu>
2461
2465
2462 * IPython/hooks.py: New hooks module, to expose user-modifiable
2466 * IPython/hooks.py: New hooks module, to expose user-modifiable
2463 IPython functionality in a clean manner. For now only the editor
2467 IPython functionality in a clean manner. For now only the editor
2464 hook is actually written, and other thigns which I intend to turn
2468 hook is actually written, and other thigns which I intend to turn
2465 into proper hooks aren't yet there. The display and prefilter
2469 into proper hooks aren't yet there. The display and prefilter
2466 stuff, for example, should be hooks. But at least now the
2470 stuff, for example, should be hooks. But at least now the
2467 framework is in place, and the rest can be moved here with more
2471 framework is in place, and the rest can be moved here with more
2468 time later. IPython had had a .hooks variable for a long time for
2472 time later. IPython had had a .hooks variable for a long time for
2469 this purpose, but I'd never actually used it for anything.
2473 this purpose, but I'd never actually used it for anything.
2470
2474
2471 2005-02-26 Fernando Perez <fperez@colorado.edu>
2475 2005-02-26 Fernando Perez <fperez@colorado.edu>
2472
2476
2473 * IPython/ipmaker.py (make_IPython): make the default ipython
2477 * IPython/ipmaker.py (make_IPython): make the default ipython
2474 directory be called _ipython under win32, to follow more the
2478 directory be called _ipython under win32, to follow more the
2475 naming peculiarities of that platform (where buggy software like
2479 naming peculiarities of that platform (where buggy software like
2476 Visual Sourcesafe breaks with .named directories). Reported by
2480 Visual Sourcesafe breaks with .named directories). Reported by
2477 Ville Vainio.
2481 Ville Vainio.
2478
2482
2479 2005-02-23 Fernando Perez <fperez@colorado.edu>
2483 2005-02-23 Fernando Perez <fperez@colorado.edu>
2480
2484
2481 * IPython/iplib.py (InteractiveShell.__init__): removed a few
2485 * IPython/iplib.py (InteractiveShell.__init__): removed a few
2482 auto_aliases for win32 which were causing problems. Users can
2486 auto_aliases for win32 which were causing problems. Users can
2483 define the ones they personally like.
2487 define the ones they personally like.
2484
2488
2485 2005-02-21 Fernando Perez <fperez@colorado.edu>
2489 2005-02-21 Fernando Perez <fperez@colorado.edu>
2486
2490
2487 * IPython/Magic.py (magic_time): new magic to time execution of
2491 * IPython/Magic.py (magic_time): new magic to time execution of
2488 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
2492 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
2489
2493
2490 2005-02-19 Fernando Perez <fperez@colorado.edu>
2494 2005-02-19 Fernando Perez <fperez@colorado.edu>
2491
2495
2492 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
2496 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
2493 into keys (for prompts, for example).
2497 into keys (for prompts, for example).
2494
2498
2495 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
2499 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
2496 prompts in case users want them. This introduces a small behavior
2500 prompts in case users want them. This introduces a small behavior
2497 change: ipython does not automatically add a space to all prompts
2501 change: ipython does not automatically add a space to all prompts
2498 anymore. To get the old prompts with a space, users should add it
2502 anymore. To get the old prompts with a space, users should add it
2499 manually to their ipythonrc file, so for example prompt_in1 should
2503 manually to their ipythonrc file, so for example prompt_in1 should
2500 now read 'In [\#]: ' instead of 'In [\#]:'.
2504 now read 'In [\#]: ' instead of 'In [\#]:'.
2501 (BasePrompt.__init__): New option prompts_pad_left (only in rc
2505 (BasePrompt.__init__): New option prompts_pad_left (only in rc
2502 file) to control left-padding of secondary prompts.
2506 file) to control left-padding of secondary prompts.
2503
2507
2504 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
2508 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
2505 the profiler can't be imported. Fix for Debian, which removed
2509 the profiler can't be imported. Fix for Debian, which removed
2506 profile.py because of License issues. I applied a slightly
2510 profile.py because of License issues. I applied a slightly
2507 modified version of the original Debian patch at
2511 modified version of the original Debian patch at
2508 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
2512 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
2509
2513
2510 2005-02-17 Fernando Perez <fperez@colorado.edu>
2514 2005-02-17 Fernando Perez <fperez@colorado.edu>
2511
2515
2512 * IPython/genutils.py (native_line_ends): Fix bug which would
2516 * IPython/genutils.py (native_line_ends): Fix bug which would
2513 cause improper line-ends under win32 b/c I was not opening files
2517 cause improper line-ends under win32 b/c I was not opening files
2514 in binary mode. Bug report and fix thanks to Ville.
2518 in binary mode. Bug report and fix thanks to Ville.
2515
2519
2516 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
2520 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
2517 trying to catch spurious foo[1] autocalls. My fix actually broke
2521 trying to catch spurious foo[1] autocalls. My fix actually broke
2518 ',/' autoquote/call with explicit escape (bad regexp).
2522 ',/' autoquote/call with explicit escape (bad regexp).
2519
2523
2520 2005-02-15 *** Released version 0.6.11
2524 2005-02-15 *** Released version 0.6.11
2521
2525
2522 2005-02-14 Fernando Perez <fperez@colorado.edu>
2526 2005-02-14 Fernando Perez <fperez@colorado.edu>
2523
2527
2524 * IPython/background_jobs.py: New background job management
2528 * IPython/background_jobs.py: New background job management
2525 subsystem. This is implemented via a new set of classes, and
2529 subsystem. This is implemented via a new set of classes, and
2526 IPython now provides a builtin 'jobs' object for background job
2530 IPython now provides a builtin 'jobs' object for background job
2527 execution. A convenience %bg magic serves as a lightweight
2531 execution. A convenience %bg magic serves as a lightweight
2528 frontend for starting the more common type of calls. This was
2532 frontend for starting the more common type of calls. This was
2529 inspired by discussions with B. Granger and the BackgroundCommand
2533 inspired by discussions with B. Granger and the BackgroundCommand
2530 class described in the book Python Scripting for Computational
2534 class described in the book Python Scripting for Computational
2531 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
2535 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
2532 (although ultimately no code from this text was used, as IPython's
2536 (although ultimately no code from this text was used, as IPython's
2533 system is a separate implementation).
2537 system is a separate implementation).
2534
2538
2535 * IPython/iplib.py (MagicCompleter.python_matches): add new option
2539 * IPython/iplib.py (MagicCompleter.python_matches): add new option
2536 to control the completion of single/double underscore names
2540 to control the completion of single/double underscore names
2537 separately. As documented in the example ipytonrc file, the
2541 separately. As documented in the example ipytonrc file, the
2538 readline_omit__names variable can now be set to 2, to omit even
2542 readline_omit__names variable can now be set to 2, to omit even
2539 single underscore names. Thanks to a patch by Brian Wong
2543 single underscore names. Thanks to a patch by Brian Wong
2540 <BrianWong-AT-AirgoNetworks.Com>.
2544 <BrianWong-AT-AirgoNetworks.Com>.
2541 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
2545 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
2542 be autocalled as foo([1]) if foo were callable. A problem for
2546 be autocalled as foo([1]) if foo were callable. A problem for
2543 things which are both callable and implement __getitem__.
2547 things which are both callable and implement __getitem__.
2544 (init_readline): Fix autoindentation for win32. Thanks to a patch
2548 (init_readline): Fix autoindentation for win32. Thanks to a patch
2545 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
2549 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
2546
2550
2547 2005-02-12 Fernando Perez <fperez@colorado.edu>
2551 2005-02-12 Fernando Perez <fperez@colorado.edu>
2548
2552
2549 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
2553 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
2550 which I had written long ago to sort out user error messages which
2554 which I had written long ago to sort out user error messages which
2551 may occur during startup. This seemed like a good idea initially,
2555 may occur during startup. This seemed like a good idea initially,
2552 but it has proven a disaster in retrospect. I don't want to
2556 but it has proven a disaster in retrospect. I don't want to
2553 change much code for now, so my fix is to set the internal 'debug'
2557 change much code for now, so my fix is to set the internal 'debug'
2554 flag to true everywhere, whose only job was precisely to control
2558 flag to true everywhere, whose only job was precisely to control
2555 this subsystem. This closes issue 28 (as well as avoiding all
2559 this subsystem. This closes issue 28 (as well as avoiding all
2556 sorts of strange hangups which occur from time to time).
2560 sorts of strange hangups which occur from time to time).
2557
2561
2558 2005-02-07 Fernando Perez <fperez@colorado.edu>
2562 2005-02-07 Fernando Perez <fperez@colorado.edu>
2559
2563
2560 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
2564 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
2561 previous call produced a syntax error.
2565 previous call produced a syntax error.
2562
2566
2563 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2567 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2564 classes without constructor.
2568 classes without constructor.
2565
2569
2566 2005-02-06 Fernando Perez <fperez@colorado.edu>
2570 2005-02-06 Fernando Perez <fperez@colorado.edu>
2567
2571
2568 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
2572 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
2569 completions with the results of each matcher, so we return results
2573 completions with the results of each matcher, so we return results
2570 to the user from all namespaces. This breaks with ipython
2574 to the user from all namespaces. This breaks with ipython
2571 tradition, but I think it's a nicer behavior. Now you get all
2575 tradition, but I think it's a nicer behavior. Now you get all
2572 possible completions listed, from all possible namespaces (python,
2576 possible completions listed, from all possible namespaces (python,
2573 filesystem, magics...) After a request by John Hunter
2577 filesystem, magics...) After a request by John Hunter
2574 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2578 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2575
2579
2576 2005-02-05 Fernando Perez <fperez@colorado.edu>
2580 2005-02-05 Fernando Perez <fperez@colorado.edu>
2577
2581
2578 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
2582 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
2579 the call had quote characters in it (the quotes were stripped).
2583 the call had quote characters in it (the quotes were stripped).
2580
2584
2581 2005-01-31 Fernando Perez <fperez@colorado.edu>
2585 2005-01-31 Fernando Perez <fperez@colorado.edu>
2582
2586
2583 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
2587 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
2584 Itpl.itpl() to make the code more robust against psyco
2588 Itpl.itpl() to make the code more robust against psyco
2585 optimizations.
2589 optimizations.
2586
2590
2587 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
2591 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
2588 of causing an exception. Quicker, cleaner.
2592 of causing an exception. Quicker, cleaner.
2589
2593
2590 2005-01-28 Fernando Perez <fperez@colorado.edu>
2594 2005-01-28 Fernando Perez <fperez@colorado.edu>
2591
2595
2592 * scripts/ipython_win_post_install.py (install): hardcode
2596 * scripts/ipython_win_post_install.py (install): hardcode
2593 sys.prefix+'python.exe' as the executable path. It turns out that
2597 sys.prefix+'python.exe' as the executable path. It turns out that
2594 during the post-installation run, sys.executable resolves to the
2598 during the post-installation run, sys.executable resolves to the
2595 name of the binary installer! I should report this as a distutils
2599 name of the binary installer! I should report this as a distutils
2596 bug, I think. I updated the .10 release with this tiny fix, to
2600 bug, I think. I updated the .10 release with this tiny fix, to
2597 avoid annoying the lists further.
2601 avoid annoying the lists further.
2598
2602
2599 2005-01-27 *** Released version 0.6.10
2603 2005-01-27 *** Released version 0.6.10
2600
2604
2601 2005-01-27 Fernando Perez <fperez@colorado.edu>
2605 2005-01-27 Fernando Perez <fperez@colorado.edu>
2602
2606
2603 * IPython/numutils.py (norm): Added 'inf' as optional name for
2607 * IPython/numutils.py (norm): Added 'inf' as optional name for
2604 L-infinity norm, included references to mathworld.com for vector
2608 L-infinity norm, included references to mathworld.com for vector
2605 norm definitions.
2609 norm definitions.
2606 (amin/amax): added amin/amax for array min/max. Similar to what
2610 (amin/amax): added amin/amax for array min/max. Similar to what
2607 pylab ships with after the recent reorganization of names.
2611 pylab ships with after the recent reorganization of names.
2608 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2612 (spike/spike_odd): removed deprecated spike/spike_odd functions.
2609
2613
2610 * ipython.el: committed Alex's recent fixes and improvements.
2614 * ipython.el: committed Alex's recent fixes and improvements.
2611 Tested with python-mode from CVS, and it looks excellent. Since
2615 Tested with python-mode from CVS, and it looks excellent. Since
2612 python-mode hasn't released anything in a while, I'm temporarily
2616 python-mode hasn't released anything in a while, I'm temporarily
2613 putting a copy of today's CVS (v 4.70) of python-mode in:
2617 putting a copy of today's CVS (v 4.70) of python-mode in:
2614 http://ipython.scipy.org/tmp/python-mode.el
2618 http://ipython.scipy.org/tmp/python-mode.el
2615
2619
2616 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2620 * scripts/ipython_win_post_install.py (install): Win32 fix to use
2617 sys.executable for the executable name, instead of assuming it's
2621 sys.executable for the executable name, instead of assuming it's
2618 called 'python.exe' (the post-installer would have produced broken
2622 called 'python.exe' (the post-installer would have produced broken
2619 setups on systems with a differently named python binary).
2623 setups on systems with a differently named python binary).
2620
2624
2621 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2625 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
2622 references to os.linesep, to make the code more
2626 references to os.linesep, to make the code more
2623 platform-independent. This is also part of the win32 coloring
2627 platform-independent. This is also part of the win32 coloring
2624 fixes.
2628 fixes.
2625
2629
2626 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2630 * IPython/genutils.py (page_dumb): Remove attempts to chop long
2627 lines, which actually cause coloring bugs because the length of
2631 lines, which actually cause coloring bugs because the length of
2628 the line is very difficult to correctly compute with embedded
2632 the line is very difficult to correctly compute with embedded
2629 escapes. This was the source of all the coloring problems under
2633 escapes. This was the source of all the coloring problems under
2630 Win32. I think that _finally_, Win32 users have a properly
2634 Win32. I think that _finally_, Win32 users have a properly
2631 working ipython in all respects. This would never have happened
2635 working ipython in all respects. This would never have happened
2632 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2636 if not for Gary Bishop and Viktor Ransmayr's great help and work.
2633
2637
2634 2005-01-26 *** Released version 0.6.9
2638 2005-01-26 *** Released version 0.6.9
2635
2639
2636 2005-01-25 Fernando Perez <fperez@colorado.edu>
2640 2005-01-25 Fernando Perez <fperez@colorado.edu>
2637
2641
2638 * setup.py: finally, we have a true Windows installer, thanks to
2642 * setup.py: finally, we have a true Windows installer, thanks to
2639 the excellent work of Viktor Ransmayr
2643 the excellent work of Viktor Ransmayr
2640 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2644 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
2641 Windows users. The setup routine is quite a bit cleaner thanks to
2645 Windows users. The setup routine is quite a bit cleaner thanks to
2642 this, and the post-install script uses the proper functions to
2646 this, and the post-install script uses the proper functions to
2643 allow a clean de-installation using the standard Windows Control
2647 allow a clean de-installation using the standard Windows Control
2644 Panel.
2648 Panel.
2645
2649
2646 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2650 * IPython/genutils.py (get_home_dir): changed to use the $HOME
2647 environment variable under all OSes (including win32) if
2651 environment variable under all OSes (including win32) if
2648 available. This will give consistency to win32 users who have set
2652 available. This will give consistency to win32 users who have set
2649 this variable for any reason. If os.environ['HOME'] fails, the
2653 this variable for any reason. If os.environ['HOME'] fails, the
2650 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2654 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
2651
2655
2652 2005-01-24 Fernando Perez <fperez@colorado.edu>
2656 2005-01-24 Fernando Perez <fperez@colorado.edu>
2653
2657
2654 * IPython/numutils.py (empty_like): add empty_like(), similar to
2658 * IPython/numutils.py (empty_like): add empty_like(), similar to
2655 zeros_like() but taking advantage of the new empty() Numeric routine.
2659 zeros_like() but taking advantage of the new empty() Numeric routine.
2656
2660
2657 2005-01-23 *** Released version 0.6.8
2661 2005-01-23 *** Released version 0.6.8
2658
2662
2659 2005-01-22 Fernando Perez <fperez@colorado.edu>
2663 2005-01-22 Fernando Perez <fperez@colorado.edu>
2660
2664
2661 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2665 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
2662 automatic show() calls. After discussing things with JDH, it
2666 automatic show() calls. After discussing things with JDH, it
2663 turns out there are too many corner cases where this can go wrong.
2667 turns out there are too many corner cases where this can go wrong.
2664 It's best not to try to be 'too smart', and simply have ipython
2668 It's best not to try to be 'too smart', and simply have ipython
2665 reproduce as much as possible the default behavior of a normal
2669 reproduce as much as possible the default behavior of a normal
2666 python shell.
2670 python shell.
2667
2671
2668 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2672 * IPython/iplib.py (InteractiveShell.__init__): Modified the
2669 line-splitting regexp and _prefilter() to avoid calling getattr()
2673 line-splitting regexp and _prefilter() to avoid calling getattr()
2670 on assignments. This closes
2674 on assignments. This closes
2671 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2675 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
2672 readline uses getattr(), so a simple <TAB> keypress is still
2676 readline uses getattr(), so a simple <TAB> keypress is still
2673 enough to trigger getattr() calls on an object.
2677 enough to trigger getattr() calls on an object.
2674
2678
2675 2005-01-21 Fernando Perez <fperez@colorado.edu>
2679 2005-01-21 Fernando Perez <fperez@colorado.edu>
2676
2680
2677 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2681 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
2678 docstring under pylab so it doesn't mask the original.
2682 docstring under pylab so it doesn't mask the original.
2679
2683
2680 2005-01-21 *** Released version 0.6.7
2684 2005-01-21 *** Released version 0.6.7
2681
2685
2682 2005-01-21 Fernando Perez <fperez@colorado.edu>
2686 2005-01-21 Fernando Perez <fperez@colorado.edu>
2683
2687
2684 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2688 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
2685 signal handling for win32 users in multithreaded mode.
2689 signal handling for win32 users in multithreaded mode.
2686
2690
2687 2005-01-17 Fernando Perez <fperez@colorado.edu>
2691 2005-01-17 Fernando Perez <fperez@colorado.edu>
2688
2692
2689 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2693 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
2690 instances with no __init__. After a crash report by Norbert Nemec
2694 instances with no __init__. After a crash report by Norbert Nemec
2691 <Norbert-AT-nemec-online.de>.
2695 <Norbert-AT-nemec-online.de>.
2692
2696
2693 2005-01-14 Fernando Perez <fperez@colorado.edu>
2697 2005-01-14 Fernando Perez <fperez@colorado.edu>
2694
2698
2695 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2699 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
2696 names for verbose exceptions, when multiple dotted names and the
2700 names for verbose exceptions, when multiple dotted names and the
2697 'parent' object were present on the same line.
2701 'parent' object were present on the same line.
2698
2702
2699 2005-01-11 Fernando Perez <fperez@colorado.edu>
2703 2005-01-11 Fernando Perez <fperez@colorado.edu>
2700
2704
2701 * IPython/genutils.py (flag_calls): new utility to trap and flag
2705 * IPython/genutils.py (flag_calls): new utility to trap and flag
2702 calls in functions. I need it to clean up matplotlib support.
2706 calls in functions. I need it to clean up matplotlib support.
2703 Also removed some deprecated code in genutils.
2707 Also removed some deprecated code in genutils.
2704
2708
2705 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2709 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
2706 that matplotlib scripts called with %run, which don't call show()
2710 that matplotlib scripts called with %run, which don't call show()
2707 themselves, still have their plotting windows open.
2711 themselves, still have their plotting windows open.
2708
2712
2709 2005-01-05 Fernando Perez <fperez@colorado.edu>
2713 2005-01-05 Fernando Perez <fperez@colorado.edu>
2710
2714
2711 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2715 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
2712 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2716 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
2713
2717
2714 2004-12-19 Fernando Perez <fperez@colorado.edu>
2718 2004-12-19 Fernando Perez <fperez@colorado.edu>
2715
2719
2716 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2720 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
2717 parent_runcode, which was an eyesore. The same result can be
2721 parent_runcode, which was an eyesore. The same result can be
2718 obtained with Python's regular superclass mechanisms.
2722 obtained with Python's regular superclass mechanisms.
2719
2723
2720 2004-12-17 Fernando Perez <fperez@colorado.edu>
2724 2004-12-17 Fernando Perez <fperez@colorado.edu>
2721
2725
2722 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2726 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
2723 reported by Prabhu.
2727 reported by Prabhu.
2724 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2728 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
2725 sys.stderr) instead of explicitly calling sys.stderr. This helps
2729 sys.stderr) instead of explicitly calling sys.stderr. This helps
2726 maintain our I/O abstractions clean, for future GUI embeddings.
2730 maintain our I/O abstractions clean, for future GUI embeddings.
2727
2731
2728 * IPython/genutils.py (info): added new utility for sys.stderr
2732 * IPython/genutils.py (info): added new utility for sys.stderr
2729 unified info message handling (thin wrapper around warn()).
2733 unified info message handling (thin wrapper around warn()).
2730
2734
2731 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2735 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
2732 composite (dotted) names on verbose exceptions.
2736 composite (dotted) names on verbose exceptions.
2733 (VerboseTB.nullrepr): harden against another kind of errors which
2737 (VerboseTB.nullrepr): harden against another kind of errors which
2734 Python's inspect module can trigger, and which were crashing
2738 Python's inspect module can trigger, and which were crashing
2735 IPython. Thanks to a report by Marco Lombardi
2739 IPython. Thanks to a report by Marco Lombardi
2736 <mlombard-AT-ma010192.hq.eso.org>.
2740 <mlombard-AT-ma010192.hq.eso.org>.
2737
2741
2738 2004-12-13 *** Released version 0.6.6
2742 2004-12-13 *** Released version 0.6.6
2739
2743
2740 2004-12-12 Fernando Perez <fperez@colorado.edu>
2744 2004-12-12 Fernando Perez <fperez@colorado.edu>
2741
2745
2742 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2746 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
2743 generated by pygtk upon initialization if it was built without
2747 generated by pygtk upon initialization if it was built without
2744 threads (for matplotlib users). After a crash reported by
2748 threads (for matplotlib users). After a crash reported by
2745 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2749 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
2746
2750
2747 * IPython/ipmaker.py (make_IPython): fix small bug in the
2751 * IPython/ipmaker.py (make_IPython): fix small bug in the
2748 import_some parameter for multiple imports.
2752 import_some parameter for multiple imports.
2749
2753
2750 * IPython/iplib.py (ipmagic): simplified the interface of
2754 * IPython/iplib.py (ipmagic): simplified the interface of
2751 ipmagic() to take a single string argument, just as it would be
2755 ipmagic() to take a single string argument, just as it would be
2752 typed at the IPython cmd line.
2756 typed at the IPython cmd line.
2753 (ipalias): Added new ipalias() with an interface identical to
2757 (ipalias): Added new ipalias() with an interface identical to
2754 ipmagic(). This completes exposing a pure python interface to the
2758 ipmagic(). This completes exposing a pure python interface to the
2755 alias and magic system, which can be used in loops or more complex
2759 alias and magic system, which can be used in loops or more complex
2756 code where IPython's automatic line mangling is not active.
2760 code where IPython's automatic line mangling is not active.
2757
2761
2758 * IPython/genutils.py (timing): changed interface of timing to
2762 * IPython/genutils.py (timing): changed interface of timing to
2759 simply run code once, which is the most common case. timings()
2763 simply run code once, which is the most common case. timings()
2760 remains unchanged, for the cases where you want multiple runs.
2764 remains unchanged, for the cases where you want multiple runs.
2761
2765
2762 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2766 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
2763 bug where Python2.2 crashes with exec'ing code which does not end
2767 bug where Python2.2 crashes with exec'ing code which does not end
2764 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2768 in a single newline. Python 2.3 is OK, so I hadn't noticed this
2765 before.
2769 before.
2766
2770
2767 2004-12-10 Fernando Perez <fperez@colorado.edu>
2771 2004-12-10 Fernando Perez <fperez@colorado.edu>
2768
2772
2769 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2773 * IPython/Magic.py (Magic.magic_prun): changed name of option from
2770 -t to -T, to accomodate the new -t flag in %run (the %run and
2774 -t to -T, to accomodate the new -t flag in %run (the %run and
2771 %prun options are kind of intermixed, and it's not easy to change
2775 %prun options are kind of intermixed, and it's not easy to change
2772 this with the limitations of python's getopt).
2776 this with the limitations of python's getopt).
2773
2777
2774 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2778 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
2775 the execution of scripts. It's not as fine-tuned as timeit.py,
2779 the execution of scripts. It's not as fine-tuned as timeit.py,
2776 but it works from inside ipython (and under 2.2, which lacks
2780 but it works from inside ipython (and under 2.2, which lacks
2777 timeit.py). Optionally a number of runs > 1 can be given for
2781 timeit.py). Optionally a number of runs > 1 can be given for
2778 timing very short-running code.
2782 timing very short-running code.
2779
2783
2780 * IPython/genutils.py (uniq_stable): new routine which returns a
2784 * IPython/genutils.py (uniq_stable): new routine which returns a
2781 list of unique elements in any iterable, but in stable order of
2785 list of unique elements in any iterable, but in stable order of
2782 appearance. I needed this for the ultraTB fixes, and it's a handy
2786 appearance. I needed this for the ultraTB fixes, and it's a handy
2783 utility.
2787 utility.
2784
2788
2785 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2789 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
2786 dotted names in Verbose exceptions. This had been broken since
2790 dotted names in Verbose exceptions. This had been broken since
2787 the very start, now x.y will properly be printed in a Verbose
2791 the very start, now x.y will properly be printed in a Verbose
2788 traceback, instead of x being shown and y appearing always as an
2792 traceback, instead of x being shown and y appearing always as an
2789 'undefined global'. Getting this to work was a bit tricky,
2793 'undefined global'. Getting this to work was a bit tricky,
2790 because by default python tokenizers are stateless. Saved by
2794 because by default python tokenizers are stateless. Saved by
2791 python's ability to easily add a bit of state to an arbitrary
2795 python's ability to easily add a bit of state to an arbitrary
2792 function (without needing to build a full-blown callable object).
2796 function (without needing to build a full-blown callable object).
2793
2797
2794 Also big cleanup of this code, which had horrendous runtime
2798 Also big cleanup of this code, which had horrendous runtime
2795 lookups of zillions of attributes for colorization. Moved all
2799 lookups of zillions of attributes for colorization. Moved all
2796 this code into a few templates, which make it cleaner and quicker.
2800 this code into a few templates, which make it cleaner and quicker.
2797
2801
2798 Printout quality was also improved for Verbose exceptions: one
2802 Printout quality was also improved for Verbose exceptions: one
2799 variable per line, and memory addresses are printed (this can be
2803 variable per line, and memory addresses are printed (this can be
2800 quite handy in nasty debugging situations, which is what Verbose
2804 quite handy in nasty debugging situations, which is what Verbose
2801 is for).
2805 is for).
2802
2806
2803 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2807 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
2804 the command line as scripts to be loaded by embedded instances.
2808 the command line as scripts to be loaded by embedded instances.
2805 Doing so has the potential for an infinite recursion if there are
2809 Doing so has the potential for an infinite recursion if there are
2806 exceptions thrown in the process. This fixes a strange crash
2810 exceptions thrown in the process. This fixes a strange crash
2807 reported by Philippe MULLER <muller-AT-irit.fr>.
2811 reported by Philippe MULLER <muller-AT-irit.fr>.
2808
2812
2809 2004-12-09 Fernando Perez <fperez@colorado.edu>
2813 2004-12-09 Fernando Perez <fperez@colorado.edu>
2810
2814
2811 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2815 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
2812 to reflect new names in matplotlib, which now expose the
2816 to reflect new names in matplotlib, which now expose the
2813 matlab-compatible interface via a pylab module instead of the
2817 matlab-compatible interface via a pylab module instead of the
2814 'matlab' name. The new code is backwards compatible, so users of
2818 'matlab' name. The new code is backwards compatible, so users of
2815 all matplotlib versions are OK. Patch by J. Hunter.
2819 all matplotlib versions are OK. Patch by J. Hunter.
2816
2820
2817 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2821 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
2818 of __init__ docstrings for instances (class docstrings are already
2822 of __init__ docstrings for instances (class docstrings are already
2819 automatically printed). Instances with customized docstrings
2823 automatically printed). Instances with customized docstrings
2820 (indep. of the class) are also recognized and all 3 separate
2824 (indep. of the class) are also recognized and all 3 separate
2821 docstrings are printed (instance, class, constructor). After some
2825 docstrings are printed (instance, class, constructor). After some
2822 comments/suggestions by J. Hunter.
2826 comments/suggestions by J. Hunter.
2823
2827
2824 2004-12-05 Fernando Perez <fperez@colorado.edu>
2828 2004-12-05 Fernando Perez <fperez@colorado.edu>
2825
2829
2826 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2830 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
2827 warnings when tab-completion fails and triggers an exception.
2831 warnings when tab-completion fails and triggers an exception.
2828
2832
2829 2004-12-03 Fernando Perez <fperez@colorado.edu>
2833 2004-12-03 Fernando Perez <fperez@colorado.edu>
2830
2834
2831 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2835 * IPython/Magic.py (magic_prun): Fix bug where an exception would
2832 be triggered when using 'run -p'. An incorrect option flag was
2836 be triggered when using 'run -p'. An incorrect option flag was
2833 being set ('d' instead of 'D').
2837 being set ('d' instead of 'D').
2834 (manpage): fix missing escaped \- sign.
2838 (manpage): fix missing escaped \- sign.
2835
2839
2836 2004-11-30 *** Released version 0.6.5
2840 2004-11-30 *** Released version 0.6.5
2837
2841
2838 2004-11-30 Fernando Perez <fperez@colorado.edu>
2842 2004-11-30 Fernando Perez <fperez@colorado.edu>
2839
2843
2840 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2844 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
2841 setting with -d option.
2845 setting with -d option.
2842
2846
2843 * setup.py (docfiles): Fix problem where the doc glob I was using
2847 * setup.py (docfiles): Fix problem where the doc glob I was using
2844 was COMPLETELY BROKEN. It was giving the right files by pure
2848 was COMPLETELY BROKEN. It was giving the right files by pure
2845 accident, but failed once I tried to include ipython.el. Note:
2849 accident, but failed once I tried to include ipython.el. Note:
2846 glob() does NOT allow you to do exclusion on multiple endings!
2850 glob() does NOT allow you to do exclusion on multiple endings!
2847
2851
2848 2004-11-29 Fernando Perez <fperez@colorado.edu>
2852 2004-11-29 Fernando Perez <fperez@colorado.edu>
2849
2853
2850 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2854 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
2851 the manpage as the source. Better formatting & consistency.
2855 the manpage as the source. Better formatting & consistency.
2852
2856
2853 * IPython/Magic.py (magic_run): Added new -d option, to run
2857 * IPython/Magic.py (magic_run): Added new -d option, to run
2854 scripts under the control of the python pdb debugger. Note that
2858 scripts under the control of the python pdb debugger. Note that
2855 this required changing the %prun option -d to -D, to avoid a clash
2859 this required changing the %prun option -d to -D, to avoid a clash
2856 (since %run must pass options to %prun, and getopt is too dumb to
2860 (since %run must pass options to %prun, and getopt is too dumb to
2857 handle options with string values with embedded spaces). Thanks
2861 handle options with string values with embedded spaces). Thanks
2858 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2862 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
2859 (magic_who_ls): added type matching to %who and %whos, so that one
2863 (magic_who_ls): added type matching to %who and %whos, so that one
2860 can filter their output to only include variables of certain
2864 can filter their output to only include variables of certain
2861 types. Another suggestion by Matthew.
2865 types. Another suggestion by Matthew.
2862 (magic_whos): Added memory summaries in kb and Mb for arrays.
2866 (magic_whos): Added memory summaries in kb and Mb for arrays.
2863 (magic_who): Improve formatting (break lines every 9 vars).
2867 (magic_who): Improve formatting (break lines every 9 vars).
2864
2868
2865 2004-11-28 Fernando Perez <fperez@colorado.edu>
2869 2004-11-28 Fernando Perez <fperez@colorado.edu>
2866
2870
2867 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2871 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
2868 cache when empty lines were present.
2872 cache when empty lines were present.
2869
2873
2870 2004-11-24 Fernando Perez <fperez@colorado.edu>
2874 2004-11-24 Fernando Perez <fperez@colorado.edu>
2871
2875
2872 * IPython/usage.py (__doc__): document the re-activated threading
2876 * IPython/usage.py (__doc__): document the re-activated threading
2873 options for WX and GTK.
2877 options for WX and GTK.
2874
2878
2875 2004-11-23 Fernando Perez <fperez@colorado.edu>
2879 2004-11-23 Fernando Perez <fperez@colorado.edu>
2876
2880
2877 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2881 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
2878 the -wthread and -gthread options, along with a new -tk one to try
2882 the -wthread and -gthread options, along with a new -tk one to try
2879 and coordinate Tk threading with wx/gtk. The tk support is very
2883 and coordinate Tk threading with wx/gtk. The tk support is very
2880 platform dependent, since it seems to require Tcl and Tk to be
2884 platform dependent, since it seems to require Tcl and Tk to be
2881 built with threads (Fedora1/2 appears NOT to have it, but in
2885 built with threads (Fedora1/2 appears NOT to have it, but in
2882 Prabhu's Debian boxes it works OK). But even with some Tk
2886 Prabhu's Debian boxes it works OK). But even with some Tk
2883 limitations, this is a great improvement.
2887 limitations, this is a great improvement.
2884
2888
2885 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2889 * IPython/Prompts.py (prompt_specials_color): Added \t for time
2886 info in user prompts. Patch by Prabhu.
2890 info in user prompts. Patch by Prabhu.
2887
2891
2888 2004-11-18 Fernando Perez <fperez@colorado.edu>
2892 2004-11-18 Fernando Perez <fperez@colorado.edu>
2889
2893
2890 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2894 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
2891 EOFErrors and bail, to avoid infinite loops if a non-terminating
2895 EOFErrors and bail, to avoid infinite loops if a non-terminating
2892 file is fed into ipython. Patch submitted in issue 19 by user,
2896 file is fed into ipython. Patch submitted in issue 19 by user,
2893 many thanks.
2897 many thanks.
2894
2898
2895 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2899 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
2896 autoquote/parens in continuation prompts, which can cause lots of
2900 autoquote/parens in continuation prompts, which can cause lots of
2897 problems. Closes roundup issue 20.
2901 problems. Closes roundup issue 20.
2898
2902
2899 2004-11-17 Fernando Perez <fperez@colorado.edu>
2903 2004-11-17 Fernando Perez <fperez@colorado.edu>
2900
2904
2901 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2905 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
2902 reported as debian bug #280505. I'm not sure my local changelog
2906 reported as debian bug #280505. I'm not sure my local changelog
2903 entry has the proper debian format (Jack?).
2907 entry has the proper debian format (Jack?).
2904
2908
2905 2004-11-08 *** Released version 0.6.4
2909 2004-11-08 *** Released version 0.6.4
2906
2910
2907 2004-11-08 Fernando Perez <fperez@colorado.edu>
2911 2004-11-08 Fernando Perez <fperez@colorado.edu>
2908
2912
2909 * IPython/iplib.py (init_readline): Fix exit message for Windows
2913 * IPython/iplib.py (init_readline): Fix exit message for Windows
2910 when readline is active. Thanks to a report by Eric Jones
2914 when readline is active. Thanks to a report by Eric Jones
2911 <eric-AT-enthought.com>.
2915 <eric-AT-enthought.com>.
2912
2916
2913 2004-11-07 Fernando Perez <fperez@colorado.edu>
2917 2004-11-07 Fernando Perez <fperez@colorado.edu>
2914
2918
2915 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2919 * IPython/genutils.py (page): Add a trap for OSError exceptions,
2916 sometimes seen by win2k/cygwin users.
2920 sometimes seen by win2k/cygwin users.
2917
2921
2918 2004-11-06 Fernando Perez <fperez@colorado.edu>
2922 2004-11-06 Fernando Perez <fperez@colorado.edu>
2919
2923
2920 * IPython/iplib.py (interact): Change the handling of %Exit from
2924 * IPython/iplib.py (interact): Change the handling of %Exit from
2921 trying to propagate a SystemExit to an internal ipython flag.
2925 trying to propagate a SystemExit to an internal ipython flag.
2922 This is less elegant than using Python's exception mechanism, but
2926 This is less elegant than using Python's exception mechanism, but
2923 I can't get that to work reliably with threads, so under -pylab
2927 I can't get that to work reliably with threads, so under -pylab
2924 %Exit was hanging IPython. Cross-thread exception handling is
2928 %Exit was hanging IPython. Cross-thread exception handling is
2925 really a bitch. Thaks to a bug report by Stephen Walton
2929 really a bitch. Thaks to a bug report by Stephen Walton
2926 <stephen.walton-AT-csun.edu>.
2930 <stephen.walton-AT-csun.edu>.
2927
2931
2928 2004-11-04 Fernando Perez <fperez@colorado.edu>
2932 2004-11-04 Fernando Perez <fperez@colorado.edu>
2929
2933
2930 * IPython/iplib.py (raw_input_original): store a pointer to the
2934 * IPython/iplib.py (raw_input_original): store a pointer to the
2931 true raw_input to harden against code which can modify it
2935 true raw_input to harden against code which can modify it
2932 (wx.py.PyShell does this and would otherwise crash ipython).
2936 (wx.py.PyShell does this and would otherwise crash ipython).
2933 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2937 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
2934
2938
2935 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2939 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
2936 Ctrl-C problem, which does not mess up the input line.
2940 Ctrl-C problem, which does not mess up the input line.
2937
2941
2938 2004-11-03 Fernando Perez <fperez@colorado.edu>
2942 2004-11-03 Fernando Perez <fperez@colorado.edu>
2939
2943
2940 * IPython/Release.py: Changed licensing to BSD, in all files.
2944 * IPython/Release.py: Changed licensing to BSD, in all files.
2941 (name): lowercase name for tarball/RPM release.
2945 (name): lowercase name for tarball/RPM release.
2942
2946
2943 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2947 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
2944 use throughout ipython.
2948 use throughout ipython.
2945
2949
2946 * IPython/Magic.py (Magic._ofind): Switch to using the new
2950 * IPython/Magic.py (Magic._ofind): Switch to using the new
2947 OInspect.getdoc() function.
2951 OInspect.getdoc() function.
2948
2952
2949 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2953 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
2950 of the line currently being canceled via Ctrl-C. It's extremely
2954 of the line currently being canceled via Ctrl-C. It's extremely
2951 ugly, but I don't know how to do it better (the problem is one of
2955 ugly, but I don't know how to do it better (the problem is one of
2952 handling cross-thread exceptions).
2956 handling cross-thread exceptions).
2953
2957
2954 2004-10-28 Fernando Perez <fperez@colorado.edu>
2958 2004-10-28 Fernando Perez <fperez@colorado.edu>
2955
2959
2956 * IPython/Shell.py (signal_handler): add signal handlers to trap
2960 * IPython/Shell.py (signal_handler): add signal handlers to trap
2957 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2961 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
2958 report by Francesc Alted.
2962 report by Francesc Alted.
2959
2963
2960 2004-10-21 Fernando Perez <fperez@colorado.edu>
2964 2004-10-21 Fernando Perez <fperez@colorado.edu>
2961
2965
2962 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2966 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
2963 to % for pysh syntax extensions.
2967 to % for pysh syntax extensions.
2964
2968
2965 2004-10-09 Fernando Perez <fperez@colorado.edu>
2969 2004-10-09 Fernando Perez <fperez@colorado.edu>
2966
2970
2967 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2971 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2968 arrays to print a more useful summary, without calling str(arr).
2972 arrays to print a more useful summary, without calling str(arr).
2969 This avoids the problem of extremely lengthy computations which
2973 This avoids the problem of extremely lengthy computations which
2970 occur if arr is large, and appear to the user as a system lockup
2974 occur if arr is large, and appear to the user as a system lockup
2971 with 100% cpu activity. After a suggestion by Kristian Sandberg
2975 with 100% cpu activity. After a suggestion by Kristian Sandberg
2972 <Kristian.Sandberg@colorado.edu>.
2976 <Kristian.Sandberg@colorado.edu>.
2973 (Magic.__init__): fix bug in global magic escapes not being
2977 (Magic.__init__): fix bug in global magic escapes not being
2974 correctly set.
2978 correctly set.
2975
2979
2976 2004-10-08 Fernando Perez <fperez@colorado.edu>
2980 2004-10-08 Fernando Perez <fperez@colorado.edu>
2977
2981
2978 * IPython/Magic.py (__license__): change to absolute imports of
2982 * IPython/Magic.py (__license__): change to absolute imports of
2979 ipython's own internal packages, to start adapting to the absolute
2983 ipython's own internal packages, to start adapting to the absolute
2980 import requirement of PEP-328.
2984 import requirement of PEP-328.
2981
2985
2982 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2986 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2983 files, and standardize author/license marks through the Release
2987 files, and standardize author/license marks through the Release
2984 module instead of having per/file stuff (except for files with
2988 module instead of having per/file stuff (except for files with
2985 particular licenses, like the MIT/PSF-licensed codes).
2989 particular licenses, like the MIT/PSF-licensed codes).
2986
2990
2987 * IPython/Debugger.py: remove dead code for python 2.1
2991 * IPython/Debugger.py: remove dead code for python 2.1
2988
2992
2989 2004-10-04 Fernando Perez <fperez@colorado.edu>
2993 2004-10-04 Fernando Perez <fperez@colorado.edu>
2990
2994
2991 * IPython/iplib.py (ipmagic): New function for accessing magics
2995 * IPython/iplib.py (ipmagic): New function for accessing magics
2992 via a normal python function call.
2996 via a normal python function call.
2993
2997
2994 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2998 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2995 from '@' to '%', to accomodate the new @decorator syntax of python
2999 from '@' to '%', to accomodate the new @decorator syntax of python
2996 2.4.
3000 2.4.
2997
3001
2998 2004-09-29 Fernando Perez <fperez@colorado.edu>
3002 2004-09-29 Fernando Perez <fperez@colorado.edu>
2999
3003
3000 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
3004 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
3001 matplotlib.use to prevent running scripts which try to switch
3005 matplotlib.use to prevent running scripts which try to switch
3002 interactive backends from within ipython. This will just crash
3006 interactive backends from within ipython. This will just crash
3003 the python interpreter, so we can't allow it (but a detailed error
3007 the python interpreter, so we can't allow it (but a detailed error
3004 is given to the user).
3008 is given to the user).
3005
3009
3006 2004-09-28 Fernando Perez <fperez@colorado.edu>
3010 2004-09-28 Fernando Perez <fperez@colorado.edu>
3007
3011
3008 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
3012 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
3009 matplotlib-related fixes so that using @run with non-matplotlib
3013 matplotlib-related fixes so that using @run with non-matplotlib
3010 scripts doesn't pop up spurious plot windows. This requires
3014 scripts doesn't pop up spurious plot windows. This requires
3011 matplotlib >= 0.63, where I had to make some changes as well.
3015 matplotlib >= 0.63, where I had to make some changes as well.
3012
3016
3013 * IPython/ipmaker.py (make_IPython): update version requirement to
3017 * IPython/ipmaker.py (make_IPython): update version requirement to
3014 python 2.2.
3018 python 2.2.
3015
3019
3016 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
3020 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
3017 banner arg for embedded customization.
3021 banner arg for embedded customization.
3018
3022
3019 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
3023 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
3020 explicit uses of __IP as the IPython's instance name. Now things
3024 explicit uses of __IP as the IPython's instance name. Now things
3021 are properly handled via the shell.name value. The actual code
3025 are properly handled via the shell.name value. The actual code
3022 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
3026 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
3023 is much better than before. I'll clean things completely when the
3027 is much better than before. I'll clean things completely when the
3024 magic stuff gets a real overhaul.
3028 magic stuff gets a real overhaul.
3025
3029
3026 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
3030 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
3027 minor changes to debian dir.
3031 minor changes to debian dir.
3028
3032
3029 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
3033 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
3030 pointer to the shell itself in the interactive namespace even when
3034 pointer to the shell itself in the interactive namespace even when
3031 a user-supplied dict is provided. This is needed for embedding
3035 a user-supplied dict is provided. This is needed for embedding
3032 purposes (found by tests with Michel Sanner).
3036 purposes (found by tests with Michel Sanner).
3033
3037
3034 2004-09-27 Fernando Perez <fperez@colorado.edu>
3038 2004-09-27 Fernando Perez <fperez@colorado.edu>
3035
3039
3036 * IPython/UserConfig/ipythonrc: remove []{} from
3040 * IPython/UserConfig/ipythonrc: remove []{} from
3037 readline_remove_delims, so that things like [modname.<TAB> do
3041 readline_remove_delims, so that things like [modname.<TAB> do
3038 proper completion. This disables [].TAB, but that's a less common
3042 proper completion. This disables [].TAB, but that's a less common
3039 case than module names in list comprehensions, for example.
3043 case than module names in list comprehensions, for example.
3040 Thanks to a report by Andrea Riciputi.
3044 Thanks to a report by Andrea Riciputi.
3041
3045
3042 2004-09-09 Fernando Perez <fperez@colorado.edu>
3046 2004-09-09 Fernando Perez <fperez@colorado.edu>
3043
3047
3044 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
3048 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
3045 blocking problems in win32 and osx. Fix by John.
3049 blocking problems in win32 and osx. Fix by John.
3046
3050
3047 2004-09-08 Fernando Perez <fperez@colorado.edu>
3051 2004-09-08 Fernando Perez <fperez@colorado.edu>
3048
3052
3049 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
3053 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
3050 for Win32 and OSX. Fix by John Hunter.
3054 for Win32 and OSX. Fix by John Hunter.
3051
3055
3052 2004-08-30 *** Released version 0.6.3
3056 2004-08-30 *** Released version 0.6.3
3053
3057
3054 2004-08-30 Fernando Perez <fperez@colorado.edu>
3058 2004-08-30 Fernando Perez <fperez@colorado.edu>
3055
3059
3056 * setup.py (isfile): Add manpages to list of dependent files to be
3060 * setup.py (isfile): Add manpages to list of dependent files to be
3057 updated.
3061 updated.
3058
3062
3059 2004-08-27 Fernando Perez <fperez@colorado.edu>
3063 2004-08-27 Fernando Perez <fperez@colorado.edu>
3060
3064
3061 * IPython/Shell.py (start): I've disabled -wthread and -gthread
3065 * IPython/Shell.py (start): I've disabled -wthread and -gthread
3062 for now. They don't really work with standalone WX/GTK code
3066 for now. They don't really work with standalone WX/GTK code
3063 (though matplotlib IS working fine with both of those backends).
3067 (though matplotlib IS working fine with both of those backends).
3064 This will neeed much more testing. I disabled most things with
3068 This will neeed much more testing. I disabled most things with
3065 comments, so turning it back on later should be pretty easy.
3069 comments, so turning it back on later should be pretty easy.
3066
3070
3067 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
3071 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
3068 autocalling of expressions like r'foo', by modifying the line
3072 autocalling of expressions like r'foo', by modifying the line
3069 split regexp. Closes
3073 split regexp. Closes
3070 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
3074 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
3071 Riley <ipythonbugs-AT-sabi.net>.
3075 Riley <ipythonbugs-AT-sabi.net>.
3072 (InteractiveShell.mainloop): honor --nobanner with banner
3076 (InteractiveShell.mainloop): honor --nobanner with banner
3073 extensions.
3077 extensions.
3074
3078
3075 * IPython/Shell.py: Significant refactoring of all classes, so
3079 * IPython/Shell.py: Significant refactoring of all classes, so
3076 that we can really support ALL matplotlib backends and threading
3080 that we can really support ALL matplotlib backends and threading
3077 models (John spotted a bug with Tk which required this). Now we
3081 models (John spotted a bug with Tk which required this). Now we
3078 should support single-threaded, WX-threads and GTK-threads, both
3082 should support single-threaded, WX-threads and GTK-threads, both
3079 for generic code and for matplotlib.
3083 for generic code and for matplotlib.
3080
3084
3081 * IPython/ipmaker.py (__call__): Changed -mpthread option to
3085 * IPython/ipmaker.py (__call__): Changed -mpthread option to
3082 -pylab, to simplify things for users. Will also remove the pylab
3086 -pylab, to simplify things for users. Will also remove the pylab
3083 profile, since now all of matplotlib configuration is directly
3087 profile, since now all of matplotlib configuration is directly
3084 handled here. This also reduces startup time.
3088 handled here. This also reduces startup time.
3085
3089
3086 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
3090 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
3087 shell wasn't being correctly called. Also in IPShellWX.
3091 shell wasn't being correctly called. Also in IPShellWX.
3088
3092
3089 * IPython/iplib.py (InteractiveShell.__init__): Added option to
3093 * IPython/iplib.py (InteractiveShell.__init__): Added option to
3090 fine-tune banner.
3094 fine-tune banner.
3091
3095
3092 * IPython/numutils.py (spike): Deprecate these spike functions,
3096 * IPython/numutils.py (spike): Deprecate these spike functions,
3093 delete (long deprecated) gnuplot_exec handler.
3097 delete (long deprecated) gnuplot_exec handler.
3094
3098
3095 2004-08-26 Fernando Perez <fperez@colorado.edu>
3099 2004-08-26 Fernando Perez <fperez@colorado.edu>
3096
3100
3097 * ipython.1: Update for threading options, plus some others which
3101 * ipython.1: Update for threading options, plus some others which
3098 were missing.
3102 were missing.
3099
3103
3100 * IPython/ipmaker.py (__call__): Added -wthread option for
3104 * IPython/ipmaker.py (__call__): Added -wthread option for
3101 wxpython thread handling. Make sure threading options are only
3105 wxpython thread handling. Make sure threading options are only
3102 valid at the command line.
3106 valid at the command line.
3103
3107
3104 * scripts/ipython: moved shell selection into a factory function
3108 * scripts/ipython: moved shell selection into a factory function
3105 in Shell.py, to keep the starter script to a minimum.
3109 in Shell.py, to keep the starter script to a minimum.
3106
3110
3107 2004-08-25 Fernando Perez <fperez@colorado.edu>
3111 2004-08-25 Fernando Perez <fperez@colorado.edu>
3108
3112
3109 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
3113 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
3110 John. Along with some recent changes he made to matplotlib, the
3114 John. Along with some recent changes he made to matplotlib, the
3111 next versions of both systems should work very well together.
3115 next versions of both systems should work very well together.
3112
3116
3113 2004-08-24 Fernando Perez <fperez@colorado.edu>
3117 2004-08-24 Fernando Perez <fperez@colorado.edu>
3114
3118
3115 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
3119 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
3116 tried to switch the profiling to using hotshot, but I'm getting
3120 tried to switch the profiling to using hotshot, but I'm getting
3117 strange errors from prof.runctx() there. I may be misreading the
3121 strange errors from prof.runctx() there. I may be misreading the
3118 docs, but it looks weird. For now the profiling code will
3122 docs, but it looks weird. For now the profiling code will
3119 continue to use the standard profiler.
3123 continue to use the standard profiler.
3120
3124
3121 2004-08-23 Fernando Perez <fperez@colorado.edu>
3125 2004-08-23 Fernando Perez <fperez@colorado.edu>
3122
3126
3123 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
3127 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
3124 threaded shell, by John Hunter. It's not quite ready yet, but
3128 threaded shell, by John Hunter. It's not quite ready yet, but
3125 close.
3129 close.
3126
3130
3127 2004-08-22 Fernando Perez <fperez@colorado.edu>
3131 2004-08-22 Fernando Perez <fperez@colorado.edu>
3128
3132
3129 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
3133 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
3130 in Magic and ultraTB.
3134 in Magic and ultraTB.
3131
3135
3132 * ipython.1: document threading options in manpage.
3136 * ipython.1: document threading options in manpage.
3133
3137
3134 * scripts/ipython: Changed name of -thread option to -gthread,
3138 * scripts/ipython: Changed name of -thread option to -gthread,
3135 since this is GTK specific. I want to leave the door open for a
3139 since this is GTK specific. I want to leave the door open for a
3136 -wthread option for WX, which will most likely be necessary. This
3140 -wthread option for WX, which will most likely be necessary. This
3137 change affects usage and ipmaker as well.
3141 change affects usage and ipmaker as well.
3138
3142
3139 * IPython/Shell.py (matplotlib_shell): Add a factory function to
3143 * IPython/Shell.py (matplotlib_shell): Add a factory function to
3140 handle the matplotlib shell issues. Code by John Hunter
3144 handle the matplotlib shell issues. Code by John Hunter
3141 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3145 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3142 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
3146 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
3143 broken (and disabled for end users) for now, but it puts the
3147 broken (and disabled for end users) for now, but it puts the
3144 infrastructure in place.
3148 infrastructure in place.
3145
3149
3146 2004-08-21 Fernando Perez <fperez@colorado.edu>
3150 2004-08-21 Fernando Perez <fperez@colorado.edu>
3147
3151
3148 * ipythonrc-pylab: Add matplotlib support.
3152 * ipythonrc-pylab: Add matplotlib support.
3149
3153
3150 * matplotlib_config.py: new files for matplotlib support, part of
3154 * matplotlib_config.py: new files for matplotlib support, part of
3151 the pylab profile.
3155 the pylab profile.
3152
3156
3153 * IPython/usage.py (__doc__): documented the threading options.
3157 * IPython/usage.py (__doc__): documented the threading options.
3154
3158
3155 2004-08-20 Fernando Perez <fperez@colorado.edu>
3159 2004-08-20 Fernando Perez <fperez@colorado.edu>
3156
3160
3157 * ipython: Modified the main calling routine to handle the -thread
3161 * ipython: Modified the main calling routine to handle the -thread
3158 and -mpthread options. This needs to be done as a top-level hack,
3162 and -mpthread options. This needs to be done as a top-level hack,
3159 because it determines which class to instantiate for IPython
3163 because it determines which class to instantiate for IPython
3160 itself.
3164 itself.
3161
3165
3162 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
3166 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
3163 classes to support multithreaded GTK operation without blocking,
3167 classes to support multithreaded GTK operation without blocking,
3164 and matplotlib with all backends. This is a lot of still very
3168 and matplotlib with all backends. This is a lot of still very
3165 experimental code, and threads are tricky. So it may still have a
3169 experimental code, and threads are tricky. So it may still have a
3166 few rough edges... This code owes a lot to
3170 few rough edges... This code owes a lot to
3167 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
3171 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
3168 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
3172 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
3169 to John Hunter for all the matplotlib work.
3173 to John Hunter for all the matplotlib work.
3170
3174
3171 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
3175 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
3172 options for gtk thread and matplotlib support.
3176 options for gtk thread and matplotlib support.
3173
3177
3174 2004-08-16 Fernando Perez <fperez@colorado.edu>
3178 2004-08-16 Fernando Perez <fperez@colorado.edu>
3175
3179
3176 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
3180 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
3177 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
3181 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
3178 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
3182 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
3179
3183
3180 2004-08-11 Fernando Perez <fperez@colorado.edu>
3184 2004-08-11 Fernando Perez <fperez@colorado.edu>
3181
3185
3182 * setup.py (isfile): Fix build so documentation gets updated for
3186 * setup.py (isfile): Fix build so documentation gets updated for
3183 rpms (it was only done for .tgz builds).
3187 rpms (it was only done for .tgz builds).
3184
3188
3185 2004-08-10 Fernando Perez <fperez@colorado.edu>
3189 2004-08-10 Fernando Perez <fperez@colorado.edu>
3186
3190
3187 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
3191 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
3188
3192
3189 * iplib.py : Silence syntax error exceptions in tab-completion.
3193 * iplib.py : Silence syntax error exceptions in tab-completion.
3190
3194
3191 2004-08-05 Fernando Perez <fperez@colorado.edu>
3195 2004-08-05 Fernando Perez <fperez@colorado.edu>
3192
3196
3193 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
3197 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
3194 'color off' mark for continuation prompts. This was causing long
3198 'color off' mark for continuation prompts. This was causing long
3195 continuation lines to mis-wrap.
3199 continuation lines to mis-wrap.
3196
3200
3197 2004-08-01 Fernando Perez <fperez@colorado.edu>
3201 2004-08-01 Fernando Perez <fperez@colorado.edu>
3198
3202
3199 * IPython/ipmaker.py (make_IPython): Allow the shell class used
3203 * IPython/ipmaker.py (make_IPython): Allow the shell class used
3200 for building ipython to be a parameter. All this is necessary
3204 for building ipython to be a parameter. All this is necessary
3201 right now to have a multithreaded version, but this insane
3205 right now to have a multithreaded version, but this insane
3202 non-design will be cleaned up soon. For now, it's a hack that
3206 non-design will be cleaned up soon. For now, it's a hack that
3203 works.
3207 works.
3204
3208
3205 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
3209 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
3206 args in various places. No bugs so far, but it's a dangerous
3210 args in various places. No bugs so far, but it's a dangerous
3207 practice.
3211 practice.
3208
3212
3209 2004-07-31 Fernando Perez <fperez@colorado.edu>
3213 2004-07-31 Fernando Perez <fperez@colorado.edu>
3210
3214
3211 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
3215 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
3212 fix completion of files with dots in their names under most
3216 fix completion of files with dots in their names under most
3213 profiles (pysh was OK because the completion order is different).
3217 profiles (pysh was OK because the completion order is different).
3214
3218
3215 2004-07-27 Fernando Perez <fperez@colorado.edu>
3219 2004-07-27 Fernando Perez <fperez@colorado.edu>
3216
3220
3217 * IPython/iplib.py (InteractiveShell.__init__): build dict of
3221 * IPython/iplib.py (InteractiveShell.__init__): build dict of
3218 keywords manually, b/c the one in keyword.py was removed in python
3222 keywords manually, b/c the one in keyword.py was removed in python
3219 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
3223 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
3220 This is NOT a bug under python 2.3 and earlier.
3224 This is NOT a bug under python 2.3 and earlier.
3221
3225
3222 2004-07-26 Fernando Perez <fperez@colorado.edu>
3226 2004-07-26 Fernando Perez <fperez@colorado.edu>
3223
3227
3224 * IPython/ultraTB.py (VerboseTB.text): Add another
3228 * IPython/ultraTB.py (VerboseTB.text): Add another
3225 linecache.checkcache() call to try to prevent inspect.py from
3229 linecache.checkcache() call to try to prevent inspect.py from
3226 crashing under python 2.3. I think this fixes
3230 crashing under python 2.3. I think this fixes
3227 http://www.scipy.net/roundup/ipython/issue17.
3231 http://www.scipy.net/roundup/ipython/issue17.
3228
3232
3229 2004-07-26 *** Released version 0.6.2
3233 2004-07-26 *** Released version 0.6.2
3230
3234
3231 2004-07-26 Fernando Perez <fperez@colorado.edu>
3235 2004-07-26 Fernando Perez <fperez@colorado.edu>
3232
3236
3233 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
3237 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
3234 fail for any number.
3238 fail for any number.
3235 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
3239 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
3236 empty bookmarks.
3240 empty bookmarks.
3237
3241
3238 2004-07-26 *** Released version 0.6.1
3242 2004-07-26 *** Released version 0.6.1
3239
3243
3240 2004-07-26 Fernando Perez <fperez@colorado.edu>
3244 2004-07-26 Fernando Perez <fperez@colorado.edu>
3241
3245
3242 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
3246 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
3243
3247
3244 * IPython/iplib.py (protect_filename): Applied Ville's patch for
3248 * IPython/iplib.py (protect_filename): Applied Ville's patch for
3245 escaping '()[]{}' in filenames.
3249 escaping '()[]{}' in filenames.
3246
3250
3247 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
3251 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
3248 Python 2.2 users who lack a proper shlex.split.
3252 Python 2.2 users who lack a proper shlex.split.
3249
3253
3250 2004-07-19 Fernando Perez <fperez@colorado.edu>
3254 2004-07-19 Fernando Perez <fperez@colorado.edu>
3251
3255
3252 * IPython/iplib.py (InteractiveShell.init_readline): Add support
3256 * IPython/iplib.py (InteractiveShell.init_readline): Add support
3253 for reading readline's init file. I follow the normal chain:
3257 for reading readline's init file. I follow the normal chain:
3254 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
3258 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
3255 report by Mike Heeter. This closes
3259 report by Mike Heeter. This closes
3256 http://www.scipy.net/roundup/ipython/issue16.
3260 http://www.scipy.net/roundup/ipython/issue16.
3257
3261
3258 2004-07-18 Fernando Perez <fperez@colorado.edu>
3262 2004-07-18 Fernando Perez <fperez@colorado.edu>
3259
3263
3260 * IPython/iplib.py (__init__): Add better handling of '\' under
3264 * IPython/iplib.py (__init__): Add better handling of '\' under
3261 Win32 for filenames. After a patch by Ville.
3265 Win32 for filenames. After a patch by Ville.
3262
3266
3263 2004-07-17 Fernando Perez <fperez@colorado.edu>
3267 2004-07-17 Fernando Perez <fperez@colorado.edu>
3264
3268
3265 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3269 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3266 autocalling would be triggered for 'foo is bar' if foo is
3270 autocalling would be triggered for 'foo is bar' if foo is
3267 callable. I also cleaned up the autocall detection code to use a
3271 callable. I also cleaned up the autocall detection code to use a
3268 regexp, which is faster. Bug reported by Alexander Schmolck.
3272 regexp, which is faster. Bug reported by Alexander Schmolck.
3269
3273
3270 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
3274 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
3271 '?' in them would confuse the help system. Reported by Alex
3275 '?' in them would confuse the help system. Reported by Alex
3272 Schmolck.
3276 Schmolck.
3273
3277
3274 2004-07-16 Fernando Perez <fperez@colorado.edu>
3278 2004-07-16 Fernando Perez <fperez@colorado.edu>
3275
3279
3276 * IPython/GnuplotInteractive.py (__all__): added plot2.
3280 * IPython/GnuplotInteractive.py (__all__): added plot2.
3277
3281
3278 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
3282 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
3279 plotting dictionaries, lists or tuples of 1d arrays.
3283 plotting dictionaries, lists or tuples of 1d arrays.
3280
3284
3281 * IPython/Magic.py (Magic.magic_hist): small clenaups and
3285 * IPython/Magic.py (Magic.magic_hist): small clenaups and
3282 optimizations.
3286 optimizations.
3283
3287
3284 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
3288 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
3285 the information which was there from Janko's original IPP code:
3289 the information which was there from Janko's original IPP code:
3286
3290
3287 03.05.99 20:53 porto.ifm.uni-kiel.de
3291 03.05.99 20:53 porto.ifm.uni-kiel.de
3288 --Started changelog.
3292 --Started changelog.
3289 --make clear do what it say it does
3293 --make clear do what it say it does
3290 --added pretty output of lines from inputcache
3294 --added pretty output of lines from inputcache
3291 --Made Logger a mixin class, simplifies handling of switches
3295 --Made Logger a mixin class, simplifies handling of switches
3292 --Added own completer class. .string<TAB> expands to last history
3296 --Added own completer class. .string<TAB> expands to last history
3293 line which starts with string. The new expansion is also present
3297 line which starts with string. The new expansion is also present
3294 with Ctrl-r from the readline library. But this shows, who this
3298 with Ctrl-r from the readline library. But this shows, who this
3295 can be done for other cases.
3299 can be done for other cases.
3296 --Added convention that all shell functions should accept a
3300 --Added convention that all shell functions should accept a
3297 parameter_string This opens the door for different behaviour for
3301 parameter_string This opens the door for different behaviour for
3298 each function. @cd is a good example of this.
3302 each function. @cd is a good example of this.
3299
3303
3300 04.05.99 12:12 porto.ifm.uni-kiel.de
3304 04.05.99 12:12 porto.ifm.uni-kiel.de
3301 --added logfile rotation
3305 --added logfile rotation
3302 --added new mainloop method which freezes first the namespace
3306 --added new mainloop method which freezes first the namespace
3303
3307
3304 07.05.99 21:24 porto.ifm.uni-kiel.de
3308 07.05.99 21:24 porto.ifm.uni-kiel.de
3305 --added the docreader classes. Now there is a help system.
3309 --added the docreader classes. Now there is a help system.
3306 -This is only a first try. Currently it's not easy to put new
3310 -This is only a first try. Currently it's not easy to put new
3307 stuff in the indices. But this is the way to go. Info would be
3311 stuff in the indices. But this is the way to go. Info would be
3308 better, but HTML is every where and not everybody has an info
3312 better, but HTML is every where and not everybody has an info
3309 system installed and it's not so easy to change html-docs to info.
3313 system installed and it's not so easy to change html-docs to info.
3310 --added global logfile option
3314 --added global logfile option
3311 --there is now a hook for object inspection method pinfo needs to
3315 --there is now a hook for object inspection method pinfo needs to
3312 be provided for this. Can be reached by two '??'.
3316 be provided for this. Can be reached by two '??'.
3313
3317
3314 08.05.99 20:51 porto.ifm.uni-kiel.de
3318 08.05.99 20:51 porto.ifm.uni-kiel.de
3315 --added a README
3319 --added a README
3316 --bug in rc file. Something has changed so functions in the rc
3320 --bug in rc file. Something has changed so functions in the rc
3317 file need to reference the shell and not self. Not clear if it's a
3321 file need to reference the shell and not self. Not clear if it's a
3318 bug or feature.
3322 bug or feature.
3319 --changed rc file for new behavior
3323 --changed rc file for new behavior
3320
3324
3321 2004-07-15 Fernando Perez <fperez@colorado.edu>
3325 2004-07-15 Fernando Perez <fperez@colorado.edu>
3322
3326
3323 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3327 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3324 cache was falling out of sync in bizarre manners when multi-line
3328 cache was falling out of sync in bizarre manners when multi-line
3325 input was present. Minor optimizations and cleanup.
3329 input was present. Minor optimizations and cleanup.
3326
3330
3327 (Logger): Remove old Changelog info for cleanup. This is the
3331 (Logger): Remove old Changelog info for cleanup. This is the
3328 information which was there from Janko's original code:
3332 information which was there from Janko's original code:
3329
3333
3330 Changes to Logger: - made the default log filename a parameter
3334 Changes to Logger: - made the default log filename a parameter
3331
3335
3332 - put a check for lines beginning with !@? in log(). Needed
3336 - put a check for lines beginning with !@? in log(). Needed
3333 (even if the handlers properly log their lines) for mid-session
3337 (even if the handlers properly log their lines) for mid-session
3334 logging activation to work properly. Without this, lines logged
3338 logging activation to work properly. Without this, lines logged
3335 in mid session, which get read from the cache, would end up
3339 in mid session, which get read from the cache, would end up
3336 'bare' (with !@? in the open) in the log. Now they are caught
3340 'bare' (with !@? in the open) in the log. Now they are caught
3337 and prepended with a #.
3341 and prepended with a #.
3338
3342
3339 * IPython/iplib.py (InteractiveShell.init_readline): added check
3343 * IPython/iplib.py (InteractiveShell.init_readline): added check
3340 in case MagicCompleter fails to be defined, so we don't crash.
3344 in case MagicCompleter fails to be defined, so we don't crash.
3341
3345
3342 2004-07-13 Fernando Perez <fperez@colorado.edu>
3346 2004-07-13 Fernando Perez <fperez@colorado.edu>
3343
3347
3344 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
3348 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
3345 of EPS if the requested filename ends in '.eps'.
3349 of EPS if the requested filename ends in '.eps'.
3346
3350
3347 2004-07-04 Fernando Perez <fperez@colorado.edu>
3351 2004-07-04 Fernando Perez <fperez@colorado.edu>
3348
3352
3349 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
3353 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
3350 escaping of quotes when calling the shell.
3354 escaping of quotes when calling the shell.
3351
3355
3352 2004-07-02 Fernando Perez <fperez@colorado.edu>
3356 2004-07-02 Fernando Perez <fperez@colorado.edu>
3353
3357
3354 * IPython/Prompts.py (CachedOutput.update): Fix problem with
3358 * IPython/Prompts.py (CachedOutput.update): Fix problem with
3355 gettext not working because we were clobbering '_'. Fixes
3359 gettext not working because we were clobbering '_'. Fixes
3356 http://www.scipy.net/roundup/ipython/issue6.
3360 http://www.scipy.net/roundup/ipython/issue6.
3357
3361
3358 2004-07-01 Fernando Perez <fperez@colorado.edu>
3362 2004-07-01 Fernando Perez <fperez@colorado.edu>
3359
3363
3360 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
3364 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
3361 into @cd. Patch by Ville.
3365 into @cd. Patch by Ville.
3362
3366
3363 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3367 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3364 new function to store things after ipmaker runs. Patch by Ville.
3368 new function to store things after ipmaker runs. Patch by Ville.
3365 Eventually this will go away once ipmaker is removed and the class
3369 Eventually this will go away once ipmaker is removed and the class
3366 gets cleaned up, but for now it's ok. Key functionality here is
3370 gets cleaned up, but for now it's ok. Key functionality here is
3367 the addition of the persistent storage mechanism, a dict for
3371 the addition of the persistent storage mechanism, a dict for
3368 keeping data across sessions (for now just bookmarks, but more can
3372 keeping data across sessions (for now just bookmarks, but more can
3369 be implemented later).
3373 be implemented later).
3370
3374
3371 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
3375 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
3372 persistent across sections. Patch by Ville, I modified it
3376 persistent across sections. Patch by Ville, I modified it
3373 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
3377 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
3374 added a '-l' option to list all bookmarks.
3378 added a '-l' option to list all bookmarks.
3375
3379
3376 * IPython/iplib.py (InteractiveShell.atexit_operations): new
3380 * IPython/iplib.py (InteractiveShell.atexit_operations): new
3377 center for cleanup. Registered with atexit.register(). I moved
3381 center for cleanup. Registered with atexit.register(). I moved
3378 here the old exit_cleanup(). After a patch by Ville.
3382 here the old exit_cleanup(). After a patch by Ville.
3379
3383
3380 * IPython/Magic.py (get_py_filename): added '~' to the accepted
3384 * IPython/Magic.py (get_py_filename): added '~' to the accepted
3381 characters in the hacked shlex_split for python 2.2.
3385 characters in the hacked shlex_split for python 2.2.
3382
3386
3383 * IPython/iplib.py (file_matches): more fixes to filenames with
3387 * IPython/iplib.py (file_matches): more fixes to filenames with
3384 whitespace in them. It's not perfect, but limitations in python's
3388 whitespace in them. It's not perfect, but limitations in python's
3385 readline make it impossible to go further.
3389 readline make it impossible to go further.
3386
3390
3387 2004-06-29 Fernando Perez <fperez@colorado.edu>
3391 2004-06-29 Fernando Perez <fperez@colorado.edu>
3388
3392
3389 * IPython/iplib.py (file_matches): escape whitespace correctly in
3393 * IPython/iplib.py (file_matches): escape whitespace correctly in
3390 filename completions. Bug reported by Ville.
3394 filename completions. Bug reported by Ville.
3391
3395
3392 2004-06-28 Fernando Perez <fperez@colorado.edu>
3396 2004-06-28 Fernando Perez <fperez@colorado.edu>
3393
3397
3394 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
3398 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
3395 the history file will be called 'history-PROFNAME' (or just
3399 the history file will be called 'history-PROFNAME' (or just
3396 'history' if no profile is loaded). I was getting annoyed at
3400 'history' if no profile is loaded). I was getting annoyed at
3397 getting my Numerical work history clobbered by pysh sessions.
3401 getting my Numerical work history clobbered by pysh sessions.
3398
3402
3399 * IPython/iplib.py (InteractiveShell.__init__): Internal
3403 * IPython/iplib.py (InteractiveShell.__init__): Internal
3400 getoutputerror() function so that we can honor the system_verbose
3404 getoutputerror() function so that we can honor the system_verbose
3401 flag for _all_ system calls. I also added escaping of #
3405 flag for _all_ system calls. I also added escaping of #
3402 characters here to avoid confusing Itpl.
3406 characters here to avoid confusing Itpl.
3403
3407
3404 * IPython/Magic.py (shlex_split): removed call to shell in
3408 * IPython/Magic.py (shlex_split): removed call to shell in
3405 parse_options and replaced it with shlex.split(). The annoying
3409 parse_options and replaced it with shlex.split(). The annoying
3406 part was that in Python 2.2, shlex.split() doesn't exist, so I had
3410 part was that in Python 2.2, shlex.split() doesn't exist, so I had
3407 to backport it from 2.3, with several frail hacks (the shlex
3411 to backport it from 2.3, with several frail hacks (the shlex
3408 module is rather limited in 2.2). Thanks to a suggestion by Ville
3412 module is rather limited in 2.2). Thanks to a suggestion by Ville
3409 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
3413 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
3410 problem.
3414 problem.
3411
3415
3412 (Magic.magic_system_verbose): new toggle to print the actual
3416 (Magic.magic_system_verbose): new toggle to print the actual
3413 system calls made by ipython. Mainly for debugging purposes.
3417 system calls made by ipython. Mainly for debugging purposes.
3414
3418
3415 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
3419 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
3416 doesn't support persistence. Reported (and fix suggested) by
3420 doesn't support persistence. Reported (and fix suggested) by
3417 Travis Caldwell <travis_caldwell2000@yahoo.com>.
3421 Travis Caldwell <travis_caldwell2000@yahoo.com>.
3418
3422
3419 2004-06-26 Fernando Perez <fperez@colorado.edu>
3423 2004-06-26 Fernando Perez <fperez@colorado.edu>
3420
3424
3421 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3425 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3422 continue prompts.
3426 continue prompts.
3423
3427
3424 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3428 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3425 function (basically a big docstring) and a few more things here to
3429 function (basically a big docstring) and a few more things here to
3426 speedup startup. pysh.py is now very lightweight. We want because
3430 speedup startup. pysh.py is now very lightweight. We want because
3427 it gets execfile'd, while InterpreterExec gets imported, so
3431 it gets execfile'd, while InterpreterExec gets imported, so
3428 byte-compilation saves time.
3432 byte-compilation saves time.
3429
3433
3430 2004-06-25 Fernando Perez <fperez@colorado.edu>
3434 2004-06-25 Fernando Perez <fperez@colorado.edu>
3431
3435
3432 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3436 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3433 -NUM', which was recently broken.
3437 -NUM', which was recently broken.
3434
3438
3435 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3439 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3436 in multi-line input (but not !!, which doesn't make sense there).
3440 in multi-line input (but not !!, which doesn't make sense there).
3437
3441
3438 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3442 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3439 It's just too useful, and people can turn it off in the less
3443 It's just too useful, and people can turn it off in the less
3440 common cases where it's a problem.
3444 common cases where it's a problem.
3441
3445
3442 2004-06-24 Fernando Perez <fperez@colorado.edu>
3446 2004-06-24 Fernando Perez <fperez@colorado.edu>
3443
3447
3444 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3448 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3445 special syntaxes (like alias calling) is now allied in multi-line
3449 special syntaxes (like alias calling) is now allied in multi-line
3446 input. This is still _very_ experimental, but it's necessary for
3450 input. This is still _very_ experimental, but it's necessary for
3447 efficient shell usage combining python looping syntax with system
3451 efficient shell usage combining python looping syntax with system
3448 calls. For now it's restricted to aliases, I don't think it
3452 calls. For now it's restricted to aliases, I don't think it
3449 really even makes sense to have this for magics.
3453 really even makes sense to have this for magics.
3450
3454
3451 2004-06-23 Fernando Perez <fperez@colorado.edu>
3455 2004-06-23 Fernando Perez <fperez@colorado.edu>
3452
3456
3453 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3457 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3454 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3458 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3455
3459
3456 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3460 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3457 extensions under Windows (after code sent by Gary Bishop). The
3461 extensions under Windows (after code sent by Gary Bishop). The
3458 extensions considered 'executable' are stored in IPython's rc
3462 extensions considered 'executable' are stored in IPython's rc
3459 structure as win_exec_ext.
3463 structure as win_exec_ext.
3460
3464
3461 * IPython/genutils.py (shell): new function, like system() but
3465 * IPython/genutils.py (shell): new function, like system() but
3462 without return value. Very useful for interactive shell work.
3466 without return value. Very useful for interactive shell work.
3463
3467
3464 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3468 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3465 delete aliases.
3469 delete aliases.
3466
3470
3467 * IPython/iplib.py (InteractiveShell.alias_table_update): make
3471 * IPython/iplib.py (InteractiveShell.alias_table_update): make
3468 sure that the alias table doesn't contain python keywords.
3472 sure that the alias table doesn't contain python keywords.
3469
3473
3470 2004-06-21 Fernando Perez <fperez@colorado.edu>
3474 2004-06-21 Fernando Perez <fperez@colorado.edu>
3471
3475
3472 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
3476 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
3473 non-existent items are found in $PATH. Reported by Thorsten.
3477 non-existent items are found in $PATH. Reported by Thorsten.
3474
3478
3475 2004-06-20 Fernando Perez <fperez@colorado.edu>
3479 2004-06-20 Fernando Perez <fperez@colorado.edu>
3476
3480
3477 * IPython/iplib.py (complete): modified the completer so that the
3481 * IPython/iplib.py (complete): modified the completer so that the
3478 order of priorities can be easily changed at runtime.
3482 order of priorities can be easily changed at runtime.
3479
3483
3480 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
3484 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
3481 Modified to auto-execute all lines beginning with '~', '/' or '.'.
3485 Modified to auto-execute all lines beginning with '~', '/' or '.'.
3482
3486
3483 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
3487 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
3484 expand Python variables prepended with $ in all system calls. The
3488 expand Python variables prepended with $ in all system calls. The
3485 same was done to InteractiveShell.handle_shell_escape. Now all
3489 same was done to InteractiveShell.handle_shell_escape. Now all
3486 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
3490 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
3487 expansion of python variables and expressions according to the
3491 expansion of python variables and expressions according to the
3488 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
3492 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
3489
3493
3490 Though PEP-215 has been rejected, a similar (but simpler) one
3494 Though PEP-215 has been rejected, a similar (but simpler) one
3491 seems like it will go into Python 2.4, PEP-292 -
3495 seems like it will go into Python 2.4, PEP-292 -
3492 http://www.python.org/peps/pep-0292.html.
3496 http://www.python.org/peps/pep-0292.html.
3493
3497
3494 I'll keep the full syntax of PEP-215, since IPython has since the
3498 I'll keep the full syntax of PEP-215, since IPython has since the
3495 start used Ka-Ping Yee's reference implementation discussed there
3499 start used Ka-Ping Yee's reference implementation discussed there
3496 (Itpl), and I actually like the powerful semantics it offers.
3500 (Itpl), and I actually like the powerful semantics it offers.
3497
3501
3498 In order to access normal shell variables, the $ has to be escaped
3502 In order to access normal shell variables, the $ has to be escaped
3499 via an extra $. For example:
3503 via an extra $. For example:
3500
3504
3501 In [7]: PATH='a python variable'
3505 In [7]: PATH='a python variable'
3502
3506
3503 In [8]: !echo $PATH
3507 In [8]: !echo $PATH
3504 a python variable
3508 a python variable
3505
3509
3506 In [9]: !echo $$PATH
3510 In [9]: !echo $$PATH
3507 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
3511 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
3508
3512
3509 (Magic.parse_options): escape $ so the shell doesn't evaluate
3513 (Magic.parse_options): escape $ so the shell doesn't evaluate
3510 things prematurely.
3514 things prematurely.
3511
3515
3512 * IPython/iplib.py (InteractiveShell.call_alias): added the
3516 * IPython/iplib.py (InteractiveShell.call_alias): added the
3513 ability for aliases to expand python variables via $.
3517 ability for aliases to expand python variables via $.
3514
3518
3515 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
3519 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
3516 system, now there's a @rehash/@rehashx pair of magics. These work
3520 system, now there's a @rehash/@rehashx pair of magics. These work
3517 like the csh rehash command, and can be invoked at any time. They
3521 like the csh rehash command, and can be invoked at any time. They
3518 build a table of aliases to everything in the user's $PATH
3522 build a table of aliases to everything in the user's $PATH
3519 (@rehash uses everything, @rehashx is slower but only adds
3523 (@rehash uses everything, @rehashx is slower but only adds
3520 executable files). With this, the pysh.py-based shell profile can
3524 executable files). With this, the pysh.py-based shell profile can
3521 now simply call rehash upon startup, and full access to all
3525 now simply call rehash upon startup, and full access to all
3522 programs in the user's path is obtained.
3526 programs in the user's path is obtained.
3523
3527
3524 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
3528 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
3525 functionality is now fully in place. I removed the old dynamic
3529 functionality is now fully in place. I removed the old dynamic
3526 code generation based approach, in favor of a much lighter one
3530 code generation based approach, in favor of a much lighter one
3527 based on a simple dict. The advantage is that this allows me to
3531 based on a simple dict. The advantage is that this allows me to
3528 now have thousands of aliases with negligible cost (unthinkable
3532 now have thousands of aliases with negligible cost (unthinkable
3529 with the old system).
3533 with the old system).
3530
3534
3531 2004-06-19 Fernando Perez <fperez@colorado.edu>
3535 2004-06-19 Fernando Perez <fperez@colorado.edu>
3532
3536
3533 * IPython/iplib.py (__init__): extended MagicCompleter class to
3537 * IPython/iplib.py (__init__): extended MagicCompleter class to
3534 also complete (last in priority) on user aliases.
3538 also complete (last in priority) on user aliases.
3535
3539
3536 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
3540 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
3537 call to eval.
3541 call to eval.
3538 (ItplNS.__init__): Added a new class which functions like Itpl,
3542 (ItplNS.__init__): Added a new class which functions like Itpl,
3539 but allows configuring the namespace for the evaluation to occur
3543 but allows configuring the namespace for the evaluation to occur
3540 in.
3544 in.
3541
3545
3542 2004-06-18 Fernando Perez <fperez@colorado.edu>
3546 2004-06-18 Fernando Perez <fperez@colorado.edu>
3543
3547
3544 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
3548 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
3545 better message when 'exit' or 'quit' are typed (a common newbie
3549 better message when 'exit' or 'quit' are typed (a common newbie
3546 confusion).
3550 confusion).
3547
3551
3548 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
3552 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
3549 check for Windows users.
3553 check for Windows users.
3550
3554
3551 * IPython/iplib.py (InteractiveShell.user_setup): removed
3555 * IPython/iplib.py (InteractiveShell.user_setup): removed
3552 disabling of colors for Windows. I'll test at runtime and issue a
3556 disabling of colors for Windows. I'll test at runtime and issue a
3553 warning if Gary's readline isn't found, as to nudge users to
3557 warning if Gary's readline isn't found, as to nudge users to
3554 download it.
3558 download it.
3555
3559
3556 2004-06-16 Fernando Perez <fperez@colorado.edu>
3560 2004-06-16 Fernando Perez <fperez@colorado.edu>
3557
3561
3558 * IPython/genutils.py (Stream.__init__): changed to print errors
3562 * IPython/genutils.py (Stream.__init__): changed to print errors
3559 to sys.stderr. I had a circular dependency here. Now it's
3563 to sys.stderr. I had a circular dependency here. Now it's
3560 possible to run ipython as IDLE's shell (consider this pre-alpha,
3564 possible to run ipython as IDLE's shell (consider this pre-alpha,
3561 since true stdout things end up in the starting terminal instead
3565 since true stdout things end up in the starting terminal instead
3562 of IDLE's out).
3566 of IDLE's out).
3563
3567
3564 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
3568 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
3565 users who haven't # updated their prompt_in2 definitions. Remove
3569 users who haven't # updated their prompt_in2 definitions. Remove
3566 eventually.
3570 eventually.
3567 (multiple_replace): added credit to original ASPN recipe.
3571 (multiple_replace): added credit to original ASPN recipe.
3568
3572
3569 2004-06-15 Fernando Perez <fperez@colorado.edu>
3573 2004-06-15 Fernando Perez <fperez@colorado.edu>
3570
3574
3571 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
3575 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
3572 list of auto-defined aliases.
3576 list of auto-defined aliases.
3573
3577
3574 2004-06-13 Fernando Perez <fperez@colorado.edu>
3578 2004-06-13 Fernando Perez <fperez@colorado.edu>
3575
3579
3576 * setup.py (scriptfiles): Don't trigger win_post_install unless an
3580 * setup.py (scriptfiles): Don't trigger win_post_install unless an
3577 install was really requested (so setup.py can be used for other
3581 install was really requested (so setup.py can be used for other
3578 things under Windows).
3582 things under Windows).
3579
3583
3580 2004-06-10 Fernando Perez <fperez@colorado.edu>
3584 2004-06-10 Fernando Perez <fperez@colorado.edu>
3581
3585
3582 * IPython/Logger.py (Logger.create_log): Manually remove any old
3586 * IPython/Logger.py (Logger.create_log): Manually remove any old
3583 backup, since os.remove may fail under Windows. Fixes bug
3587 backup, since os.remove may fail under Windows. Fixes bug
3584 reported by Thorsten.
3588 reported by Thorsten.
3585
3589
3586 2004-06-09 Fernando Perez <fperez@colorado.edu>
3590 2004-06-09 Fernando Perez <fperez@colorado.edu>
3587
3591
3588 * examples/example-embed.py: fixed all references to %n (replaced
3592 * examples/example-embed.py: fixed all references to %n (replaced
3589 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
3593 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
3590 for all examples and the manual as well.
3594 for all examples and the manual as well.
3591
3595
3592 2004-06-08 Fernando Perez <fperez@colorado.edu>
3596 2004-06-08 Fernando Perez <fperez@colorado.edu>
3593
3597
3594 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3598 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
3595 alignment and color management. All 3 prompt subsystems now
3599 alignment and color management. All 3 prompt subsystems now
3596 inherit from BasePrompt.
3600 inherit from BasePrompt.
3597
3601
3598 * tools/release: updates for windows installer build and tag rpms
3602 * tools/release: updates for windows installer build and tag rpms
3599 with python version (since paths are fixed).
3603 with python version (since paths are fixed).
3600
3604
3601 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3605 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
3602 which will become eventually obsolete. Also fixed the default
3606 which will become eventually obsolete. Also fixed the default
3603 prompt_in2 to use \D, so at least new users start with the correct
3607 prompt_in2 to use \D, so at least new users start with the correct
3604 defaults.
3608 defaults.
3605 WARNING: Users with existing ipythonrc files will need to apply
3609 WARNING: Users with existing ipythonrc files will need to apply
3606 this fix manually!
3610 this fix manually!
3607
3611
3608 * setup.py: make windows installer (.exe). This is finally the
3612 * setup.py: make windows installer (.exe). This is finally the
3609 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3613 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
3610 which I hadn't included because it required Python 2.3 (or recent
3614 which I hadn't included because it required Python 2.3 (or recent
3611 distutils).
3615 distutils).
3612
3616
3613 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3617 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
3614 usage of new '\D' escape.
3618 usage of new '\D' escape.
3615
3619
3616 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3620 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
3617 lacks os.getuid())
3621 lacks os.getuid())
3618 (CachedOutput.set_colors): Added the ability to turn coloring
3622 (CachedOutput.set_colors): Added the ability to turn coloring
3619 on/off with @colors even for manually defined prompt colors. It
3623 on/off with @colors even for manually defined prompt colors. It
3620 uses a nasty global, but it works safely and via the generic color
3624 uses a nasty global, but it works safely and via the generic color
3621 handling mechanism.
3625 handling mechanism.
3622 (Prompt2.__init__): Introduced new escape '\D' for continuation
3626 (Prompt2.__init__): Introduced new escape '\D' for continuation
3623 prompts. It represents the counter ('\#') as dots.
3627 prompts. It represents the counter ('\#') as dots.
3624 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3628 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
3625 need to update their ipythonrc files and replace '%n' with '\D' in
3629 need to update their ipythonrc files and replace '%n' with '\D' in
3626 their prompt_in2 settings everywhere. Sorry, but there's
3630 their prompt_in2 settings everywhere. Sorry, but there's
3627 otherwise no clean way to get all prompts to properly align. The
3631 otherwise no clean way to get all prompts to properly align. The
3628 ipythonrc shipped with IPython has been updated.
3632 ipythonrc shipped with IPython has been updated.
3629
3633
3630 2004-06-07 Fernando Perez <fperez@colorado.edu>
3634 2004-06-07 Fernando Perez <fperez@colorado.edu>
3631
3635
3632 * setup.py (isfile): Pass local_icons option to latex2html, so the
3636 * setup.py (isfile): Pass local_icons option to latex2html, so the
3633 resulting HTML file is self-contained. Thanks to
3637 resulting HTML file is self-contained. Thanks to
3634 dryice-AT-liu.com.cn for the tip.
3638 dryice-AT-liu.com.cn for the tip.
3635
3639
3636 * pysh.py: I created a new profile 'shell', which implements a
3640 * pysh.py: I created a new profile 'shell', which implements a
3637 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3641 _rudimentary_ IPython-based shell. This is in NO WAY a realy
3638 system shell, nor will it become one anytime soon. It's mainly
3642 system shell, nor will it become one anytime soon. It's mainly
3639 meant to illustrate the use of the new flexible bash-like prompts.
3643 meant to illustrate the use of the new flexible bash-like prompts.
3640 I guess it could be used by hardy souls for true shell management,
3644 I guess it could be used by hardy souls for true shell management,
3641 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3645 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
3642 profile. This uses the InterpreterExec extension provided by
3646 profile. This uses the InterpreterExec extension provided by
3643 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3647 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
3644
3648
3645 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3649 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
3646 auto-align itself with the length of the previous input prompt
3650 auto-align itself with the length of the previous input prompt
3647 (taking into account the invisible color escapes).
3651 (taking into account the invisible color escapes).
3648 (CachedOutput.__init__): Large restructuring of this class. Now
3652 (CachedOutput.__init__): Large restructuring of this class. Now
3649 all three prompts (primary1, primary2, output) are proper objects,
3653 all three prompts (primary1, primary2, output) are proper objects,
3650 managed by the 'parent' CachedOutput class. The code is still a
3654 managed by the 'parent' CachedOutput class. The code is still a
3651 bit hackish (all prompts share state via a pointer to the cache),
3655 bit hackish (all prompts share state via a pointer to the cache),
3652 but it's overall far cleaner than before.
3656 but it's overall far cleaner than before.
3653
3657
3654 * IPython/genutils.py (getoutputerror): modified to add verbose,
3658 * IPython/genutils.py (getoutputerror): modified to add verbose,
3655 debug and header options. This makes the interface of all getout*
3659 debug and header options. This makes the interface of all getout*
3656 functions uniform.
3660 functions uniform.
3657 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3661 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
3658
3662
3659 * IPython/Magic.py (Magic.default_option): added a function to
3663 * IPython/Magic.py (Magic.default_option): added a function to
3660 allow registering default options for any magic command. This
3664 allow registering default options for any magic command. This
3661 makes it easy to have profiles which customize the magics globally
3665 makes it easy to have profiles which customize the magics globally
3662 for a certain use. The values set through this function are
3666 for a certain use. The values set through this function are
3663 picked up by the parse_options() method, which all magics should
3667 picked up by the parse_options() method, which all magics should
3664 use to parse their options.
3668 use to parse their options.
3665
3669
3666 * IPython/genutils.py (warn): modified the warnings framework to
3670 * IPython/genutils.py (warn): modified the warnings framework to
3667 use the Term I/O class. I'm trying to slowly unify all of
3671 use the Term I/O class. I'm trying to slowly unify all of
3668 IPython's I/O operations to pass through Term.
3672 IPython's I/O operations to pass through Term.
3669
3673
3670 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3674 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
3671 the secondary prompt to correctly match the length of the primary
3675 the secondary prompt to correctly match the length of the primary
3672 one for any prompt. Now multi-line code will properly line up
3676 one for any prompt. Now multi-line code will properly line up
3673 even for path dependent prompts, such as the new ones available
3677 even for path dependent prompts, such as the new ones available
3674 via the prompt_specials.
3678 via the prompt_specials.
3675
3679
3676 2004-06-06 Fernando Perez <fperez@colorado.edu>
3680 2004-06-06 Fernando Perez <fperez@colorado.edu>
3677
3681
3678 * IPython/Prompts.py (prompt_specials): Added the ability to have
3682 * IPython/Prompts.py (prompt_specials): Added the ability to have
3679 bash-like special sequences in the prompts, which get
3683 bash-like special sequences in the prompts, which get
3680 automatically expanded. Things like hostname, current working
3684 automatically expanded. Things like hostname, current working
3681 directory and username are implemented already, but it's easy to
3685 directory and username are implemented already, but it's easy to
3682 add more in the future. Thanks to a patch by W.J. van der Laan
3686 add more in the future. Thanks to a patch by W.J. van der Laan
3683 <gnufnork-AT-hetdigitalegat.nl>
3687 <gnufnork-AT-hetdigitalegat.nl>
3684 (prompt_specials): Added color support for prompt strings, so
3688 (prompt_specials): Added color support for prompt strings, so
3685 users can define arbitrary color setups for their prompts.
3689 users can define arbitrary color setups for their prompts.
3686
3690
3687 2004-06-05 Fernando Perez <fperez@colorado.edu>
3691 2004-06-05 Fernando Perez <fperez@colorado.edu>
3688
3692
3689 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3693 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
3690 code to load Gary Bishop's readline and configure it
3694 code to load Gary Bishop's readline and configure it
3691 automatically. Thanks to Gary for help on this.
3695 automatically. Thanks to Gary for help on this.
3692
3696
3693 2004-06-01 Fernando Perez <fperez@colorado.edu>
3697 2004-06-01 Fernando Perez <fperez@colorado.edu>
3694
3698
3695 * IPython/Logger.py (Logger.create_log): fix bug for logging
3699 * IPython/Logger.py (Logger.create_log): fix bug for logging
3696 with no filename (previous fix was incomplete).
3700 with no filename (previous fix was incomplete).
3697
3701
3698 2004-05-25 Fernando Perez <fperez@colorado.edu>
3702 2004-05-25 Fernando Perez <fperez@colorado.edu>
3699
3703
3700 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3704 * IPython/Magic.py (Magic.parse_options): fix bug where naked
3701 parens would get passed to the shell.
3705 parens would get passed to the shell.
3702
3706
3703 2004-05-20 Fernando Perez <fperez@colorado.edu>
3707 2004-05-20 Fernando Perez <fperez@colorado.edu>
3704
3708
3705 * IPython/Magic.py (Magic.magic_prun): changed default profile
3709 * IPython/Magic.py (Magic.magic_prun): changed default profile
3706 sort order to 'time' (the more common profiling need).
3710 sort order to 'time' (the more common profiling need).
3707
3711
3708 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3712 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
3709 so that source code shown is guaranteed in sync with the file on
3713 so that source code shown is guaranteed in sync with the file on
3710 disk (also changed in psource). Similar fix to the one for
3714 disk (also changed in psource). Similar fix to the one for
3711 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3715 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
3712 <yann.ledu-AT-noos.fr>.
3716 <yann.ledu-AT-noos.fr>.
3713
3717
3714 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3718 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
3715 with a single option would not be correctly parsed. Closes
3719 with a single option would not be correctly parsed. Closes
3716 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3720 http://www.scipy.net/roundup/ipython/issue14. This bug had been
3717 introduced in 0.6.0 (on 2004-05-06).
3721 introduced in 0.6.0 (on 2004-05-06).
3718
3722
3719 2004-05-13 *** Released version 0.6.0
3723 2004-05-13 *** Released version 0.6.0
3720
3724
3721 2004-05-13 Fernando Perez <fperez@colorado.edu>
3725 2004-05-13 Fernando Perez <fperez@colorado.edu>
3722
3726
3723 * debian/: Added debian/ directory to CVS, so that debian support
3727 * debian/: Added debian/ directory to CVS, so that debian support
3724 is publicly accessible. The debian package is maintained by Jack
3728 is publicly accessible. The debian package is maintained by Jack
3725 Moffit <jack-AT-xiph.org>.
3729 Moffit <jack-AT-xiph.org>.
3726
3730
3727 * Documentation: included the notes about an ipython-based system
3731 * Documentation: included the notes about an ipython-based system
3728 shell (the hypothetical 'pysh') into the new_design.pdf document,
3732 shell (the hypothetical 'pysh') into the new_design.pdf document,
3729 so that these ideas get distributed to users along with the
3733 so that these ideas get distributed to users along with the
3730 official documentation.
3734 official documentation.
3731
3735
3732 2004-05-10 Fernando Perez <fperez@colorado.edu>
3736 2004-05-10 Fernando Perez <fperez@colorado.edu>
3733
3737
3734 * IPython/Logger.py (Logger.create_log): fix recently introduced
3738 * IPython/Logger.py (Logger.create_log): fix recently introduced
3735 bug (misindented line) where logstart would fail when not given an
3739 bug (misindented line) where logstart would fail when not given an
3736 explicit filename.
3740 explicit filename.
3737
3741
3738 2004-05-09 Fernando Perez <fperez@colorado.edu>
3742 2004-05-09 Fernando Perez <fperez@colorado.edu>
3739
3743
3740 * IPython/Magic.py (Magic.parse_options): skip system call when
3744 * IPython/Magic.py (Magic.parse_options): skip system call when
3741 there are no options to look for. Faster, cleaner for the common
3745 there are no options to look for. Faster, cleaner for the common
3742 case.
3746 case.
3743
3747
3744 * Documentation: many updates to the manual: describing Windows
3748 * Documentation: many updates to the manual: describing Windows
3745 support better, Gnuplot updates, credits, misc small stuff. Also
3749 support better, Gnuplot updates, credits, misc small stuff. Also
3746 updated the new_design doc a bit.
3750 updated the new_design doc a bit.
3747
3751
3748 2004-05-06 *** Released version 0.6.0.rc1
3752 2004-05-06 *** Released version 0.6.0.rc1
3749
3753
3750 2004-05-06 Fernando Perez <fperez@colorado.edu>
3754 2004-05-06 Fernando Perez <fperez@colorado.edu>
3751
3755
3752 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3756 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
3753 operations to use the vastly more efficient list/''.join() method.
3757 operations to use the vastly more efficient list/''.join() method.
3754 (FormattedTB.text): Fix
3758 (FormattedTB.text): Fix
3755 http://www.scipy.net/roundup/ipython/issue12 - exception source
3759 http://www.scipy.net/roundup/ipython/issue12 - exception source
3756 extract not updated after reload. Thanks to Mike Salib
3760 extract not updated after reload. Thanks to Mike Salib
3757 <msalib-AT-mit.edu> for pinning the source of the problem.
3761 <msalib-AT-mit.edu> for pinning the source of the problem.
3758 Fortunately, the solution works inside ipython and doesn't require
3762 Fortunately, the solution works inside ipython and doesn't require
3759 any changes to python proper.
3763 any changes to python proper.
3760
3764
3761 * IPython/Magic.py (Magic.parse_options): Improved to process the
3765 * IPython/Magic.py (Magic.parse_options): Improved to process the
3762 argument list as a true shell would (by actually using the
3766 argument list as a true shell would (by actually using the
3763 underlying system shell). This way, all @magics automatically get
3767 underlying system shell). This way, all @magics automatically get
3764 shell expansion for variables. Thanks to a comment by Alex
3768 shell expansion for variables. Thanks to a comment by Alex
3765 Schmolck.
3769 Schmolck.
3766
3770
3767 2004-04-04 Fernando Perez <fperez@colorado.edu>
3771 2004-04-04 Fernando Perez <fperez@colorado.edu>
3768
3772
3769 * IPython/iplib.py (InteractiveShell.interact): Added a special
3773 * IPython/iplib.py (InteractiveShell.interact): Added a special
3770 trap for a debugger quit exception, which is basically impossible
3774 trap for a debugger quit exception, which is basically impossible
3771 to handle by normal mechanisms, given what pdb does to the stack.
3775 to handle by normal mechanisms, given what pdb does to the stack.
3772 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3776 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
3773
3777
3774 2004-04-03 Fernando Perez <fperez@colorado.edu>
3778 2004-04-03 Fernando Perez <fperez@colorado.edu>
3775
3779
3776 * IPython/genutils.py (Term): Standardized the names of the Term
3780 * IPython/genutils.py (Term): Standardized the names of the Term
3777 class streams to cin/cout/cerr, following C++ naming conventions
3781 class streams to cin/cout/cerr, following C++ naming conventions
3778 (I can't use in/out/err because 'in' is not a valid attribute
3782 (I can't use in/out/err because 'in' is not a valid attribute
3779 name).
3783 name).
3780
3784
3781 * IPython/iplib.py (InteractiveShell.interact): don't increment
3785 * IPython/iplib.py (InteractiveShell.interact): don't increment
3782 the prompt if there's no user input. By Daniel 'Dang' Griffith
3786 the prompt if there's no user input. By Daniel 'Dang' Griffith
3783 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3787 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
3784 Francois Pinard.
3788 Francois Pinard.
3785
3789
3786 2004-04-02 Fernando Perez <fperez@colorado.edu>
3790 2004-04-02 Fernando Perez <fperez@colorado.edu>
3787
3791
3788 * IPython/genutils.py (Stream.__init__): Modified to survive at
3792 * IPython/genutils.py (Stream.__init__): Modified to survive at
3789 least importing in contexts where stdin/out/err aren't true file
3793 least importing in contexts where stdin/out/err aren't true file
3790 objects, such as PyCrust (they lack fileno() and mode). However,
3794 objects, such as PyCrust (they lack fileno() and mode). However,
3791 the recovery facilities which rely on these things existing will
3795 the recovery facilities which rely on these things existing will
3792 not work.
3796 not work.
3793
3797
3794 2004-04-01 Fernando Perez <fperez@colorado.edu>
3798 2004-04-01 Fernando Perez <fperez@colorado.edu>
3795
3799
3796 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3800 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
3797 use the new getoutputerror() function, so it properly
3801 use the new getoutputerror() function, so it properly
3798 distinguishes stdout/err.
3802 distinguishes stdout/err.
3799
3803
3800 * IPython/genutils.py (getoutputerror): added a function to
3804 * IPython/genutils.py (getoutputerror): added a function to
3801 capture separately the standard output and error of a command.
3805 capture separately the standard output and error of a command.
3802 After a comment from dang on the mailing lists. This code is
3806 After a comment from dang on the mailing lists. This code is
3803 basically a modified version of commands.getstatusoutput(), from
3807 basically a modified version of commands.getstatusoutput(), from
3804 the standard library.
3808 the standard library.
3805
3809
3806 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3810 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
3807 '!!' as a special syntax (shorthand) to access @sx.
3811 '!!' as a special syntax (shorthand) to access @sx.
3808
3812
3809 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3813 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
3810 command and return its output as a list split on '\n'.
3814 command and return its output as a list split on '\n'.
3811
3815
3812 2004-03-31 Fernando Perez <fperez@colorado.edu>
3816 2004-03-31 Fernando Perez <fperez@colorado.edu>
3813
3817
3814 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3818 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
3815 method to dictionaries used as FakeModule instances if they lack
3819 method to dictionaries used as FakeModule instances if they lack
3816 it. At least pydoc in python2.3 breaks for runtime-defined
3820 it. At least pydoc in python2.3 breaks for runtime-defined
3817 functions without this hack. At some point I need to _really_
3821 functions without this hack. At some point I need to _really_
3818 understand what FakeModule is doing, because it's a gross hack.
3822 understand what FakeModule is doing, because it's a gross hack.
3819 But it solves Arnd's problem for now...
3823 But it solves Arnd's problem for now...
3820
3824
3821 2004-02-27 Fernando Perez <fperez@colorado.edu>
3825 2004-02-27 Fernando Perez <fperez@colorado.edu>
3822
3826
3823 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3827 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
3824 mode would behave erratically. Also increased the number of
3828 mode would behave erratically. Also increased the number of
3825 possible logs in rotate mod to 999. Thanks to Rod Holland
3829 possible logs in rotate mod to 999. Thanks to Rod Holland
3826 <rhh@StructureLABS.com> for the report and fixes.
3830 <rhh@StructureLABS.com> for the report and fixes.
3827
3831
3828 2004-02-26 Fernando Perez <fperez@colorado.edu>
3832 2004-02-26 Fernando Perez <fperez@colorado.edu>
3829
3833
3830 * IPython/genutils.py (page): Check that the curses module really
3834 * IPython/genutils.py (page): Check that the curses module really
3831 has the initscr attribute before trying to use it. For some
3835 has the initscr attribute before trying to use it. For some
3832 reason, the Solaris curses module is missing this. I think this
3836 reason, the Solaris curses module is missing this. I think this
3833 should be considered a Solaris python bug, but I'm not sure.
3837 should be considered a Solaris python bug, but I'm not sure.
3834
3838
3835 2004-01-17 Fernando Perez <fperez@colorado.edu>
3839 2004-01-17 Fernando Perez <fperez@colorado.edu>
3836
3840
3837 * IPython/genutils.py (Stream.__init__): Changes to try to make
3841 * IPython/genutils.py (Stream.__init__): Changes to try to make
3838 ipython robust against stdin/out/err being closed by the user.
3842 ipython robust against stdin/out/err being closed by the user.
3839 This is 'user error' (and blocks a normal python session, at least
3843 This is 'user error' (and blocks a normal python session, at least
3840 the stdout case). However, Ipython should be able to survive such
3844 the stdout case). However, Ipython should be able to survive such
3841 instances of abuse as gracefully as possible. To simplify the
3845 instances of abuse as gracefully as possible. To simplify the
3842 coding and maintain compatibility with Gary Bishop's Term
3846 coding and maintain compatibility with Gary Bishop's Term
3843 contributions, I've made use of classmethods for this. I think
3847 contributions, I've made use of classmethods for this. I think
3844 this introduces a dependency on python 2.2.
3848 this introduces a dependency on python 2.2.
3845
3849
3846 2004-01-13 Fernando Perez <fperez@colorado.edu>
3850 2004-01-13 Fernando Perez <fperez@colorado.edu>
3847
3851
3848 * IPython/numutils.py (exp_safe): simplified the code a bit and
3852 * IPython/numutils.py (exp_safe): simplified the code a bit and
3849 removed the need for importing the kinds module altogether.
3853 removed the need for importing the kinds module altogether.
3850
3854
3851 2004-01-06 Fernando Perez <fperez@colorado.edu>
3855 2004-01-06 Fernando Perez <fperez@colorado.edu>
3852
3856
3853 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3857 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
3854 a magic function instead, after some community feedback. No
3858 a magic function instead, after some community feedback. No
3855 special syntax will exist for it, but its name is deliberately
3859 special syntax will exist for it, but its name is deliberately
3856 very short.
3860 very short.
3857
3861
3858 2003-12-20 Fernando Perez <fperez@colorado.edu>
3862 2003-12-20 Fernando Perez <fperez@colorado.edu>
3859
3863
3860 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3864 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
3861 new functionality, to automagically assign the result of a shell
3865 new functionality, to automagically assign the result of a shell
3862 command to a variable. I'll solicit some community feedback on
3866 command to a variable. I'll solicit some community feedback on
3863 this before making it permanent.
3867 this before making it permanent.
3864
3868
3865 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3869 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
3866 requested about callables for which inspect couldn't obtain a
3870 requested about callables for which inspect couldn't obtain a
3867 proper argspec. Thanks to a crash report sent by Etienne
3871 proper argspec. Thanks to a crash report sent by Etienne
3868 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3872 Posthumus <etienne-AT-apple01.cs.vu.nl>.
3869
3873
3870 2003-12-09 Fernando Perez <fperez@colorado.edu>
3874 2003-12-09 Fernando Perez <fperez@colorado.edu>
3871
3875
3872 * IPython/genutils.py (page): patch for the pager to work across
3876 * IPython/genutils.py (page): patch for the pager to work across
3873 various versions of Windows. By Gary Bishop.
3877 various versions of Windows. By Gary Bishop.
3874
3878
3875 2003-12-04 Fernando Perez <fperez@colorado.edu>
3879 2003-12-04 Fernando Perez <fperez@colorado.edu>
3876
3880
3877 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3881 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
3878 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3882 Gnuplot.py version 1.7, whose internal names changed quite a bit.
3879 While I tested this and it looks ok, there may still be corner
3883 While I tested this and it looks ok, there may still be corner
3880 cases I've missed.
3884 cases I've missed.
3881
3885
3882 2003-12-01 Fernando Perez <fperez@colorado.edu>
3886 2003-12-01 Fernando Perez <fperez@colorado.edu>
3883
3887
3884 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3888 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
3885 where a line like 'p,q=1,2' would fail because the automagic
3889 where a line like 'p,q=1,2' would fail because the automagic
3886 system would be triggered for @p.
3890 system would be triggered for @p.
3887
3891
3888 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3892 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
3889 cleanups, code unmodified.
3893 cleanups, code unmodified.
3890
3894
3891 * IPython/genutils.py (Term): added a class for IPython to handle
3895 * IPython/genutils.py (Term): added a class for IPython to handle
3892 output. In most cases it will just be a proxy for stdout/err, but
3896 output. In most cases it will just be a proxy for stdout/err, but
3893 having this allows modifications to be made for some platforms,
3897 having this allows modifications to be made for some platforms,
3894 such as handling color escapes under Windows. All of this code
3898 such as handling color escapes under Windows. All of this code
3895 was contributed by Gary Bishop, with minor modifications by me.
3899 was contributed by Gary Bishop, with minor modifications by me.
3896 The actual changes affect many files.
3900 The actual changes affect many files.
3897
3901
3898 2003-11-30 Fernando Perez <fperez@colorado.edu>
3902 2003-11-30 Fernando Perez <fperez@colorado.edu>
3899
3903
3900 * IPython/iplib.py (file_matches): new completion code, courtesy
3904 * IPython/iplib.py (file_matches): new completion code, courtesy
3901 of Jeff Collins. This enables filename completion again under
3905 of Jeff Collins. This enables filename completion again under
3902 python 2.3, which disabled it at the C level.
3906 python 2.3, which disabled it at the C level.
3903
3907
3904 2003-11-11 Fernando Perez <fperez@colorado.edu>
3908 2003-11-11 Fernando Perez <fperez@colorado.edu>
3905
3909
3906 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3910 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
3907 for Numeric.array(map(...)), but often convenient.
3911 for Numeric.array(map(...)), but often convenient.
3908
3912
3909 2003-11-05 Fernando Perez <fperez@colorado.edu>
3913 2003-11-05 Fernando Perez <fperez@colorado.edu>
3910
3914
3911 * IPython/numutils.py (frange): Changed a call from int() to
3915 * IPython/numutils.py (frange): Changed a call from int() to
3912 int(round()) to prevent a problem reported with arange() in the
3916 int(round()) to prevent a problem reported with arange() in the
3913 numpy list.
3917 numpy list.
3914
3918
3915 2003-10-06 Fernando Perez <fperez@colorado.edu>
3919 2003-10-06 Fernando Perez <fperez@colorado.edu>
3916
3920
3917 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3921 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
3918 prevent crashes if sys lacks an argv attribute (it happens with
3922 prevent crashes if sys lacks an argv attribute (it happens with
3919 embedded interpreters which build a bare-bones sys module).
3923 embedded interpreters which build a bare-bones sys module).
3920 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3924 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
3921
3925
3922 2003-09-24 Fernando Perez <fperez@colorado.edu>
3926 2003-09-24 Fernando Perez <fperez@colorado.edu>
3923
3927
3924 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3928 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
3925 to protect against poorly written user objects where __getattr__
3929 to protect against poorly written user objects where __getattr__
3926 raises exceptions other than AttributeError. Thanks to a bug
3930 raises exceptions other than AttributeError. Thanks to a bug
3927 report by Oliver Sander <osander-AT-gmx.de>.
3931 report by Oliver Sander <osander-AT-gmx.de>.
3928
3932
3929 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3933 * IPython/FakeModule.py (FakeModule.__repr__): this method was
3930 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3934 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
3931
3935
3932 2003-09-09 Fernando Perez <fperez@colorado.edu>
3936 2003-09-09 Fernando Perez <fperez@colorado.edu>
3933
3937
3934 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3938 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3935 unpacking a list whith a callable as first element would
3939 unpacking a list whith a callable as first element would
3936 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3940 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
3937 Collins.
3941 Collins.
3938
3942
3939 2003-08-25 *** Released version 0.5.0
3943 2003-08-25 *** Released version 0.5.0
3940
3944
3941 2003-08-22 Fernando Perez <fperez@colorado.edu>
3945 2003-08-22 Fernando Perez <fperez@colorado.edu>
3942
3946
3943 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3947 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
3944 improperly defined user exceptions. Thanks to feedback from Mark
3948 improperly defined user exceptions. Thanks to feedback from Mark
3945 Russell <mrussell-AT-verio.net>.
3949 Russell <mrussell-AT-verio.net>.
3946
3950
3947 2003-08-20 Fernando Perez <fperez@colorado.edu>
3951 2003-08-20 Fernando Perez <fperez@colorado.edu>
3948
3952
3949 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3953 * IPython/OInspect.py (Inspector.pinfo): changed String Form
3950 printing so that it would print multi-line string forms starting
3954 printing so that it would print multi-line string forms starting
3951 with a new line. This way the formatting is better respected for
3955 with a new line. This way the formatting is better respected for
3952 objects which work hard to make nice string forms.
3956 objects which work hard to make nice string forms.
3953
3957
3954 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3958 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
3955 autocall would overtake data access for objects with both
3959 autocall would overtake data access for objects with both
3956 __getitem__ and __call__.
3960 __getitem__ and __call__.
3957
3961
3958 2003-08-19 *** Released version 0.5.0-rc1
3962 2003-08-19 *** Released version 0.5.0-rc1
3959
3963
3960 2003-08-19 Fernando Perez <fperez@colorado.edu>
3964 2003-08-19 Fernando Perez <fperez@colorado.edu>
3961
3965
3962 * IPython/deep_reload.py (load_tail): single tiny change here
3966 * IPython/deep_reload.py (load_tail): single tiny change here
3963 seems to fix the long-standing bug of dreload() failing to work
3967 seems to fix the long-standing bug of dreload() failing to work
3964 for dotted names. But this module is pretty tricky, so I may have
3968 for dotted names. But this module is pretty tricky, so I may have
3965 missed some subtlety. Needs more testing!.
3969 missed some subtlety. Needs more testing!.
3966
3970
3967 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3971 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3968 exceptions which have badly implemented __str__ methods.
3972 exceptions which have badly implemented __str__ methods.
3969 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3973 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3970 which I've been getting reports about from Python 2.3 users. I
3974 which I've been getting reports about from Python 2.3 users. I
3971 wish I had a simple test case to reproduce the problem, so I could
3975 wish I had a simple test case to reproduce the problem, so I could
3972 either write a cleaner workaround or file a bug report if
3976 either write a cleaner workaround or file a bug report if
3973 necessary.
3977 necessary.
3974
3978
3975 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3979 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3976 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3980 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3977 a bug report by Tjabo Kloppenburg.
3981 a bug report by Tjabo Kloppenburg.
3978
3982
3979 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3983 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3980 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3984 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3981 seems rather unstable. Thanks to a bug report by Tjabo
3985 seems rather unstable. Thanks to a bug report by Tjabo
3982 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3986 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3983
3987
3984 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3988 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3985 this out soon because of the critical fixes in the inner loop for
3989 this out soon because of the critical fixes in the inner loop for
3986 generators.
3990 generators.
3987
3991
3988 * IPython/Magic.py (Magic.getargspec): removed. This (and
3992 * IPython/Magic.py (Magic.getargspec): removed. This (and
3989 _get_def) have been obsoleted by OInspect for a long time, I
3993 _get_def) have been obsoleted by OInspect for a long time, I
3990 hadn't noticed that they were dead code.
3994 hadn't noticed that they were dead code.
3991 (Magic._ofind): restored _ofind functionality for a few literals
3995 (Magic._ofind): restored _ofind functionality for a few literals
3992 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3996 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3993 for things like "hello".capitalize?, since that would require a
3997 for things like "hello".capitalize?, since that would require a
3994 potentially dangerous eval() again.
3998 potentially dangerous eval() again.
3995
3999
3996 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
4000 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3997 logic a bit more to clean up the escapes handling and minimize the
4001 logic a bit more to clean up the escapes handling and minimize the
3998 use of _ofind to only necessary cases. The interactive 'feel' of
4002 use of _ofind to only necessary cases. The interactive 'feel' of
3999 IPython should have improved quite a bit with the changes in
4003 IPython should have improved quite a bit with the changes in
4000 _prefilter and _ofind (besides being far safer than before).
4004 _prefilter and _ofind (besides being far safer than before).
4001
4005
4002 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
4006 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
4003 obscure, never reported). Edit would fail to find the object to
4007 obscure, never reported). Edit would fail to find the object to
4004 edit under some circumstances.
4008 edit under some circumstances.
4005 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
4009 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
4006 which were causing double-calling of generators. Those eval calls
4010 which were causing double-calling of generators. Those eval calls
4007 were _very_ dangerous, since code with side effects could be
4011 were _very_ dangerous, since code with side effects could be
4008 triggered. As they say, 'eval is evil'... These were the
4012 triggered. As they say, 'eval is evil'... These were the
4009 nastiest evals in IPython. Besides, _ofind is now far simpler,
4013 nastiest evals in IPython. Besides, _ofind is now far simpler,
4010 and it should also be quite a bit faster. Its use of inspect is
4014 and it should also be quite a bit faster. Its use of inspect is
4011 also safer, so perhaps some of the inspect-related crashes I've
4015 also safer, so perhaps some of the inspect-related crashes I've
4012 seen lately with Python 2.3 might be taken care of. That will
4016 seen lately with Python 2.3 might be taken care of. That will
4013 need more testing.
4017 need more testing.
4014
4018
4015 2003-08-17 Fernando Perez <fperez@colorado.edu>
4019 2003-08-17 Fernando Perez <fperez@colorado.edu>
4016
4020
4017 * IPython/iplib.py (InteractiveShell._prefilter): significant
4021 * IPython/iplib.py (InteractiveShell._prefilter): significant
4018 simplifications to the logic for handling user escapes. Faster
4022 simplifications to the logic for handling user escapes. Faster
4019 and simpler code.
4023 and simpler code.
4020
4024
4021 2003-08-14 Fernando Perez <fperez@colorado.edu>
4025 2003-08-14 Fernando Perez <fperez@colorado.edu>
4022
4026
4023 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
4027 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
4024 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
4028 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
4025 but it should be quite a bit faster. And the recursive version
4029 but it should be quite a bit faster. And the recursive version
4026 generated O(log N) intermediate storage for all rank>1 arrays,
4030 generated O(log N) intermediate storage for all rank>1 arrays,
4027 even if they were contiguous.
4031 even if they were contiguous.
4028 (l1norm): Added this function.
4032 (l1norm): Added this function.
4029 (norm): Added this function for arbitrary norms (including
4033 (norm): Added this function for arbitrary norms (including
4030 l-infinity). l1 and l2 are still special cases for convenience
4034 l-infinity). l1 and l2 are still special cases for convenience
4031 and speed.
4035 and speed.
4032
4036
4033 2003-08-03 Fernando Perez <fperez@colorado.edu>
4037 2003-08-03 Fernando Perez <fperez@colorado.edu>
4034
4038
4035 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
4039 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
4036 exceptions, which now raise PendingDeprecationWarnings in Python
4040 exceptions, which now raise PendingDeprecationWarnings in Python
4037 2.3. There were some in Magic and some in Gnuplot2.
4041 2.3. There were some in Magic and some in Gnuplot2.
4038
4042
4039 2003-06-30 Fernando Perez <fperez@colorado.edu>
4043 2003-06-30 Fernando Perez <fperez@colorado.edu>
4040
4044
4041 * IPython/genutils.py (page): modified to call curses only for
4045 * IPython/genutils.py (page): modified to call curses only for
4042 terminals where TERM=='xterm'. After problems under many other
4046 terminals where TERM=='xterm'. After problems under many other
4043 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
4047 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
4044
4048
4045 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
4049 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
4046 would be triggered when readline was absent. This was just an old
4050 would be triggered when readline was absent. This was just an old
4047 debugging statement I'd forgotten to take out.
4051 debugging statement I'd forgotten to take out.
4048
4052
4049 2003-06-20 Fernando Perez <fperez@colorado.edu>
4053 2003-06-20 Fernando Perez <fperez@colorado.edu>
4050
4054
4051 * IPython/genutils.py (clock): modified to return only user time
4055 * IPython/genutils.py (clock): modified to return only user time
4052 (not counting system time), after a discussion on scipy. While
4056 (not counting system time), after a discussion on scipy. While
4053 system time may be a useful quantity occasionally, it may much
4057 system time may be a useful quantity occasionally, it may much
4054 more easily be skewed by occasional swapping or other similar
4058 more easily be skewed by occasional swapping or other similar
4055 activity.
4059 activity.
4056
4060
4057 2003-06-05 Fernando Perez <fperez@colorado.edu>
4061 2003-06-05 Fernando Perez <fperez@colorado.edu>
4058
4062
4059 * IPython/numutils.py (identity): new function, for building
4063 * IPython/numutils.py (identity): new function, for building
4060 arbitrary rank Kronecker deltas (mostly backwards compatible with
4064 arbitrary rank Kronecker deltas (mostly backwards compatible with
4061 Numeric.identity)
4065 Numeric.identity)
4062
4066
4063 2003-06-03 Fernando Perez <fperez@colorado.edu>
4067 2003-06-03 Fernando Perez <fperez@colorado.edu>
4064
4068
4065 * IPython/iplib.py (InteractiveShell.handle_magic): protect
4069 * IPython/iplib.py (InteractiveShell.handle_magic): protect
4066 arguments passed to magics with spaces, to allow trailing '\' to
4070 arguments passed to magics with spaces, to allow trailing '\' to
4067 work normally (mainly for Windows users).
4071 work normally (mainly for Windows users).
4068
4072
4069 2003-05-29 Fernando Perez <fperez@colorado.edu>
4073 2003-05-29 Fernando Perez <fperez@colorado.edu>
4070
4074
4071 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
4075 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
4072 instead of pydoc.help. This fixes a bizarre behavior where
4076 instead of pydoc.help. This fixes a bizarre behavior where
4073 printing '%s' % locals() would trigger the help system. Now
4077 printing '%s' % locals() would trigger the help system. Now
4074 ipython behaves like normal python does.
4078 ipython behaves like normal python does.
4075
4079
4076 Note that if one does 'from pydoc import help', the bizarre
4080 Note that if one does 'from pydoc import help', the bizarre
4077 behavior returns, but this will also happen in normal python, so
4081 behavior returns, but this will also happen in normal python, so
4078 it's not an ipython bug anymore (it has to do with how pydoc.help
4082 it's not an ipython bug anymore (it has to do with how pydoc.help
4079 is implemented).
4083 is implemented).
4080
4084
4081 2003-05-22 Fernando Perez <fperez@colorado.edu>
4085 2003-05-22 Fernando Perez <fperez@colorado.edu>
4082
4086
4083 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
4087 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
4084 return [] instead of None when nothing matches, also match to end
4088 return [] instead of None when nothing matches, also match to end
4085 of line. Patch by Gary Bishop.
4089 of line. Patch by Gary Bishop.
4086
4090
4087 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
4091 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
4088 protection as before, for files passed on the command line. This
4092 protection as before, for files passed on the command line. This
4089 prevents the CrashHandler from kicking in if user files call into
4093 prevents the CrashHandler from kicking in if user files call into
4090 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
4094 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
4091 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
4095 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
4092
4096
4093 2003-05-20 *** Released version 0.4.0
4097 2003-05-20 *** Released version 0.4.0
4094
4098
4095 2003-05-20 Fernando Perez <fperez@colorado.edu>
4099 2003-05-20 Fernando Perez <fperez@colorado.edu>
4096
4100
4097 * setup.py: added support for manpages. It's a bit hackish b/c of
4101 * setup.py: added support for manpages. It's a bit hackish b/c of
4098 a bug in the way the bdist_rpm distutils target handles gzipped
4102 a bug in the way the bdist_rpm distutils target handles gzipped
4099 manpages, but it works. After a patch by Jack.
4103 manpages, but it works. After a patch by Jack.
4100
4104
4101 2003-05-19 Fernando Perez <fperez@colorado.edu>
4105 2003-05-19 Fernando Perez <fperez@colorado.edu>
4102
4106
4103 * IPython/numutils.py: added a mockup of the kinds module, since
4107 * IPython/numutils.py: added a mockup of the kinds module, since
4104 it was recently removed from Numeric. This way, numutils will
4108 it was recently removed from Numeric. This way, numutils will
4105 work for all users even if they are missing kinds.
4109 work for all users even if they are missing kinds.
4106
4110
4107 * IPython/Magic.py (Magic._ofind): Harden against an inspect
4111 * IPython/Magic.py (Magic._ofind): Harden against an inspect
4108 failure, which can occur with SWIG-wrapped extensions. After a
4112 failure, which can occur with SWIG-wrapped extensions. After a
4109 crash report from Prabhu.
4113 crash report from Prabhu.
4110
4114
4111 2003-05-16 Fernando Perez <fperez@colorado.edu>
4115 2003-05-16 Fernando Perez <fperez@colorado.edu>
4112
4116
4113 * IPython/iplib.py (InteractiveShell.excepthook): New method to
4117 * IPython/iplib.py (InteractiveShell.excepthook): New method to
4114 protect ipython from user code which may call directly
4118 protect ipython from user code which may call directly
4115 sys.excepthook (this looks like an ipython crash to the user, even
4119 sys.excepthook (this looks like an ipython crash to the user, even
4116 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4120 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4117 This is especially important to help users of WxWindows, but may
4121 This is especially important to help users of WxWindows, but may
4118 also be useful in other cases.
4122 also be useful in other cases.
4119
4123
4120 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
4124 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
4121 an optional tb_offset to be specified, and to preserve exception
4125 an optional tb_offset to be specified, and to preserve exception
4122 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4126 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4123
4127
4124 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
4128 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
4125
4129
4126 2003-05-15 Fernando Perez <fperez@colorado.edu>
4130 2003-05-15 Fernando Perez <fperez@colorado.edu>
4127
4131
4128 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
4132 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
4129 installing for a new user under Windows.
4133 installing for a new user under Windows.
4130
4134
4131 2003-05-12 Fernando Perez <fperez@colorado.edu>
4135 2003-05-12 Fernando Perez <fperez@colorado.edu>
4132
4136
4133 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
4137 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
4134 handler for Emacs comint-based lines. Currently it doesn't do
4138 handler for Emacs comint-based lines. Currently it doesn't do
4135 much (but importantly, it doesn't update the history cache). In
4139 much (but importantly, it doesn't update the history cache). In
4136 the future it may be expanded if Alex needs more functionality
4140 the future it may be expanded if Alex needs more functionality
4137 there.
4141 there.
4138
4142
4139 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
4143 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
4140 info to crash reports.
4144 info to crash reports.
4141
4145
4142 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
4146 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
4143 just like Python's -c. Also fixed crash with invalid -color
4147 just like Python's -c. Also fixed crash with invalid -color
4144 option value at startup. Thanks to Will French
4148 option value at startup. Thanks to Will French
4145 <wfrench-AT-bestweb.net> for the bug report.
4149 <wfrench-AT-bestweb.net> for the bug report.
4146
4150
4147 2003-05-09 Fernando Perez <fperez@colorado.edu>
4151 2003-05-09 Fernando Perez <fperez@colorado.edu>
4148
4152
4149 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
4153 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
4150 to EvalDict (it's a mapping, after all) and simplified its code
4154 to EvalDict (it's a mapping, after all) and simplified its code
4151 quite a bit, after a nice discussion on c.l.py where Gustavo
4155 quite a bit, after a nice discussion on c.l.py where Gustavo
4152 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
4156 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
4153
4157
4154 2003-04-30 Fernando Perez <fperez@colorado.edu>
4158 2003-04-30 Fernando Perez <fperez@colorado.edu>
4155
4159
4156 * IPython/genutils.py (timings_out): modified it to reduce its
4160 * IPython/genutils.py (timings_out): modified it to reduce its
4157 overhead in the common reps==1 case.
4161 overhead in the common reps==1 case.
4158
4162
4159 2003-04-29 Fernando Perez <fperez@colorado.edu>
4163 2003-04-29 Fernando Perez <fperez@colorado.edu>
4160
4164
4161 * IPython/genutils.py (timings_out): Modified to use the resource
4165 * IPython/genutils.py (timings_out): Modified to use the resource
4162 module, which avoids the wraparound problems of time.clock().
4166 module, which avoids the wraparound problems of time.clock().
4163
4167
4164 2003-04-17 *** Released version 0.2.15pre4
4168 2003-04-17 *** Released version 0.2.15pre4
4165
4169
4166 2003-04-17 Fernando Perez <fperez@colorado.edu>
4170 2003-04-17 Fernando Perez <fperez@colorado.edu>
4167
4171
4168 * setup.py (scriptfiles): Split windows-specific stuff over to a
4172 * setup.py (scriptfiles): Split windows-specific stuff over to a
4169 separate file, in an attempt to have a Windows GUI installer.
4173 separate file, in an attempt to have a Windows GUI installer.
4170 That didn't work, but part of the groundwork is done.
4174 That didn't work, but part of the groundwork is done.
4171
4175
4172 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
4176 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
4173 indent/unindent with 4 spaces. Particularly useful in combination
4177 indent/unindent with 4 spaces. Particularly useful in combination
4174 with the new auto-indent option.
4178 with the new auto-indent option.
4175
4179
4176 2003-04-16 Fernando Perez <fperez@colorado.edu>
4180 2003-04-16 Fernando Perez <fperez@colorado.edu>
4177
4181
4178 * IPython/Magic.py: various replacements of self.rc for
4182 * IPython/Magic.py: various replacements of self.rc for
4179 self.shell.rc. A lot more remains to be done to fully disentangle
4183 self.shell.rc. A lot more remains to be done to fully disentangle
4180 this class from the main Shell class.
4184 this class from the main Shell class.
4181
4185
4182 * IPython/GnuplotRuntime.py: added checks for mouse support so
4186 * IPython/GnuplotRuntime.py: added checks for mouse support so
4183 that we don't try to enable it if the current gnuplot doesn't
4187 that we don't try to enable it if the current gnuplot doesn't
4184 really support it. Also added checks so that we don't try to
4188 really support it. Also added checks so that we don't try to
4185 enable persist under Windows (where Gnuplot doesn't recognize the
4189 enable persist under Windows (where Gnuplot doesn't recognize the
4186 option).
4190 option).
4187
4191
4188 * IPython/iplib.py (InteractiveShell.interact): Added optional
4192 * IPython/iplib.py (InteractiveShell.interact): Added optional
4189 auto-indenting code, after a patch by King C. Shu
4193 auto-indenting code, after a patch by King C. Shu
4190 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
4194 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
4191 get along well with pasting indented code. If I ever figure out
4195 get along well with pasting indented code. If I ever figure out
4192 how to make that part go well, it will become on by default.
4196 how to make that part go well, it will become on by default.
4193
4197
4194 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
4198 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
4195 crash ipython if there was an unmatched '%' in the user's prompt
4199 crash ipython if there was an unmatched '%' in the user's prompt
4196 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4200 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4197
4201
4198 * IPython/iplib.py (InteractiveShell.interact): removed the
4202 * IPython/iplib.py (InteractiveShell.interact): removed the
4199 ability to ask the user whether he wants to crash or not at the
4203 ability to ask the user whether he wants to crash or not at the
4200 'last line' exception handler. Calling functions at that point
4204 'last line' exception handler. Calling functions at that point
4201 changes the stack, and the error reports would have incorrect
4205 changes the stack, and the error reports would have incorrect
4202 tracebacks.
4206 tracebacks.
4203
4207
4204 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
4208 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
4205 pass through a peger a pretty-printed form of any object. After a
4209 pass through a peger a pretty-printed form of any object. After a
4206 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
4210 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
4207
4211
4208 2003-04-14 Fernando Perez <fperez@colorado.edu>
4212 2003-04-14 Fernando Perez <fperez@colorado.edu>
4209
4213
4210 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
4214 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
4211 all files in ~ would be modified at first install (instead of
4215 all files in ~ would be modified at first install (instead of
4212 ~/.ipython). This could be potentially disastrous, as the
4216 ~/.ipython). This could be potentially disastrous, as the
4213 modification (make line-endings native) could damage binary files.
4217 modification (make line-endings native) could damage binary files.
4214
4218
4215 2003-04-10 Fernando Perez <fperez@colorado.edu>
4219 2003-04-10 Fernando Perez <fperez@colorado.edu>
4216
4220
4217 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
4221 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
4218 handle only lines which are invalid python. This now means that
4222 handle only lines which are invalid python. This now means that
4219 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
4223 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
4220 for the bug report.
4224 for the bug report.
4221
4225
4222 2003-04-01 Fernando Perez <fperez@colorado.edu>
4226 2003-04-01 Fernando Perez <fperez@colorado.edu>
4223
4227
4224 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
4228 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
4225 where failing to set sys.last_traceback would crash pdb.pm().
4229 where failing to set sys.last_traceback would crash pdb.pm().
4226 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
4230 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
4227 report.
4231 report.
4228
4232
4229 2003-03-25 Fernando Perez <fperez@colorado.edu>
4233 2003-03-25 Fernando Perez <fperez@colorado.edu>
4230
4234
4231 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
4235 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
4232 before printing it (it had a lot of spurious blank lines at the
4236 before printing it (it had a lot of spurious blank lines at the
4233 end).
4237 end).
4234
4238
4235 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
4239 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
4236 output would be sent 21 times! Obviously people don't use this
4240 output would be sent 21 times! Obviously people don't use this
4237 too often, or I would have heard about it.
4241 too often, or I would have heard about it.
4238
4242
4239 2003-03-24 Fernando Perez <fperez@colorado.edu>
4243 2003-03-24 Fernando Perez <fperez@colorado.edu>
4240
4244
4241 * setup.py (scriptfiles): renamed the data_files parameter from
4245 * setup.py (scriptfiles): renamed the data_files parameter from
4242 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
4246 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
4243 for the patch.
4247 for the patch.
4244
4248
4245 2003-03-20 Fernando Perez <fperez@colorado.edu>
4249 2003-03-20 Fernando Perez <fperez@colorado.edu>
4246
4250
4247 * IPython/genutils.py (error): added error() and fatal()
4251 * IPython/genutils.py (error): added error() and fatal()
4248 functions.
4252 functions.
4249
4253
4250 2003-03-18 *** Released version 0.2.15pre3
4254 2003-03-18 *** Released version 0.2.15pre3
4251
4255
4252 2003-03-18 Fernando Perez <fperez@colorado.edu>
4256 2003-03-18 Fernando Perez <fperez@colorado.edu>
4253
4257
4254 * setupext/install_data_ext.py
4258 * setupext/install_data_ext.py
4255 (install_data_ext.initialize_options): Class contributed by Jack
4259 (install_data_ext.initialize_options): Class contributed by Jack
4256 Moffit for fixing the old distutils hack. He is sending this to
4260 Moffit for fixing the old distutils hack. He is sending this to
4257 the distutils folks so in the future we may not need it as a
4261 the distutils folks so in the future we may not need it as a
4258 private fix.
4262 private fix.
4259
4263
4260 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
4264 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
4261 changes for Debian packaging. See his patch for full details.
4265 changes for Debian packaging. See his patch for full details.
4262 The old distutils hack of making the ipythonrc* files carry a
4266 The old distutils hack of making the ipythonrc* files carry a
4263 bogus .py extension is gone, at last. Examples were moved to a
4267 bogus .py extension is gone, at last. Examples were moved to a
4264 separate subdir under doc/, and the separate executable scripts
4268 separate subdir under doc/, and the separate executable scripts
4265 now live in their own directory. Overall a great cleanup. The
4269 now live in their own directory. Overall a great cleanup. The
4266 manual was updated to use the new files, and setup.py has been
4270 manual was updated to use the new files, and setup.py has been
4267 fixed for this setup.
4271 fixed for this setup.
4268
4272
4269 * IPython/PyColorize.py (Parser.usage): made non-executable and
4273 * IPython/PyColorize.py (Parser.usage): made non-executable and
4270 created a pycolor wrapper around it to be included as a script.
4274 created a pycolor wrapper around it to be included as a script.
4271
4275
4272 2003-03-12 *** Released version 0.2.15pre2
4276 2003-03-12 *** Released version 0.2.15pre2
4273
4277
4274 2003-03-12 Fernando Perez <fperez@colorado.edu>
4278 2003-03-12 Fernando Perez <fperez@colorado.edu>
4275
4279
4276 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4280 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4277 long-standing problem with garbage characters in some terminals.
4281 long-standing problem with garbage characters in some terminals.
4278 The issue was really that the \001 and \002 escapes must _only_ be
4282 The issue was really that the \001 and \002 escapes must _only_ be
4279 passed to input prompts (which call readline), but _never_ to
4283 passed to input prompts (which call readline), but _never_ to
4280 normal text to be printed on screen. I changed ColorANSI to have
4284 normal text to be printed on screen. I changed ColorANSI to have
4281 two classes: TermColors and InputTermColors, each with the
4285 two classes: TermColors and InputTermColors, each with the
4282 appropriate escapes for input prompts or normal text. The code in
4286 appropriate escapes for input prompts or normal text. The code in
4283 Prompts.py got slightly more complicated, but this very old and
4287 Prompts.py got slightly more complicated, but this very old and
4284 annoying bug is finally fixed.
4288 annoying bug is finally fixed.
4285
4289
4286 All the credit for nailing down the real origin of this problem
4290 All the credit for nailing down the real origin of this problem
4287 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4291 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4288 *Many* thanks to him for spending quite a bit of effort on this.
4292 *Many* thanks to him for spending quite a bit of effort on this.
4289
4293
4290 2003-03-05 *** Released version 0.2.15pre1
4294 2003-03-05 *** Released version 0.2.15pre1
4291
4295
4292 2003-03-03 Fernando Perez <fperez@colorado.edu>
4296 2003-03-03 Fernando Perez <fperez@colorado.edu>
4293
4297
4294 * IPython/FakeModule.py: Moved the former _FakeModule to a
4298 * IPython/FakeModule.py: Moved the former _FakeModule to a
4295 separate file, because it's also needed by Magic (to fix a similar
4299 separate file, because it's also needed by Magic (to fix a similar
4296 pickle-related issue in @run).
4300 pickle-related issue in @run).
4297
4301
4298 2003-03-02 Fernando Perez <fperez@colorado.edu>
4302 2003-03-02 Fernando Perez <fperez@colorado.edu>
4299
4303
4300 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4304 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4301 the autocall option at runtime.
4305 the autocall option at runtime.
4302 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4306 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4303 across Magic.py to start separating Magic from InteractiveShell.
4307 across Magic.py to start separating Magic from InteractiveShell.
4304 (Magic._ofind): Fixed to return proper namespace for dotted
4308 (Magic._ofind): Fixed to return proper namespace for dotted
4305 names. Before, a dotted name would always return 'not currently
4309 names. Before, a dotted name would always return 'not currently
4306 defined', because it would find the 'parent'. s.x would be found,
4310 defined', because it would find the 'parent'. s.x would be found,
4307 but since 'x' isn't defined by itself, it would get confused.
4311 but since 'x' isn't defined by itself, it would get confused.
4308 (Magic.magic_run): Fixed pickling problems reported by Ralf
4312 (Magic.magic_run): Fixed pickling problems reported by Ralf
4309 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4313 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4310 that I'd used when Mike Heeter reported similar issues at the
4314 that I'd used when Mike Heeter reported similar issues at the
4311 top-level, but now for @run. It boils down to injecting the
4315 top-level, but now for @run. It boils down to injecting the
4312 namespace where code is being executed with something that looks
4316 namespace where code is being executed with something that looks
4313 enough like a module to fool pickle.dump(). Since a pickle stores
4317 enough like a module to fool pickle.dump(). Since a pickle stores
4314 a named reference to the importing module, we need this for
4318 a named reference to the importing module, we need this for
4315 pickles to save something sensible.
4319 pickles to save something sensible.
4316
4320
4317 * IPython/ipmaker.py (make_IPython): added an autocall option.
4321 * IPython/ipmaker.py (make_IPython): added an autocall option.
4318
4322
4319 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4323 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4320 the auto-eval code. Now autocalling is an option, and the code is
4324 the auto-eval code. Now autocalling is an option, and the code is
4321 also vastly safer. There is no more eval() involved at all.
4325 also vastly safer. There is no more eval() involved at all.
4322
4326
4323 2003-03-01 Fernando Perez <fperez@colorado.edu>
4327 2003-03-01 Fernando Perez <fperez@colorado.edu>
4324
4328
4325 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4329 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4326 dict with named keys instead of a tuple.
4330 dict with named keys instead of a tuple.
4327
4331
4328 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4332 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4329
4333
4330 * setup.py (make_shortcut): Fixed message about directories
4334 * setup.py (make_shortcut): Fixed message about directories
4331 created during Windows installation (the directories were ok, just
4335 created during Windows installation (the directories were ok, just
4332 the printed message was misleading). Thanks to Chris Liechti
4336 the printed message was misleading). Thanks to Chris Liechti
4333 <cliechti-AT-gmx.net> for the heads up.
4337 <cliechti-AT-gmx.net> for the heads up.
4334
4338
4335 2003-02-21 Fernando Perez <fperez@colorado.edu>
4339 2003-02-21 Fernando Perez <fperez@colorado.edu>
4336
4340
4337 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
4341 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
4338 of ValueError exception when checking for auto-execution. This
4342 of ValueError exception when checking for auto-execution. This
4339 one is raised by things like Numeric arrays arr.flat when the
4343 one is raised by things like Numeric arrays arr.flat when the
4340 array is non-contiguous.
4344 array is non-contiguous.
4341
4345
4342 2003-01-31 Fernando Perez <fperez@colorado.edu>
4346 2003-01-31 Fernando Perez <fperez@colorado.edu>
4343
4347
4344 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
4348 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
4345 not return any value at all (even though the command would get
4349 not return any value at all (even though the command would get
4346 executed).
4350 executed).
4347 (xsys): Flush stdout right after printing the command to ensure
4351 (xsys): Flush stdout right after printing the command to ensure
4348 proper ordering of commands and command output in the total
4352 proper ordering of commands and command output in the total
4349 output.
4353 output.
4350 (SystemExec/xsys/bq): Switched the names of xsys/bq and
4354 (SystemExec/xsys/bq): Switched the names of xsys/bq and
4351 system/getoutput as defaults. The old ones are kept for
4355 system/getoutput as defaults. The old ones are kept for
4352 compatibility reasons, so no code which uses this library needs
4356 compatibility reasons, so no code which uses this library needs
4353 changing.
4357 changing.
4354
4358
4355 2003-01-27 *** Released version 0.2.14
4359 2003-01-27 *** Released version 0.2.14
4356
4360
4357 2003-01-25 Fernando Perez <fperez@colorado.edu>
4361 2003-01-25 Fernando Perez <fperez@colorado.edu>
4358
4362
4359 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
4363 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
4360 functions defined in previous edit sessions could not be re-edited
4364 functions defined in previous edit sessions could not be re-edited
4361 (because the temp files were immediately removed). Now temp files
4365 (because the temp files were immediately removed). Now temp files
4362 are removed only at IPython's exit.
4366 are removed only at IPython's exit.
4363 (Magic.magic_run): Improved @run to perform shell-like expansions
4367 (Magic.magic_run): Improved @run to perform shell-like expansions
4364 on its arguments (~users and $VARS). With this, @run becomes more
4368 on its arguments (~users and $VARS). With this, @run becomes more
4365 like a normal command-line.
4369 like a normal command-line.
4366
4370
4367 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
4371 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
4368 bugs related to embedding and cleaned up that code. A fairly
4372 bugs related to embedding and cleaned up that code. A fairly
4369 important one was the impossibility to access the global namespace
4373 important one was the impossibility to access the global namespace
4370 through the embedded IPython (only local variables were visible).
4374 through the embedded IPython (only local variables were visible).
4371
4375
4372 2003-01-14 Fernando Perez <fperez@colorado.edu>
4376 2003-01-14 Fernando Perez <fperez@colorado.edu>
4373
4377
4374 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
4378 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
4375 auto-calling to be a bit more conservative. Now it doesn't get
4379 auto-calling to be a bit more conservative. Now it doesn't get
4376 triggered if any of '!=()<>' are in the rest of the input line, to
4380 triggered if any of '!=()<>' are in the rest of the input line, to
4377 allow comparing callables. Thanks to Alex for the heads up.
4381 allow comparing callables. Thanks to Alex for the heads up.
4378
4382
4379 2003-01-07 Fernando Perez <fperez@colorado.edu>
4383 2003-01-07 Fernando Perez <fperez@colorado.edu>
4380
4384
4381 * IPython/genutils.py (page): fixed estimation of the number of
4385 * IPython/genutils.py (page): fixed estimation of the number of
4382 lines in a string to be paged to simply count newlines. This
4386 lines in a string to be paged to simply count newlines. This
4383 prevents over-guessing due to embedded escape sequences. A better
4387 prevents over-guessing due to embedded escape sequences. A better
4384 long-term solution would involve stripping out the control chars
4388 long-term solution would involve stripping out the control chars
4385 for the count, but it's potentially so expensive I just don't
4389 for the count, but it's potentially so expensive I just don't
4386 think it's worth doing.
4390 think it's worth doing.
4387
4391
4388 2002-12-19 *** Released version 0.2.14pre50
4392 2002-12-19 *** Released version 0.2.14pre50
4389
4393
4390 2002-12-19 Fernando Perez <fperez@colorado.edu>
4394 2002-12-19 Fernando Perez <fperez@colorado.edu>
4391
4395
4392 * tools/release (version): Changed release scripts to inform
4396 * tools/release (version): Changed release scripts to inform
4393 Andrea and build a NEWS file with a list of recent changes.
4397 Andrea and build a NEWS file with a list of recent changes.
4394
4398
4395 * IPython/ColorANSI.py (__all__): changed terminal detection
4399 * IPython/ColorANSI.py (__all__): changed terminal detection
4396 code. Seems to work better for xterms without breaking
4400 code. Seems to work better for xterms without breaking
4397 konsole. Will need more testing to determine if WinXP and Mac OSX
4401 konsole. Will need more testing to determine if WinXP and Mac OSX
4398 also work ok.
4402 also work ok.
4399
4403
4400 2002-12-18 *** Released version 0.2.14pre49
4404 2002-12-18 *** Released version 0.2.14pre49
4401
4405
4402 2002-12-18 Fernando Perez <fperez@colorado.edu>
4406 2002-12-18 Fernando Perez <fperez@colorado.edu>
4403
4407
4404 * Docs: added new info about Mac OSX, from Andrea.
4408 * Docs: added new info about Mac OSX, from Andrea.
4405
4409
4406 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
4410 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
4407 allow direct plotting of python strings whose format is the same
4411 allow direct plotting of python strings whose format is the same
4408 of gnuplot data files.
4412 of gnuplot data files.
4409
4413
4410 2002-12-16 Fernando Perez <fperez@colorado.edu>
4414 2002-12-16 Fernando Perez <fperez@colorado.edu>
4411
4415
4412 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
4416 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
4413 value of exit question to be acknowledged.
4417 value of exit question to be acknowledged.
4414
4418
4415 2002-12-03 Fernando Perez <fperez@colorado.edu>
4419 2002-12-03 Fernando Perez <fperez@colorado.edu>
4416
4420
4417 * IPython/ipmaker.py: removed generators, which had been added
4421 * IPython/ipmaker.py: removed generators, which had been added
4418 by mistake in an earlier debugging run. This was causing trouble
4422 by mistake in an earlier debugging run. This was causing trouble
4419 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
4423 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
4420 for pointing this out.
4424 for pointing this out.
4421
4425
4422 2002-11-17 Fernando Perez <fperez@colorado.edu>
4426 2002-11-17 Fernando Perez <fperez@colorado.edu>
4423
4427
4424 * Manual: updated the Gnuplot section.
4428 * Manual: updated the Gnuplot section.
4425
4429
4426 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4430 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4427 a much better split of what goes in Runtime and what goes in
4431 a much better split of what goes in Runtime and what goes in
4428 Interactive.
4432 Interactive.
4429
4433
4430 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4434 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4431 being imported from iplib.
4435 being imported from iplib.
4432
4436
4433 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4437 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4434 for command-passing. Now the global Gnuplot instance is called
4438 for command-passing. Now the global Gnuplot instance is called
4435 'gp' instead of 'g', which was really a far too fragile and
4439 'gp' instead of 'g', which was really a far too fragile and
4436 common name.
4440 common name.
4437
4441
4438 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4442 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4439 bounding boxes generated by Gnuplot for square plots.
4443 bounding boxes generated by Gnuplot for square plots.
4440
4444
4441 * IPython/genutils.py (popkey): new function added. I should
4445 * IPython/genutils.py (popkey): new function added. I should
4442 suggest this on c.l.py as a dict method, it seems useful.
4446 suggest this on c.l.py as a dict method, it seems useful.
4443
4447
4444 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4448 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4445 to transparently handle PostScript generation. MUCH better than
4449 to transparently handle PostScript generation. MUCH better than
4446 the previous plot_eps/replot_eps (which I removed now). The code
4450 the previous plot_eps/replot_eps (which I removed now). The code
4447 is also fairly clean and well documented now (including
4451 is also fairly clean and well documented now (including
4448 docstrings).
4452 docstrings).
4449
4453
4450 2002-11-13 Fernando Perez <fperez@colorado.edu>
4454 2002-11-13 Fernando Perez <fperez@colorado.edu>
4451
4455
4452 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4456 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4453 (inconsistent with options).
4457 (inconsistent with options).
4454
4458
4455 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4459 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4456 manually disabled, I don't know why. Fixed it.
4460 manually disabled, I don't know why. Fixed it.
4457 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4461 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4458 eps output.
4462 eps output.
4459
4463
4460 2002-11-12 Fernando Perez <fperez@colorado.edu>
4464 2002-11-12 Fernando Perez <fperez@colorado.edu>
4461
4465
4462 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4466 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4463 don't propagate up to caller. Fixes crash reported by François
4467 don't propagate up to caller. Fixes crash reported by François
4464 Pinard.
4468 Pinard.
4465
4469
4466 2002-11-09 Fernando Perez <fperez@colorado.edu>
4470 2002-11-09 Fernando Perez <fperez@colorado.edu>
4467
4471
4468 * IPython/ipmaker.py (make_IPython): fixed problem with writing
4472 * IPython/ipmaker.py (make_IPython): fixed problem with writing
4469 history file for new users.
4473 history file for new users.
4470 (make_IPython): fixed bug where initial install would leave the
4474 (make_IPython): fixed bug where initial install would leave the
4471 user running in the .ipython dir.
4475 user running in the .ipython dir.
4472 (make_IPython): fixed bug where config dir .ipython would be
4476 (make_IPython): fixed bug where config dir .ipython would be
4473 created regardless of the given -ipythondir option. Thanks to Cory
4477 created regardless of the given -ipythondir option. Thanks to Cory
4474 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
4478 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
4475
4479
4476 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
4480 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
4477 type confirmations. Will need to use it in all of IPython's code
4481 type confirmations. Will need to use it in all of IPython's code
4478 consistently.
4482 consistently.
4479
4483
4480 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
4484 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
4481 context to print 31 lines instead of the default 5. This will make
4485 context to print 31 lines instead of the default 5. This will make
4482 the crash reports extremely detailed in case the problem is in
4486 the crash reports extremely detailed in case the problem is in
4483 libraries I don't have access to.
4487 libraries I don't have access to.
4484
4488
4485 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
4489 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
4486 line of defense' code to still crash, but giving users fair
4490 line of defense' code to still crash, but giving users fair
4487 warning. I don't want internal errors to go unreported: if there's
4491 warning. I don't want internal errors to go unreported: if there's
4488 an internal problem, IPython should crash and generate a full
4492 an internal problem, IPython should crash and generate a full
4489 report.
4493 report.
4490
4494
4491 2002-11-08 Fernando Perez <fperez@colorado.edu>
4495 2002-11-08 Fernando Perez <fperez@colorado.edu>
4492
4496
4493 * IPython/iplib.py (InteractiveShell.interact): added code to trap
4497 * IPython/iplib.py (InteractiveShell.interact): added code to trap
4494 otherwise uncaught exceptions which can appear if people set
4498 otherwise uncaught exceptions which can appear if people set
4495 sys.stdout to something badly broken. Thanks to a crash report
4499 sys.stdout to something badly broken. Thanks to a crash report
4496 from henni-AT-mail.brainbot.com.
4500 from henni-AT-mail.brainbot.com.
4497
4501
4498 2002-11-04 Fernando Perez <fperez@colorado.edu>
4502 2002-11-04 Fernando Perez <fperez@colorado.edu>
4499
4503
4500 * IPython/iplib.py (InteractiveShell.interact): added
4504 * IPython/iplib.py (InteractiveShell.interact): added
4501 __IPYTHON__active to the builtins. It's a flag which goes on when
4505 __IPYTHON__active to the builtins. It's a flag which goes on when
4502 the interaction starts and goes off again when it stops. This
4506 the interaction starts and goes off again when it stops. This
4503 allows embedding code to detect being inside IPython. Before this
4507 allows embedding code to detect being inside IPython. Before this
4504 was done via __IPYTHON__, but that only shows that an IPython
4508 was done via __IPYTHON__, but that only shows that an IPython
4505 instance has been created.
4509 instance has been created.
4506
4510
4507 * IPython/Magic.py (Magic.magic_env): I realized that in a
4511 * IPython/Magic.py (Magic.magic_env): I realized that in a
4508 UserDict, instance.data holds the data as a normal dict. So I
4512 UserDict, instance.data holds the data as a normal dict. So I
4509 modified @env to return os.environ.data instead of rebuilding a
4513 modified @env to return os.environ.data instead of rebuilding a
4510 dict by hand.
4514 dict by hand.
4511
4515
4512 2002-11-02 Fernando Perez <fperez@colorado.edu>
4516 2002-11-02 Fernando Perez <fperez@colorado.edu>
4513
4517
4514 * IPython/genutils.py (warn): changed so that level 1 prints no
4518 * IPython/genutils.py (warn): changed so that level 1 prints no
4515 header. Level 2 is now the default (with 'WARNING' header, as
4519 header. Level 2 is now the default (with 'WARNING' header, as
4516 before). I think I tracked all places where changes were needed in
4520 before). I think I tracked all places where changes were needed in
4517 IPython, but outside code using the old level numbering may have
4521 IPython, but outside code using the old level numbering may have
4518 broken.
4522 broken.
4519
4523
4520 * IPython/iplib.py (InteractiveShell.runcode): added this to
4524 * IPython/iplib.py (InteractiveShell.runcode): added this to
4521 handle the tracebacks in SystemExit traps correctly. The previous
4525 handle the tracebacks in SystemExit traps correctly. The previous
4522 code (through interact) was printing more of the stack than
4526 code (through interact) was printing more of the stack than
4523 necessary, showing IPython internal code to the user.
4527 necessary, showing IPython internal code to the user.
4524
4528
4525 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
4529 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
4526 default. Now that the default at the confirmation prompt is yes,
4530 default. Now that the default at the confirmation prompt is yes,
4527 it's not so intrusive. François' argument that ipython sessions
4531 it's not so intrusive. François' argument that ipython sessions
4528 tend to be complex enough not to lose them from an accidental C-d,
4532 tend to be complex enough not to lose them from an accidental C-d,
4529 is a valid one.
4533 is a valid one.
4530
4534
4531 * IPython/iplib.py (InteractiveShell.interact): added a
4535 * IPython/iplib.py (InteractiveShell.interact): added a
4532 showtraceback() call to the SystemExit trap, and modified the exit
4536 showtraceback() call to the SystemExit trap, and modified the exit
4533 confirmation to have yes as the default.
4537 confirmation to have yes as the default.
4534
4538
4535 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
4539 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
4536 this file. It's been gone from the code for a long time, this was
4540 this file. It's been gone from the code for a long time, this was
4537 simply leftover junk.
4541 simply leftover junk.
4538
4542
4539 2002-11-01 Fernando Perez <fperez@colorado.edu>
4543 2002-11-01 Fernando Perez <fperez@colorado.edu>
4540
4544
4541 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
4545 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
4542 added. If set, IPython now traps EOF and asks for
4546 added. If set, IPython now traps EOF and asks for
4543 confirmation. After a request by François Pinard.
4547 confirmation. After a request by François Pinard.
4544
4548
4545 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
4549 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
4546 of @abort, and with a new (better) mechanism for handling the
4550 of @abort, and with a new (better) mechanism for handling the
4547 exceptions.
4551 exceptions.
4548
4552
4549 2002-10-27 Fernando Perez <fperez@colorado.edu>
4553 2002-10-27 Fernando Perez <fperez@colorado.edu>
4550
4554
4551 * IPython/usage.py (__doc__): updated the --help information and
4555 * IPython/usage.py (__doc__): updated the --help information and
4552 the ipythonrc file to indicate that -log generates
4556 the ipythonrc file to indicate that -log generates
4553 ./ipython.log. Also fixed the corresponding info in @logstart.
4557 ./ipython.log. Also fixed the corresponding info in @logstart.
4554 This and several other fixes in the manuals thanks to reports by
4558 This and several other fixes in the manuals thanks to reports by
4555 François Pinard <pinard-AT-iro.umontreal.ca>.
4559 François Pinard <pinard-AT-iro.umontreal.ca>.
4556
4560
4557 * IPython/Logger.py (Logger.switch_log): Fixed error message to
4561 * IPython/Logger.py (Logger.switch_log): Fixed error message to
4558 refer to @logstart (instead of @log, which doesn't exist).
4562 refer to @logstart (instead of @log, which doesn't exist).
4559
4563
4560 * IPython/iplib.py (InteractiveShell._prefilter): fixed
4564 * IPython/iplib.py (InteractiveShell._prefilter): fixed
4561 AttributeError crash. Thanks to Christopher Armstrong
4565 AttributeError crash. Thanks to Christopher Armstrong
4562 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
4566 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
4563 introduced recently (in 0.2.14pre37) with the fix to the eval
4567 introduced recently (in 0.2.14pre37) with the fix to the eval
4564 problem mentioned below.
4568 problem mentioned below.
4565
4569
4566 2002-10-17 Fernando Perez <fperez@colorado.edu>
4570 2002-10-17 Fernando Perez <fperez@colorado.edu>
4567
4571
4568 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
4572 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
4569 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
4573 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
4570
4574
4571 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
4575 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
4572 this function to fix a problem reported by Alex Schmolck. He saw
4576 this function to fix a problem reported by Alex Schmolck. He saw
4573 it with list comprehensions and generators, which were getting
4577 it with list comprehensions and generators, which were getting
4574 called twice. The real problem was an 'eval' call in testing for
4578 called twice. The real problem was an 'eval' call in testing for
4575 automagic which was evaluating the input line silently.
4579 automagic which was evaluating the input line silently.
4576
4580
4577 This is a potentially very nasty bug, if the input has side
4581 This is a potentially very nasty bug, if the input has side
4578 effects which must not be repeated. The code is much cleaner now,
4582 effects which must not be repeated. The code is much cleaner now,
4579 without any blanket 'except' left and with a regexp test for
4583 without any blanket 'except' left and with a regexp test for
4580 actual function names.
4584 actual function names.
4581
4585
4582 But an eval remains, which I'm not fully comfortable with. I just
4586 But an eval remains, which I'm not fully comfortable with. I just
4583 don't know how to find out if an expression could be a callable in
4587 don't know how to find out if an expression could be a callable in
4584 the user's namespace without doing an eval on the string. However
4588 the user's namespace without doing an eval on the string. However
4585 that string is now much more strictly checked so that no code
4589 that string is now much more strictly checked so that no code
4586 slips by, so the eval should only happen for things that can
4590 slips by, so the eval should only happen for things that can
4587 really be only function/method names.
4591 really be only function/method names.
4588
4592
4589 2002-10-15 Fernando Perez <fperez@colorado.edu>
4593 2002-10-15 Fernando Perez <fperez@colorado.edu>
4590
4594
4591 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4595 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
4592 OSX information to main manual, removed README_Mac_OSX file from
4596 OSX information to main manual, removed README_Mac_OSX file from
4593 distribution. Also updated credits for recent additions.
4597 distribution. Also updated credits for recent additions.
4594
4598
4595 2002-10-10 Fernando Perez <fperez@colorado.edu>
4599 2002-10-10 Fernando Perez <fperez@colorado.edu>
4596
4600
4597 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4601 * README_Mac_OSX: Added a README for Mac OSX users for fixing
4598 terminal-related issues. Many thanks to Andrea Riciputi
4602 terminal-related issues. Many thanks to Andrea Riciputi
4599 <andrea.riciputi-AT-libero.it> for writing it.
4603 <andrea.riciputi-AT-libero.it> for writing it.
4600
4604
4601 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4605 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
4602 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4606 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4603
4607
4604 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4608 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
4605 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4609 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
4606 <syver-en-AT-online.no> who both submitted patches for this problem.
4610 <syver-en-AT-online.no> who both submitted patches for this problem.
4607
4611
4608 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4612 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
4609 global embedding to make sure that things don't overwrite user
4613 global embedding to make sure that things don't overwrite user
4610 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4614 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
4611
4615
4612 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4616 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
4613 compatibility. Thanks to Hayden Callow
4617 compatibility. Thanks to Hayden Callow
4614 <h.callow-AT-elec.canterbury.ac.nz>
4618 <h.callow-AT-elec.canterbury.ac.nz>
4615
4619
4616 2002-10-04 Fernando Perez <fperez@colorado.edu>
4620 2002-10-04 Fernando Perez <fperez@colorado.edu>
4617
4621
4618 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4622 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
4619 Gnuplot.File objects.
4623 Gnuplot.File objects.
4620
4624
4621 2002-07-23 Fernando Perez <fperez@colorado.edu>
4625 2002-07-23 Fernando Perez <fperez@colorado.edu>
4622
4626
4623 * IPython/genutils.py (timing): Added timings() and timing() for
4627 * IPython/genutils.py (timing): Added timings() and timing() for
4624 quick access to the most commonly needed data, the execution
4628 quick access to the most commonly needed data, the execution
4625 times. Old timing() renamed to timings_out().
4629 times. Old timing() renamed to timings_out().
4626
4630
4627 2002-07-18 Fernando Perez <fperez@colorado.edu>
4631 2002-07-18 Fernando Perez <fperez@colorado.edu>
4628
4632
4629 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4633 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
4630 bug with nested instances disrupting the parent's tab completion.
4634 bug with nested instances disrupting the parent's tab completion.
4631
4635
4632 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4636 * IPython/iplib.py (all_completions): Added Alex Schmolck's
4633 all_completions code to begin the emacs integration.
4637 all_completions code to begin the emacs integration.
4634
4638
4635 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4639 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
4636 argument to allow titling individual arrays when plotting.
4640 argument to allow titling individual arrays when plotting.
4637
4641
4638 2002-07-15 Fernando Perez <fperez@colorado.edu>
4642 2002-07-15 Fernando Perez <fperez@colorado.edu>
4639
4643
4640 * setup.py (make_shortcut): changed to retrieve the value of
4644 * setup.py (make_shortcut): changed to retrieve the value of
4641 'Program Files' directory from the registry (this value changes in
4645 'Program Files' directory from the registry (this value changes in
4642 non-english versions of Windows). Thanks to Thomas Fanslau
4646 non-english versions of Windows). Thanks to Thomas Fanslau
4643 <tfanslau-AT-gmx.de> for the report.
4647 <tfanslau-AT-gmx.de> for the report.
4644
4648
4645 2002-07-10 Fernando Perez <fperez@colorado.edu>
4649 2002-07-10 Fernando Perez <fperez@colorado.edu>
4646
4650
4647 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4651 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
4648 a bug in pdb, which crashes if a line with only whitespace is
4652 a bug in pdb, which crashes if a line with only whitespace is
4649 entered. Bug report submitted to sourceforge.
4653 entered. Bug report submitted to sourceforge.
4650
4654
4651 2002-07-09 Fernando Perez <fperez@colorado.edu>
4655 2002-07-09 Fernando Perez <fperez@colorado.edu>
4652
4656
4653 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4657 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
4654 reporting exceptions (it's a bug in inspect.py, I just set a
4658 reporting exceptions (it's a bug in inspect.py, I just set a
4655 workaround).
4659 workaround).
4656
4660
4657 2002-07-08 Fernando Perez <fperez@colorado.edu>
4661 2002-07-08 Fernando Perez <fperez@colorado.edu>
4658
4662
4659 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4663 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
4660 __IPYTHON__ in __builtins__ to show up in user_ns.
4664 __IPYTHON__ in __builtins__ to show up in user_ns.
4661
4665
4662 2002-07-03 Fernando Perez <fperez@colorado.edu>
4666 2002-07-03 Fernando Perez <fperez@colorado.edu>
4663
4667
4664 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4668 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
4665 name from @gp_set_instance to @gp_set_default.
4669 name from @gp_set_instance to @gp_set_default.
4666
4670
4667 * IPython/ipmaker.py (make_IPython): default editor value set to
4671 * IPython/ipmaker.py (make_IPython): default editor value set to
4668 '0' (a string), to match the rc file. Otherwise will crash when
4672 '0' (a string), to match the rc file. Otherwise will crash when
4669 .strip() is called on it.
4673 .strip() is called on it.
4670
4674
4671
4675
4672 2002-06-28 Fernando Perez <fperez@colorado.edu>
4676 2002-06-28 Fernando Perez <fperez@colorado.edu>
4673
4677
4674 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4678 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
4675 of files in current directory when a file is executed via
4679 of files in current directory when a file is executed via
4676 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4680 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
4677
4681
4678 * setup.py (manfiles): fix for rpm builds, submitted by RA
4682 * setup.py (manfiles): fix for rpm builds, submitted by RA
4679 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4683 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
4680
4684
4681 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4685 * IPython/ipmaker.py (make_IPython): fixed lookup of default
4682 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4686 editor when set to '0'. Problem was, '0' evaluates to True (it's a
4683 string!). A. Schmolck caught this one.
4687 string!). A. Schmolck caught this one.
4684
4688
4685 2002-06-27 Fernando Perez <fperez@colorado.edu>
4689 2002-06-27 Fernando Perez <fperez@colorado.edu>
4686
4690
4687 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4691 * IPython/ipmaker.py (make_IPython): fixed bug when running user
4688 defined files at the cmd line. __name__ wasn't being set to
4692 defined files at the cmd line. __name__ wasn't being set to
4689 __main__.
4693 __main__.
4690
4694
4691 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4695 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
4692 regular lists and tuples besides Numeric arrays.
4696 regular lists and tuples besides Numeric arrays.
4693
4697
4694 * IPython/Prompts.py (CachedOutput.__call__): Added output
4698 * IPython/Prompts.py (CachedOutput.__call__): Added output
4695 supression for input ending with ';'. Similar to Mathematica and
4699 supression for input ending with ';'. Similar to Mathematica and
4696 Matlab. The _* vars and Out[] list are still updated, just like
4700 Matlab. The _* vars and Out[] list are still updated, just like
4697 Mathematica behaves.
4701 Mathematica behaves.
4698
4702
4699 2002-06-25 Fernando Perez <fperez@colorado.edu>
4703 2002-06-25 Fernando Perez <fperez@colorado.edu>
4700
4704
4701 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4705 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
4702 .ini extensions for profiels under Windows.
4706 .ini extensions for profiels under Windows.
4703
4707
4704 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4708 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
4705 string form. Fix contributed by Alexander Schmolck
4709 string form. Fix contributed by Alexander Schmolck
4706 <a.schmolck-AT-gmx.net>
4710 <a.schmolck-AT-gmx.net>
4707
4711
4708 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4712 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
4709 pre-configured Gnuplot instance.
4713 pre-configured Gnuplot instance.
4710
4714
4711 2002-06-21 Fernando Perez <fperez@colorado.edu>
4715 2002-06-21 Fernando Perez <fperez@colorado.edu>
4712
4716
4713 * IPython/numutils.py (exp_safe): new function, works around the
4717 * IPython/numutils.py (exp_safe): new function, works around the
4714 underflow problems in Numeric.
4718 underflow problems in Numeric.
4715 (log2): New fn. Safe log in base 2: returns exact integer answer
4719 (log2): New fn. Safe log in base 2: returns exact integer answer
4716 for exact integer powers of 2.
4720 for exact integer powers of 2.
4717
4721
4718 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4722 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
4719 properly.
4723 properly.
4720
4724
4721 2002-06-20 Fernando Perez <fperez@colorado.edu>
4725 2002-06-20 Fernando Perez <fperez@colorado.edu>
4722
4726
4723 * IPython/genutils.py (timing): new function like
4727 * IPython/genutils.py (timing): new function like
4724 Mathematica's. Similar to time_test, but returns more info.
4728 Mathematica's. Similar to time_test, but returns more info.
4725
4729
4726 2002-06-18 Fernando Perez <fperez@colorado.edu>
4730 2002-06-18 Fernando Perez <fperez@colorado.edu>
4727
4731
4728 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4732 * IPython/Magic.py (Magic.magic_save): modified @save and @r
4729 according to Mike Heeter's suggestions.
4733 according to Mike Heeter's suggestions.
4730
4734
4731 2002-06-16 Fernando Perez <fperez@colorado.edu>
4735 2002-06-16 Fernando Perez <fperez@colorado.edu>
4732
4736
4733 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4737 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
4734 system. GnuplotMagic is gone as a user-directory option. New files
4738 system. GnuplotMagic is gone as a user-directory option. New files
4735 make it easier to use all the gnuplot stuff both from external
4739 make it easier to use all the gnuplot stuff both from external
4736 programs as well as from IPython. Had to rewrite part of
4740 programs as well as from IPython. Had to rewrite part of
4737 hardcopy() b/c of a strange bug: often the ps files simply don't
4741 hardcopy() b/c of a strange bug: often the ps files simply don't
4738 get created, and require a repeat of the command (often several
4742 get created, and require a repeat of the command (often several
4739 times).
4743 times).
4740
4744
4741 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4745 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
4742 resolve output channel at call time, so that if sys.stderr has
4746 resolve output channel at call time, so that if sys.stderr has
4743 been redirected by user this gets honored.
4747 been redirected by user this gets honored.
4744
4748
4745 2002-06-13 Fernando Perez <fperez@colorado.edu>
4749 2002-06-13 Fernando Perez <fperez@colorado.edu>
4746
4750
4747 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4751 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
4748 IPShell. Kept a copy with the old names to avoid breaking people's
4752 IPShell. Kept a copy with the old names to avoid breaking people's
4749 embedded code.
4753 embedded code.
4750
4754
4751 * IPython/ipython: simplified it to the bare minimum after
4755 * IPython/ipython: simplified it to the bare minimum after
4752 Holger's suggestions. Added info about how to use it in
4756 Holger's suggestions. Added info about how to use it in
4753 PYTHONSTARTUP.
4757 PYTHONSTARTUP.
4754
4758
4755 * IPython/Shell.py (IPythonShell): changed the options passing
4759 * IPython/Shell.py (IPythonShell): changed the options passing
4756 from a string with funky %s replacements to a straight list. Maybe
4760 from a string with funky %s replacements to a straight list. Maybe
4757 a bit more typing, but it follows sys.argv conventions, so there's
4761 a bit more typing, but it follows sys.argv conventions, so there's
4758 less special-casing to remember.
4762 less special-casing to remember.
4759
4763
4760 2002-06-12 Fernando Perez <fperez@colorado.edu>
4764 2002-06-12 Fernando Perez <fperez@colorado.edu>
4761
4765
4762 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4766 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
4763 command. Thanks to a suggestion by Mike Heeter.
4767 command. Thanks to a suggestion by Mike Heeter.
4764 (Magic.magic_pfile): added behavior to look at filenames if given
4768 (Magic.magic_pfile): added behavior to look at filenames if given
4765 arg is not a defined object.
4769 arg is not a defined object.
4766 (Magic.magic_save): New @save function to save code snippets. Also
4770 (Magic.magic_save): New @save function to save code snippets. Also
4767 a Mike Heeter idea.
4771 a Mike Heeter idea.
4768
4772
4769 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4773 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
4770 plot() and replot(). Much more convenient now, especially for
4774 plot() and replot(). Much more convenient now, especially for
4771 interactive use.
4775 interactive use.
4772
4776
4773 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4777 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
4774 filenames.
4778 filenames.
4775
4779
4776 2002-06-02 Fernando Perez <fperez@colorado.edu>
4780 2002-06-02 Fernando Perez <fperez@colorado.edu>
4777
4781
4778 * IPython/Struct.py (Struct.__init__): modified to admit
4782 * IPython/Struct.py (Struct.__init__): modified to admit
4779 initialization via another struct.
4783 initialization via another struct.
4780
4784
4781 * IPython/genutils.py (SystemExec.__init__): New stateful
4785 * IPython/genutils.py (SystemExec.__init__): New stateful
4782 interface to xsys and bq. Useful for writing system scripts.
4786 interface to xsys and bq. Useful for writing system scripts.
4783
4787
4784 2002-05-30 Fernando Perez <fperez@colorado.edu>
4788 2002-05-30 Fernando Perez <fperez@colorado.edu>
4785
4789
4786 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4790 * MANIFEST.in: Changed docfile selection to exclude all the lyx
4787 documents. This will make the user download smaller (it's getting
4791 documents. This will make the user download smaller (it's getting
4788 too big).
4792 too big).
4789
4793
4790 2002-05-29 Fernando Perez <fperez@colorado.edu>
4794 2002-05-29 Fernando Perez <fperez@colorado.edu>
4791
4795
4792 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4796 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
4793 fix problems with shelve and pickle. Seems to work, but I don't
4797 fix problems with shelve and pickle. Seems to work, but I don't
4794 know if corner cases break it. Thanks to Mike Heeter
4798 know if corner cases break it. Thanks to Mike Heeter
4795 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4799 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
4796
4800
4797 2002-05-24 Fernando Perez <fperez@colorado.edu>
4801 2002-05-24 Fernando Perez <fperez@colorado.edu>
4798
4802
4799 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4803 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
4800 macros having broken.
4804 macros having broken.
4801
4805
4802 2002-05-21 Fernando Perez <fperez@colorado.edu>
4806 2002-05-21 Fernando Perez <fperez@colorado.edu>
4803
4807
4804 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4808 * IPython/Magic.py (Magic.magic_logstart): fixed recently
4805 introduced logging bug: all history before logging started was
4809 introduced logging bug: all history before logging started was
4806 being written one character per line! This came from the redesign
4810 being written one character per line! This came from the redesign
4807 of the input history as a special list which slices to strings,
4811 of the input history as a special list which slices to strings,
4808 not to lists.
4812 not to lists.
4809
4813
4810 2002-05-20 Fernando Perez <fperez@colorado.edu>
4814 2002-05-20 Fernando Perez <fperez@colorado.edu>
4811
4815
4812 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4816 * IPython/Prompts.py (CachedOutput.__init__): made the color table
4813 be an attribute of all classes in this module. The design of these
4817 be an attribute of all classes in this module. The design of these
4814 classes needs some serious overhauling.
4818 classes needs some serious overhauling.
4815
4819
4816 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4820 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
4817 which was ignoring '_' in option names.
4821 which was ignoring '_' in option names.
4818
4822
4819 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4823 * IPython/ultraTB.py (FormattedTB.__init__): Changed
4820 'Verbose_novars' to 'Context' and made it the new default. It's a
4824 'Verbose_novars' to 'Context' and made it the new default. It's a
4821 bit more readable and also safer than verbose.
4825 bit more readable and also safer than verbose.
4822
4826
4823 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4827 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
4824 triple-quoted strings.
4828 triple-quoted strings.
4825
4829
4826 * IPython/OInspect.py (__all__): new module exposing the object
4830 * IPython/OInspect.py (__all__): new module exposing the object
4827 introspection facilities. Now the corresponding magics are dummy
4831 introspection facilities. Now the corresponding magics are dummy
4828 wrappers around this. Having this module will make it much easier
4832 wrappers around this. Having this module will make it much easier
4829 to put these functions into our modified pdb.
4833 to put these functions into our modified pdb.
4830 This new object inspector system uses the new colorizing module,
4834 This new object inspector system uses the new colorizing module,
4831 so source code and other things are nicely syntax highlighted.
4835 so source code and other things are nicely syntax highlighted.
4832
4836
4833 2002-05-18 Fernando Perez <fperez@colorado.edu>
4837 2002-05-18 Fernando Perez <fperez@colorado.edu>
4834
4838
4835 * IPython/ColorANSI.py: Split the coloring tools into a separate
4839 * IPython/ColorANSI.py: Split the coloring tools into a separate
4836 module so I can use them in other code easier (they were part of
4840 module so I can use them in other code easier (they were part of
4837 ultraTB).
4841 ultraTB).
4838
4842
4839 2002-05-17 Fernando Perez <fperez@colorado.edu>
4843 2002-05-17 Fernando Perez <fperez@colorado.edu>
4840
4844
4841 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4845 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4842 fixed it to set the global 'g' also to the called instance, as
4846 fixed it to set the global 'g' also to the called instance, as
4843 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4847 long as 'g' was still a gnuplot instance (so it doesn't overwrite
4844 user's 'g' variables).
4848 user's 'g' variables).
4845
4849
4846 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4850 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
4847 global variables (aliases to _ih,_oh) so that users which expect
4851 global variables (aliases to _ih,_oh) so that users which expect
4848 In[5] or Out[7] to work aren't unpleasantly surprised.
4852 In[5] or Out[7] to work aren't unpleasantly surprised.
4849 (InputList.__getslice__): new class to allow executing slices of
4853 (InputList.__getslice__): new class to allow executing slices of
4850 input history directly. Very simple class, complements the use of
4854 input history directly. Very simple class, complements the use of
4851 macros.
4855 macros.
4852
4856
4853 2002-05-16 Fernando Perez <fperez@colorado.edu>
4857 2002-05-16 Fernando Perez <fperez@colorado.edu>
4854
4858
4855 * setup.py (docdirbase): make doc directory be just doc/IPython
4859 * setup.py (docdirbase): make doc directory be just doc/IPython
4856 without version numbers, it will reduce clutter for users.
4860 without version numbers, it will reduce clutter for users.
4857
4861
4858 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4862 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
4859 execfile call to prevent possible memory leak. See for details:
4863 execfile call to prevent possible memory leak. See for details:
4860 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4864 http://mail.python.org/pipermail/python-list/2002-February/088476.html
4861
4865
4862 2002-05-15 Fernando Perez <fperez@colorado.edu>
4866 2002-05-15 Fernando Perez <fperez@colorado.edu>
4863
4867
4864 * IPython/Magic.py (Magic.magic_psource): made the object
4868 * IPython/Magic.py (Magic.magic_psource): made the object
4865 introspection names be more standard: pdoc, pdef, pfile and
4869 introspection names be more standard: pdoc, pdef, pfile and
4866 psource. They all print/page their output, and it makes
4870 psource. They all print/page their output, and it makes
4867 remembering them easier. Kept old names for compatibility as
4871 remembering them easier. Kept old names for compatibility as
4868 aliases.
4872 aliases.
4869
4873
4870 2002-05-14 Fernando Perez <fperez@colorado.edu>
4874 2002-05-14 Fernando Perez <fperez@colorado.edu>
4871
4875
4872 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4876 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
4873 what the mouse problem was. The trick is to use gnuplot with temp
4877 what the mouse problem was. The trick is to use gnuplot with temp
4874 files and NOT with pipes (for data communication), because having
4878 files and NOT with pipes (for data communication), because having
4875 both pipes and the mouse on is bad news.
4879 both pipes and the mouse on is bad news.
4876
4880
4877 2002-05-13 Fernando Perez <fperez@colorado.edu>
4881 2002-05-13 Fernando Perez <fperez@colorado.edu>
4878
4882
4879 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4883 * IPython/Magic.py (Magic._ofind): fixed namespace order search
4880 bug. Information would be reported about builtins even when
4884 bug. Information would be reported about builtins even when
4881 user-defined functions overrode them.
4885 user-defined functions overrode them.
4882
4886
4883 2002-05-11 Fernando Perez <fperez@colorado.edu>
4887 2002-05-11 Fernando Perez <fperez@colorado.edu>
4884
4888
4885 * IPython/__init__.py (__all__): removed FlexCompleter from
4889 * IPython/__init__.py (__all__): removed FlexCompleter from
4886 __all__ so that things don't fail in platforms without readline.
4890 __all__ so that things don't fail in platforms without readline.
4887
4891
4888 2002-05-10 Fernando Perez <fperez@colorado.edu>
4892 2002-05-10 Fernando Perez <fperez@colorado.edu>
4889
4893
4890 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4894 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
4891 it requires Numeric, effectively making Numeric a dependency for
4895 it requires Numeric, effectively making Numeric a dependency for
4892 IPython.
4896 IPython.
4893
4897
4894 * Released 0.2.13
4898 * Released 0.2.13
4895
4899
4896 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4900 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
4897 profiler interface. Now all the major options from the profiler
4901 profiler interface. Now all the major options from the profiler
4898 module are directly supported in IPython, both for single
4902 module are directly supported in IPython, both for single
4899 expressions (@prun) and for full programs (@run -p).
4903 expressions (@prun) and for full programs (@run -p).
4900
4904
4901 2002-05-09 Fernando Perez <fperez@colorado.edu>
4905 2002-05-09 Fernando Perez <fperez@colorado.edu>
4902
4906
4903 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4907 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
4904 magic properly formatted for screen.
4908 magic properly formatted for screen.
4905
4909
4906 * setup.py (make_shortcut): Changed things to put pdf version in
4910 * setup.py (make_shortcut): Changed things to put pdf version in
4907 doc/ instead of doc/manual (had to change lyxport a bit).
4911 doc/ instead of doc/manual (had to change lyxport a bit).
4908
4912
4909 * IPython/Magic.py (Profile.string_stats): made profile runs go
4913 * IPython/Magic.py (Profile.string_stats): made profile runs go
4910 through pager (they are long and a pager allows searching, saving,
4914 through pager (they are long and a pager allows searching, saving,
4911 etc.)
4915 etc.)
4912
4916
4913 2002-05-08 Fernando Perez <fperez@colorado.edu>
4917 2002-05-08 Fernando Perez <fperez@colorado.edu>
4914
4918
4915 * Released 0.2.12
4919 * Released 0.2.12
4916
4920
4917 2002-05-06 Fernando Perez <fperez@colorado.edu>
4921 2002-05-06 Fernando Perez <fperez@colorado.edu>
4918
4922
4919 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4923 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
4920 introduced); 'hist n1 n2' was broken.
4924 introduced); 'hist n1 n2' was broken.
4921 (Magic.magic_pdb): added optional on/off arguments to @pdb
4925 (Magic.magic_pdb): added optional on/off arguments to @pdb
4922 (Magic.magic_run): added option -i to @run, which executes code in
4926 (Magic.magic_run): added option -i to @run, which executes code in
4923 the IPython namespace instead of a clean one. Also added @irun as
4927 the IPython namespace instead of a clean one. Also added @irun as
4924 an alias to @run -i.
4928 an alias to @run -i.
4925
4929
4926 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4930 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
4927 fixed (it didn't really do anything, the namespaces were wrong).
4931 fixed (it didn't really do anything, the namespaces were wrong).
4928
4932
4929 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4933 * IPython/Debugger.py (__init__): Added workaround for python 2.1
4930
4934
4931 * IPython/__init__.py (__all__): Fixed package namespace, now
4935 * IPython/__init__.py (__all__): Fixed package namespace, now
4932 'import IPython' does give access to IPython.<all> as
4936 'import IPython' does give access to IPython.<all> as
4933 expected. Also renamed __release__ to Release.
4937 expected. Also renamed __release__ to Release.
4934
4938
4935 * IPython/Debugger.py (__license__): created new Pdb class which
4939 * IPython/Debugger.py (__license__): created new Pdb class which
4936 functions like a drop-in for the normal pdb.Pdb but does NOT
4940 functions like a drop-in for the normal pdb.Pdb but does NOT
4937 import readline by default. This way it doesn't muck up IPython's
4941 import readline by default. This way it doesn't muck up IPython's
4938 readline handling, and now tab-completion finally works in the
4942 readline handling, and now tab-completion finally works in the
4939 debugger -- sort of. It completes things globally visible, but the
4943 debugger -- sort of. It completes things globally visible, but the
4940 completer doesn't track the stack as pdb walks it. That's a bit
4944 completer doesn't track the stack as pdb walks it. That's a bit
4941 tricky, and I'll have to implement it later.
4945 tricky, and I'll have to implement it later.
4942
4946
4943 2002-05-05 Fernando Perez <fperez@colorado.edu>
4947 2002-05-05 Fernando Perez <fperez@colorado.edu>
4944
4948
4945 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4949 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
4946 magic docstrings when printed via ? (explicit \'s were being
4950 magic docstrings when printed via ? (explicit \'s were being
4947 printed).
4951 printed).
4948
4952
4949 * IPython/ipmaker.py (make_IPython): fixed namespace
4953 * IPython/ipmaker.py (make_IPython): fixed namespace
4950 identification bug. Now variables loaded via logs or command-line
4954 identification bug. Now variables loaded via logs or command-line
4951 files are recognized in the interactive namespace by @who.
4955 files are recognized in the interactive namespace by @who.
4952
4956
4953 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4957 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
4954 log replay system stemming from the string form of Structs.
4958 log replay system stemming from the string form of Structs.
4955
4959
4956 * IPython/Magic.py (Macro.__init__): improved macros to properly
4960 * IPython/Magic.py (Macro.__init__): improved macros to properly
4957 handle magic commands in them.
4961 handle magic commands in them.
4958 (Magic.magic_logstart): usernames are now expanded so 'logstart
4962 (Magic.magic_logstart): usernames are now expanded so 'logstart
4959 ~/mylog' now works.
4963 ~/mylog' now works.
4960
4964
4961 * IPython/iplib.py (complete): fixed bug where paths starting with
4965 * IPython/iplib.py (complete): fixed bug where paths starting with
4962 '/' would be completed as magic names.
4966 '/' would be completed as magic names.
4963
4967
4964 2002-05-04 Fernando Perez <fperez@colorado.edu>
4968 2002-05-04 Fernando Perez <fperez@colorado.edu>
4965
4969
4966 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4970 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
4967 allow running full programs under the profiler's control.
4971 allow running full programs under the profiler's control.
4968
4972
4969 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4973 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4970 mode to report exceptions verbosely but without formatting
4974 mode to report exceptions verbosely but without formatting
4971 variables. This addresses the issue of ipython 'freezing' (it's
4975 variables. This addresses the issue of ipython 'freezing' (it's
4972 not frozen, but caught in an expensive formatting loop) when huge
4976 not frozen, but caught in an expensive formatting loop) when huge
4973 variables are in the context of an exception.
4977 variables are in the context of an exception.
4974 (VerboseTB.text): Added '--->' markers at line where exception was
4978 (VerboseTB.text): Added '--->' markers at line where exception was
4975 triggered. Much clearer to read, especially in NoColor modes.
4979 triggered. Much clearer to read, especially in NoColor modes.
4976
4980
4977 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4981 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4978 implemented in reverse when changing to the new parse_options().
4982 implemented in reverse when changing to the new parse_options().
4979
4983
4980 2002-05-03 Fernando Perez <fperez@colorado.edu>
4984 2002-05-03 Fernando Perez <fperez@colorado.edu>
4981
4985
4982 * IPython/Magic.py (Magic.parse_options): new function so that
4986 * IPython/Magic.py (Magic.parse_options): new function so that
4983 magics can parse options easier.
4987 magics can parse options easier.
4984 (Magic.magic_prun): new function similar to profile.run(),
4988 (Magic.magic_prun): new function similar to profile.run(),
4985 suggested by Chris Hart.
4989 suggested by Chris Hart.
4986 (Magic.magic_cd): fixed behavior so that it only changes if
4990 (Magic.magic_cd): fixed behavior so that it only changes if
4987 directory actually is in history.
4991 directory actually is in history.
4988
4992
4989 * IPython/usage.py (__doc__): added information about potential
4993 * IPython/usage.py (__doc__): added information about potential
4990 slowness of Verbose exception mode when there are huge data
4994 slowness of Verbose exception mode when there are huge data
4991 structures to be formatted (thanks to Archie Paulson).
4995 structures to be formatted (thanks to Archie Paulson).
4992
4996
4993 * IPython/ipmaker.py (make_IPython): Changed default logging
4997 * IPython/ipmaker.py (make_IPython): Changed default logging
4994 (when simply called with -log) to use curr_dir/ipython.log in
4998 (when simply called with -log) to use curr_dir/ipython.log in
4995 rotate mode. Fixed crash which was occuring with -log before
4999 rotate mode. Fixed crash which was occuring with -log before
4996 (thanks to Jim Boyle).
5000 (thanks to Jim Boyle).
4997
5001
4998 2002-05-01 Fernando Perez <fperez@colorado.edu>
5002 2002-05-01 Fernando Perez <fperez@colorado.edu>
4999
5003
5000 * Released 0.2.11 for these fixes (mainly the ultraTB one which
5004 * Released 0.2.11 for these fixes (mainly the ultraTB one which
5001 was nasty -- though somewhat of a corner case).
5005 was nasty -- though somewhat of a corner case).
5002
5006
5003 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
5007 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
5004 text (was a bug).
5008 text (was a bug).
5005
5009
5006 2002-04-30 Fernando Perez <fperez@colorado.edu>
5010 2002-04-30 Fernando Perez <fperez@colorado.edu>
5007
5011
5008 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
5012 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
5009 a print after ^D or ^C from the user so that the In[] prompt
5013 a print after ^D or ^C from the user so that the In[] prompt
5010 doesn't over-run the gnuplot one.
5014 doesn't over-run the gnuplot one.
5011
5015
5012 2002-04-29 Fernando Perez <fperez@colorado.edu>
5016 2002-04-29 Fernando Perez <fperez@colorado.edu>
5013
5017
5014 * Released 0.2.10
5018 * Released 0.2.10
5015
5019
5016 * IPython/__release__.py (version): get date dynamically.
5020 * IPython/__release__.py (version): get date dynamically.
5017
5021
5018 * Misc. documentation updates thanks to Arnd's comments. Also ran
5022 * Misc. documentation updates thanks to Arnd's comments. Also ran
5019 a full spellcheck on the manual (hadn't been done in a while).
5023 a full spellcheck on the manual (hadn't been done in a while).
5020
5024
5021 2002-04-27 Fernando Perez <fperez@colorado.edu>
5025 2002-04-27 Fernando Perez <fperez@colorado.edu>
5022
5026
5023 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
5027 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
5024 starting a log in mid-session would reset the input history list.
5028 starting a log in mid-session would reset the input history list.
5025
5029
5026 2002-04-26 Fernando Perez <fperez@colorado.edu>
5030 2002-04-26 Fernando Perez <fperez@colorado.edu>
5027
5031
5028 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
5032 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
5029 all files were being included in an update. Now anything in
5033 all files were being included in an update. Now anything in
5030 UserConfig that matches [A-Za-z]*.py will go (this excludes
5034 UserConfig that matches [A-Za-z]*.py will go (this excludes
5031 __init__.py)
5035 __init__.py)
5032
5036
5033 2002-04-25 Fernando Perez <fperez@colorado.edu>
5037 2002-04-25 Fernando Perez <fperez@colorado.edu>
5034
5038
5035 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
5039 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
5036 to __builtins__ so that any form of embedded or imported code can
5040 to __builtins__ so that any form of embedded or imported code can
5037 test for being inside IPython.
5041 test for being inside IPython.
5038
5042
5039 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
5043 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
5040 changed to GnuplotMagic because it's now an importable module,
5044 changed to GnuplotMagic because it's now an importable module,
5041 this makes the name follow that of the standard Gnuplot module.
5045 this makes the name follow that of the standard Gnuplot module.
5042 GnuplotMagic can now be loaded at any time in mid-session.
5046 GnuplotMagic can now be loaded at any time in mid-session.
5043
5047
5044 2002-04-24 Fernando Perez <fperez@colorado.edu>
5048 2002-04-24 Fernando Perez <fperez@colorado.edu>
5045
5049
5046 * IPython/numutils.py: removed SIUnits. It doesn't properly set
5050 * IPython/numutils.py: removed SIUnits. It doesn't properly set
5047 the globals (IPython has its own namespace) and the
5051 the globals (IPython has its own namespace) and the
5048 PhysicalQuantity stuff is much better anyway.
5052 PhysicalQuantity stuff is much better anyway.
5049
5053
5050 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
5054 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
5051 embedding example to standard user directory for
5055 embedding example to standard user directory for
5052 distribution. Also put it in the manual.
5056 distribution. Also put it in the manual.
5053
5057
5054 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
5058 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
5055 instance as first argument (so it doesn't rely on some obscure
5059 instance as first argument (so it doesn't rely on some obscure
5056 hidden global).
5060 hidden global).
5057
5061
5058 * IPython/UserConfig/ipythonrc.py: put () back in accepted
5062 * IPython/UserConfig/ipythonrc.py: put () back in accepted
5059 delimiters. While it prevents ().TAB from working, it allows
5063 delimiters. While it prevents ().TAB from working, it allows
5060 completions in open (... expressions. This is by far a more common
5064 completions in open (... expressions. This is by far a more common
5061 case.
5065 case.
5062
5066
5063 2002-04-23 Fernando Perez <fperez@colorado.edu>
5067 2002-04-23 Fernando Perez <fperez@colorado.edu>
5064
5068
5065 * IPython/Extensions/InterpreterPasteInput.py: new
5069 * IPython/Extensions/InterpreterPasteInput.py: new
5066 syntax-processing module for pasting lines with >>> or ... at the
5070 syntax-processing module for pasting lines with >>> or ... at the
5067 start.
5071 start.
5068
5072
5069 * IPython/Extensions/PhysicalQ_Interactive.py
5073 * IPython/Extensions/PhysicalQ_Interactive.py
5070 (PhysicalQuantityInteractive.__int__): fixed to work with either
5074 (PhysicalQuantityInteractive.__int__): fixed to work with either
5071 Numeric or math.
5075 Numeric or math.
5072
5076
5073 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
5077 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
5074 provided profiles. Now we have:
5078 provided profiles. Now we have:
5075 -math -> math module as * and cmath with its own namespace.
5079 -math -> math module as * and cmath with its own namespace.
5076 -numeric -> Numeric as *, plus gnuplot & grace
5080 -numeric -> Numeric as *, plus gnuplot & grace
5077 -physics -> same as before
5081 -physics -> same as before
5078
5082
5079 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
5083 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
5080 user-defined magics wouldn't be found by @magic if they were
5084 user-defined magics wouldn't be found by @magic if they were
5081 defined as class methods. Also cleaned up the namespace search
5085 defined as class methods. Also cleaned up the namespace search
5082 logic and the string building (to use %s instead of many repeated
5086 logic and the string building (to use %s instead of many repeated
5083 string adds).
5087 string adds).
5084
5088
5085 * IPython/UserConfig/example-magic.py (magic_foo): updated example
5089 * IPython/UserConfig/example-magic.py (magic_foo): updated example
5086 of user-defined magics to operate with class methods (cleaner, in
5090 of user-defined magics to operate with class methods (cleaner, in
5087 line with the gnuplot code).
5091 line with the gnuplot code).
5088
5092
5089 2002-04-22 Fernando Perez <fperez@colorado.edu>
5093 2002-04-22 Fernando Perez <fperez@colorado.edu>
5090
5094
5091 * setup.py: updated dependency list so that manual is updated when
5095 * setup.py: updated dependency list so that manual is updated when
5092 all included files change.
5096 all included files change.
5093
5097
5094 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
5098 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
5095 the delimiter removal option (the fix is ugly right now).
5099 the delimiter removal option (the fix is ugly right now).
5096
5100
5097 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
5101 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
5098 all of the math profile (quicker loading, no conflict between
5102 all of the math profile (quicker loading, no conflict between
5099 g-9.8 and g-gnuplot).
5103 g-9.8 and g-gnuplot).
5100
5104
5101 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
5105 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
5102 name of post-mortem files to IPython_crash_report.txt.
5106 name of post-mortem files to IPython_crash_report.txt.
5103
5107
5104 * Cleanup/update of the docs. Added all the new readline info and
5108 * Cleanup/update of the docs. Added all the new readline info and
5105 formatted all lists as 'real lists'.
5109 formatted all lists as 'real lists'.
5106
5110
5107 * IPython/ipmaker.py (make_IPython): removed now-obsolete
5111 * IPython/ipmaker.py (make_IPython): removed now-obsolete
5108 tab-completion options, since the full readline parse_and_bind is
5112 tab-completion options, since the full readline parse_and_bind is
5109 now accessible.
5113 now accessible.
5110
5114
5111 * IPython/iplib.py (InteractiveShell.init_readline): Changed
5115 * IPython/iplib.py (InteractiveShell.init_readline): Changed
5112 handling of readline options. Now users can specify any string to
5116 handling of readline options. Now users can specify any string to
5113 be passed to parse_and_bind(), as well as the delimiters to be
5117 be passed to parse_and_bind(), as well as the delimiters to be
5114 removed.
5118 removed.
5115 (InteractiveShell.__init__): Added __name__ to the global
5119 (InteractiveShell.__init__): Added __name__ to the global
5116 namespace so that things like Itpl which rely on its existence
5120 namespace so that things like Itpl which rely on its existence
5117 don't crash.
5121 don't crash.
5118 (InteractiveShell._prefilter): Defined the default with a _ so
5122 (InteractiveShell._prefilter): Defined the default with a _ so
5119 that prefilter() is easier to override, while the default one
5123 that prefilter() is easier to override, while the default one
5120 remains available.
5124 remains available.
5121
5125
5122 2002-04-18 Fernando Perez <fperez@colorado.edu>
5126 2002-04-18 Fernando Perez <fperez@colorado.edu>
5123
5127
5124 * Added information about pdb in the docs.
5128 * Added information about pdb in the docs.
5125
5129
5126 2002-04-17 Fernando Perez <fperez@colorado.edu>
5130 2002-04-17 Fernando Perez <fperez@colorado.edu>
5127
5131
5128 * IPython/ipmaker.py (make_IPython): added rc_override option to
5132 * IPython/ipmaker.py (make_IPython): added rc_override option to
5129 allow passing config options at creation time which may override
5133 allow passing config options at creation time which may override
5130 anything set in the config files or command line. This is
5134 anything set in the config files or command line. This is
5131 particularly useful for configuring embedded instances.
5135 particularly useful for configuring embedded instances.
5132
5136
5133 2002-04-15 Fernando Perez <fperez@colorado.edu>
5137 2002-04-15 Fernando Perez <fperez@colorado.edu>
5134
5138
5135 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
5139 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
5136 crash embedded instances because of the input cache falling out of
5140 crash embedded instances because of the input cache falling out of
5137 sync with the output counter.
5141 sync with the output counter.
5138
5142
5139 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
5143 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
5140 mode which calls pdb after an uncaught exception in IPython itself.
5144 mode which calls pdb after an uncaught exception in IPython itself.
5141
5145
5142 2002-04-14 Fernando Perez <fperez@colorado.edu>
5146 2002-04-14 Fernando Perez <fperez@colorado.edu>
5143
5147
5144 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
5148 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
5145 readline, fix it back after each call.
5149 readline, fix it back after each call.
5146
5150
5147 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
5151 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
5148 method to force all access via __call__(), which guarantees that
5152 method to force all access via __call__(), which guarantees that
5149 traceback references are properly deleted.
5153 traceback references are properly deleted.
5150
5154
5151 * IPython/Prompts.py (CachedOutput._display): minor fixes to
5155 * IPython/Prompts.py (CachedOutput._display): minor fixes to
5152 improve printing when pprint is in use.
5156 improve printing when pprint is in use.
5153
5157
5154 2002-04-13 Fernando Perez <fperez@colorado.edu>
5158 2002-04-13 Fernando Perez <fperez@colorado.edu>
5155
5159
5156 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
5160 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
5157 exceptions aren't caught anymore. If the user triggers one, he
5161 exceptions aren't caught anymore. If the user triggers one, he
5158 should know why he's doing it and it should go all the way up,
5162 should know why he's doing it and it should go all the way up,
5159 just like any other exception. So now @abort will fully kill the
5163 just like any other exception. So now @abort will fully kill the
5160 embedded interpreter and the embedding code (unless that happens
5164 embedded interpreter and the embedding code (unless that happens
5161 to catch SystemExit).
5165 to catch SystemExit).
5162
5166
5163 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
5167 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
5164 and a debugger() method to invoke the interactive pdb debugger
5168 and a debugger() method to invoke the interactive pdb debugger
5165 after printing exception information. Also added the corresponding
5169 after printing exception information. Also added the corresponding
5166 -pdb option and @pdb magic to control this feature, and updated
5170 -pdb option and @pdb magic to control this feature, and updated
5167 the docs. After a suggestion from Christopher Hart
5171 the docs. After a suggestion from Christopher Hart
5168 (hart-AT-caltech.edu).
5172 (hart-AT-caltech.edu).
5169
5173
5170 2002-04-12 Fernando Perez <fperez@colorado.edu>
5174 2002-04-12 Fernando Perez <fperez@colorado.edu>
5171
5175
5172 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
5176 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
5173 the exception handlers defined by the user (not the CrashHandler)
5177 the exception handlers defined by the user (not the CrashHandler)
5174 so that user exceptions don't trigger an ipython bug report.
5178 so that user exceptions don't trigger an ipython bug report.
5175
5179
5176 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
5180 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
5177 configurable (it should have always been so).
5181 configurable (it should have always been so).
5178
5182
5179 2002-03-26 Fernando Perez <fperez@colorado.edu>
5183 2002-03-26 Fernando Perez <fperez@colorado.edu>
5180
5184
5181 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
5185 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
5182 and there to fix embedding namespace issues. This should all be
5186 and there to fix embedding namespace issues. This should all be
5183 done in a more elegant way.
5187 done in a more elegant way.
5184
5188
5185 2002-03-25 Fernando Perez <fperez@colorado.edu>
5189 2002-03-25 Fernando Perez <fperez@colorado.edu>
5186
5190
5187 * IPython/genutils.py (get_home_dir): Try to make it work under
5191 * IPython/genutils.py (get_home_dir): Try to make it work under
5188 win9x also.
5192 win9x also.
5189
5193
5190 2002-03-20 Fernando Perez <fperez@colorado.edu>
5194 2002-03-20 Fernando Perez <fperez@colorado.edu>
5191
5195
5192 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
5196 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
5193 sys.displayhook untouched upon __init__.
5197 sys.displayhook untouched upon __init__.
5194
5198
5195 2002-03-19 Fernando Perez <fperez@colorado.edu>
5199 2002-03-19 Fernando Perez <fperez@colorado.edu>
5196
5200
5197 * Released 0.2.9 (for embedding bug, basically).
5201 * Released 0.2.9 (for embedding bug, basically).
5198
5202
5199 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
5203 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
5200 exceptions so that enclosing shell's state can be restored.
5204 exceptions so that enclosing shell's state can be restored.
5201
5205
5202 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
5206 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
5203 naming conventions in the .ipython/ dir.
5207 naming conventions in the .ipython/ dir.
5204
5208
5205 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
5209 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
5206 from delimiters list so filenames with - in them get expanded.
5210 from delimiters list so filenames with - in them get expanded.
5207
5211
5208 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
5212 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
5209 sys.displayhook not being properly restored after an embedded call.
5213 sys.displayhook not being properly restored after an embedded call.
5210
5214
5211 2002-03-18 Fernando Perez <fperez@colorado.edu>
5215 2002-03-18 Fernando Perez <fperez@colorado.edu>
5212
5216
5213 * Released 0.2.8
5217 * Released 0.2.8
5214
5218
5215 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
5219 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
5216 some files weren't being included in a -upgrade.
5220 some files weren't being included in a -upgrade.
5217 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
5221 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
5218 on' so that the first tab completes.
5222 on' so that the first tab completes.
5219 (InteractiveShell.handle_magic): fixed bug with spaces around
5223 (InteractiveShell.handle_magic): fixed bug with spaces around
5220 quotes breaking many magic commands.
5224 quotes breaking many magic commands.
5221
5225
5222 * setup.py: added note about ignoring the syntax error messages at
5226 * setup.py: added note about ignoring the syntax error messages at
5223 installation.
5227 installation.
5224
5228
5225 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
5229 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
5226 streamlining the gnuplot interface, now there's only one magic @gp.
5230 streamlining the gnuplot interface, now there's only one magic @gp.
5227
5231
5228 2002-03-17 Fernando Perez <fperez@colorado.edu>
5232 2002-03-17 Fernando Perez <fperez@colorado.edu>
5229
5233
5230 * IPython/UserConfig/magic_gnuplot.py: new name for the
5234 * IPython/UserConfig/magic_gnuplot.py: new name for the
5231 example-magic_pm.py file. Much enhanced system, now with a shell
5235 example-magic_pm.py file. Much enhanced system, now with a shell
5232 for communicating directly with gnuplot, one command at a time.
5236 for communicating directly with gnuplot, one command at a time.
5233
5237
5234 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
5238 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
5235 setting __name__=='__main__'.
5239 setting __name__=='__main__'.
5236
5240
5237 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
5241 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
5238 mini-shell for accessing gnuplot from inside ipython. Should
5242 mini-shell for accessing gnuplot from inside ipython. Should
5239 extend it later for grace access too. Inspired by Arnd's
5243 extend it later for grace access too. Inspired by Arnd's
5240 suggestion.
5244 suggestion.
5241
5245
5242 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
5246 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
5243 calling magic functions with () in their arguments. Thanks to Arnd
5247 calling magic functions with () in their arguments. Thanks to Arnd
5244 Baecker for pointing this to me.
5248 Baecker for pointing this to me.
5245
5249
5246 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
5250 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
5247 infinitely for integer or complex arrays (only worked with floats).
5251 infinitely for integer or complex arrays (only worked with floats).
5248
5252
5249 2002-03-16 Fernando Perez <fperez@colorado.edu>
5253 2002-03-16 Fernando Perez <fperez@colorado.edu>
5250
5254
5251 * setup.py: Merged setup and setup_windows into a single script
5255 * setup.py: Merged setup and setup_windows into a single script
5252 which properly handles things for windows users.
5256 which properly handles things for windows users.
5253
5257
5254 2002-03-15 Fernando Perez <fperez@colorado.edu>
5258 2002-03-15 Fernando Perez <fperez@colorado.edu>
5255
5259
5256 * Big change to the manual: now the magics are all automatically
5260 * Big change to the manual: now the magics are all automatically
5257 documented. This information is generated from their docstrings
5261 documented. This information is generated from their docstrings
5258 and put in a latex file included by the manual lyx file. This way
5262 and put in a latex file included by the manual lyx file. This way
5259 we get always up to date information for the magics. The manual
5263 we get always up to date information for the magics. The manual
5260 now also has proper version information, also auto-synced.
5264 now also has proper version information, also auto-synced.
5261
5265
5262 For this to work, an undocumented --magic_docstrings option was added.
5266 For this to work, an undocumented --magic_docstrings option was added.
5263
5267
5264 2002-03-13 Fernando Perez <fperez@colorado.edu>
5268 2002-03-13 Fernando Perez <fperez@colorado.edu>
5265
5269
5266 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
5270 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
5267 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
5271 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
5268
5272
5269 2002-03-12 Fernando Perez <fperez@colorado.edu>
5273 2002-03-12 Fernando Perez <fperez@colorado.edu>
5270
5274
5271 * IPython/ultraTB.py (TermColors): changed color escapes again to
5275 * IPython/ultraTB.py (TermColors): changed color escapes again to
5272 fix the (old, reintroduced) line-wrapping bug. Basically, if
5276 fix the (old, reintroduced) line-wrapping bug. Basically, if
5273 \001..\002 aren't given in the color escapes, lines get wrapped
5277 \001..\002 aren't given in the color escapes, lines get wrapped
5274 weirdly. But giving those screws up old xterms and emacs terms. So
5278 weirdly. But giving those screws up old xterms and emacs terms. So
5275 I added some logic for emacs terms to be ok, but I can't identify old
5279 I added some logic for emacs terms to be ok, but I can't identify old
5276 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5280 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5277
5281
5278 2002-03-10 Fernando Perez <fperez@colorado.edu>
5282 2002-03-10 Fernando Perez <fperez@colorado.edu>
5279
5283
5280 * IPython/usage.py (__doc__): Various documentation cleanups and
5284 * IPython/usage.py (__doc__): Various documentation cleanups and
5281 updates, both in usage docstrings and in the manual.
5285 updates, both in usage docstrings and in the manual.
5282
5286
5283 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
5287 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
5284 handling of caching. Set minimum acceptabe value for having a
5288 handling of caching. Set minimum acceptabe value for having a
5285 cache at 20 values.
5289 cache at 20 values.
5286
5290
5287 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5291 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5288 install_first_time function to a method, renamed it and added an
5292 install_first_time function to a method, renamed it and added an
5289 'upgrade' mode. Now people can update their config directory with
5293 'upgrade' mode. Now people can update their config directory with
5290 a simple command line switch (-upgrade, also new).
5294 a simple command line switch (-upgrade, also new).
5291
5295
5292 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5296 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5293 @file (convenient for automagic users under Python >= 2.2).
5297 @file (convenient for automagic users under Python >= 2.2).
5294 Removed @files (it seemed more like a plural than an abbrev. of
5298 Removed @files (it seemed more like a plural than an abbrev. of
5295 'file show').
5299 'file show').
5296
5300
5297 * IPython/iplib.py (install_first_time): Fixed crash if there were
5301 * IPython/iplib.py (install_first_time): Fixed crash if there were
5298 backup files ('~') in .ipython/ install directory.
5302 backup files ('~') in .ipython/ install directory.
5299
5303
5300 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5304 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5301 system. Things look fine, but these changes are fairly
5305 system. Things look fine, but these changes are fairly
5302 intrusive. Test them for a few days.
5306 intrusive. Test them for a few days.
5303
5307
5304 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5308 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5305 the prompts system. Now all in/out prompt strings are user
5309 the prompts system. Now all in/out prompt strings are user
5306 controllable. This is particularly useful for embedding, as one
5310 controllable. This is particularly useful for embedding, as one
5307 can tag embedded instances with particular prompts.
5311 can tag embedded instances with particular prompts.
5308
5312
5309 Also removed global use of sys.ps1/2, which now allows nested
5313 Also removed global use of sys.ps1/2, which now allows nested
5310 embeddings without any problems. Added command-line options for
5314 embeddings without any problems. Added command-line options for
5311 the prompt strings.
5315 the prompt strings.
5312
5316
5313 2002-03-08 Fernando Perez <fperez@colorado.edu>
5317 2002-03-08 Fernando Perez <fperez@colorado.edu>
5314
5318
5315 * IPython/UserConfig/example-embed-short.py (ipshell): added
5319 * IPython/UserConfig/example-embed-short.py (ipshell): added
5316 example file with the bare minimum code for embedding.
5320 example file with the bare minimum code for embedding.
5317
5321
5318 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5322 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5319 functionality for the embeddable shell to be activated/deactivated
5323 functionality for the embeddable shell to be activated/deactivated
5320 either globally or at each call.
5324 either globally or at each call.
5321
5325
5322 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5326 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5323 rewriting the prompt with '--->' for auto-inputs with proper
5327 rewriting the prompt with '--->' for auto-inputs with proper
5324 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5328 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5325 this is handled by the prompts class itself, as it should.
5329 this is handled by the prompts class itself, as it should.
5326
5330
5327 2002-03-05 Fernando Perez <fperez@colorado.edu>
5331 2002-03-05 Fernando Perez <fperez@colorado.edu>
5328
5332
5329 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5333 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5330 @logstart to avoid name clashes with the math log function.
5334 @logstart to avoid name clashes with the math log function.
5331
5335
5332 * Big updates to X/Emacs section of the manual.
5336 * Big updates to X/Emacs section of the manual.
5333
5337
5334 * Removed ipython_emacs. Milan explained to me how to pass
5338 * Removed ipython_emacs. Milan explained to me how to pass
5335 arguments to ipython through Emacs. Some day I'm going to end up
5339 arguments to ipython through Emacs. Some day I'm going to end up
5336 learning some lisp...
5340 learning some lisp...
5337
5341
5338 2002-03-04 Fernando Perez <fperez@colorado.edu>
5342 2002-03-04 Fernando Perez <fperez@colorado.edu>
5339
5343
5340 * IPython/ipython_emacs: Created script to be used as the
5344 * IPython/ipython_emacs: Created script to be used as the
5341 py-python-command Emacs variable so we can pass IPython
5345 py-python-command Emacs variable so we can pass IPython
5342 parameters. I can't figure out how to tell Emacs directly to pass
5346 parameters. I can't figure out how to tell Emacs directly to pass
5343 parameters to IPython, so a dummy shell script will do it.
5347 parameters to IPython, so a dummy shell script will do it.
5344
5348
5345 Other enhancements made for things to work better under Emacs'
5349 Other enhancements made for things to work better under Emacs'
5346 various types of terminals. Many thanks to Milan Zamazal
5350 various types of terminals. Many thanks to Milan Zamazal
5347 <pdm-AT-zamazal.org> for all the suggestions and pointers.
5351 <pdm-AT-zamazal.org> for all the suggestions and pointers.
5348
5352
5349 2002-03-01 Fernando Perez <fperez@colorado.edu>
5353 2002-03-01 Fernando Perez <fperez@colorado.edu>
5350
5354
5351 * IPython/ipmaker.py (make_IPython): added a --readline! option so
5355 * IPython/ipmaker.py (make_IPython): added a --readline! option so
5352 that loading of readline is now optional. This gives better
5356 that loading of readline is now optional. This gives better
5353 control to emacs users.
5357 control to emacs users.
5354
5358
5355 * IPython/ultraTB.py (__date__): Modified color escape sequences
5359 * IPython/ultraTB.py (__date__): Modified color escape sequences
5356 and now things work fine under xterm and in Emacs' term buffers
5360 and now things work fine under xterm and in Emacs' term buffers
5357 (though not shell ones). Well, in emacs you get colors, but all
5361 (though not shell ones). Well, in emacs you get colors, but all
5358 seem to be 'light' colors (no difference between dark and light
5362 seem to be 'light' colors (no difference between dark and light
5359 ones). But the garbage chars are gone, and also in xterms. It
5363 ones). But the garbage chars are gone, and also in xterms. It
5360 seems that now I'm using 'cleaner' ansi sequences.
5364 seems that now I'm using 'cleaner' ansi sequences.
5361
5365
5362 2002-02-21 Fernando Perez <fperez@colorado.edu>
5366 2002-02-21 Fernando Perez <fperez@colorado.edu>
5363
5367
5364 * Released 0.2.7 (mainly to publish the scoping fix).
5368 * Released 0.2.7 (mainly to publish the scoping fix).
5365
5369
5366 * IPython/Logger.py (Logger.logstate): added. A corresponding
5370 * IPython/Logger.py (Logger.logstate): added. A corresponding
5367 @logstate magic was created.
5371 @logstate magic was created.
5368
5372
5369 * IPython/Magic.py: fixed nested scoping problem under Python
5373 * IPython/Magic.py: fixed nested scoping problem under Python
5370 2.1.x (automagic wasn't working).
5374 2.1.x (automagic wasn't working).
5371
5375
5372 2002-02-20 Fernando Perez <fperez@colorado.edu>
5376 2002-02-20 Fernando Perez <fperez@colorado.edu>
5373
5377
5374 * Released 0.2.6.
5378 * Released 0.2.6.
5375
5379
5376 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
5380 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
5377 option so that logs can come out without any headers at all.
5381 option so that logs can come out without any headers at all.
5378
5382
5379 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
5383 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
5380 SciPy.
5384 SciPy.
5381
5385
5382 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
5386 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
5383 that embedded IPython calls don't require vars() to be explicitly
5387 that embedded IPython calls don't require vars() to be explicitly
5384 passed. Now they are extracted from the caller's frame (code
5388 passed. Now they are extracted from the caller's frame (code
5385 snatched from Eric Jones' weave). Added better documentation to
5389 snatched from Eric Jones' weave). Added better documentation to
5386 the section on embedding and the example file.
5390 the section on embedding and the example file.
5387
5391
5388 * IPython/genutils.py (page): Changed so that under emacs, it just
5392 * IPython/genutils.py (page): Changed so that under emacs, it just
5389 prints the string. You can then page up and down in the emacs
5393 prints the string. You can then page up and down in the emacs
5390 buffer itself. This is how the builtin help() works.
5394 buffer itself. This is how the builtin help() works.
5391
5395
5392 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
5396 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
5393 macro scoping: macros need to be executed in the user's namespace
5397 macro scoping: macros need to be executed in the user's namespace
5394 to work as if they had been typed by the user.
5398 to work as if they had been typed by the user.
5395
5399
5396 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
5400 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
5397 execute automatically (no need to type 'exec...'). They then
5401 execute automatically (no need to type 'exec...'). They then
5398 behave like 'true macros'. The printing system was also modified
5402 behave like 'true macros'. The printing system was also modified
5399 for this to work.
5403 for this to work.
5400
5404
5401 2002-02-19 Fernando Perez <fperez@colorado.edu>
5405 2002-02-19 Fernando Perez <fperez@colorado.edu>
5402
5406
5403 * IPython/genutils.py (page_file): new function for paging files
5407 * IPython/genutils.py (page_file): new function for paging files
5404 in an OS-independent way. Also necessary for file viewing to work
5408 in an OS-independent way. Also necessary for file viewing to work
5405 well inside Emacs buffers.
5409 well inside Emacs buffers.
5406 (page): Added checks for being in an emacs buffer.
5410 (page): Added checks for being in an emacs buffer.
5407 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
5411 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
5408 same bug in iplib.
5412 same bug in iplib.
5409
5413
5410 2002-02-18 Fernando Perez <fperez@colorado.edu>
5414 2002-02-18 Fernando Perez <fperez@colorado.edu>
5411
5415
5412 * IPython/iplib.py (InteractiveShell.init_readline): modified use
5416 * IPython/iplib.py (InteractiveShell.init_readline): modified use
5413 of readline so that IPython can work inside an Emacs buffer.
5417 of readline so that IPython can work inside an Emacs buffer.
5414
5418
5415 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
5419 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
5416 method signatures (they weren't really bugs, but it looks cleaner
5420 method signatures (they weren't really bugs, but it looks cleaner
5417 and keeps PyChecker happy).
5421 and keeps PyChecker happy).
5418
5422
5419 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
5423 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
5420 for implementing various user-defined hooks. Currently only
5424 for implementing various user-defined hooks. Currently only
5421 display is done.
5425 display is done.
5422
5426
5423 * IPython/Prompts.py (CachedOutput._display): changed display
5427 * IPython/Prompts.py (CachedOutput._display): changed display
5424 functions so that they can be dynamically changed by users easily.
5428 functions so that they can be dynamically changed by users easily.
5425
5429
5426 * IPython/Extensions/numeric_formats.py (num_display): added an
5430 * IPython/Extensions/numeric_formats.py (num_display): added an
5427 extension for printing NumPy arrays in flexible manners. It
5431 extension for printing NumPy arrays in flexible manners. It
5428 doesn't do anything yet, but all the structure is in
5432 doesn't do anything yet, but all the structure is in
5429 place. Ultimately the plan is to implement output format control
5433 place. Ultimately the plan is to implement output format control
5430 like in Octave.
5434 like in Octave.
5431
5435
5432 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5436 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5433 methods are found at run-time by all the automatic machinery.
5437 methods are found at run-time by all the automatic machinery.
5434
5438
5435 2002-02-17 Fernando Perez <fperez@colorado.edu>
5439 2002-02-17 Fernando Perez <fperez@colorado.edu>
5436
5440
5437 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5441 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5438 whole file a little.
5442 whole file a little.
5439
5443
5440 * ToDo: closed this document. Now there's a new_design.lyx
5444 * ToDo: closed this document. Now there's a new_design.lyx
5441 document for all new ideas. Added making a pdf of it for the
5445 document for all new ideas. Added making a pdf of it for the
5442 end-user distro.
5446 end-user distro.
5443
5447
5444 * IPython/Logger.py (Logger.switch_log): Created this to replace
5448 * IPython/Logger.py (Logger.switch_log): Created this to replace
5445 logon() and logoff(). It also fixes a nasty crash reported by
5449 logon() and logoff(). It also fixes a nasty crash reported by
5446 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5450 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5447
5451
5448 * IPython/iplib.py (complete): got auto-completion to work with
5452 * IPython/iplib.py (complete): got auto-completion to work with
5449 automagic (I had wanted this for a long time).
5453 automagic (I had wanted this for a long time).
5450
5454
5451 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5455 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5452 to @file, since file() is now a builtin and clashes with automagic
5456 to @file, since file() is now a builtin and clashes with automagic
5453 for @file.
5457 for @file.
5454
5458
5455 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5459 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5456 of this was previously in iplib, which had grown to more than 2000
5460 of this was previously in iplib, which had grown to more than 2000
5457 lines, way too long. No new functionality, but it makes managing
5461 lines, way too long. No new functionality, but it makes managing
5458 the code a bit easier.
5462 the code a bit easier.
5459
5463
5460 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5464 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5461 information to crash reports.
5465 information to crash reports.
5462
5466
5463 2002-02-12 Fernando Perez <fperez@colorado.edu>
5467 2002-02-12 Fernando Perez <fperez@colorado.edu>
5464
5468
5465 * Released 0.2.5.
5469 * Released 0.2.5.
5466
5470
5467 2002-02-11 Fernando Perez <fperez@colorado.edu>
5471 2002-02-11 Fernando Perez <fperez@colorado.edu>
5468
5472
5469 * Wrote a relatively complete Windows installer. It puts
5473 * Wrote a relatively complete Windows installer. It puts
5470 everything in place, creates Start Menu entries and fixes the
5474 everything in place, creates Start Menu entries and fixes the
5471 color issues. Nothing fancy, but it works.
5475 color issues. Nothing fancy, but it works.
5472
5476
5473 2002-02-10 Fernando Perez <fperez@colorado.edu>
5477 2002-02-10 Fernando Perez <fperez@colorado.edu>
5474
5478
5475 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
5479 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
5476 os.path.expanduser() call so that we can type @run ~/myfile.py and
5480 os.path.expanduser() call so that we can type @run ~/myfile.py and
5477 have thigs work as expected.
5481 have thigs work as expected.
5478
5482
5479 * IPython/genutils.py (page): fixed exception handling so things
5483 * IPython/genutils.py (page): fixed exception handling so things
5480 work both in Unix and Windows correctly. Quitting a pager triggers
5484 work both in Unix and Windows correctly. Quitting a pager triggers
5481 an IOError/broken pipe in Unix, and in windows not finding a pager
5485 an IOError/broken pipe in Unix, and in windows not finding a pager
5482 is also an IOError, so I had to actually look at the return value
5486 is also an IOError, so I had to actually look at the return value
5483 of the exception, not just the exception itself. Should be ok now.
5487 of the exception, not just the exception itself. Should be ok now.
5484
5488
5485 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
5489 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
5486 modified to allow case-insensitive color scheme changes.
5490 modified to allow case-insensitive color scheme changes.
5487
5491
5488 2002-02-09 Fernando Perez <fperez@colorado.edu>
5492 2002-02-09 Fernando Perez <fperez@colorado.edu>
5489
5493
5490 * IPython/genutils.py (native_line_ends): new function to leave
5494 * IPython/genutils.py (native_line_ends): new function to leave
5491 user config files with os-native line-endings.
5495 user config files with os-native line-endings.
5492
5496
5493 * README and manual updates.
5497 * README and manual updates.
5494
5498
5495 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
5499 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
5496 instead of StringType to catch Unicode strings.
5500 instead of StringType to catch Unicode strings.
5497
5501
5498 * IPython/genutils.py (filefind): fixed bug for paths with
5502 * IPython/genutils.py (filefind): fixed bug for paths with
5499 embedded spaces (very common in Windows).
5503 embedded spaces (very common in Windows).
5500
5504
5501 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
5505 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
5502 files under Windows, so that they get automatically associated
5506 files under Windows, so that they get automatically associated
5503 with a text editor. Windows makes it a pain to handle
5507 with a text editor. Windows makes it a pain to handle
5504 extension-less files.
5508 extension-less files.
5505
5509
5506 * IPython/iplib.py (InteractiveShell.init_readline): Made the
5510 * IPython/iplib.py (InteractiveShell.init_readline): Made the
5507 warning about readline only occur for Posix. In Windows there's no
5511 warning about readline only occur for Posix. In Windows there's no
5508 way to get readline, so why bother with the warning.
5512 way to get readline, so why bother with the warning.
5509
5513
5510 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
5514 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
5511 for __str__ instead of dir(self), since dir() changed in 2.2.
5515 for __str__ instead of dir(self), since dir() changed in 2.2.
5512
5516
5513 * Ported to Windows! Tested on XP, I suspect it should work fine
5517 * Ported to Windows! Tested on XP, I suspect it should work fine
5514 on NT/2000, but I don't think it will work on 98 et al. That
5518 on NT/2000, but I don't think it will work on 98 et al. That
5515 series of Windows is such a piece of junk anyway that I won't try
5519 series of Windows is such a piece of junk anyway that I won't try
5516 porting it there. The XP port was straightforward, showed a few
5520 porting it there. The XP port was straightforward, showed a few
5517 bugs here and there (fixed all), in particular some string
5521 bugs here and there (fixed all), in particular some string
5518 handling stuff which required considering Unicode strings (which
5522 handling stuff which required considering Unicode strings (which
5519 Windows uses). This is good, but hasn't been too tested :) No
5523 Windows uses). This is good, but hasn't been too tested :) No
5520 fancy installer yet, I'll put a note in the manual so people at
5524 fancy installer yet, I'll put a note in the manual so people at
5521 least make manually a shortcut.
5525 least make manually a shortcut.
5522
5526
5523 * IPython/iplib.py (Magic.magic_colors): Unified the color options
5527 * IPython/iplib.py (Magic.magic_colors): Unified the color options
5524 into a single one, "colors". This now controls both prompt and
5528 into a single one, "colors". This now controls both prompt and
5525 exception color schemes, and can be changed both at startup
5529 exception color schemes, and can be changed both at startup
5526 (either via command-line switches or via ipythonrc files) and at
5530 (either via command-line switches or via ipythonrc files) and at
5527 runtime, with @colors.
5531 runtime, with @colors.
5528 (Magic.magic_run): renamed @prun to @run and removed the old
5532 (Magic.magic_run): renamed @prun to @run and removed the old
5529 @run. The two were too similar to warrant keeping both.
5533 @run. The two were too similar to warrant keeping both.
5530
5534
5531 2002-02-03 Fernando Perez <fperez@colorado.edu>
5535 2002-02-03 Fernando Perez <fperez@colorado.edu>
5532
5536
5533 * IPython/iplib.py (install_first_time): Added comment on how to
5537 * IPython/iplib.py (install_first_time): Added comment on how to
5534 configure the color options for first-time users. Put a <return>
5538 configure the color options for first-time users. Put a <return>
5535 request at the end so that small-terminal users get a chance to
5539 request at the end so that small-terminal users get a chance to
5536 read the startup info.
5540 read the startup info.
5537
5541
5538 2002-01-23 Fernando Perez <fperez@colorado.edu>
5542 2002-01-23 Fernando Perez <fperez@colorado.edu>
5539
5543
5540 * IPython/iplib.py (CachedOutput.update): Changed output memory
5544 * IPython/iplib.py (CachedOutput.update): Changed output memory
5541 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
5545 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
5542 input history we still use _i. Did this b/c these variable are
5546 input history we still use _i. Did this b/c these variable are
5543 very commonly used in interactive work, so the less we need to
5547 very commonly used in interactive work, so the less we need to
5544 type the better off we are.
5548 type the better off we are.
5545 (Magic.magic_prun): updated @prun to better handle the namespaces
5549 (Magic.magic_prun): updated @prun to better handle the namespaces
5546 the file will run in, including a fix for __name__ not being set
5550 the file will run in, including a fix for __name__ not being set
5547 before.
5551 before.
5548
5552
5549 2002-01-20 Fernando Perez <fperez@colorado.edu>
5553 2002-01-20 Fernando Perez <fperez@colorado.edu>
5550
5554
5551 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
5555 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
5552 extra garbage for Python 2.2. Need to look more carefully into
5556 extra garbage for Python 2.2. Need to look more carefully into
5553 this later.
5557 this later.
5554
5558
5555 2002-01-19 Fernando Perez <fperez@colorado.edu>
5559 2002-01-19 Fernando Perez <fperez@colorado.edu>
5556
5560
5557 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
5561 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
5558 display SyntaxError exceptions properly formatted when they occur
5562 display SyntaxError exceptions properly formatted when they occur
5559 (they can be triggered by imported code).
5563 (they can be triggered by imported code).
5560
5564
5561 2002-01-18 Fernando Perez <fperez@colorado.edu>
5565 2002-01-18 Fernando Perez <fperez@colorado.edu>
5562
5566
5563 * IPython/iplib.py (InteractiveShell.safe_execfile): now
5567 * IPython/iplib.py (InteractiveShell.safe_execfile): now
5564 SyntaxError exceptions are reported nicely formatted, instead of
5568 SyntaxError exceptions are reported nicely formatted, instead of
5565 spitting out only offset information as before.
5569 spitting out only offset information as before.
5566 (Magic.magic_prun): Added the @prun function for executing
5570 (Magic.magic_prun): Added the @prun function for executing
5567 programs with command line args inside IPython.
5571 programs with command line args inside IPython.
5568
5572
5569 2002-01-16 Fernando Perez <fperez@colorado.edu>
5573 2002-01-16 Fernando Perez <fperez@colorado.edu>
5570
5574
5571 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
5575 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
5572 to *not* include the last item given in a range. This brings their
5576 to *not* include the last item given in a range. This brings their
5573 behavior in line with Python's slicing:
5577 behavior in line with Python's slicing:
5574 a[n1:n2] -> a[n1]...a[n2-1]
5578 a[n1:n2] -> a[n1]...a[n2-1]
5575 It may be a bit less convenient, but I prefer to stick to Python's
5579 It may be a bit less convenient, but I prefer to stick to Python's
5576 conventions *everywhere*, so users never have to wonder.
5580 conventions *everywhere*, so users never have to wonder.
5577 (Magic.magic_macro): Added @macro function to ease the creation of
5581 (Magic.magic_macro): Added @macro function to ease the creation of
5578 macros.
5582 macros.
5579
5583
5580 2002-01-05 Fernando Perez <fperez@colorado.edu>
5584 2002-01-05 Fernando Perez <fperez@colorado.edu>
5581
5585
5582 * Released 0.2.4.
5586 * Released 0.2.4.
5583
5587
5584 * IPython/iplib.py (Magic.magic_pdef):
5588 * IPython/iplib.py (Magic.magic_pdef):
5585 (InteractiveShell.safe_execfile): report magic lines and error
5589 (InteractiveShell.safe_execfile): report magic lines and error
5586 lines without line numbers so one can easily copy/paste them for
5590 lines without line numbers so one can easily copy/paste them for
5587 re-execution.
5591 re-execution.
5588
5592
5589 * Updated manual with recent changes.
5593 * Updated manual with recent changes.
5590
5594
5591 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5595 * IPython/iplib.py (Magic.magic_oinfo): added constructor
5592 docstring printing when class? is called. Very handy for knowing
5596 docstring printing when class? is called. Very handy for knowing
5593 how to create class instances (as long as __init__ is well
5597 how to create class instances (as long as __init__ is well
5594 documented, of course :)
5598 documented, of course :)
5595 (Magic.magic_doc): print both class and constructor docstrings.
5599 (Magic.magic_doc): print both class and constructor docstrings.
5596 (Magic.magic_pdef): give constructor info if passed a class and
5600 (Magic.magic_pdef): give constructor info if passed a class and
5597 __call__ info for callable object instances.
5601 __call__ info for callable object instances.
5598
5602
5599 2002-01-04 Fernando Perez <fperez@colorado.edu>
5603 2002-01-04 Fernando Perez <fperez@colorado.edu>
5600
5604
5601 * Made deep_reload() off by default. It doesn't always work
5605 * Made deep_reload() off by default. It doesn't always work
5602 exactly as intended, so it's probably safer to have it off. It's
5606 exactly as intended, so it's probably safer to have it off. It's
5603 still available as dreload() anyway, so nothing is lost.
5607 still available as dreload() anyway, so nothing is lost.
5604
5608
5605 2002-01-02 Fernando Perez <fperez@colorado.edu>
5609 2002-01-02 Fernando Perez <fperez@colorado.edu>
5606
5610
5607 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5611 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
5608 so I wanted an updated release).
5612 so I wanted an updated release).
5609
5613
5610 2001-12-27 Fernando Perez <fperez@colorado.edu>
5614 2001-12-27 Fernando Perez <fperez@colorado.edu>
5611
5615
5612 * IPython/iplib.py (InteractiveShell.interact): Added the original
5616 * IPython/iplib.py (InteractiveShell.interact): Added the original
5613 code from 'code.py' for this module in order to change the
5617 code from 'code.py' for this module in order to change the
5614 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5618 handling of a KeyboardInterrupt. This was necessary b/c otherwise
5615 the history cache would break when the user hit Ctrl-C, and
5619 the history cache would break when the user hit Ctrl-C, and
5616 interact() offers no way to add any hooks to it.
5620 interact() offers no way to add any hooks to it.
5617
5621
5618 2001-12-23 Fernando Perez <fperez@colorado.edu>
5622 2001-12-23 Fernando Perez <fperez@colorado.edu>
5619
5623
5620 * setup.py: added check for 'MANIFEST' before trying to remove
5624 * setup.py: added check for 'MANIFEST' before trying to remove
5621 it. Thanks to Sean Reifschneider.
5625 it. Thanks to Sean Reifschneider.
5622
5626
5623 2001-12-22 Fernando Perez <fperez@colorado.edu>
5627 2001-12-22 Fernando Perez <fperez@colorado.edu>
5624
5628
5625 * Released 0.2.2.
5629 * Released 0.2.2.
5626
5630
5627 * Finished (reasonably) writing the manual. Later will add the
5631 * Finished (reasonably) writing the manual. Later will add the
5628 python-standard navigation stylesheets, but for the time being
5632 python-standard navigation stylesheets, but for the time being
5629 it's fairly complete. Distribution will include html and pdf
5633 it's fairly complete. Distribution will include html and pdf
5630 versions.
5634 versions.
5631
5635
5632 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5636 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
5633 (MayaVi author).
5637 (MayaVi author).
5634
5638
5635 2001-12-21 Fernando Perez <fperez@colorado.edu>
5639 2001-12-21 Fernando Perez <fperez@colorado.edu>
5636
5640
5637 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5641 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
5638 good public release, I think (with the manual and the distutils
5642 good public release, I think (with the manual and the distutils
5639 installer). The manual can use some work, but that can go
5643 installer). The manual can use some work, but that can go
5640 slowly. Otherwise I think it's quite nice for end users. Next
5644 slowly. Otherwise I think it's quite nice for end users. Next
5641 summer, rewrite the guts of it...
5645 summer, rewrite the guts of it...
5642
5646
5643 * Changed format of ipythonrc files to use whitespace as the
5647 * Changed format of ipythonrc files to use whitespace as the
5644 separator instead of an explicit '='. Cleaner.
5648 separator instead of an explicit '='. Cleaner.
5645
5649
5646 2001-12-20 Fernando Perez <fperez@colorado.edu>
5650 2001-12-20 Fernando Perez <fperez@colorado.edu>
5647
5651
5648 * Started a manual in LyX. For now it's just a quick merge of the
5652 * Started a manual in LyX. For now it's just a quick merge of the
5649 various internal docstrings and READMEs. Later it may grow into a
5653 various internal docstrings and READMEs. Later it may grow into a
5650 nice, full-blown manual.
5654 nice, full-blown manual.
5651
5655
5652 * Set up a distutils based installer. Installation should now be
5656 * Set up a distutils based installer. Installation should now be
5653 trivially simple for end-users.
5657 trivially simple for end-users.
5654
5658
5655 2001-12-11 Fernando Perez <fperez@colorado.edu>
5659 2001-12-11 Fernando Perez <fperez@colorado.edu>
5656
5660
5657 * Released 0.2.0. First public release, announced it at
5661 * Released 0.2.0. First public release, announced it at
5658 comp.lang.python. From now on, just bugfixes...
5662 comp.lang.python. From now on, just bugfixes...
5659
5663
5660 * Went through all the files, set copyright/license notices and
5664 * Went through all the files, set copyright/license notices and
5661 cleaned up things. Ready for release.
5665 cleaned up things. Ready for release.
5662
5666
5663 2001-12-10 Fernando Perez <fperez@colorado.edu>
5667 2001-12-10 Fernando Perez <fperez@colorado.edu>
5664
5668
5665 * Changed the first-time installer not to use tarfiles. It's more
5669 * Changed the first-time installer not to use tarfiles. It's more
5666 robust now and less unix-dependent. Also makes it easier for
5670 robust now and less unix-dependent. Also makes it easier for
5667 people to later upgrade versions.
5671 people to later upgrade versions.
5668
5672
5669 * Changed @exit to @abort to reflect the fact that it's pretty
5673 * Changed @exit to @abort to reflect the fact that it's pretty
5670 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5674 brutal (a sys.exit()). The difference between @abort and Ctrl-D
5671 becomes significant only when IPyhton is embedded: in that case,
5675 becomes significant only when IPyhton is embedded: in that case,
5672 C-D closes IPython only, but @abort kills the enclosing program
5676 C-D closes IPython only, but @abort kills the enclosing program
5673 too (unless it had called IPython inside a try catching
5677 too (unless it had called IPython inside a try catching
5674 SystemExit).
5678 SystemExit).
5675
5679
5676 * Created Shell module which exposes the actuall IPython Shell
5680 * Created Shell module which exposes the actuall IPython Shell
5677 classes, currently the normal and the embeddable one. This at
5681 classes, currently the normal and the embeddable one. This at
5678 least offers a stable interface we won't need to change when
5682 least offers a stable interface we won't need to change when
5679 (later) the internals are rewritten. That rewrite will be confined
5683 (later) the internals are rewritten. That rewrite will be confined
5680 to iplib and ipmaker, but the Shell interface should remain as is.
5684 to iplib and ipmaker, but the Shell interface should remain as is.
5681
5685
5682 * Added embed module which offers an embeddable IPShell object,
5686 * Added embed module which offers an embeddable IPShell object,
5683 useful to fire up IPython *inside* a running program. Great for
5687 useful to fire up IPython *inside* a running program. Great for
5684 debugging or dynamical data analysis.
5688 debugging or dynamical data analysis.
5685
5689
5686 2001-12-08 Fernando Perez <fperez@colorado.edu>
5690 2001-12-08 Fernando Perez <fperez@colorado.edu>
5687
5691
5688 * Fixed small bug preventing seeing info from methods of defined
5692 * Fixed small bug preventing seeing info from methods of defined
5689 objects (incorrect namespace in _ofind()).
5693 objects (incorrect namespace in _ofind()).
5690
5694
5691 * Documentation cleanup. Moved the main usage docstrings to a
5695 * Documentation cleanup. Moved the main usage docstrings to a
5692 separate file, usage.py (cleaner to maintain, and hopefully in the
5696 separate file, usage.py (cleaner to maintain, and hopefully in the
5693 future some perlpod-like way of producing interactive, man and
5697 future some perlpod-like way of producing interactive, man and
5694 html docs out of it will be found).
5698 html docs out of it will be found).
5695
5699
5696 * Added @profile to see your profile at any time.
5700 * Added @profile to see your profile at any time.
5697
5701
5698 * Added @p as an alias for 'print'. It's especially convenient if
5702 * Added @p as an alias for 'print'. It's especially convenient if
5699 using automagic ('p x' prints x).
5703 using automagic ('p x' prints x).
5700
5704
5701 * Small cleanups and fixes after a pychecker run.
5705 * Small cleanups and fixes after a pychecker run.
5702
5706
5703 * Changed the @cd command to handle @cd - and @cd -<n> for
5707 * Changed the @cd command to handle @cd - and @cd -<n> for
5704 visiting any directory in _dh.
5708 visiting any directory in _dh.
5705
5709
5706 * Introduced _dh, a history of visited directories. @dhist prints
5710 * Introduced _dh, a history of visited directories. @dhist prints
5707 it out with numbers.
5711 it out with numbers.
5708
5712
5709 2001-12-07 Fernando Perez <fperez@colorado.edu>
5713 2001-12-07 Fernando Perez <fperez@colorado.edu>
5710
5714
5711 * Released 0.1.22
5715 * Released 0.1.22
5712
5716
5713 * Made initialization a bit more robust against invalid color
5717 * Made initialization a bit more robust against invalid color
5714 options in user input (exit, not traceback-crash).
5718 options in user input (exit, not traceback-crash).
5715
5719
5716 * Changed the bug crash reporter to write the report only in the
5720 * Changed the bug crash reporter to write the report only in the
5717 user's .ipython directory. That way IPython won't litter people's
5721 user's .ipython directory. That way IPython won't litter people's
5718 hard disks with crash files all over the place. Also print on
5722 hard disks with crash files all over the place. Also print on
5719 screen the necessary mail command.
5723 screen the necessary mail command.
5720
5724
5721 * With the new ultraTB, implemented LightBG color scheme for light
5725 * With the new ultraTB, implemented LightBG color scheme for light
5722 background terminals. A lot of people like white backgrounds, so I
5726 background terminals. A lot of people like white backgrounds, so I
5723 guess we should at least give them something readable.
5727 guess we should at least give them something readable.
5724
5728
5725 2001-12-06 Fernando Perez <fperez@colorado.edu>
5729 2001-12-06 Fernando Perez <fperez@colorado.edu>
5726
5730
5727 * Modified the structure of ultraTB. Now there's a proper class
5731 * Modified the structure of ultraTB. Now there's a proper class
5728 for tables of color schemes which allow adding schemes easily and
5732 for tables of color schemes which allow adding schemes easily and
5729 switching the active scheme without creating a new instance every
5733 switching the active scheme without creating a new instance every
5730 time (which was ridiculous). The syntax for creating new schemes
5734 time (which was ridiculous). The syntax for creating new schemes
5731 is also cleaner. I think ultraTB is finally done, with a clean
5735 is also cleaner. I think ultraTB is finally done, with a clean
5732 class structure. Names are also much cleaner (now there's proper
5736 class structure. Names are also much cleaner (now there's proper
5733 color tables, no need for every variable to also have 'color' in
5737 color tables, no need for every variable to also have 'color' in
5734 its name).
5738 its name).
5735
5739
5736 * Broke down genutils into separate files. Now genutils only
5740 * Broke down genutils into separate files. Now genutils only
5737 contains utility functions, and classes have been moved to their
5741 contains utility functions, and classes have been moved to their
5738 own files (they had enough independent functionality to warrant
5742 own files (they had enough independent functionality to warrant
5739 it): ConfigLoader, OutputTrap, Struct.
5743 it): ConfigLoader, OutputTrap, Struct.
5740
5744
5741 2001-12-05 Fernando Perez <fperez@colorado.edu>
5745 2001-12-05 Fernando Perez <fperez@colorado.edu>
5742
5746
5743 * IPython turns 21! Released version 0.1.21, as a candidate for
5747 * IPython turns 21! Released version 0.1.21, as a candidate for
5744 public consumption. If all goes well, release in a few days.
5748 public consumption. If all goes well, release in a few days.
5745
5749
5746 * Fixed path bug (files in Extensions/ directory wouldn't be found
5750 * Fixed path bug (files in Extensions/ directory wouldn't be found
5747 unless IPython/ was explicitly in sys.path).
5751 unless IPython/ was explicitly in sys.path).
5748
5752
5749 * Extended the FlexCompleter class as MagicCompleter to allow
5753 * Extended the FlexCompleter class as MagicCompleter to allow
5750 completion of @-starting lines.
5754 completion of @-starting lines.
5751
5755
5752 * Created __release__.py file as a central repository for release
5756 * Created __release__.py file as a central repository for release
5753 info that other files can read from.
5757 info that other files can read from.
5754
5758
5755 * Fixed small bug in logging: when logging was turned on in
5759 * Fixed small bug in logging: when logging was turned on in
5756 mid-session, old lines with special meanings (!@?) were being
5760 mid-session, old lines with special meanings (!@?) were being
5757 logged without the prepended comment, which is necessary since
5761 logged without the prepended comment, which is necessary since
5758 they are not truly valid python syntax. This should make session
5762 they are not truly valid python syntax. This should make session
5759 restores produce less errors.
5763 restores produce less errors.
5760
5764
5761 * The namespace cleanup forced me to make a FlexCompleter class
5765 * The namespace cleanup forced me to make a FlexCompleter class
5762 which is nothing but a ripoff of rlcompleter, but with selectable
5766 which is nothing but a ripoff of rlcompleter, but with selectable
5763 namespace (rlcompleter only works in __main__.__dict__). I'll try
5767 namespace (rlcompleter only works in __main__.__dict__). I'll try
5764 to submit a note to the authors to see if this change can be
5768 to submit a note to the authors to see if this change can be
5765 incorporated in future rlcompleter releases (Dec.6: done)
5769 incorporated in future rlcompleter releases (Dec.6: done)
5766
5770
5767 * More fixes to namespace handling. It was a mess! Now all
5771 * More fixes to namespace handling. It was a mess! Now all
5768 explicit references to __main__.__dict__ are gone (except when
5772 explicit references to __main__.__dict__ are gone (except when
5769 really needed) and everything is handled through the namespace
5773 really needed) and everything is handled through the namespace
5770 dicts in the IPython instance. We seem to be getting somewhere
5774 dicts in the IPython instance. We seem to be getting somewhere
5771 with this, finally...
5775 with this, finally...
5772
5776
5773 * Small documentation updates.
5777 * Small documentation updates.
5774
5778
5775 * Created the Extensions directory under IPython (with an
5779 * Created the Extensions directory under IPython (with an
5776 __init__.py). Put the PhysicalQ stuff there. This directory should
5780 __init__.py). Put the PhysicalQ stuff there. This directory should
5777 be used for all special-purpose extensions.
5781 be used for all special-purpose extensions.
5778
5782
5779 * File renaming:
5783 * File renaming:
5780 ipythonlib --> ipmaker
5784 ipythonlib --> ipmaker
5781 ipplib --> iplib
5785 ipplib --> iplib
5782 This makes a bit more sense in terms of what these files actually do.
5786 This makes a bit more sense in terms of what these files actually do.
5783
5787
5784 * Moved all the classes and functions in ipythonlib to ipplib, so
5788 * Moved all the classes and functions in ipythonlib to ipplib, so
5785 now ipythonlib only has make_IPython(). This will ease up its
5789 now ipythonlib only has make_IPython(). This will ease up its
5786 splitting in smaller functional chunks later.
5790 splitting in smaller functional chunks later.
5787
5791
5788 * Cleaned up (done, I think) output of @whos. Better column
5792 * Cleaned up (done, I think) output of @whos. Better column
5789 formatting, and now shows str(var) for as much as it can, which is
5793 formatting, and now shows str(var) for as much as it can, which is
5790 typically what one gets with a 'print var'.
5794 typically what one gets with a 'print var'.
5791
5795
5792 2001-12-04 Fernando Perez <fperez@colorado.edu>
5796 2001-12-04 Fernando Perez <fperez@colorado.edu>
5793
5797
5794 * Fixed namespace problems. Now builtin/IPyhton/user names get
5798 * Fixed namespace problems. Now builtin/IPyhton/user names get
5795 properly reported in their namespace. Internal namespace handling
5799 properly reported in their namespace. Internal namespace handling
5796 is finally getting decent (not perfect yet, but much better than
5800 is finally getting decent (not perfect yet, but much better than
5797 the ad-hoc mess we had).
5801 the ad-hoc mess we had).
5798
5802
5799 * Removed -exit option. If people just want to run a python
5803 * Removed -exit option. If people just want to run a python
5800 script, that's what the normal interpreter is for. Less
5804 script, that's what the normal interpreter is for. Less
5801 unnecessary options, less chances for bugs.
5805 unnecessary options, less chances for bugs.
5802
5806
5803 * Added a crash handler which generates a complete post-mortem if
5807 * Added a crash handler which generates a complete post-mortem if
5804 IPython crashes. This will help a lot in tracking bugs down the
5808 IPython crashes. This will help a lot in tracking bugs down the
5805 road.
5809 road.
5806
5810
5807 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5811 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
5808 which were boud to functions being reassigned would bypass the
5812 which were boud to functions being reassigned would bypass the
5809 logger, breaking the sync of _il with the prompt counter. This
5813 logger, breaking the sync of _il with the prompt counter. This
5810 would then crash IPython later when a new line was logged.
5814 would then crash IPython later when a new line was logged.
5811
5815
5812 2001-12-02 Fernando Perez <fperez@colorado.edu>
5816 2001-12-02 Fernando Perez <fperez@colorado.edu>
5813
5817
5814 * Made IPython a package. This means people don't have to clutter
5818 * Made IPython a package. This means people don't have to clutter
5815 their sys.path with yet another directory. Changed the INSTALL
5819 their sys.path with yet another directory. Changed the INSTALL
5816 file accordingly.
5820 file accordingly.
5817
5821
5818 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5822 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
5819 sorts its output (so @who shows it sorted) and @whos formats the
5823 sorts its output (so @who shows it sorted) and @whos formats the
5820 table according to the width of the first column. Nicer, easier to
5824 table according to the width of the first column. Nicer, easier to
5821 read. Todo: write a generic table_format() which takes a list of
5825 read. Todo: write a generic table_format() which takes a list of
5822 lists and prints it nicely formatted, with optional row/column
5826 lists and prints it nicely formatted, with optional row/column
5823 separators and proper padding and justification.
5827 separators and proper padding and justification.
5824
5828
5825 * Released 0.1.20
5829 * Released 0.1.20
5826
5830
5827 * Fixed bug in @log which would reverse the inputcache list (a
5831 * Fixed bug in @log which would reverse the inputcache list (a
5828 copy operation was missing).
5832 copy operation was missing).
5829
5833
5830 * Code cleanup. @config was changed to use page(). Better, since
5834 * Code cleanup. @config was changed to use page(). Better, since
5831 its output is always quite long.
5835 its output is always quite long.
5832
5836
5833 * Itpl is back as a dependency. I was having too many problems
5837 * Itpl is back as a dependency. I was having too many problems
5834 getting the parametric aliases to work reliably, and it's just
5838 getting the parametric aliases to work reliably, and it's just
5835 easier to code weird string operations with it than playing %()s
5839 easier to code weird string operations with it than playing %()s
5836 games. It's only ~6k, so I don't think it's too big a deal.
5840 games. It's only ~6k, so I don't think it's too big a deal.
5837
5841
5838 * Found (and fixed) a very nasty bug with history. !lines weren't
5842 * Found (and fixed) a very nasty bug with history. !lines weren't
5839 getting cached, and the out of sync caches would crash
5843 getting cached, and the out of sync caches would crash
5840 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5844 IPython. Fixed it by reorganizing the prefilter/handlers/logger
5841 division of labor a bit better. Bug fixed, cleaner structure.
5845 division of labor a bit better. Bug fixed, cleaner structure.
5842
5846
5843 2001-12-01 Fernando Perez <fperez@colorado.edu>
5847 2001-12-01 Fernando Perez <fperez@colorado.edu>
5844
5848
5845 * Released 0.1.19
5849 * Released 0.1.19
5846
5850
5847 * Added option -n to @hist to prevent line number printing. Much
5851 * Added option -n to @hist to prevent line number printing. Much
5848 easier to copy/paste code this way.
5852 easier to copy/paste code this way.
5849
5853
5850 * Created global _il to hold the input list. Allows easy
5854 * Created global _il to hold the input list. Allows easy
5851 re-execution of blocks of code by slicing it (inspired by Janko's
5855 re-execution of blocks of code by slicing it (inspired by Janko's
5852 comment on 'macros').
5856 comment on 'macros').
5853
5857
5854 * Small fixes and doc updates.
5858 * Small fixes and doc updates.
5855
5859
5856 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5860 * Rewrote @history function (was @h). Renamed it to @hist, @h is
5857 much too fragile with automagic. Handles properly multi-line
5861 much too fragile with automagic. Handles properly multi-line
5858 statements and takes parameters.
5862 statements and takes parameters.
5859
5863
5860 2001-11-30 Fernando Perez <fperez@colorado.edu>
5864 2001-11-30 Fernando Perez <fperez@colorado.edu>
5861
5865
5862 * Version 0.1.18 released.
5866 * Version 0.1.18 released.
5863
5867
5864 * Fixed nasty namespace bug in initial module imports.
5868 * Fixed nasty namespace bug in initial module imports.
5865
5869
5866 * Added copyright/license notes to all code files (except
5870 * Added copyright/license notes to all code files (except
5867 DPyGetOpt). For the time being, LGPL. That could change.
5871 DPyGetOpt). For the time being, LGPL. That could change.
5868
5872
5869 * Rewrote a much nicer README, updated INSTALL, cleaned up
5873 * Rewrote a much nicer README, updated INSTALL, cleaned up
5870 ipythonrc-* samples.
5874 ipythonrc-* samples.
5871
5875
5872 * Overall code/documentation cleanup. Basically ready for
5876 * Overall code/documentation cleanup. Basically ready for
5873 release. Only remaining thing: licence decision (LGPL?).
5877 release. Only remaining thing: licence decision (LGPL?).
5874
5878
5875 * Converted load_config to a class, ConfigLoader. Now recursion
5879 * Converted load_config to a class, ConfigLoader. Now recursion
5876 control is better organized. Doesn't include the same file twice.
5880 control is better organized. Doesn't include the same file twice.
5877
5881
5878 2001-11-29 Fernando Perez <fperez@colorado.edu>
5882 2001-11-29 Fernando Perez <fperez@colorado.edu>
5879
5883
5880 * Got input history working. Changed output history variables from
5884 * Got input history working. Changed output history variables from
5881 _p to _o so that _i is for input and _o for output. Just cleaner
5885 _p to _o so that _i is for input and _o for output. Just cleaner
5882 convention.
5886 convention.
5883
5887
5884 * Implemented parametric aliases. This pretty much allows the
5888 * Implemented parametric aliases. This pretty much allows the
5885 alias system to offer full-blown shell convenience, I think.
5889 alias system to offer full-blown shell convenience, I think.
5886
5890
5887 * Version 0.1.17 released, 0.1.18 opened.
5891 * Version 0.1.17 released, 0.1.18 opened.
5888
5892
5889 * dot_ipython/ipythonrc (alias): added documentation.
5893 * dot_ipython/ipythonrc (alias): added documentation.
5890 (xcolor): Fixed small bug (xcolors -> xcolor)
5894 (xcolor): Fixed small bug (xcolors -> xcolor)
5891
5895
5892 * Changed the alias system. Now alias is a magic command to define
5896 * Changed the alias system. Now alias is a magic command to define
5893 aliases just like the shell. Rationale: the builtin magics should
5897 aliases just like the shell. Rationale: the builtin magics should
5894 be there for things deeply connected to IPython's
5898 be there for things deeply connected to IPython's
5895 architecture. And this is a much lighter system for what I think
5899 architecture. And this is a much lighter system for what I think
5896 is the really important feature: allowing users to define quickly
5900 is the really important feature: allowing users to define quickly
5897 magics that will do shell things for them, so they can customize
5901 magics that will do shell things for them, so they can customize
5898 IPython easily to match their work habits. If someone is really
5902 IPython easily to match their work habits. If someone is really
5899 desperate to have another name for a builtin alias, they can
5903 desperate to have another name for a builtin alias, they can
5900 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5904 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
5901 works.
5905 works.
5902
5906
5903 2001-11-28 Fernando Perez <fperez@colorado.edu>
5907 2001-11-28 Fernando Perez <fperez@colorado.edu>
5904
5908
5905 * Changed @file so that it opens the source file at the proper
5909 * Changed @file so that it opens the source file at the proper
5906 line. Since it uses less, if your EDITOR environment is
5910 line. Since it uses less, if your EDITOR environment is
5907 configured, typing v will immediately open your editor of choice
5911 configured, typing v will immediately open your editor of choice
5908 right at the line where the object is defined. Not as quick as
5912 right at the line where the object is defined. Not as quick as
5909 having a direct @edit command, but for all intents and purposes it
5913 having a direct @edit command, but for all intents and purposes it
5910 works. And I don't have to worry about writing @edit to deal with
5914 works. And I don't have to worry about writing @edit to deal with
5911 all the editors, less does that.
5915 all the editors, less does that.
5912
5916
5913 * Version 0.1.16 released, 0.1.17 opened.
5917 * Version 0.1.16 released, 0.1.17 opened.
5914
5918
5915 * Fixed some nasty bugs in the page/page_dumb combo that could
5919 * Fixed some nasty bugs in the page/page_dumb combo that could
5916 crash IPython.
5920 crash IPython.
5917
5921
5918 2001-11-27 Fernando Perez <fperez@colorado.edu>
5922 2001-11-27 Fernando Perez <fperez@colorado.edu>
5919
5923
5920 * Version 0.1.15 released, 0.1.16 opened.
5924 * Version 0.1.15 released, 0.1.16 opened.
5921
5925
5922 * Finally got ? and ?? to work for undefined things: now it's
5926 * Finally got ? and ?? to work for undefined things: now it's
5923 possible to type {}.get? and get information about the get method
5927 possible to type {}.get? and get information about the get method
5924 of dicts, or os.path? even if only os is defined (so technically
5928 of dicts, or os.path? even if only os is defined (so technically
5925 os.path isn't). Works at any level. For example, after import os,
5929 os.path isn't). Works at any level. For example, after import os,
5926 os?, os.path?, os.path.abspath? all work. This is great, took some
5930 os?, os.path?, os.path.abspath? all work. This is great, took some
5927 work in _ofind.
5931 work in _ofind.
5928
5932
5929 * Fixed more bugs with logging. The sanest way to do it was to add
5933 * Fixed more bugs with logging. The sanest way to do it was to add
5930 to @log a 'mode' parameter. Killed two in one shot (this mode
5934 to @log a 'mode' parameter. Killed two in one shot (this mode
5931 option was a request of Janko's). I think it's finally clean
5935 option was a request of Janko's). I think it's finally clean
5932 (famous last words).
5936 (famous last words).
5933
5937
5934 * Added a page_dumb() pager which does a decent job of paging on
5938 * Added a page_dumb() pager which does a decent job of paging on
5935 screen, if better things (like less) aren't available. One less
5939 screen, if better things (like less) aren't available. One less
5936 unix dependency (someday maybe somebody will port this to
5940 unix dependency (someday maybe somebody will port this to
5937 windows).
5941 windows).
5938
5942
5939 * Fixed problem in magic_log: would lock of logging out if log
5943 * Fixed problem in magic_log: would lock of logging out if log
5940 creation failed (because it would still think it had succeeded).
5944 creation failed (because it would still think it had succeeded).
5941
5945
5942 * Improved the page() function using curses to auto-detect screen
5946 * Improved the page() function using curses to auto-detect screen
5943 size. Now it can make a much better decision on whether to print
5947 size. Now it can make a much better decision on whether to print
5944 or page a string. Option screen_length was modified: a value 0
5948 or page a string. Option screen_length was modified: a value 0
5945 means auto-detect, and that's the default now.
5949 means auto-detect, and that's the default now.
5946
5950
5947 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5951 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
5948 go out. I'll test it for a few days, then talk to Janko about
5952 go out. I'll test it for a few days, then talk to Janko about
5949 licences and announce it.
5953 licences and announce it.
5950
5954
5951 * Fixed the length of the auto-generated ---> prompt which appears
5955 * Fixed the length of the auto-generated ---> prompt which appears
5952 for auto-parens and auto-quotes. Getting this right isn't trivial,
5956 for auto-parens and auto-quotes. Getting this right isn't trivial,
5953 with all the color escapes, different prompt types and optional
5957 with all the color escapes, different prompt types and optional
5954 separators. But it seems to be working in all the combinations.
5958 separators. But it seems to be working in all the combinations.
5955
5959
5956 2001-11-26 Fernando Perez <fperez@colorado.edu>
5960 2001-11-26 Fernando Perez <fperez@colorado.edu>
5957
5961
5958 * Wrote a regexp filter to get option types from the option names
5962 * Wrote a regexp filter to get option types from the option names
5959 string. This eliminates the need to manually keep two duplicate
5963 string. This eliminates the need to manually keep two duplicate
5960 lists.
5964 lists.
5961
5965
5962 * Removed the unneeded check_option_names. Now options are handled
5966 * Removed the unneeded check_option_names. Now options are handled
5963 in a much saner manner and it's easy to visually check that things
5967 in a much saner manner and it's easy to visually check that things
5964 are ok.
5968 are ok.
5965
5969
5966 * Updated version numbers on all files I modified to carry a
5970 * Updated version numbers on all files I modified to carry a
5967 notice so Janko and Nathan have clear version markers.
5971 notice so Janko and Nathan have clear version markers.
5968
5972
5969 * Updated docstring for ultraTB with my changes. I should send
5973 * Updated docstring for ultraTB with my changes. I should send
5970 this to Nathan.
5974 this to Nathan.
5971
5975
5972 * Lots of small fixes. Ran everything through pychecker again.
5976 * Lots of small fixes. Ran everything through pychecker again.
5973
5977
5974 * Made loading of deep_reload an cmd line option. If it's not too
5978 * Made loading of deep_reload an cmd line option. If it's not too
5975 kosher, now people can just disable it. With -nodeep_reload it's
5979 kosher, now people can just disable it. With -nodeep_reload it's
5976 still available as dreload(), it just won't overwrite reload().
5980 still available as dreload(), it just won't overwrite reload().
5977
5981
5978 * Moved many options to the no| form (-opt and -noopt
5982 * Moved many options to the no| form (-opt and -noopt
5979 accepted). Cleaner.
5983 accepted). Cleaner.
5980
5984
5981 * Changed magic_log so that if called with no parameters, it uses
5985 * Changed magic_log so that if called with no parameters, it uses
5982 'rotate' mode. That way auto-generated logs aren't automatically
5986 'rotate' mode. That way auto-generated logs aren't automatically
5983 over-written. For normal logs, now a backup is made if it exists
5987 over-written. For normal logs, now a backup is made if it exists
5984 (only 1 level of backups). A new 'backup' mode was added to the
5988 (only 1 level of backups). A new 'backup' mode was added to the
5985 Logger class to support this. This was a request by Janko.
5989 Logger class to support this. This was a request by Janko.
5986
5990
5987 * Added @logoff/@logon to stop/restart an active log.
5991 * Added @logoff/@logon to stop/restart an active log.
5988
5992
5989 * Fixed a lot of bugs in log saving/replay. It was pretty
5993 * Fixed a lot of bugs in log saving/replay. It was pretty
5990 broken. Now special lines (!@,/) appear properly in the command
5994 broken. Now special lines (!@,/) appear properly in the command
5991 history after a log replay.
5995 history after a log replay.
5992
5996
5993 * Tried and failed to implement full session saving via pickle. My
5997 * Tried and failed to implement full session saving via pickle. My
5994 idea was to pickle __main__.__dict__, but modules can't be
5998 idea was to pickle __main__.__dict__, but modules can't be
5995 pickled. This would be a better alternative to replaying logs, but
5999 pickled. This would be a better alternative to replaying logs, but
5996 seems quite tricky to get to work. Changed -session to be called
6000 seems quite tricky to get to work. Changed -session to be called
5997 -logplay, which more accurately reflects what it does. And if we
6001 -logplay, which more accurately reflects what it does. And if we
5998 ever get real session saving working, -session is now available.
6002 ever get real session saving working, -session is now available.
5999
6003
6000 * Implemented color schemes for prompts also. As for tracebacks,
6004 * Implemented color schemes for prompts also. As for tracebacks,
6001 currently only NoColor and Linux are supported. But now the
6005 currently only NoColor and Linux are supported. But now the
6002 infrastructure is in place, based on a generic ColorScheme
6006 infrastructure is in place, based on a generic ColorScheme
6003 class. So writing and activating new schemes both for the prompts
6007 class. So writing and activating new schemes both for the prompts
6004 and the tracebacks should be straightforward.
6008 and the tracebacks should be straightforward.
6005
6009
6006 * Version 0.1.13 released, 0.1.14 opened.
6010 * Version 0.1.13 released, 0.1.14 opened.
6007
6011
6008 * Changed handling of options for output cache. Now counter is
6012 * Changed handling of options for output cache. Now counter is
6009 hardwired starting at 1 and one specifies the maximum number of
6013 hardwired starting at 1 and one specifies the maximum number of
6010 entries *in the outcache* (not the max prompt counter). This is
6014 entries *in the outcache* (not the max prompt counter). This is
6011 much better, since many statements won't increase the cache
6015 much better, since many statements won't increase the cache
6012 count. It also eliminated some confusing options, now there's only
6016 count. It also eliminated some confusing options, now there's only
6013 one: cache_size.
6017 one: cache_size.
6014
6018
6015 * Added 'alias' magic function and magic_alias option in the
6019 * Added 'alias' magic function and magic_alias option in the
6016 ipythonrc file. Now the user can easily define whatever names he
6020 ipythonrc file. Now the user can easily define whatever names he
6017 wants for the magic functions without having to play weird
6021 wants for the magic functions without having to play weird
6018 namespace games. This gives IPython a real shell-like feel.
6022 namespace games. This gives IPython a real shell-like feel.
6019
6023
6020 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
6024 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
6021 @ or not).
6025 @ or not).
6022
6026
6023 This was one of the last remaining 'visible' bugs (that I know
6027 This was one of the last remaining 'visible' bugs (that I know
6024 of). I think if I can clean up the session loading so it works
6028 of). I think if I can clean up the session loading so it works
6025 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
6029 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
6026 about licensing).
6030 about licensing).
6027
6031
6028 2001-11-25 Fernando Perez <fperez@colorado.edu>
6032 2001-11-25 Fernando Perez <fperez@colorado.edu>
6029
6033
6030 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
6034 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
6031 there's a cleaner distinction between what ? and ?? show.
6035 there's a cleaner distinction between what ? and ?? show.
6032
6036
6033 * Added screen_length option. Now the user can define his own
6037 * Added screen_length option. Now the user can define his own
6034 screen size for page() operations.
6038 screen size for page() operations.
6035
6039
6036 * Implemented magic shell-like functions with automatic code
6040 * Implemented magic shell-like functions with automatic code
6037 generation. Now adding another function is just a matter of adding
6041 generation. Now adding another function is just a matter of adding
6038 an entry to a dict, and the function is dynamically generated at
6042 an entry to a dict, and the function is dynamically generated at
6039 run-time. Python has some really cool features!
6043 run-time. Python has some really cool features!
6040
6044
6041 * Renamed many options to cleanup conventions a little. Now all
6045 * Renamed many options to cleanup conventions a little. Now all
6042 are lowercase, and only underscores where needed. Also in the code
6046 are lowercase, and only underscores where needed. Also in the code
6043 option name tables are clearer.
6047 option name tables are clearer.
6044
6048
6045 * Changed prompts a little. Now input is 'In [n]:' instead of
6049 * Changed prompts a little. Now input is 'In [n]:' instead of
6046 'In[n]:='. This allows it the numbers to be aligned with the
6050 'In[n]:='. This allows it the numbers to be aligned with the
6047 Out[n] numbers, and removes usage of ':=' which doesn't exist in
6051 Out[n] numbers, and removes usage of ':=' which doesn't exist in
6048 Python (it was a Mathematica thing). The '...' continuation prompt
6052 Python (it was a Mathematica thing). The '...' continuation prompt
6049 was also changed a little to align better.
6053 was also changed a little to align better.
6050
6054
6051 * Fixed bug when flushing output cache. Not all _p<n> variables
6055 * Fixed bug when flushing output cache. Not all _p<n> variables
6052 exist, so their deletion needs to be wrapped in a try:
6056 exist, so their deletion needs to be wrapped in a try:
6053
6057
6054 * Figured out how to properly use inspect.formatargspec() (it
6058 * Figured out how to properly use inspect.formatargspec() (it
6055 requires the args preceded by *). So I removed all the code from
6059 requires the args preceded by *). So I removed all the code from
6056 _get_pdef in Magic, which was just replicating that.
6060 _get_pdef in Magic, which was just replicating that.
6057
6061
6058 * Added test to prefilter to allow redefining magic function names
6062 * Added test to prefilter to allow redefining magic function names
6059 as variables. This is ok, since the @ form is always available,
6063 as variables. This is ok, since the @ form is always available,
6060 but whe should allow the user to define a variable called 'ls' if
6064 but whe should allow the user to define a variable called 'ls' if
6061 he needs it.
6065 he needs it.
6062
6066
6063 * Moved the ToDo information from README into a separate ToDo.
6067 * Moved the ToDo information from README into a separate ToDo.
6064
6068
6065 * General code cleanup and small bugfixes. I think it's close to a
6069 * General code cleanup and small bugfixes. I think it's close to a
6066 state where it can be released, obviously with a big 'beta'
6070 state where it can be released, obviously with a big 'beta'
6067 warning on it.
6071 warning on it.
6068
6072
6069 * Got the magic function split to work. Now all magics are defined
6073 * Got the magic function split to work. Now all magics are defined
6070 in a separate class. It just organizes things a bit, and now
6074 in a separate class. It just organizes things a bit, and now
6071 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
6075 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
6072 was too long).
6076 was too long).
6073
6077
6074 * Changed @clear to @reset to avoid potential confusions with
6078 * Changed @clear to @reset to avoid potential confusions with
6075 the shell command clear. Also renamed @cl to @clear, which does
6079 the shell command clear. Also renamed @cl to @clear, which does
6076 exactly what people expect it to from their shell experience.
6080 exactly what people expect it to from their shell experience.
6077
6081
6078 Added a check to the @reset command (since it's so
6082 Added a check to the @reset command (since it's so
6079 destructive, it's probably a good idea to ask for confirmation).
6083 destructive, it's probably a good idea to ask for confirmation).
6080 But now reset only works for full namespace resetting. Since the
6084 But now reset only works for full namespace resetting. Since the
6081 del keyword is already there for deleting a few specific
6085 del keyword is already there for deleting a few specific
6082 variables, I don't see the point of having a redundant magic
6086 variables, I don't see the point of having a redundant magic
6083 function for the same task.
6087 function for the same task.
6084
6088
6085 2001-11-24 Fernando Perez <fperez@colorado.edu>
6089 2001-11-24 Fernando Perez <fperez@colorado.edu>
6086
6090
6087 * Updated the builtin docs (esp. the ? ones).
6091 * Updated the builtin docs (esp. the ? ones).
6088
6092
6089 * Ran all the code through pychecker. Not terribly impressed with
6093 * Ran all the code through pychecker. Not terribly impressed with
6090 it: lots of spurious warnings and didn't really find anything of
6094 it: lots of spurious warnings and didn't really find anything of
6091 substance (just a few modules being imported and not used).
6095 substance (just a few modules being imported and not used).
6092
6096
6093 * Implemented the new ultraTB functionality into IPython. New
6097 * Implemented the new ultraTB functionality into IPython. New
6094 option: xcolors. This chooses color scheme. xmode now only selects
6098 option: xcolors. This chooses color scheme. xmode now only selects
6095 between Plain and Verbose. Better orthogonality.
6099 between Plain and Verbose. Better orthogonality.
6096
6100
6097 * Large rewrite of ultraTB. Much cleaner now, with a separation of
6101 * Large rewrite of ultraTB. Much cleaner now, with a separation of
6098 mode and color scheme for the exception handlers. Now it's
6102 mode and color scheme for the exception handlers. Now it's
6099 possible to have the verbose traceback with no coloring.
6103 possible to have the verbose traceback with no coloring.
6100
6104
6101 2001-11-23 Fernando Perez <fperez@colorado.edu>
6105 2001-11-23 Fernando Perez <fperez@colorado.edu>
6102
6106
6103 * Version 0.1.12 released, 0.1.13 opened.
6107 * Version 0.1.12 released, 0.1.13 opened.
6104
6108
6105 * Removed option to set auto-quote and auto-paren escapes by
6109 * Removed option to set auto-quote and auto-paren escapes by
6106 user. The chances of breaking valid syntax are just too high. If
6110 user. The chances of breaking valid syntax are just too high. If
6107 someone *really* wants, they can always dig into the code.
6111 someone *really* wants, they can always dig into the code.
6108
6112
6109 * Made prompt separators configurable.
6113 * Made prompt separators configurable.
6110
6114
6111 2001-11-22 Fernando Perez <fperez@colorado.edu>
6115 2001-11-22 Fernando Perez <fperez@colorado.edu>
6112
6116
6113 * Small bugfixes in many places.
6117 * Small bugfixes in many places.
6114
6118
6115 * Removed the MyCompleter class from ipplib. It seemed redundant
6119 * Removed the MyCompleter class from ipplib. It seemed redundant
6116 with the C-p,C-n history search functionality. Less code to
6120 with the C-p,C-n history search functionality. Less code to
6117 maintain.
6121 maintain.
6118
6122
6119 * Moved all the original ipython.py code into ipythonlib.py. Right
6123 * Moved all the original ipython.py code into ipythonlib.py. Right
6120 now it's just one big dump into a function called make_IPython, so
6124 now it's just one big dump into a function called make_IPython, so
6121 no real modularity has been gained. But at least it makes the
6125 no real modularity has been gained. But at least it makes the
6122 wrapper script tiny, and since ipythonlib is a module, it gets
6126 wrapper script tiny, and since ipythonlib is a module, it gets
6123 compiled and startup is much faster.
6127 compiled and startup is much faster.
6124
6128
6125 This is a reasobably 'deep' change, so we should test it for a
6129 This is a reasobably 'deep' change, so we should test it for a
6126 while without messing too much more with the code.
6130 while without messing too much more with the code.
6127
6131
6128 2001-11-21 Fernando Perez <fperez@colorado.edu>
6132 2001-11-21 Fernando Perez <fperez@colorado.edu>
6129
6133
6130 * Version 0.1.11 released, 0.1.12 opened for further work.
6134 * Version 0.1.11 released, 0.1.12 opened for further work.
6131
6135
6132 * Removed dependency on Itpl. It was only needed in one place. It
6136 * Removed dependency on Itpl. It was only needed in one place. It
6133 would be nice if this became part of python, though. It makes life
6137 would be nice if this became part of python, though. It makes life
6134 *a lot* easier in some cases.
6138 *a lot* easier in some cases.
6135
6139
6136 * Simplified the prefilter code a bit. Now all handlers are
6140 * Simplified the prefilter code a bit. Now all handlers are
6137 expected to explicitly return a value (at least a blank string).
6141 expected to explicitly return a value (at least a blank string).
6138
6142
6139 * Heavy edits in ipplib. Removed the help system altogether. Now
6143 * Heavy edits in ipplib. Removed the help system altogether. Now
6140 obj?/?? is used for inspecting objects, a magic @doc prints
6144 obj?/?? is used for inspecting objects, a magic @doc prints
6141 docstrings, and full-blown Python help is accessed via the 'help'
6145 docstrings, and full-blown Python help is accessed via the 'help'
6142 keyword. This cleans up a lot of code (less to maintain) and does
6146 keyword. This cleans up a lot of code (less to maintain) and does
6143 the job. Since 'help' is now a standard Python component, might as
6147 the job. Since 'help' is now a standard Python component, might as
6144 well use it and remove duplicate functionality.
6148 well use it and remove duplicate functionality.
6145
6149
6146 Also removed the option to use ipplib as a standalone program. By
6150 Also removed the option to use ipplib as a standalone program. By
6147 now it's too dependent on other parts of IPython to function alone.
6151 now it's too dependent on other parts of IPython to function alone.
6148
6152
6149 * Fixed bug in genutils.pager. It would crash if the pager was
6153 * Fixed bug in genutils.pager. It would crash if the pager was
6150 exited immediately after opening (broken pipe).
6154 exited immediately after opening (broken pipe).
6151
6155
6152 * Trimmed down the VerboseTB reporting a little. The header is
6156 * Trimmed down the VerboseTB reporting a little. The header is
6153 much shorter now and the repeated exception arguments at the end
6157 much shorter now and the repeated exception arguments at the end
6154 have been removed. For interactive use the old header seemed a bit
6158 have been removed. For interactive use the old header seemed a bit
6155 excessive.
6159 excessive.
6156
6160
6157 * Fixed small bug in output of @whos for variables with multi-word
6161 * Fixed small bug in output of @whos for variables with multi-word
6158 types (only first word was displayed).
6162 types (only first word was displayed).
6159
6163
6160 2001-11-17 Fernando Perez <fperez@colorado.edu>
6164 2001-11-17 Fernando Perez <fperez@colorado.edu>
6161
6165
6162 * Version 0.1.10 released, 0.1.11 opened for further work.
6166 * Version 0.1.10 released, 0.1.11 opened for further work.
6163
6167
6164 * Modified dirs and friends. dirs now *returns* the stack (not
6168 * Modified dirs and friends. dirs now *returns* the stack (not
6165 prints), so one can manipulate it as a variable. Convenient to
6169 prints), so one can manipulate it as a variable. Convenient to
6166 travel along many directories.
6170 travel along many directories.
6167
6171
6168 * Fixed bug in magic_pdef: would only work with functions with
6172 * Fixed bug in magic_pdef: would only work with functions with
6169 arguments with default values.
6173 arguments with default values.
6170
6174
6171 2001-11-14 Fernando Perez <fperez@colorado.edu>
6175 2001-11-14 Fernando Perez <fperez@colorado.edu>
6172
6176
6173 * Added the PhysicsInput stuff to dot_ipython so it ships as an
6177 * Added the PhysicsInput stuff to dot_ipython so it ships as an
6174 example with IPython. Various other minor fixes and cleanups.
6178 example with IPython. Various other minor fixes and cleanups.
6175
6179
6176 * Version 0.1.9 released, 0.1.10 opened for further work.
6180 * Version 0.1.9 released, 0.1.10 opened for further work.
6177
6181
6178 * Added sys.path to the list of directories searched in the
6182 * Added sys.path to the list of directories searched in the
6179 execfile= option. It used to be the current directory and the
6183 execfile= option. It used to be the current directory and the
6180 user's IPYTHONDIR only.
6184 user's IPYTHONDIR only.
6181
6185
6182 2001-11-13 Fernando Perez <fperez@colorado.edu>
6186 2001-11-13 Fernando Perez <fperez@colorado.edu>
6183
6187
6184 * Reinstated the raw_input/prefilter separation that Janko had
6188 * Reinstated the raw_input/prefilter separation that Janko had
6185 initially. This gives a more convenient setup for extending the
6189 initially. This gives a more convenient setup for extending the
6186 pre-processor from the outside: raw_input always gets a string,
6190 pre-processor from the outside: raw_input always gets a string,
6187 and prefilter has to process it. We can then redefine prefilter
6191 and prefilter has to process it. We can then redefine prefilter
6188 from the outside and implement extensions for special
6192 from the outside and implement extensions for special
6189 purposes.
6193 purposes.
6190
6194
6191 Today I got one for inputting PhysicalQuantity objects
6195 Today I got one for inputting PhysicalQuantity objects
6192 (from Scientific) without needing any function calls at
6196 (from Scientific) without needing any function calls at
6193 all. Extremely convenient, and it's all done as a user-level
6197 all. Extremely convenient, and it's all done as a user-level
6194 extension (no IPython code was touched). Now instead of:
6198 extension (no IPython code was touched). Now instead of:
6195 a = PhysicalQuantity(4.2,'m/s**2')
6199 a = PhysicalQuantity(4.2,'m/s**2')
6196 one can simply say
6200 one can simply say
6197 a = 4.2 m/s**2
6201 a = 4.2 m/s**2
6198 or even
6202 or even
6199 a = 4.2 m/s^2
6203 a = 4.2 m/s^2
6200
6204
6201 I use this, but it's also a proof of concept: IPython really is
6205 I use this, but it's also a proof of concept: IPython really is
6202 fully user-extensible, even at the level of the parsing of the
6206 fully user-extensible, even at the level of the parsing of the
6203 command line. It's not trivial, but it's perfectly doable.
6207 command line. It's not trivial, but it's perfectly doable.
6204
6208
6205 * Added 'add_flip' method to inclusion conflict resolver. Fixes
6209 * Added 'add_flip' method to inclusion conflict resolver. Fixes
6206 the problem of modules being loaded in the inverse order in which
6210 the problem of modules being loaded in the inverse order in which
6207 they were defined in
6211 they were defined in
6208
6212
6209 * Version 0.1.8 released, 0.1.9 opened for further work.
6213 * Version 0.1.8 released, 0.1.9 opened for further work.
6210
6214
6211 * Added magics pdef, source and file. They respectively show the
6215 * Added magics pdef, source and file. They respectively show the
6212 definition line ('prototype' in C), source code and full python
6216 definition line ('prototype' in C), source code and full python
6213 file for any callable object. The object inspector oinfo uses
6217 file for any callable object. The object inspector oinfo uses
6214 these to show the same information.
6218 these to show the same information.
6215
6219
6216 * Version 0.1.7 released, 0.1.8 opened for further work.
6220 * Version 0.1.7 released, 0.1.8 opened for further work.
6217
6221
6218 * Separated all the magic functions into a class called Magic. The
6222 * Separated all the magic functions into a class called Magic. The
6219 InteractiveShell class was becoming too big for Xemacs to handle
6223 InteractiveShell class was becoming too big for Xemacs to handle
6220 (de-indenting a line would lock it up for 10 seconds while it
6224 (de-indenting a line would lock it up for 10 seconds while it
6221 backtracked on the whole class!)
6225 backtracked on the whole class!)
6222
6226
6223 FIXME: didn't work. It can be done, but right now namespaces are
6227 FIXME: didn't work. It can be done, but right now namespaces are
6224 all messed up. Do it later (reverted it for now, so at least
6228 all messed up. Do it later (reverted it for now, so at least
6225 everything works as before).
6229 everything works as before).
6226
6230
6227 * Got the object introspection system (magic_oinfo) working! I
6231 * Got the object introspection system (magic_oinfo) working! I
6228 think this is pretty much ready for release to Janko, so he can
6232 think this is pretty much ready for release to Janko, so he can
6229 test it for a while and then announce it. Pretty much 100% of what
6233 test it for a while and then announce it. Pretty much 100% of what
6230 I wanted for the 'phase 1' release is ready. Happy, tired.
6234 I wanted for the 'phase 1' release is ready. Happy, tired.
6231
6235
6232 2001-11-12 Fernando Perez <fperez@colorado.edu>
6236 2001-11-12 Fernando Perez <fperez@colorado.edu>
6233
6237
6234 * Version 0.1.6 released, 0.1.7 opened for further work.
6238 * Version 0.1.6 released, 0.1.7 opened for further work.
6235
6239
6236 * Fixed bug in printing: it used to test for truth before
6240 * Fixed bug in printing: it used to test for truth before
6237 printing, so 0 wouldn't print. Now checks for None.
6241 printing, so 0 wouldn't print. Now checks for None.
6238
6242
6239 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
6243 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
6240 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
6244 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
6241 reaches by hand into the outputcache. Think of a better way to do
6245 reaches by hand into the outputcache. Think of a better way to do
6242 this later.
6246 this later.
6243
6247
6244 * Various small fixes thanks to Nathan's comments.
6248 * Various small fixes thanks to Nathan's comments.
6245
6249
6246 * Changed magic_pprint to magic_Pprint. This way it doesn't
6250 * Changed magic_pprint to magic_Pprint. This way it doesn't
6247 collide with pprint() and the name is consistent with the command
6251 collide with pprint() and the name is consistent with the command
6248 line option.
6252 line option.
6249
6253
6250 * Changed prompt counter behavior to be fully like
6254 * Changed prompt counter behavior to be fully like
6251 Mathematica's. That is, even input that doesn't return a result
6255 Mathematica's. That is, even input that doesn't return a result
6252 raises the prompt counter. The old behavior was kind of confusing
6256 raises the prompt counter. The old behavior was kind of confusing
6253 (getting the same prompt number several times if the operation
6257 (getting the same prompt number several times if the operation
6254 didn't return a result).
6258 didn't return a result).
6255
6259
6256 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
6260 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
6257
6261
6258 * Fixed -Classic mode (wasn't working anymore).
6262 * Fixed -Classic mode (wasn't working anymore).
6259
6263
6260 * Added colored prompts using Nathan's new code. Colors are
6264 * Added colored prompts using Nathan's new code. Colors are
6261 currently hardwired, they can be user-configurable. For
6265 currently hardwired, they can be user-configurable. For
6262 developers, they can be chosen in file ipythonlib.py, at the
6266 developers, they can be chosen in file ipythonlib.py, at the
6263 beginning of the CachedOutput class def.
6267 beginning of the CachedOutput class def.
6264
6268
6265 2001-11-11 Fernando Perez <fperez@colorado.edu>
6269 2001-11-11 Fernando Perez <fperez@colorado.edu>
6266
6270
6267 * Version 0.1.5 released, 0.1.6 opened for further work.
6271 * Version 0.1.5 released, 0.1.6 opened for further work.
6268
6272
6269 * Changed magic_env to *return* the environment as a dict (not to
6273 * Changed magic_env to *return* the environment as a dict (not to
6270 print it). This way it prints, but it can also be processed.
6274 print it). This way it prints, but it can also be processed.
6271
6275
6272 * Added Verbose exception reporting to interactive
6276 * Added Verbose exception reporting to interactive
6273 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6277 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6274 traceback. Had to make some changes to the ultraTB file. This is
6278 traceback. Had to make some changes to the ultraTB file. This is
6275 probably the last 'big' thing in my mental todo list. This ties
6279 probably the last 'big' thing in my mental todo list. This ties
6276 in with the next entry:
6280 in with the next entry:
6277
6281
6278 * Changed -Xi and -Xf to a single -xmode option. Now all the user
6282 * Changed -Xi and -Xf to a single -xmode option. Now all the user
6279 has to specify is Plain, Color or Verbose for all exception
6283 has to specify is Plain, Color or Verbose for all exception
6280 handling.
6284 handling.
6281
6285
6282 * Removed ShellServices option. All this can really be done via
6286 * Removed ShellServices option. All this can really be done via
6283 the magic system. It's easier to extend, cleaner and has automatic
6287 the magic system. It's easier to extend, cleaner and has automatic
6284 namespace protection and documentation.
6288 namespace protection and documentation.
6285
6289
6286 2001-11-09 Fernando Perez <fperez@colorado.edu>
6290 2001-11-09 Fernando Perez <fperez@colorado.edu>
6287
6291
6288 * Fixed bug in output cache flushing (missing parameter to
6292 * Fixed bug in output cache flushing (missing parameter to
6289 __init__). Other small bugs fixed (found using pychecker).
6293 __init__). Other small bugs fixed (found using pychecker).
6290
6294
6291 * Version 0.1.4 opened for bugfixing.
6295 * Version 0.1.4 opened for bugfixing.
6292
6296
6293 2001-11-07 Fernando Perez <fperez@colorado.edu>
6297 2001-11-07 Fernando Perez <fperez@colorado.edu>
6294
6298
6295 * Version 0.1.3 released, mainly because of the raw_input bug.
6299 * Version 0.1.3 released, mainly because of the raw_input bug.
6296
6300
6297 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6301 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6298 and when testing for whether things were callable, a call could
6302 and when testing for whether things were callable, a call could
6299 actually be made to certain functions. They would get called again
6303 actually be made to certain functions. They would get called again
6300 once 'really' executed, with a resulting double call. A disaster
6304 once 'really' executed, with a resulting double call. A disaster
6301 in many cases (list.reverse() would never work!).
6305 in many cases (list.reverse() would never work!).
6302
6306
6303 * Removed prefilter() function, moved its code to raw_input (which
6307 * Removed prefilter() function, moved its code to raw_input (which
6304 after all was just a near-empty caller for prefilter). This saves
6308 after all was just a near-empty caller for prefilter). This saves
6305 a function call on every prompt, and simplifies the class a tiny bit.
6309 a function call on every prompt, and simplifies the class a tiny bit.
6306
6310
6307 * Fix _ip to __ip name in magic example file.
6311 * Fix _ip to __ip name in magic example file.
6308
6312
6309 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6313 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6310 work with non-gnu versions of tar.
6314 work with non-gnu versions of tar.
6311
6315
6312 2001-11-06 Fernando Perez <fperez@colorado.edu>
6316 2001-11-06 Fernando Perez <fperez@colorado.edu>
6313
6317
6314 * Version 0.1.2. Just to keep track of the recent changes.
6318 * Version 0.1.2. Just to keep track of the recent changes.
6315
6319
6316 * Fixed nasty bug in output prompt routine. It used to check 'if
6320 * Fixed nasty bug in output prompt routine. It used to check 'if
6317 arg != None...'. Problem is, this fails if arg implements a
6321 arg != None...'. Problem is, this fails if arg implements a
6318 special comparison (__cmp__) which disallows comparing to
6322 special comparison (__cmp__) which disallows comparing to
6319 None. Found it when trying to use the PhysicalQuantity module from
6323 None. Found it when trying to use the PhysicalQuantity module from
6320 ScientificPython.
6324 ScientificPython.
6321
6325
6322 2001-11-05 Fernando Perez <fperez@colorado.edu>
6326 2001-11-05 Fernando Perez <fperez@colorado.edu>
6323
6327
6324 * Also added dirs. Now the pushd/popd/dirs family functions
6328 * Also added dirs. Now the pushd/popd/dirs family functions
6325 basically like the shell, with the added convenience of going home
6329 basically like the shell, with the added convenience of going home
6326 when called with no args.
6330 when called with no args.
6327
6331
6328 * pushd/popd slightly modified to mimic shell behavior more
6332 * pushd/popd slightly modified to mimic shell behavior more
6329 closely.
6333 closely.
6330
6334
6331 * Added env,pushd,popd from ShellServices as magic functions. I
6335 * Added env,pushd,popd from ShellServices as magic functions. I
6332 think the cleanest will be to port all desired functions from
6336 think the cleanest will be to port all desired functions from
6333 ShellServices as magics and remove ShellServices altogether. This
6337 ShellServices as magics and remove ShellServices altogether. This
6334 will provide a single, clean way of adding functionality
6338 will provide a single, clean way of adding functionality
6335 (shell-type or otherwise) to IP.
6339 (shell-type or otherwise) to IP.
6336
6340
6337 2001-11-04 Fernando Perez <fperez@colorado.edu>
6341 2001-11-04 Fernando Perez <fperez@colorado.edu>
6338
6342
6339 * Added .ipython/ directory to sys.path. This way users can keep
6343 * Added .ipython/ directory to sys.path. This way users can keep
6340 customizations there and access them via import.
6344 customizations there and access them via import.
6341
6345
6342 2001-11-03 Fernando Perez <fperez@colorado.edu>
6346 2001-11-03 Fernando Perez <fperez@colorado.edu>
6343
6347
6344 * Opened version 0.1.1 for new changes.
6348 * Opened version 0.1.1 for new changes.
6345
6349
6346 * Changed version number to 0.1.0: first 'public' release, sent to
6350 * Changed version number to 0.1.0: first 'public' release, sent to
6347 Nathan and Janko.
6351 Nathan and Janko.
6348
6352
6349 * Lots of small fixes and tweaks.
6353 * Lots of small fixes and tweaks.
6350
6354
6351 * Minor changes to whos format. Now strings are shown, snipped if
6355 * Minor changes to whos format. Now strings are shown, snipped if
6352 too long.
6356 too long.
6353
6357
6354 * Changed ShellServices to work on __main__ so they show up in @who
6358 * Changed ShellServices to work on __main__ so they show up in @who
6355
6359
6356 * Help also works with ? at the end of a line:
6360 * Help also works with ? at the end of a line:
6357 ?sin and sin?
6361 ?sin and sin?
6358 both produce the same effect. This is nice, as often I use the
6362 both produce the same effect. This is nice, as often I use the
6359 tab-complete to find the name of a method, but I used to then have
6363 tab-complete to find the name of a method, but I used to then have
6360 to go to the beginning of the line to put a ? if I wanted more
6364 to go to the beginning of the line to put a ? if I wanted more
6361 info. Now I can just add the ? and hit return. Convenient.
6365 info. Now I can just add the ? and hit return. Convenient.
6362
6366
6363 2001-11-02 Fernando Perez <fperez@colorado.edu>
6367 2001-11-02 Fernando Perez <fperez@colorado.edu>
6364
6368
6365 * Python version check (>=2.1) added.
6369 * Python version check (>=2.1) added.
6366
6370
6367 * Added LazyPython documentation. At this point the docs are quite
6371 * Added LazyPython documentation. At this point the docs are quite
6368 a mess. A cleanup is in order.
6372 a mess. A cleanup is in order.
6369
6373
6370 * Auto-installer created. For some bizarre reason, the zipfiles
6374 * Auto-installer created. For some bizarre reason, the zipfiles
6371 module isn't working on my system. So I made a tar version
6375 module isn't working on my system. So I made a tar version
6372 (hopefully the command line options in various systems won't kill
6376 (hopefully the command line options in various systems won't kill
6373 me).
6377 me).
6374
6378
6375 * Fixes to Struct in genutils. Now all dictionary-like methods are
6379 * Fixes to Struct in genutils. Now all dictionary-like methods are
6376 protected (reasonably).
6380 protected (reasonably).
6377
6381
6378 * Added pager function to genutils and changed ? to print usage
6382 * Added pager function to genutils and changed ? to print usage
6379 note through it (it was too long).
6383 note through it (it was too long).
6380
6384
6381 * Added the LazyPython functionality. Works great! I changed the
6385 * Added the LazyPython functionality. Works great! I changed the
6382 auto-quote escape to ';', it's on home row and next to '. But
6386 auto-quote escape to ';', it's on home row and next to '. But
6383 both auto-quote and auto-paren (still /) escapes are command-line
6387 both auto-quote and auto-paren (still /) escapes are command-line
6384 parameters.
6388 parameters.
6385
6389
6386
6390
6387 2001-11-01 Fernando Perez <fperez@colorado.edu>
6391 2001-11-01 Fernando Perez <fperez@colorado.edu>
6388
6392
6389 * Version changed to 0.0.7. Fairly large change: configuration now
6393 * Version changed to 0.0.7. Fairly large change: configuration now
6390 is all stored in a directory, by default .ipython. There, all
6394 is all stored in a directory, by default .ipython. There, all
6391 config files have normal looking names (not .names)
6395 config files have normal looking names (not .names)
6392
6396
6393 * Version 0.0.6 Released first to Lucas and Archie as a test
6397 * Version 0.0.6 Released first to Lucas and Archie as a test
6394 run. Since it's the first 'semi-public' release, change version to
6398 run. Since it's the first 'semi-public' release, change version to
6395 > 0.0.6 for any changes now.
6399 > 0.0.6 for any changes now.
6396
6400
6397 * Stuff I had put in the ipplib.py changelog:
6401 * Stuff I had put in the ipplib.py changelog:
6398
6402
6399 Changes to InteractiveShell:
6403 Changes to InteractiveShell:
6400
6404
6401 - Made the usage message a parameter.
6405 - Made the usage message a parameter.
6402
6406
6403 - Require the name of the shell variable to be given. It's a bit
6407 - Require the name of the shell variable to be given. It's a bit
6404 of a hack, but allows the name 'shell' not to be hardwired in the
6408 of a hack, but allows the name 'shell' not to be hardwired in the
6405 magic (@) handler, which is problematic b/c it requires
6409 magic (@) handler, which is problematic b/c it requires
6406 polluting the global namespace with 'shell'. This in turn is
6410 polluting the global namespace with 'shell'. This in turn is
6407 fragile: if a user redefines a variable called shell, things
6411 fragile: if a user redefines a variable called shell, things
6408 break.
6412 break.
6409
6413
6410 - magic @: all functions available through @ need to be defined
6414 - magic @: all functions available through @ need to be defined
6411 as magic_<name>, even though they can be called simply as
6415 as magic_<name>, even though they can be called simply as
6412 @<name>. This allows the special command @magic to gather
6416 @<name>. This allows the special command @magic to gather
6413 information automatically about all existing magic functions,
6417 information automatically about all existing magic functions,
6414 even if they are run-time user extensions, by parsing the shell
6418 even if they are run-time user extensions, by parsing the shell
6415 instance __dict__ looking for special magic_ names.
6419 instance __dict__ looking for special magic_ names.
6416
6420
6417 - mainloop: added *two* local namespace parameters. This allows
6421 - mainloop: added *two* local namespace parameters. This allows
6418 the class to differentiate between parameters which were there
6422 the class to differentiate between parameters which were there
6419 before and after command line initialization was processed. This
6423 before and after command line initialization was processed. This
6420 way, later @who can show things loaded at startup by the
6424 way, later @who can show things loaded at startup by the
6421 user. This trick was necessary to make session saving/reloading
6425 user. This trick was necessary to make session saving/reloading
6422 really work: ideally after saving/exiting/reloading a session,
6426 really work: ideally after saving/exiting/reloading a session,
6423 *everything* should look the same, including the output of @who. I
6427 *everything* should look the same, including the output of @who. I
6424 was only able to make this work with this double namespace
6428 was only able to make this work with this double namespace
6425 trick.
6429 trick.
6426
6430
6427 - added a header to the logfile which allows (almost) full
6431 - added a header to the logfile which allows (almost) full
6428 session restoring.
6432 session restoring.
6429
6433
6430 - prepend lines beginning with @ or !, with a and log
6434 - prepend lines beginning with @ or !, with a and log
6431 them. Why? !lines: may be useful to know what you did @lines:
6435 them. Why? !lines: may be useful to know what you did @lines:
6432 they may affect session state. So when restoring a session, at
6436 they may affect session state. So when restoring a session, at
6433 least inform the user of their presence. I couldn't quite get
6437 least inform the user of their presence. I couldn't quite get
6434 them to properly re-execute, but at least the user is warned.
6438 them to properly re-execute, but at least the user is warned.
6435
6439
6436 * Started ChangeLog.
6440 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now