##// END OF EJS Templates
Fix extra newlines in autocalling.
fperez -
Show More
@@ -1,2047 +1,2047 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 IPython -- An enhanced Interactive Python
3 IPython -- An enhanced Interactive Python
4
4
5 Requires Python 2.1 or newer.
5 Requires Python 2.1 or newer.
6
6
7 This file contains all the classes and helper functions specific to IPython.
7 This file contains all the classes and helper functions specific to IPython.
8
8
9 $Id: iplib.py 802 2005-09-06 03:49:12Z fperez $
9 $Id: iplib.py 807 2005-09-07 01:55:33Z fperez $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
14 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
14 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
15 #
15 #
16 # Distributed under the terms of the BSD License. The full license is in
16 # Distributed under the terms of the BSD License. The full license is in
17 # the file COPYING, distributed as part of this software.
17 # the file COPYING, distributed as part of this software.
18 #
18 #
19 # Note: this code originally subclassed code.InteractiveConsole from the
19 # Note: this code originally subclassed code.InteractiveConsole from the
20 # Python standard library. Over time, much of that class has been copied
20 # Python standard library. Over time, much of that class has been copied
21 # verbatim here for modifications which could not be accomplished by
21 # verbatim here for modifications which could not be accomplished by
22 # subclassing. The Python License (sec. 2) allows for this, but it's always
22 # subclassing. The Python License (sec. 2) allows for this, but it's always
23 # nice to acknowledge credit where credit is due.
23 # nice to acknowledge credit where credit is due.
24 #*****************************************************************************
24 #*****************************************************************************
25
25
26 #****************************************************************************
26 #****************************************************************************
27 # Modules and globals
27 # Modules and globals
28
28
29 from __future__ import generators # for 2.2 backwards-compatibility
29 from __future__ import generators # for 2.2 backwards-compatibility
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 exceptions
40 import exceptions
41 import keyword
41 import keyword
42 import new
42 import new
43 import os, sys, shutil
43 import os, sys, shutil
44 import code, glob, types, re
44 import code, glob, types, re
45 import string, StringIO
45 import string, StringIO
46 import inspect, pydoc
46 import inspect, pydoc
47 import bdb, pdb
47 import bdb, pdb
48 import UserList # don't subclass list so this works with Python2.1
48 import UserList # don't subclass list so this works with Python2.1
49 from pprint import pprint, pformat
49 from pprint import pprint, pformat
50 import cPickle as pickle
50 import cPickle as pickle
51 import traceback
51 import traceback
52
52
53 # IPython's own modules
53 # IPython's own modules
54 import IPython
54 import IPython
55 from IPython import OInspect,PyColorize,ultraTB
55 from IPython import OInspect,PyColorize,ultraTB
56 from IPython.ultraTB import ColorScheme,ColorSchemeTable # too long names
56 from IPython.ultraTB import ColorScheme,ColorSchemeTable # too long names
57 from IPython.Logger import Logger
57 from IPython.Logger import Logger
58 from IPython.Magic import Magic,magic2python,shlex_split
58 from IPython.Magic import Magic,magic2python,shlex_split
59 from IPython.usage import cmd_line_usage,interactive_usage
59 from IPython.usage import cmd_line_usage,interactive_usage
60 from IPython.Struct import Struct
60 from IPython.Struct import Struct
61 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
61 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
62 from IPython.FakeModule import FakeModule
62 from IPython.FakeModule import FakeModule
63 from IPython.background_jobs import BackgroundJobManager
63 from IPython.background_jobs import BackgroundJobManager
64 from IPython.genutils import *
64 from IPython.genutils import *
65
65
66 # Global pointer to the running
66 # Global pointer to the running
67
67
68 # store the builtin raw_input globally, and use this always, in case user code
68 # store the builtin raw_input globally, and use this always, in case user code
69 # overwrites it (like wx.py.PyShell does)
69 # overwrites it (like wx.py.PyShell does)
70 raw_input_original = raw_input
70 raw_input_original = raw_input
71
71
72 #****************************************************************************
72 #****************************************************************************
73 # Some utility function definitions
73 # Some utility function definitions
74
74
75 class Bunch: pass
75 class Bunch: pass
76
76
77 def esc_quotes(strng):
77 def esc_quotes(strng):
78 """Return the input string with single and double quotes escaped out"""
78 """Return the input string with single and double quotes escaped out"""
79
79
80 return strng.replace('"','\\"').replace("'","\\'")
80 return strng.replace('"','\\"').replace("'","\\'")
81
81
82 def import_fail_info(mod_name,fns=None):
82 def import_fail_info(mod_name,fns=None):
83 """Inform load failure for a module."""
83 """Inform load failure for a module."""
84
84
85 if fns == None:
85 if fns == None:
86 warn("Loading of %s failed.\n" % (mod_name,))
86 warn("Loading of %s failed.\n" % (mod_name,))
87 else:
87 else:
88 warn("Loading of %s from %s failed.\n" % (fns,mod_name))
88 warn("Loading of %s from %s failed.\n" % (fns,mod_name))
89
89
90 def qw_lol(indata):
90 def qw_lol(indata):
91 """qw_lol('a b') -> [['a','b']],
91 """qw_lol('a b') -> [['a','b']],
92 otherwise it's just a call to qw().
92 otherwise it's just a call to qw().
93
93
94 We need this to make sure the modules_some keys *always* end up as a
94 We need this to make sure the modules_some keys *always* end up as a
95 list of lists."""
95 list of lists."""
96
96
97 if type(indata) in StringTypes:
97 if type(indata) in StringTypes:
98 return [qw(indata)]
98 return [qw(indata)]
99 else:
99 else:
100 return qw(indata)
100 return qw(indata)
101
101
102 def ipmagic(arg_s):
102 def ipmagic(arg_s):
103 """Call a magic function by name.
103 """Call a magic function by name.
104
104
105 Input: a string containing the name of the magic function to call and any
105 Input: a string containing the name of the magic function to call and any
106 additional arguments to be passed to the magic.
106 additional arguments to be passed to the magic.
107
107
108 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
108 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
109 prompt:
109 prompt:
110
110
111 In[1]: %name -opt foo bar
111 In[1]: %name -opt foo bar
112
112
113 To call a magic without arguments, simply use ipmagic('name').
113 To call a magic without arguments, simply use ipmagic('name').
114
114
115 This provides a proper Python function to call IPython's magics in any
115 This provides a proper Python function to call IPython's magics in any
116 valid Python code you can type at the interpreter, including loops and
116 valid Python code you can type at the interpreter, including loops and
117 compound statements. It is added by IPython to the Python builtin
117 compound statements. It is added by IPython to the Python builtin
118 namespace upon initialization."""
118 namespace upon initialization."""
119
119
120 args = arg_s.split(' ',1)
120 args = arg_s.split(' ',1)
121 magic_name = args[0]
121 magic_name = args[0]
122 if magic_name.startswith(__IPYTHON__.ESC_MAGIC):
122 if magic_name.startswith(__IPYTHON__.ESC_MAGIC):
123 magic_name = magic_name[1:]
123 magic_name = magic_name[1:]
124 try:
124 try:
125 magic_args = args[1]
125 magic_args = args[1]
126 except IndexError:
126 except IndexError:
127 magic_args = ''
127 magic_args = ''
128 fn = getattr(__IPYTHON__,'magic_'+magic_name,None)
128 fn = getattr(__IPYTHON__,'magic_'+magic_name,None)
129 if fn is None:
129 if fn is None:
130 error("Magic function `%s` not found." % magic_name)
130 error("Magic function `%s` not found." % magic_name)
131 else:
131 else:
132 magic_args = __IPYTHON__.var_expand(magic_args)
132 magic_args = __IPYTHON__.var_expand(magic_args)
133 return fn(magic_args)
133 return fn(magic_args)
134
134
135 def ipalias(arg_s):
135 def ipalias(arg_s):
136 """Call an alias by name.
136 """Call an alias by name.
137
137
138 Input: a string containing the name of the alias to call and any
138 Input: a string containing the name of the alias to call and any
139 additional arguments to be passed to the magic.
139 additional arguments to be passed to the magic.
140
140
141 ipalias('name -opt foo bar') is equivalent to typing at the ipython
141 ipalias('name -opt foo bar') is equivalent to typing at the ipython
142 prompt:
142 prompt:
143
143
144 In[1]: name -opt foo bar
144 In[1]: name -opt foo bar
145
145
146 To call an alias without arguments, simply use ipalias('name').
146 To call an alias without arguments, simply use ipalias('name').
147
147
148 This provides a proper Python function to call IPython's aliases in any
148 This provides a proper Python function to call IPython's aliases in any
149 valid Python code you can type at the interpreter, including loops and
149 valid Python code you can type at the interpreter, including loops and
150 compound statements. It is added by IPython to the Python builtin
150 compound statements. It is added by IPython to the Python builtin
151 namespace upon initialization."""
151 namespace upon initialization."""
152
152
153 args = arg_s.split(' ',1)
153 args = arg_s.split(' ',1)
154 alias_name = args[0]
154 alias_name = args[0]
155 try:
155 try:
156 alias_args = args[1]
156 alias_args = args[1]
157 except IndexError:
157 except IndexError:
158 alias_args = ''
158 alias_args = ''
159 if alias_name in __IPYTHON__.alias_table:
159 if alias_name in __IPYTHON__.alias_table:
160 __IPYTHON__.call_alias(alias_name,alias_args)
160 __IPYTHON__.call_alias(alias_name,alias_args)
161 else:
161 else:
162 error("Alias `%s` not found." % alias_name)
162 error("Alias `%s` not found." % alias_name)
163
163
164 #-----------------------------------------------------------------------------
164 #-----------------------------------------------------------------------------
165 # Local use classes
165 # Local use classes
166 try:
166 try:
167 from IPython import FlexCompleter
167 from IPython import FlexCompleter
168
168
169 class MagicCompleter(FlexCompleter.Completer):
169 class MagicCompleter(FlexCompleter.Completer):
170 """Extension of the completer class to work on %-prefixed lines."""
170 """Extension of the completer class to work on %-prefixed lines."""
171
171
172 def __init__(self,shell,namespace=None,omit__names=0,alias_table=None):
172 def __init__(self,shell,namespace=None,omit__names=0,alias_table=None):
173 """MagicCompleter() -> completer
173 """MagicCompleter() -> completer
174
174
175 Return a completer object suitable for use by the readline library
175 Return a completer object suitable for use by the readline library
176 via readline.set_completer().
176 via readline.set_completer().
177
177
178 Inputs:
178 Inputs:
179
179
180 - shell: a pointer to the ipython shell itself. This is needed
180 - shell: a pointer to the ipython shell itself. This is needed
181 because this completer knows about magic functions, and those can
181 because this completer knows about magic functions, and those can
182 only be accessed via the ipython instance.
182 only be accessed via the ipython instance.
183
183
184 - namespace: an optional dict where completions are performed.
184 - namespace: an optional dict where completions are performed.
185
185
186 - The optional omit__names parameter sets the completer to omit the
186 - The optional omit__names parameter sets the completer to omit the
187 'magic' names (__magicname__) for python objects unless the text
187 'magic' names (__magicname__) for python objects unless the text
188 to be completed explicitly starts with one or more underscores.
188 to be completed explicitly starts with one or more underscores.
189
189
190 - If alias_table is supplied, it should be a dictionary of aliases
190 - If alias_table is supplied, it should be a dictionary of aliases
191 to complete. """
191 to complete. """
192
192
193 FlexCompleter.Completer.__init__(self,namespace)
193 FlexCompleter.Completer.__init__(self,namespace)
194 self.magic_prefix = shell.name+'.magic_'
194 self.magic_prefix = shell.name+'.magic_'
195 self.magic_escape = shell.ESC_MAGIC
195 self.magic_escape = shell.ESC_MAGIC
196 self.readline = FlexCompleter.readline
196 self.readline = FlexCompleter.readline
197 delims = self.readline.get_completer_delims()
197 delims = self.readline.get_completer_delims()
198 delims = delims.replace(self.magic_escape,'')
198 delims = delims.replace(self.magic_escape,'')
199 self.readline.set_completer_delims(delims)
199 self.readline.set_completer_delims(delims)
200 self.get_line_buffer = self.readline.get_line_buffer
200 self.get_line_buffer = self.readline.get_line_buffer
201 self.omit__names = omit__names
201 self.omit__names = omit__names
202 self.merge_completions = shell.rc.readline_merge_completions
202 self.merge_completions = shell.rc.readline_merge_completions
203
203
204 if alias_table is None:
204 if alias_table is None:
205 alias_table = {}
205 alias_table = {}
206 self.alias_table = alias_table
206 self.alias_table = alias_table
207 # Regexp to split filenames with spaces in them
207 # Regexp to split filenames with spaces in them
208 self.space_name_re = re.compile(r'([^\\] )')
208 self.space_name_re = re.compile(r'([^\\] )')
209 # Hold a local ref. to glob.glob for speed
209 # Hold a local ref. to glob.glob for speed
210 self.glob = glob.glob
210 self.glob = glob.glob
211 # Special handling of backslashes needed in win32 platforms
211 # Special handling of backslashes needed in win32 platforms
212 if sys.platform == "win32":
212 if sys.platform == "win32":
213 self.clean_glob = self._clean_glob_win32
213 self.clean_glob = self._clean_glob_win32
214 else:
214 else:
215 self.clean_glob = self._clean_glob
215 self.clean_glob = self._clean_glob
216 self.matchers = [self.python_matches,
216 self.matchers = [self.python_matches,
217 self.file_matches,
217 self.file_matches,
218 self.alias_matches,
218 self.alias_matches,
219 self.python_func_kw_matches]
219 self.python_func_kw_matches]
220
220
221 # Code contributed by Alex Schmolck, for ipython/emacs integration
221 # Code contributed by Alex Schmolck, for ipython/emacs integration
222 def all_completions(self, text):
222 def all_completions(self, text):
223 """Return all possible completions for the benefit of emacs."""
223 """Return all possible completions for the benefit of emacs."""
224
224
225 completions = []
225 completions = []
226 try:
226 try:
227 for i in xrange(sys.maxint):
227 for i in xrange(sys.maxint):
228 res = self.complete(text, i)
228 res = self.complete(text, i)
229
229
230 if not res: break
230 if not res: break
231
231
232 completions.append(res)
232 completions.append(res)
233 #XXX workaround for ``notDefined.<tab>``
233 #XXX workaround for ``notDefined.<tab>``
234 except NameError:
234 except NameError:
235 pass
235 pass
236 return completions
236 return completions
237 # /end Alex Schmolck code.
237 # /end Alex Schmolck code.
238
238
239 def _clean_glob(self,text):
239 def _clean_glob(self,text):
240 return self.glob("%s*" % text)
240 return self.glob("%s*" % text)
241
241
242 def _clean_glob_win32(self,text):
242 def _clean_glob_win32(self,text):
243 return [f.replace("\\","/")
243 return [f.replace("\\","/")
244 for f in self.glob("%s*" % text)]
244 for f in self.glob("%s*" % text)]
245
245
246 def file_matches(self, text):
246 def file_matches(self, text):
247 """Match filneames, expanding ~USER type strings.
247 """Match filneames, expanding ~USER type strings.
248
248
249 Most of the seemingly convoluted logic in this completer is an
249 Most of the seemingly convoluted logic in this completer is an
250 attempt to handle filenames with spaces in them. And yet it's not
250 attempt to handle filenames with spaces in them. And yet it's not
251 quite perfect, because Python's readline doesn't expose all of the
251 quite perfect, because Python's readline doesn't expose all of the
252 GNU readline details needed for this to be done correctly.
252 GNU readline details needed for this to be done correctly.
253
253
254 For a filename with a space in it, the printed completions will be
254 For a filename with a space in it, the printed completions will be
255 only the parts after what's already been typed (instead of the
255 only the parts after what's already been typed (instead of the
256 full completions, as is normally done). I don't think with the
256 full completions, as is normally done). I don't think with the
257 current (as of Python 2.3) Python readline it's possible to do
257 current (as of Python 2.3) Python readline it's possible to do
258 better."""
258 better."""
259
259
260 #print 'Completer->file_matches: <%s>' % text # dbg
260 #print 'Completer->file_matches: <%s>' % text # dbg
261
261
262 # chars that require escaping with backslash - i.e. chars
262 # chars that require escaping with backslash - i.e. chars
263 # that readline treats incorrectly as delimiters, but we
263 # that readline treats incorrectly as delimiters, but we
264 # don't want to treat as delimiters in filename matching
264 # don't want to treat as delimiters in filename matching
265 # when escaped with backslash
265 # when escaped with backslash
266
266
267 protectables = ' ()[]{}'
267 protectables = ' ()[]{}'
268
268
269 def protect_filename(s):
269 def protect_filename(s):
270 return "".join([(ch in protectables and '\\' + ch or ch)
270 return "".join([(ch in protectables and '\\' + ch or ch)
271 for ch in s])
271 for ch in s])
272
272
273 lbuf = self.get_line_buffer()[:self.readline.get_endidx()]
273 lbuf = self.get_line_buffer()[:self.readline.get_endidx()]
274 open_quotes = 0 # track strings with open quotes
274 open_quotes = 0 # track strings with open quotes
275 try:
275 try:
276 lsplit = shlex_split(lbuf)[-1]
276 lsplit = shlex_split(lbuf)[-1]
277 except ValueError:
277 except ValueError:
278 # typically an unmatched ", or backslash without escaped char.
278 # typically an unmatched ", or backslash without escaped char.
279 if lbuf.count('"')==1:
279 if lbuf.count('"')==1:
280 open_quotes = 1
280 open_quotes = 1
281 lsplit = lbuf.split('"')[-1]
281 lsplit = lbuf.split('"')[-1]
282 elif lbuf.count("'")==1:
282 elif lbuf.count("'")==1:
283 open_quotes = 1
283 open_quotes = 1
284 lsplit = lbuf.split("'")[-1]
284 lsplit = lbuf.split("'")[-1]
285 else:
285 else:
286 return None
286 return None
287 except IndexError:
287 except IndexError:
288 # tab pressed on empty line
288 # tab pressed on empty line
289 lsplit = ""
289 lsplit = ""
290
290
291 if lsplit != protect_filename(lsplit):
291 if lsplit != protect_filename(lsplit):
292 # if protectables are found, do matching on the whole escaped
292 # if protectables are found, do matching on the whole escaped
293 # name
293 # name
294 has_protectables = 1
294 has_protectables = 1
295 text0,text = text,lsplit
295 text0,text = text,lsplit
296 else:
296 else:
297 has_protectables = 0
297 has_protectables = 0
298 text = os.path.expanduser(text)
298 text = os.path.expanduser(text)
299
299
300 if text == "":
300 if text == "":
301 return [protect_filename(f) for f in self.glob("*")]
301 return [protect_filename(f) for f in self.glob("*")]
302
302
303 m0 = self.clean_glob(text.replace('\\',''))
303 m0 = self.clean_glob(text.replace('\\',''))
304 if has_protectables:
304 if has_protectables:
305 # If we had protectables, we need to revert our changes to the
305 # If we had protectables, we need to revert our changes to the
306 # beginning of filename so that we don't double-write the part
306 # beginning of filename so that we don't double-write the part
307 # of the filename we have so far
307 # of the filename we have so far
308 len_lsplit = len(lsplit)
308 len_lsplit = len(lsplit)
309 matches = [text0 + protect_filename(f[len_lsplit:]) for f in m0]
309 matches = [text0 + protect_filename(f[len_lsplit:]) for f in m0]
310 else:
310 else:
311 if open_quotes:
311 if open_quotes:
312 # if we have a string with an open quote, we don't need to
312 # if we have a string with an open quote, we don't need to
313 # protect the names at all (and we _shouldn't_, as it
313 # protect the names at all (and we _shouldn't_, as it
314 # would cause bugs when the filesystem call is made).
314 # would cause bugs when the filesystem call is made).
315 matches = m0
315 matches = m0
316 else:
316 else:
317 matches = [protect_filename(f) for f in m0]
317 matches = [protect_filename(f) for f in m0]
318 if len(matches) == 1 and os.path.isdir(matches[0]):
318 if len(matches) == 1 and os.path.isdir(matches[0]):
319 # Takes care of links to directories also. Use '/'
319 # Takes care of links to directories also. Use '/'
320 # explicitly, even under Windows, so that name completions
320 # explicitly, even under Windows, so that name completions
321 # don't end up escaped.
321 # don't end up escaped.
322 matches[0] += '/'
322 matches[0] += '/'
323 return matches
323 return matches
324
324
325 def alias_matches(self, text):
325 def alias_matches(self, text):
326 """Match internal system aliases"""
326 """Match internal system aliases"""
327 #print 'Completer->alias_matches:',text # dbg
327 #print 'Completer->alias_matches:',text # dbg
328 text = os.path.expanduser(text)
328 text = os.path.expanduser(text)
329 aliases = self.alias_table.keys()
329 aliases = self.alias_table.keys()
330 if text == "":
330 if text == "":
331 return aliases
331 return aliases
332 else:
332 else:
333 return [alias for alias in aliases if alias.startswith(text)]
333 return [alias for alias in aliases if alias.startswith(text)]
334
334
335 def python_matches(self,text):
335 def python_matches(self,text):
336 """Match attributes or global python names"""
336 """Match attributes or global python names"""
337 #print 'Completer->python_matches' # dbg
337 #print 'Completer->python_matches' # dbg
338 if "." in text:
338 if "." in text:
339 try:
339 try:
340 matches = self.attr_matches(text)
340 matches = self.attr_matches(text)
341 if text.endswith('.') and self.omit__names:
341 if text.endswith('.') and self.omit__names:
342 if self.omit__names == 1:
342 if self.omit__names == 1:
343 # true if txt is _not_ a __ name, false otherwise:
343 # true if txt is _not_ a __ name, false otherwise:
344 no__name = (lambda txt:
344 no__name = (lambda txt:
345 re.match(r'.*\.__.*?__',txt) is None)
345 re.match(r'.*\.__.*?__',txt) is None)
346 else:
346 else:
347 # true if txt is _not_ a _ name, false otherwise:
347 # true if txt is _not_ a _ name, false otherwise:
348 no__name = (lambda txt:
348 no__name = (lambda txt:
349 re.match(r'.*\._.*?',txt) is None)
349 re.match(r'.*\._.*?',txt) is None)
350 matches = filter(no__name, matches)
350 matches = filter(no__name, matches)
351 except NameError:
351 except NameError:
352 # catches <undefined attributes>.<tab>
352 # catches <undefined attributes>.<tab>
353 matches = []
353 matches = []
354 else:
354 else:
355 matches = self.global_matches(text)
355 matches = self.global_matches(text)
356 # this is so completion finds magics when automagic is on:
356 # this is so completion finds magics when automagic is on:
357 if matches == [] and not text.startswith(os.sep):
357 if matches == [] and not text.startswith(os.sep):
358 matches = self.attr_matches(self.magic_prefix+text)
358 matches = self.attr_matches(self.magic_prefix+text)
359 return matches
359 return matches
360
360
361 def _default_arguments(self, obj):
361 def _default_arguments(self, obj):
362 """Return the list of default arguments of obj if it is callable,
362 """Return the list of default arguments of obj if it is callable,
363 or empty list otherwise."""
363 or empty list otherwise."""
364
364
365 if not (inspect.isfunction(obj) or inspect.ismethod(obj)):
365 if not (inspect.isfunction(obj) or inspect.ismethod(obj)):
366 # for classes, check for __init__,__new__
366 # for classes, check for __init__,__new__
367 if inspect.isclass(obj):
367 if inspect.isclass(obj):
368 obj = (getattr(obj,'__init__',None) or
368 obj = (getattr(obj,'__init__',None) or
369 getattr(obj,'__new__',None))
369 getattr(obj,'__new__',None))
370 # for all others, check if they are __call__able
370 # for all others, check if they are __call__able
371 elif hasattr(obj, '__call__'):
371 elif hasattr(obj, '__call__'):
372 obj = obj.__call__
372 obj = obj.__call__
373 # XXX: is there a way to handle the builtins ?
373 # XXX: is there a way to handle the builtins ?
374 try:
374 try:
375 args,_,_1,defaults = inspect.getargspec(obj)
375 args,_,_1,defaults = inspect.getargspec(obj)
376 if defaults:
376 if defaults:
377 return args[-len(defaults):]
377 return args[-len(defaults):]
378 except TypeError: pass
378 except TypeError: pass
379 return []
379 return []
380
380
381 def python_func_kw_matches(self,text):
381 def python_func_kw_matches(self,text):
382 """Match named parameters (kwargs) of the last open function"""
382 """Match named parameters (kwargs) of the last open function"""
383
383
384 if "." in text: # a parameter cannot be dotted
384 if "." in text: # a parameter cannot be dotted
385 return []
385 return []
386 try: regexp = self.__funcParamsRegex
386 try: regexp = self.__funcParamsRegex
387 except AttributeError:
387 except AttributeError:
388 regexp = self.__funcParamsRegex = re.compile(r'''
388 regexp = self.__funcParamsRegex = re.compile(r'''
389 '.*?' | # single quoted strings or
389 '.*?' | # single quoted strings or
390 ".*?" | # double quoted strings or
390 ".*?" | # double quoted strings or
391 \w+ | # identifier
391 \w+ | # identifier
392 \S # other characters
392 \S # other characters
393 ''', re.VERBOSE | re.DOTALL)
393 ''', re.VERBOSE | re.DOTALL)
394 # 1. find the nearest identifier that comes before an unclosed
394 # 1. find the nearest identifier that comes before an unclosed
395 # parenthesis e.g. for "foo (1+bar(x), pa", the candidate is "foo"
395 # parenthesis e.g. for "foo (1+bar(x), pa", the candidate is "foo"
396 tokens = regexp.findall(self.get_line_buffer())
396 tokens = regexp.findall(self.get_line_buffer())
397 tokens.reverse()
397 tokens.reverse()
398 iterTokens = iter(tokens); openPar = 0
398 iterTokens = iter(tokens); openPar = 0
399 for token in iterTokens:
399 for token in iterTokens:
400 if token == ')':
400 if token == ')':
401 openPar -= 1
401 openPar -= 1
402 elif token == '(':
402 elif token == '(':
403 openPar += 1
403 openPar += 1
404 if openPar > 0:
404 if openPar > 0:
405 # found the last unclosed parenthesis
405 # found the last unclosed parenthesis
406 break
406 break
407 else:
407 else:
408 return []
408 return []
409 # 2. Concatenate any dotted names (e.g. "foo.bar" for "foo.bar(x, pa" )
409 # 2. Concatenate any dotted names (e.g. "foo.bar" for "foo.bar(x, pa" )
410 ids = []
410 ids = []
411 isId = re.compile(r'\w+$').match
411 isId = re.compile(r'\w+$').match
412 while True:
412 while True:
413 try:
413 try:
414 ids.append(iterTokens.next())
414 ids.append(iterTokens.next())
415 if not isId(ids[-1]):
415 if not isId(ids[-1]):
416 ids.pop(); break
416 ids.pop(); break
417 if not iterTokens.next() == '.':
417 if not iterTokens.next() == '.':
418 break
418 break
419 except StopIteration:
419 except StopIteration:
420 break
420 break
421 # lookup the candidate callable matches either using global_matches
421 # lookup the candidate callable matches either using global_matches
422 # or attr_matches for dotted names
422 # or attr_matches for dotted names
423 if len(ids) == 1:
423 if len(ids) == 1:
424 callableMatches = self.global_matches(ids[0])
424 callableMatches = self.global_matches(ids[0])
425 else:
425 else:
426 callableMatches = self.attr_matches('.'.join(ids[::-1]))
426 callableMatches = self.attr_matches('.'.join(ids[::-1]))
427 argMatches = []
427 argMatches = []
428 for callableMatch in callableMatches:
428 for callableMatch in callableMatches:
429 try: namedArgs = self._default_arguments(eval(callableMatch,
429 try: namedArgs = self._default_arguments(eval(callableMatch,
430 self.namespace))
430 self.namespace))
431 except: continue
431 except: continue
432 for namedArg in namedArgs:
432 for namedArg in namedArgs:
433 if namedArg.startswith(text):
433 if namedArg.startswith(text):
434 argMatches.append("%s=" %namedArg)
434 argMatches.append("%s=" %namedArg)
435 return argMatches
435 return argMatches
436
436
437 def complete(self, text, state):
437 def complete(self, text, state):
438 """Return the next possible completion for 'text'.
438 """Return the next possible completion for 'text'.
439
439
440 This is called successively with state == 0, 1, 2, ... until it
440 This is called successively with state == 0, 1, 2, ... until it
441 returns None. The completion should begin with 'text'. """
441 returns None. The completion should begin with 'text'. """
442
442
443 #print '\n*** COMPLETE: <%s> (%s)' % (text,state) # dbg
443 #print '\n*** COMPLETE: <%s> (%s)' % (text,state) # dbg
444 magic_escape = self.magic_escape
444 magic_escape = self.magic_escape
445 magic_prefix = self.magic_prefix
445 magic_prefix = self.magic_prefix
446
446
447 try:
447 try:
448 if text.startswith(magic_escape):
448 if text.startswith(magic_escape):
449 text = text.replace(magic_escape,magic_prefix)
449 text = text.replace(magic_escape,magic_prefix)
450 elif text.startswith('~'):
450 elif text.startswith('~'):
451 text = os.path.expanduser(text)
451 text = os.path.expanduser(text)
452 if state == 0:
452 if state == 0:
453 # Extend the list of completions with the results of each
453 # Extend the list of completions with the results of each
454 # matcher, so we return results to the user from all
454 # matcher, so we return results to the user from all
455 # namespaces.
455 # namespaces.
456 if self.merge_completions:
456 if self.merge_completions:
457 self.matches = []
457 self.matches = []
458 for matcher in self.matchers:
458 for matcher in self.matchers:
459 self.matches.extend(matcher(text))
459 self.matches.extend(matcher(text))
460 else:
460 else:
461 for matcher in self.matchers:
461 for matcher in self.matchers:
462 self.matches = matcher(text)
462 self.matches = matcher(text)
463 if self.matches:
463 if self.matches:
464 break
464 break
465
465
466 try:
466 try:
467 return self.matches[state].replace(magic_prefix,magic_escape)
467 return self.matches[state].replace(magic_prefix,magic_escape)
468 except IndexError:
468 except IndexError:
469 return None
469 return None
470 except:
470 except:
471 # If completion fails, don't annoy the user.
471 # If completion fails, don't annoy the user.
472 pass
472 pass
473
473
474 except ImportError:
474 except ImportError:
475 pass # no readline support
475 pass # no readline support
476
476
477 except KeyError:
477 except KeyError:
478 pass # Windows doesn't set TERM, it doesn't matter
478 pass # Windows doesn't set TERM, it doesn't matter
479
479
480
480
481 class InputList(UserList.UserList):
481 class InputList(UserList.UserList):
482 """Class to store user input.
482 """Class to store user input.
483
483
484 It's basically a list, but slices return a string instead of a list, thus
484 It's basically a list, but slices return a string instead of a list, thus
485 allowing things like (assuming 'In' is an instance):
485 allowing things like (assuming 'In' is an instance):
486
486
487 exec In[4:7]
487 exec In[4:7]
488
488
489 or
489 or
490
490
491 exec In[5:9] + In[14] + In[21:25]"""
491 exec In[5:9] + In[14] + In[21:25]"""
492
492
493 def __getslice__(self,i,j):
493 def __getslice__(self,i,j):
494 return ''.join(UserList.UserList.__getslice__(self,i,j))
494 return ''.join(UserList.UserList.__getslice__(self,i,j))
495
495
496 #****************************************************************************
496 #****************************************************************************
497 # Local use exceptions
497 # Local use exceptions
498 class SpaceInInput(exceptions.Exception):
498 class SpaceInInput(exceptions.Exception):
499 pass
499 pass
500
500
501 #****************************************************************************
501 #****************************************************************************
502 # Main IPython class
502 # Main IPython class
503
503
504 class InteractiveShell(code.InteractiveConsole, Logger, Magic):
504 class InteractiveShell(code.InteractiveConsole, Logger, Magic):
505 """An enhanced console for Python."""
505 """An enhanced console for Python."""
506
506
507 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
507 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
508 user_ns = None,banner2='',
508 user_ns = None,banner2='',
509 custom_exceptions=((),None)):
509 custom_exceptions=((),None)):
510
510
511 # Put a reference to self in builtins so that any form of embedded or
511 # Put a reference to self in builtins so that any form of embedded or
512 # imported code can test for being inside IPython.
512 # imported code can test for being inside IPython.
513 __builtin__.__IPYTHON__ = self
513 __builtin__.__IPYTHON__ = self
514
514
515 # And load into builtins ipmagic/ipalias as well
515 # And load into builtins ipmagic/ipalias as well
516 __builtin__.ipmagic = ipmagic
516 __builtin__.ipmagic = ipmagic
517 __builtin__.ipalias = ipalias
517 __builtin__.ipalias = ipalias
518
518
519 # Add to __builtin__ other parts of IPython's public API
519 # Add to __builtin__ other parts of IPython's public API
520 __builtin__.ip_set_hook = self.set_hook
520 __builtin__.ip_set_hook = self.set_hook
521
521
522 # Keep in the builtins a flag for when IPython is active. We set it
522 # Keep in the builtins a flag for when IPython is active. We set it
523 # with setdefault so that multiple nested IPythons don't clobber one
523 # with setdefault so that multiple nested IPythons don't clobber one
524 # another. Each will increase its value by one upon being activated,
524 # another. Each will increase its value by one upon being activated,
525 # which also gives us a way to determine the nesting level.
525 # which also gives us a way to determine the nesting level.
526 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
526 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
527
527
528 # Inform the user of ipython's fast exit magics.
528 # Inform the user of ipython's fast exit magics.
529 _exit = ' Use %Exit or %Quit to exit without confirmation.'
529 _exit = ' Use %Exit or %Quit to exit without confirmation.'
530 __builtin__.exit += _exit
530 __builtin__.exit += _exit
531 __builtin__.quit += _exit
531 __builtin__.quit += _exit
532
532
533 # Create the namespace where the user will operate:
533 # Create the namespace where the user will operate:
534
534
535 # FIXME. For some strange reason, __builtins__ is showing up at user
535 # FIXME. For some strange reason, __builtins__ is showing up at user
536 # level as a dict instead of a module. This is a manual fix, but I
536 # level as a dict instead of a module. This is a manual fix, but I
537 # should really track down where the problem is coming from. Alex
537 # should really track down where the problem is coming from. Alex
538 # Schmolck reported this problem first.
538 # Schmolck reported this problem first.
539
539
540 # A useful post by Alex Martelli on this topic:
540 # A useful post by Alex Martelli on this topic:
541 # Re: inconsistent value from __builtins__
541 # Re: inconsistent value from __builtins__
542 # Von: Alex Martelli <aleaxit@yahoo.com>
542 # Von: Alex Martelli <aleaxit@yahoo.com>
543 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
543 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
544 # Gruppen: comp.lang.python
544 # Gruppen: comp.lang.python
545 # Referenzen: 1
545 # Referenzen: 1
546
546
547 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
547 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
548 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
548 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
549 # > <type 'dict'>
549 # > <type 'dict'>
550 # > >>> print type(__builtins__)
550 # > >>> print type(__builtins__)
551 # > <type 'module'>
551 # > <type 'module'>
552 # > Is this difference in return value intentional?
552 # > Is this difference in return value intentional?
553
553
554 # Well, it's documented that '__builtins__' can be either a dictionary
554 # Well, it's documented that '__builtins__' can be either a dictionary
555 # or a module, and it's been that way for a long time. Whether it's
555 # or a module, and it's been that way for a long time. Whether it's
556 # intentional (or sensible), I don't know. In any case, the idea is that
556 # intentional (or sensible), I don't know. In any case, the idea is that
557 # if you need to access the built-in namespace directly, you should start
557 # if you need to access the built-in namespace directly, you should start
558 # with "import __builtin__" (note, no 's') which will definitely give you
558 # with "import __builtin__" (note, no 's') which will definitely give you
559 # a module. Yeah, it's somewhatΒ confusing:-(.
559 # a module. Yeah, it's somewhatΒ confusing:-(.
560
560
561 if user_ns is None:
561 if user_ns is None:
562 # Set __name__ to __main__ to better match the behavior of the
562 # Set __name__ to __main__ to better match the behavior of the
563 # normal interpreter.
563 # normal interpreter.
564 self.user_ns = {'__name__' :'__main__',
564 self.user_ns = {'__name__' :'__main__',
565 '__builtins__' : __builtin__,
565 '__builtins__' : __builtin__,
566 }
566 }
567 else:
567 else:
568 self.user_ns = user_ns
568 self.user_ns = user_ns
569
569
570 # The user namespace MUST have a pointer to the shell itself.
570 # The user namespace MUST have a pointer to the shell itself.
571 self.user_ns[name] = self
571 self.user_ns[name] = self
572
572
573 # We need to insert into sys.modules something that looks like a
573 # We need to insert into sys.modules something that looks like a
574 # module but which accesses the IPython namespace, for shelve and
574 # module but which accesses the IPython namespace, for shelve and
575 # pickle to work interactively. Normally they rely on getting
575 # pickle to work interactively. Normally they rely on getting
576 # everything out of __main__, but for embedding purposes each IPython
576 # everything out of __main__, but for embedding purposes each IPython
577 # instance has its own private namespace, so we can't go shoving
577 # instance has its own private namespace, so we can't go shoving
578 # everything into __main__.
578 # everything into __main__.
579
579
580 try:
580 try:
581 main_name = self.user_ns['__name__']
581 main_name = self.user_ns['__name__']
582 except KeyError:
582 except KeyError:
583 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
583 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
584 else:
584 else:
585 #print "pickle hack in place" # dbg
585 #print "pickle hack in place" # dbg
586 sys.modules[main_name] = FakeModule(self.user_ns)
586 sys.modules[main_name] = FakeModule(self.user_ns)
587
587
588 # List of input with multi-line handling.
588 # List of input with multi-line handling.
589 # Fill its zero entry, user counter starts at 1
589 # Fill its zero entry, user counter starts at 1
590 self.input_hist = InputList(['\n'])
590 self.input_hist = InputList(['\n'])
591
591
592 # list of visited directories
592 # list of visited directories
593 try:
593 try:
594 self.dir_hist = [os.getcwd()]
594 self.dir_hist = [os.getcwd()]
595 except IOError, e:
595 except IOError, e:
596 self.dir_hist = []
596 self.dir_hist = []
597
597
598 # dict of output history
598 # dict of output history
599 self.output_hist = {}
599 self.output_hist = {}
600
600
601 # dict of names to be treated as system aliases. Each entry in the
601 # dict of names to be treated as system aliases. Each entry in the
602 # alias table must be a 2-tuple of the form (N,name), where N is the
602 # alias table must be a 2-tuple of the form (N,name), where N is the
603 # number of positional arguments of the alias.
603 # number of positional arguments of the alias.
604 self.alias_table = {}
604 self.alias_table = {}
605
605
606 # dict of things NOT to alias (keywords, builtins and some special magics)
606 # dict of things NOT to alias (keywords, builtins and some special magics)
607 no_alias = {}
607 no_alias = {}
608 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
608 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
609 for key in keyword.kwlist + no_alias_magics:
609 for key in keyword.kwlist + no_alias_magics:
610 no_alias[key] = 1
610 no_alias[key] = 1
611 no_alias.update(__builtin__.__dict__)
611 no_alias.update(__builtin__.__dict__)
612 self.no_alias = no_alias
612 self.no_alias = no_alias
613
613
614
614
615 # make global variables for user access to these
615 # make global variables for user access to these
616 self.user_ns['_ih'] = self.input_hist
616 self.user_ns['_ih'] = self.input_hist
617 self.user_ns['_oh'] = self.output_hist
617 self.user_ns['_oh'] = self.output_hist
618 self.user_ns['_dh'] = self.dir_hist
618 self.user_ns['_dh'] = self.dir_hist
619
619
620 # user aliases to input and output histories
620 # user aliases to input and output histories
621 self.user_ns['In'] = self.input_hist
621 self.user_ns['In'] = self.input_hist
622 self.user_ns['Out'] = self.output_hist
622 self.user_ns['Out'] = self.output_hist
623
623
624 # Store the actual shell's name
624 # Store the actual shell's name
625 self.name = name
625 self.name = name
626
626
627 # Object variable to store code object waiting execution. This is
627 # Object variable to store code object waiting execution. This is
628 # used mainly by the multithreaded shells, but it can come in handy in
628 # used mainly by the multithreaded shells, but it can come in handy in
629 # other situations. No need to use a Queue here, since it's a single
629 # other situations. No need to use a Queue here, since it's a single
630 # item which gets cleared once run.
630 # item which gets cleared once run.
631 self.code_to_run = None
631 self.code_to_run = None
632
632
633 # Job manager (for jobs run as background threads)
633 # Job manager (for jobs run as background threads)
634 self.jobs = BackgroundJobManager()
634 self.jobs = BackgroundJobManager()
635 # Put the job manager into builtins so it's always there.
635 # Put the job manager into builtins so it's always there.
636 __builtin__.jobs = self.jobs
636 __builtin__.jobs = self.jobs
637
637
638 # escapes for automatic behavior on the command line
638 # escapes for automatic behavior on the command line
639 self.ESC_SHELL = '!'
639 self.ESC_SHELL = '!'
640 self.ESC_HELP = '?'
640 self.ESC_HELP = '?'
641 self.ESC_MAGIC = '%'
641 self.ESC_MAGIC = '%'
642 self.ESC_QUOTE = ','
642 self.ESC_QUOTE = ','
643 self.ESC_QUOTE2 = ';'
643 self.ESC_QUOTE2 = ';'
644 self.ESC_PAREN = '/'
644 self.ESC_PAREN = '/'
645
645
646 # And their associated handlers
646 # And their associated handlers
647 self.esc_handlers = {self.ESC_PAREN:self.handle_auto,
647 self.esc_handlers = {self.ESC_PAREN:self.handle_auto,
648 self.ESC_QUOTE:self.handle_auto,
648 self.ESC_QUOTE:self.handle_auto,
649 self.ESC_QUOTE2:self.handle_auto,
649 self.ESC_QUOTE2:self.handle_auto,
650 self.ESC_MAGIC:self.handle_magic,
650 self.ESC_MAGIC:self.handle_magic,
651 self.ESC_HELP:self.handle_help,
651 self.ESC_HELP:self.handle_help,
652 self.ESC_SHELL:self.handle_shell_escape,
652 self.ESC_SHELL:self.handle_shell_escape,
653 }
653 }
654
654
655 # class initializations
655 # class initializations
656 code.InteractiveConsole.__init__(self,locals = self.user_ns)
656 code.InteractiveConsole.__init__(self,locals = self.user_ns)
657 Logger.__init__(self,log_ns = self.user_ns)
657 Logger.__init__(self,log_ns = self.user_ns)
658 Magic.__init__(self,self)
658 Magic.__init__(self,self)
659
659
660 # an ugly hack to get a pointer to the shell, so I can start writing
660 # an ugly hack to get a pointer to the shell, so I can start writing
661 # magic code via this pointer instead of the current mixin salad.
661 # magic code via this pointer instead of the current mixin salad.
662 Magic.set_shell(self,self)
662 Magic.set_shell(self,self)
663
663
664 # hooks holds pointers used for user-side customizations
664 # hooks holds pointers used for user-side customizations
665 self.hooks = Struct()
665 self.hooks = Struct()
666
666
667 # Set all default hooks, defined in the IPython.hooks module.
667 # Set all default hooks, defined in the IPython.hooks module.
668 hooks = IPython.hooks
668 hooks = IPython.hooks
669 for hook_name in hooks.__all__:
669 for hook_name in hooks.__all__:
670 self.set_hook(hook_name,getattr(hooks,hook_name))
670 self.set_hook(hook_name,getattr(hooks,hook_name))
671
671
672 # Flag to mark unconditional exit
672 # Flag to mark unconditional exit
673 self.exit_now = False
673 self.exit_now = False
674
674
675 self.usage_min = """\
675 self.usage_min = """\
676 An enhanced console for Python.
676 An enhanced console for Python.
677 Some of its features are:
677 Some of its features are:
678 - Readline support if the readline library is present.
678 - Readline support if the readline library is present.
679 - Tab completion in the local namespace.
679 - Tab completion in the local namespace.
680 - Logging of input, see command-line options.
680 - Logging of input, see command-line options.
681 - System shell escape via ! , eg !ls.
681 - System shell escape via ! , eg !ls.
682 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
682 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
683 - Keeps track of locally defined variables via %who, %whos.
683 - Keeps track of locally defined variables via %who, %whos.
684 - Show object information with a ? eg ?x or x? (use ?? for more info).
684 - Show object information with a ? eg ?x or x? (use ?? for more info).
685 """
685 """
686 if usage: self.usage = usage
686 if usage: self.usage = usage
687 else: self.usage = self.usage_min
687 else: self.usage = self.usage_min
688
688
689 # Storage
689 # Storage
690 self.rc = rc # This will hold all configuration information
690 self.rc = rc # This will hold all configuration information
691 self.inputcache = []
691 self.inputcache = []
692 self._boundcache = []
692 self._boundcache = []
693 self.pager = 'less'
693 self.pager = 'less'
694 # temporary files used for various purposes. Deleted at exit.
694 # temporary files used for various purposes. Deleted at exit.
695 self.tempfiles = []
695 self.tempfiles = []
696
696
697 # Keep track of readline usage (later set by init_readline)
697 # Keep track of readline usage (later set by init_readline)
698 self.has_readline = 0
698 self.has_readline = 0
699
699
700 # for pushd/popd management
700 # for pushd/popd management
701 try:
701 try:
702 self.home_dir = get_home_dir()
702 self.home_dir = get_home_dir()
703 except HomeDirError,msg:
703 except HomeDirError,msg:
704 fatal(msg)
704 fatal(msg)
705
705
706 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
706 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
707
707
708 # Functions to call the underlying shell.
708 # Functions to call the underlying shell.
709
709
710 # utility to expand user variables via Itpl
710 # utility to expand user variables via Itpl
711 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
711 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
712 self.user_ns))
712 self.user_ns))
713 # The first is similar to os.system, but it doesn't return a value,
713 # The first is similar to os.system, but it doesn't return a value,
714 # and it allows interpolation of variables in the user's namespace.
714 # and it allows interpolation of variables in the user's namespace.
715 self.system = lambda cmd: shell(self.var_expand(cmd),
715 self.system = lambda cmd: shell(self.var_expand(cmd),
716 header='IPython system call: ',
716 header='IPython system call: ',
717 verbose=self.rc.system_verbose)
717 verbose=self.rc.system_verbose)
718 # These are for getoutput and getoutputerror:
718 # These are for getoutput and getoutputerror:
719 self.getoutput = lambda cmd: \
719 self.getoutput = lambda cmd: \
720 getoutput(self.var_expand(cmd),
720 getoutput(self.var_expand(cmd),
721 header='IPython system call: ',
721 header='IPython system call: ',
722 verbose=self.rc.system_verbose)
722 verbose=self.rc.system_verbose)
723 self.getoutputerror = lambda cmd: \
723 self.getoutputerror = lambda cmd: \
724 getoutputerror(str(ItplNS(cmd.replace('#','\#'),
724 getoutputerror(str(ItplNS(cmd.replace('#','\#'),
725 self.user_ns)),
725 self.user_ns)),
726 header='IPython system call: ',
726 header='IPython system call: ',
727 verbose=self.rc.system_verbose)
727 verbose=self.rc.system_verbose)
728
728
729 # RegExp for splitting line contents into pre-char//first
729 # RegExp for splitting line contents into pre-char//first
730 # word-method//rest. For clarity, each group in on one line.
730 # word-method//rest. For clarity, each group in on one line.
731
731
732 # WARNING: update the regexp if the above escapes are changed, as they
732 # WARNING: update the regexp if the above escapes are changed, as they
733 # are hardwired in.
733 # are hardwired in.
734
734
735 # Don't get carried away with trying to make the autocalling catch too
735 # Don't get carried away with trying to make the autocalling catch too
736 # much: it's better to be conservative rather than to trigger hidden
736 # much: it's better to be conservative rather than to trigger hidden
737 # evals() somewhere and end up causing side effects.
737 # evals() somewhere and end up causing side effects.
738
738
739 self.line_split = re.compile(r'^([\s*,;/])'
739 self.line_split = re.compile(r'^([\s*,;/])'
740 r'([\?\w\.]+\w*\s*)'
740 r'([\?\w\.]+\w*\s*)'
741 r'(\(?.*$)')
741 r'(\(?.*$)')
742
742
743 # Original re, keep around for a while in case changes break something
743 # Original re, keep around for a while in case changes break something
744 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
744 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
745 # r'(\s*[\?\w\.]+\w*\s*)'
745 # r'(\s*[\?\w\.]+\w*\s*)'
746 # r'(\(?.*$)')
746 # r'(\(?.*$)')
747
747
748 # RegExp to identify potential function names
748 # RegExp to identify potential function names
749 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
749 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
750 # RegExp to exclude strings with this start from autocalling
750 # RegExp to exclude strings with this start from autocalling
751 self.re_exclude_auto = re.compile('^[!=()<>,\*/\+-]|^is ')
751 self.re_exclude_auto = re.compile('^[!=()<>,\*/\+-]|^is ')
752 # try to catch also methods for stuff in lists/tuples/dicts: off
752 # try to catch also methods for stuff in lists/tuples/dicts: off
753 # (experimental). For this to work, the line_split regexp would need
753 # (experimental). For this to work, the line_split regexp would need
754 # to be modified so it wouldn't break things at '['. That line is
754 # to be modified so it wouldn't break things at '['. That line is
755 # nasty enough that I shouldn't change it until I can test it _well_.
755 # nasty enough that I shouldn't change it until I can test it _well_.
756 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
756 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
757
757
758 # keep track of where we started running (mainly for crash post-mortem)
758 # keep track of where we started running (mainly for crash post-mortem)
759 self.starting_dir = os.getcwd()
759 self.starting_dir = os.getcwd()
760
760
761 # Attributes for Logger mixin class, make defaults here
761 # Attributes for Logger mixin class, make defaults here
762 self._dolog = 0
762 self._dolog = 0
763 self.LOG = ''
763 self.LOG = ''
764 self.LOGDEF = '.InteractiveShell.log'
764 self.LOGDEF = '.InteractiveShell.log'
765 self.LOGMODE = 'over'
765 self.LOGMODE = 'over'
766 self.LOGHEAD = Itpl(
766 self.LOGHEAD = Itpl(
767 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
767 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
768 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
768 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
769 #log# opts = $self.rc.opts
769 #log# opts = $self.rc.opts
770 #log# args = $self.rc.args
770 #log# args = $self.rc.args
771 #log# It is safe to make manual edits below here.
771 #log# It is safe to make manual edits below here.
772 #log#-----------------------------------------------------------------------
772 #log#-----------------------------------------------------------------------
773 """)
773 """)
774 # Various switches which can be set
774 # Various switches which can be set
775 self.CACHELENGTH = 5000 # this is cheap, it's just text
775 self.CACHELENGTH = 5000 # this is cheap, it's just text
776 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
776 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
777 self.banner2 = banner2
777 self.banner2 = banner2
778
778
779 # TraceBack handlers:
779 # TraceBack handlers:
780 # Need two, one for syntax errors and one for other exceptions.
780 # Need two, one for syntax errors and one for other exceptions.
781 self.SyntaxTB = ultraTB.ListTB(color_scheme='NoColor')
781 self.SyntaxTB = ultraTB.ListTB(color_scheme='NoColor')
782 # This one is initialized with an offset, meaning we always want to
782 # This one is initialized with an offset, meaning we always want to
783 # remove the topmost item in the traceback, which is our own internal
783 # remove the topmost item in the traceback, which is our own internal
784 # code. Valid modes: ['Plain','Context','Verbose']
784 # code. Valid modes: ['Plain','Context','Verbose']
785 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
785 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
786 color_scheme='NoColor',
786 color_scheme='NoColor',
787 tb_offset = 1)
787 tb_offset = 1)
788 # and add any custom exception handlers the user may have specified
788 # and add any custom exception handlers the user may have specified
789 self.set_custom_exc(*custom_exceptions)
789 self.set_custom_exc(*custom_exceptions)
790
790
791 # Object inspector
791 # Object inspector
792 ins_colors = OInspect.InspectColors
792 ins_colors = OInspect.InspectColors
793 code_colors = PyColorize.ANSICodeColors
793 code_colors = PyColorize.ANSICodeColors
794 self.inspector = OInspect.Inspector(ins_colors,code_colors,'NoColor')
794 self.inspector = OInspect.Inspector(ins_colors,code_colors,'NoColor')
795 self.autoindent = 0
795 self.autoindent = 0
796
796
797 # Make some aliases automatically
797 # Make some aliases automatically
798 # Prepare list of shell aliases to auto-define
798 # Prepare list of shell aliases to auto-define
799 if os.name == 'posix':
799 if os.name == 'posix':
800 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
800 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
801 'mv mv -i','rm rm -i','cp cp -i',
801 'mv mv -i','rm rm -i','cp cp -i',
802 'cat cat','less less','clear clear',
802 'cat cat','less less','clear clear',
803 # a better ls
803 # a better ls
804 'ls ls -F',
804 'ls ls -F',
805 # long ls
805 # long ls
806 'll ls -lF',
806 'll ls -lF',
807 # color ls
807 # color ls
808 'lc ls -F -o --color',
808 'lc ls -F -o --color',
809 # ls normal files only
809 # ls normal files only
810 'lf ls -F -o --color %l | grep ^-',
810 'lf ls -F -o --color %l | grep ^-',
811 # ls symbolic links
811 # ls symbolic links
812 'lk ls -F -o --color %l | grep ^l',
812 'lk ls -F -o --color %l | grep ^l',
813 # directories or links to directories,
813 # directories or links to directories,
814 'ldir ls -F -o --color %l | grep /$',
814 'ldir ls -F -o --color %l | grep /$',
815 # things which are executable
815 # things which are executable
816 'lx ls -F -o --color %l | grep ^-..x',
816 'lx ls -F -o --color %l | grep ^-..x',
817 )
817 )
818 elif os.name in ['nt','dos']:
818 elif os.name in ['nt','dos']:
819 auto_alias = ('dir dir /on', 'ls dir /on',
819 auto_alias = ('dir dir /on', 'ls dir /on',
820 'ddir dir /ad /on', 'ldir dir /ad /on',
820 'ddir dir /ad /on', 'ldir dir /ad /on',
821 'mkdir mkdir','rmdir rmdir','echo echo',
821 'mkdir mkdir','rmdir rmdir','echo echo',
822 'ren ren','cls cls','copy copy')
822 'ren ren','cls cls','copy copy')
823 else:
823 else:
824 auto_alias = ()
824 auto_alias = ()
825 self.auto_alias = map(lambda s:s.split(None,1),auto_alias)
825 self.auto_alias = map(lambda s:s.split(None,1),auto_alias)
826 # Call the actual (public) initializer
826 # Call the actual (public) initializer
827 self.init_auto_alias()
827 self.init_auto_alias()
828 # end __init__
828 # end __init__
829
829
830 def set_hook(self,name,hook):
830 def set_hook(self,name,hook):
831 """set_hook(name,hook) -> sets an internal IPython hook.
831 """set_hook(name,hook) -> sets an internal IPython hook.
832
832
833 IPython exposes some of its internal API as user-modifiable hooks. By
833 IPython exposes some of its internal API as user-modifiable hooks. By
834 resetting one of these hooks, you can modify IPython's behavior to
834 resetting one of these hooks, you can modify IPython's behavior to
835 call at runtime your own routines."""
835 call at runtime your own routines."""
836
836
837 # At some point in the future, this should validate the hook before it
837 # At some point in the future, this should validate the hook before it
838 # accepts it. Probably at least check that the hook takes the number
838 # accepts it. Probably at least check that the hook takes the number
839 # of args it's supposed to.
839 # of args it's supposed to.
840 setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
840 setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
841
841
842 def set_custom_exc(self,exc_tuple,handler):
842 def set_custom_exc(self,exc_tuple,handler):
843 """set_custom_exc(exc_tuple,handler)
843 """set_custom_exc(exc_tuple,handler)
844
844
845 Set a custom exception handler, which will be called if any of the
845 Set a custom exception handler, which will be called if any of the
846 exceptions in exc_tuple occur in the mainloop (specifically, in the
846 exceptions in exc_tuple occur in the mainloop (specifically, in the
847 runcode() method.
847 runcode() method.
848
848
849 Inputs:
849 Inputs:
850
850
851 - exc_tuple: a *tuple* of valid exceptions to call the defined
851 - exc_tuple: a *tuple* of valid exceptions to call the defined
852 handler for. It is very important that you use a tuple, and NOT A
852 handler for. It is very important that you use a tuple, and NOT A
853 LIST here, because of the way Python's except statement works. If
853 LIST here, because of the way Python's except statement works. If
854 you only want to trap a single exception, use a singleton tuple:
854 you only want to trap a single exception, use a singleton tuple:
855
855
856 exc_tuple == (MyCustomException,)
856 exc_tuple == (MyCustomException,)
857
857
858 - handler: this must be defined as a function with the following
858 - handler: this must be defined as a function with the following
859 basic interface: def my_handler(self,etype,value,tb).
859 basic interface: def my_handler(self,etype,value,tb).
860
860
861 This will be made into an instance method (via new.instancemethod)
861 This will be made into an instance method (via new.instancemethod)
862 of IPython itself, and it will be called if any of the exceptions
862 of IPython itself, and it will be called if any of the exceptions
863 listed in the exc_tuple are caught. If the handler is None, an
863 listed in the exc_tuple are caught. If the handler is None, an
864 internal basic one is used, which just prints basic info.
864 internal basic one is used, which just prints basic info.
865
865
866 WARNING: by putting in your own exception handler into IPython's main
866 WARNING: by putting in your own exception handler into IPython's main
867 execution loop, you run a very good chance of nasty crashes. This
867 execution loop, you run a very good chance of nasty crashes. This
868 facility should only be used if you really know what you are doing."""
868 facility should only be used if you really know what you are doing."""
869
869
870 assert type(exc_tuple)==type(()) , \
870 assert type(exc_tuple)==type(()) , \
871 "The custom exceptions must be given AS A TUPLE."
871 "The custom exceptions must be given AS A TUPLE."
872
872
873 def dummy_handler(self,etype,value,tb):
873 def dummy_handler(self,etype,value,tb):
874 print '*** Simple custom exception handler ***'
874 print '*** Simple custom exception handler ***'
875 print 'Exception type :',etype
875 print 'Exception type :',etype
876 print 'Exception value:',value
876 print 'Exception value:',value
877 print 'Traceback :',tb
877 print 'Traceback :',tb
878 print 'Source code :','\n'.join(self.buffer)
878 print 'Source code :','\n'.join(self.buffer)
879
879
880 if handler is None: handler = dummy_handler
880 if handler is None: handler = dummy_handler
881
881
882 self.CustomTB = new.instancemethod(handler,self,self.__class__)
882 self.CustomTB = new.instancemethod(handler,self,self.__class__)
883 self.custom_exceptions = exc_tuple
883 self.custom_exceptions = exc_tuple
884
884
885 def set_custom_completer(self,completer,pos=0):
885 def set_custom_completer(self,completer,pos=0):
886 """set_custom_completer(completer,pos=0)
886 """set_custom_completer(completer,pos=0)
887
887
888 Adds a new custom completer function.
888 Adds a new custom completer function.
889
889
890 The position argument (defaults to 0) is the index in the completers
890 The position argument (defaults to 0) is the index in the completers
891 list where you want the completer to be inserted."""
891 list where you want the completer to be inserted."""
892
892
893 newcomp = new.instancemethod(completer,self.Completer,
893 newcomp = new.instancemethod(completer,self.Completer,
894 self.Completer.__class__)
894 self.Completer.__class__)
895 self.Completer.matchers.insert(pos,newcomp)
895 self.Completer.matchers.insert(pos,newcomp)
896
896
897 def complete(self,text):
897 def complete(self,text):
898 """Return a sorted list of all possible completions on text.
898 """Return a sorted list of all possible completions on text.
899
899
900 Inputs:
900 Inputs:
901
901
902 - text: a string of text to be completed on.
902 - text: a string of text to be completed on.
903
903
904 This is a wrapper around the completion mechanism, similar to what
904 This is a wrapper around the completion mechanism, similar to what
905 readline does at the command line when the TAB key is hit. By
905 readline does at the command line when the TAB key is hit. By
906 exposing it as a method, it can be used by other non-readline
906 exposing it as a method, it can be used by other non-readline
907 environments (such as GUIs) for text completion.
907 environments (such as GUIs) for text completion.
908
908
909 Simple usage example:
909 Simple usage example:
910
910
911 In [1]: x = 'hello'
911 In [1]: x = 'hello'
912
912
913 In [2]: __IP.complete('x.l')
913 In [2]: __IP.complete('x.l')
914 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
914 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
915
915
916 complete = self.Completer.complete
916 complete = self.Completer.complete
917 state = 0
917 state = 0
918 # use a dict so we get unique keys, since ipyhton's multiple
918 # use a dict so we get unique keys, since ipyhton's multiple
919 # completers can return duplicates.
919 # completers can return duplicates.
920 comps = {}
920 comps = {}
921 while True:
921 while True:
922 newcomp = complete(text,state)
922 newcomp = complete(text,state)
923 if newcomp is None:
923 if newcomp is None:
924 break
924 break
925 comps[newcomp] = 1
925 comps[newcomp] = 1
926 state += 1
926 state += 1
927 outcomps = comps.keys()
927 outcomps = comps.keys()
928 outcomps.sort()
928 outcomps.sort()
929 return outcomps
929 return outcomps
930
930
931 def post_config_initialization(self):
931 def post_config_initialization(self):
932 """Post configuration init method
932 """Post configuration init method
933
933
934 This is called after the configuration files have been processed to
934 This is called after the configuration files have been processed to
935 'finalize' the initialization."""
935 'finalize' the initialization."""
936
936
937 # dynamic data that survives through sessions
937 # dynamic data that survives through sessions
938 # XXX make the filename a config option?
938 # XXX make the filename a config option?
939 persist_base = 'persist'
939 persist_base = 'persist'
940 if self.rc.profile:
940 if self.rc.profile:
941 persist_base += '_%s' % self.rc.profile
941 persist_base += '_%s' % self.rc.profile
942 self.persist_fname = os.path.join(self.rc.ipythondir,persist_base)
942 self.persist_fname = os.path.join(self.rc.ipythondir,persist_base)
943
943
944 try:
944 try:
945 self.persist = pickle.load(file(self.persist_fname))
945 self.persist = pickle.load(file(self.persist_fname))
946 except:
946 except:
947 self.persist = {}
947 self.persist = {}
948
948
949 def init_auto_alias(self):
949 def init_auto_alias(self):
950 """Define some aliases automatically.
950 """Define some aliases automatically.
951
951
952 These are ALL parameter-less aliases"""
952 These are ALL parameter-less aliases"""
953 for alias,cmd in self.auto_alias:
953 for alias,cmd in self.auto_alias:
954 self.alias_table[alias] = (0,cmd)
954 self.alias_table[alias] = (0,cmd)
955
955
956 def alias_table_validate(self,verbose=0):
956 def alias_table_validate(self,verbose=0):
957 """Update information about the alias table.
957 """Update information about the alias table.
958
958
959 In particular, make sure no Python keywords/builtins are in it."""
959 In particular, make sure no Python keywords/builtins are in it."""
960
960
961 no_alias = self.no_alias
961 no_alias = self.no_alias
962 for k in self.alias_table:
962 for k in self.alias_table:
963 if k in no_alias:
963 if k in no_alias:
964 del self.alias_table[k]
964 del self.alias_table[k]
965 if verbose:
965 if verbose:
966 print ("Deleting alias <%s>, it's a Python "
966 print ("Deleting alias <%s>, it's a Python "
967 "keyword or builtin." % k)
967 "keyword or builtin." % k)
968
968
969 def set_autoindent(self,value=None):
969 def set_autoindent(self,value=None):
970 """Set the autoindent flag, checking for readline support.
970 """Set the autoindent flag, checking for readline support.
971
971
972 If called with no arguments, it acts as a toggle."""
972 If called with no arguments, it acts as a toggle."""
973
973
974 if not self.has_readline:
974 if not self.has_readline:
975 if os.name == 'posix':
975 if os.name == 'posix':
976 warn("The auto-indent feature requires the readline library")
976 warn("The auto-indent feature requires the readline library")
977 self.autoindent = 0
977 self.autoindent = 0
978 return
978 return
979 if value is None:
979 if value is None:
980 self.autoindent = not self.autoindent
980 self.autoindent = not self.autoindent
981 else:
981 else:
982 self.autoindent = value
982 self.autoindent = value
983
983
984 def rc_set_toggle(self,rc_field,value=None):
984 def rc_set_toggle(self,rc_field,value=None):
985 """Set or toggle a field in IPython's rc config. structure.
985 """Set or toggle a field in IPython's rc config. structure.
986
986
987 If called with no arguments, it acts as a toggle.
987 If called with no arguments, it acts as a toggle.
988
988
989 If called with a non-existent field, the resulting AttributeError
989 If called with a non-existent field, the resulting AttributeError
990 exception will propagate out."""
990 exception will propagate out."""
991
991
992 rc_val = getattr(self.rc,rc_field)
992 rc_val = getattr(self.rc,rc_field)
993 if value is None:
993 if value is None:
994 value = not rc_val
994 value = not rc_val
995 setattr(self.rc,rc_field,value)
995 setattr(self.rc,rc_field,value)
996
996
997 def user_setup(self,ipythondir,rc_suffix,mode='install'):
997 def user_setup(self,ipythondir,rc_suffix,mode='install'):
998 """Install the user configuration directory.
998 """Install the user configuration directory.
999
999
1000 Can be called when running for the first time or to upgrade the user's
1000 Can be called when running for the first time or to upgrade the user's
1001 .ipython/ directory with the mode parameter. Valid modes are 'install'
1001 .ipython/ directory with the mode parameter. Valid modes are 'install'
1002 and 'upgrade'."""
1002 and 'upgrade'."""
1003
1003
1004 def wait():
1004 def wait():
1005 try:
1005 try:
1006 raw_input("Please press <RETURN> to start IPython.")
1006 raw_input("Please press <RETURN> to start IPython.")
1007 except EOFError:
1007 except EOFError:
1008 print >> Term.cout
1008 print >> Term.cout
1009 print '*'*70
1009 print '*'*70
1010
1010
1011 cwd = os.getcwd() # remember where we started
1011 cwd = os.getcwd() # remember where we started
1012 glb = glob.glob
1012 glb = glob.glob
1013 print '*'*70
1013 print '*'*70
1014 if mode == 'install':
1014 if mode == 'install':
1015 print \
1015 print \
1016 """Welcome to IPython. I will try to create a personal configuration directory
1016 """Welcome to IPython. I will try to create a personal configuration directory
1017 where you can customize many aspects of IPython's functionality in:\n"""
1017 where you can customize many aspects of IPython's functionality in:\n"""
1018 else:
1018 else:
1019 print 'I am going to upgrade your configuration in:'
1019 print 'I am going to upgrade your configuration in:'
1020
1020
1021 print ipythondir
1021 print ipythondir
1022
1022
1023 rcdirend = os.path.join('IPython','UserConfig')
1023 rcdirend = os.path.join('IPython','UserConfig')
1024 cfg = lambda d: os.path.join(d,rcdirend)
1024 cfg = lambda d: os.path.join(d,rcdirend)
1025 try:
1025 try:
1026 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1026 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1027 except IOError:
1027 except IOError:
1028 warning = """
1028 warning = """
1029 Installation error. IPython's directory was not found.
1029 Installation error. IPython's directory was not found.
1030
1030
1031 Check the following:
1031 Check the following:
1032
1032
1033 The ipython/IPython directory should be in a directory belonging to your
1033 The ipython/IPython directory should be in a directory belonging to your
1034 PYTHONPATH environment variable (that is, it should be in a directory
1034 PYTHONPATH environment variable (that is, it should be in a directory
1035 belonging to sys.path). You can copy it explicitly there or just link to it.
1035 belonging to sys.path). You can copy it explicitly there or just link to it.
1036
1036
1037 IPython will proceed with builtin defaults.
1037 IPython will proceed with builtin defaults.
1038 """
1038 """
1039 warn(warning)
1039 warn(warning)
1040 wait()
1040 wait()
1041 return
1041 return
1042
1042
1043 if mode == 'install':
1043 if mode == 'install':
1044 try:
1044 try:
1045 shutil.copytree(rcdir,ipythondir)
1045 shutil.copytree(rcdir,ipythondir)
1046 os.chdir(ipythondir)
1046 os.chdir(ipythondir)
1047 rc_files = glb("ipythonrc*")
1047 rc_files = glb("ipythonrc*")
1048 for rc_file in rc_files:
1048 for rc_file in rc_files:
1049 os.rename(rc_file,rc_file+rc_suffix)
1049 os.rename(rc_file,rc_file+rc_suffix)
1050 except:
1050 except:
1051 warning = """
1051 warning = """
1052
1052
1053 There was a problem with the installation:
1053 There was a problem with the installation:
1054 %s
1054 %s
1055 Try to correct it or contact the developers if you think it's a bug.
1055 Try to correct it or contact the developers if you think it's a bug.
1056 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1056 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1057 warn(warning)
1057 warn(warning)
1058 wait()
1058 wait()
1059 return
1059 return
1060
1060
1061 elif mode == 'upgrade':
1061 elif mode == 'upgrade':
1062 try:
1062 try:
1063 os.chdir(ipythondir)
1063 os.chdir(ipythondir)
1064 except:
1064 except:
1065 print """
1065 print """
1066 Can not upgrade: changing to directory %s failed. Details:
1066 Can not upgrade: changing to directory %s failed. Details:
1067 %s
1067 %s
1068 """ % (ipythondir,sys.exc_info()[1])
1068 """ % (ipythondir,sys.exc_info()[1])
1069 wait()
1069 wait()
1070 return
1070 return
1071 else:
1071 else:
1072 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1072 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1073 for new_full_path in sources:
1073 for new_full_path in sources:
1074 new_filename = os.path.basename(new_full_path)
1074 new_filename = os.path.basename(new_full_path)
1075 if new_filename.startswith('ipythonrc'):
1075 if new_filename.startswith('ipythonrc'):
1076 new_filename = new_filename + rc_suffix
1076 new_filename = new_filename + rc_suffix
1077 # The config directory should only contain files, skip any
1077 # The config directory should only contain files, skip any
1078 # directories which may be there (like CVS)
1078 # directories which may be there (like CVS)
1079 if os.path.isdir(new_full_path):
1079 if os.path.isdir(new_full_path):
1080 continue
1080 continue
1081 if os.path.exists(new_filename):
1081 if os.path.exists(new_filename):
1082 old_file = new_filename+'.old'
1082 old_file = new_filename+'.old'
1083 if os.path.exists(old_file):
1083 if os.path.exists(old_file):
1084 os.remove(old_file)
1084 os.remove(old_file)
1085 os.rename(new_filename,old_file)
1085 os.rename(new_filename,old_file)
1086 shutil.copy(new_full_path,new_filename)
1086 shutil.copy(new_full_path,new_filename)
1087 else:
1087 else:
1088 raise ValueError,'unrecognized mode for install:',`mode`
1088 raise ValueError,'unrecognized mode for install:',`mode`
1089
1089
1090 # Fix line-endings to those native to each platform in the config
1090 # Fix line-endings to those native to each platform in the config
1091 # directory.
1091 # directory.
1092 try:
1092 try:
1093 os.chdir(ipythondir)
1093 os.chdir(ipythondir)
1094 except:
1094 except:
1095 print """
1095 print """
1096 Problem: changing to directory %s failed.
1096 Problem: changing to directory %s failed.
1097 Details:
1097 Details:
1098 %s
1098 %s
1099
1099
1100 Some configuration files may have incorrect line endings. This should not
1100 Some configuration files may have incorrect line endings. This should not
1101 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1101 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1102 wait()
1102 wait()
1103 else:
1103 else:
1104 for fname in glb('ipythonrc*'):
1104 for fname in glb('ipythonrc*'):
1105 try:
1105 try:
1106 native_line_ends(fname,backup=0)
1106 native_line_ends(fname,backup=0)
1107 except IOError:
1107 except IOError:
1108 pass
1108 pass
1109
1109
1110 if mode == 'install':
1110 if mode == 'install':
1111 print """
1111 print """
1112 Successful installation!
1112 Successful installation!
1113
1113
1114 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1114 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1115 IPython manual (there are both HTML and PDF versions supplied with the
1115 IPython manual (there are both HTML and PDF versions supplied with the
1116 distribution) to make sure that your system environment is properly configured
1116 distribution) to make sure that your system environment is properly configured
1117 to take advantage of IPython's features."""
1117 to take advantage of IPython's features."""
1118 else:
1118 else:
1119 print """
1119 print """
1120 Successful upgrade!
1120 Successful upgrade!
1121
1121
1122 All files in your directory:
1122 All files in your directory:
1123 %(ipythondir)s
1123 %(ipythondir)s
1124 which would have been overwritten by the upgrade were backed up with a .old
1124 which would have been overwritten by the upgrade were backed up with a .old
1125 extension. If you had made particular customizations in those files you may
1125 extension. If you had made particular customizations in those files you may
1126 want to merge them back into the new files.""" % locals()
1126 want to merge them back into the new files.""" % locals()
1127 wait()
1127 wait()
1128 os.chdir(cwd)
1128 os.chdir(cwd)
1129 # end user_setup()
1129 # end user_setup()
1130
1130
1131 def atexit_operations(self):
1131 def atexit_operations(self):
1132 """This will be executed at the time of exit.
1132 """This will be executed at the time of exit.
1133
1133
1134 Saving of persistent data should be performed here. """
1134 Saving of persistent data should be performed here. """
1135
1135
1136 # input history
1136 # input history
1137 self.savehist()
1137 self.savehist()
1138
1138
1139 # Cleanup all tempfiles left around
1139 # Cleanup all tempfiles left around
1140 for tfile in self.tempfiles:
1140 for tfile in self.tempfiles:
1141 try:
1141 try:
1142 os.unlink(tfile)
1142 os.unlink(tfile)
1143 except OSError:
1143 except OSError:
1144 pass
1144 pass
1145
1145
1146 # save the "persistent data" catch-all dictionary
1146 # save the "persistent data" catch-all dictionary
1147 try:
1147 try:
1148 pickle.dump(self.persist, open(self.persist_fname,"w"))
1148 pickle.dump(self.persist, open(self.persist_fname,"w"))
1149 except:
1149 except:
1150 print "*** ERROR *** persistent data saving failed."
1150 print "*** ERROR *** persistent data saving failed."
1151
1151
1152 def savehist(self):
1152 def savehist(self):
1153 """Save input history to a file (via readline library)."""
1153 """Save input history to a file (via readline library)."""
1154 try:
1154 try:
1155 self.readline.write_history_file(self.histfile)
1155 self.readline.write_history_file(self.histfile)
1156 except:
1156 except:
1157 print 'Unable to save IPython command history to file: ' + \
1157 print 'Unable to save IPython command history to file: ' + \
1158 `self.histfile`
1158 `self.histfile`
1159
1159
1160 def pre_readline(self):
1160 def pre_readline(self):
1161 """readline hook to be used at the start of each line.
1161 """readline hook to be used at the start of each line.
1162
1162
1163 Currently it handles auto-indent only."""
1163 Currently it handles auto-indent only."""
1164
1164
1165 self.readline.insert_text(' '* self.readline_indent)
1165 self.readline.insert_text(' '* self.readline_indent)
1166
1166
1167 def init_readline(self):
1167 def init_readline(self):
1168 """Command history completion/saving/reloading."""
1168 """Command history completion/saving/reloading."""
1169 try:
1169 try:
1170 import readline
1170 import readline
1171 self.Completer = MagicCompleter(self,
1171 self.Completer = MagicCompleter(self,
1172 self.user_ns,
1172 self.user_ns,
1173 self.rc.readline_omit__names,
1173 self.rc.readline_omit__names,
1174 self.alias_table)
1174 self.alias_table)
1175 except ImportError,NameError:
1175 except ImportError,NameError:
1176 # If FlexCompleter failed to import, MagicCompleter won't be
1176 # If FlexCompleter failed to import, MagicCompleter won't be
1177 # defined. This can happen because of a problem with readline
1177 # defined. This can happen because of a problem with readline
1178 self.has_readline = 0
1178 self.has_readline = 0
1179 # no point in bugging windows users with this every time:
1179 # no point in bugging windows users with this every time:
1180 if os.name == 'posix':
1180 if os.name == 'posix':
1181 warn('Readline services not available on this platform.')
1181 warn('Readline services not available on this platform.')
1182 else:
1182 else:
1183 import atexit
1183 import atexit
1184
1184
1185 # Platform-specific configuration
1185 # Platform-specific configuration
1186 if os.name == 'nt':
1186 if os.name == 'nt':
1187 # readline under Windows modifies the default exit behavior
1187 # readline under Windows modifies the default exit behavior
1188 # from being Ctrl-Z/Return to the Unix Ctrl-D one.
1188 # from being Ctrl-Z/Return to the Unix Ctrl-D one.
1189 __builtin__.exit = __builtin__.quit = \
1189 __builtin__.exit = __builtin__.quit = \
1190 ('Use Ctrl-D (i.e. EOF) to exit. '
1190 ('Use Ctrl-D (i.e. EOF) to exit. '
1191 'Use %Exit or %Quit to exit without confirmation.')
1191 'Use %Exit or %Quit to exit without confirmation.')
1192 self.readline_startup_hook = readline.set_pre_input_hook
1192 self.readline_startup_hook = readline.set_pre_input_hook
1193 else:
1193 else:
1194 self.readline_startup_hook = readline.set_startup_hook
1194 self.readline_startup_hook = readline.set_startup_hook
1195
1195
1196 # Load user's initrc file (readline config)
1196 # Load user's initrc file (readline config)
1197 inputrc_name = os.environ.get('INPUTRC')
1197 inputrc_name = os.environ.get('INPUTRC')
1198 if inputrc_name is None:
1198 if inputrc_name is None:
1199 home_dir = get_home_dir()
1199 home_dir = get_home_dir()
1200 if home_dir is not None:
1200 if home_dir is not None:
1201 inputrc_name = os.path.join(home_dir,'.inputrc')
1201 inputrc_name = os.path.join(home_dir,'.inputrc')
1202 if os.path.isfile(inputrc_name):
1202 if os.path.isfile(inputrc_name):
1203 try:
1203 try:
1204 readline.read_init_file(inputrc_name)
1204 readline.read_init_file(inputrc_name)
1205 except:
1205 except:
1206 warn('Problems reading readline initialization file <%s>'
1206 warn('Problems reading readline initialization file <%s>'
1207 % inputrc_name)
1207 % inputrc_name)
1208
1208
1209 self.has_readline = 1
1209 self.has_readline = 1
1210 self.readline = readline
1210 self.readline = readline
1211 self.readline_indent = 0 # for auto-indenting via readline
1211 self.readline_indent = 0 # for auto-indenting via readline
1212 # save this in sys so embedded copies can restore it properly
1212 # save this in sys so embedded copies can restore it properly
1213 sys.ipcompleter = self.Completer.complete
1213 sys.ipcompleter = self.Completer.complete
1214 readline.set_completer(self.Completer.complete)
1214 readline.set_completer(self.Completer.complete)
1215
1215
1216 # Configure readline according to user's prefs
1216 # Configure readline according to user's prefs
1217 for rlcommand in self.rc.readline_parse_and_bind:
1217 for rlcommand in self.rc.readline_parse_and_bind:
1218 readline.parse_and_bind(rlcommand)
1218 readline.parse_and_bind(rlcommand)
1219
1219
1220 # remove some chars from the delimiters list
1220 # remove some chars from the delimiters list
1221 delims = readline.get_completer_delims()
1221 delims = readline.get_completer_delims()
1222 delims = delims.translate(string._idmap,
1222 delims = delims.translate(string._idmap,
1223 self.rc.readline_remove_delims)
1223 self.rc.readline_remove_delims)
1224 readline.set_completer_delims(delims)
1224 readline.set_completer_delims(delims)
1225 # otherwise we end up with a monster history after a while:
1225 # otherwise we end up with a monster history after a while:
1226 readline.set_history_length(1000)
1226 readline.set_history_length(1000)
1227 try:
1227 try:
1228 #print '*** Reading readline history' # dbg
1228 #print '*** Reading readline history' # dbg
1229 readline.read_history_file(self.histfile)
1229 readline.read_history_file(self.histfile)
1230 except IOError:
1230 except IOError:
1231 pass # It doesn't exist yet.
1231 pass # It doesn't exist yet.
1232
1232
1233 atexit.register(self.atexit_operations)
1233 atexit.register(self.atexit_operations)
1234 del atexit
1234 del atexit
1235
1235
1236 # Configure auto-indent for all platforms
1236 # Configure auto-indent for all platforms
1237 self.set_autoindent(self.rc.autoindent)
1237 self.set_autoindent(self.rc.autoindent)
1238
1238
1239 def showsyntaxerror(self, filename=None):
1239 def showsyntaxerror(self, filename=None):
1240 """Display the syntax error that just occurred.
1240 """Display the syntax error that just occurred.
1241
1241
1242 This doesn't display a stack trace because there isn't one.
1242 This doesn't display a stack trace because there isn't one.
1243
1243
1244 If a filename is given, it is stuffed in the exception instead
1244 If a filename is given, it is stuffed in the exception instead
1245 of what was there before (because Python's parser always uses
1245 of what was there before (because Python's parser always uses
1246 "<string>" when reading from a string).
1246 "<string>" when reading from a string).
1247 """
1247 """
1248 type, value, sys.last_traceback = sys.exc_info()
1248 type, value, sys.last_traceback = sys.exc_info()
1249 sys.last_type = type
1249 sys.last_type = type
1250 sys.last_value = value
1250 sys.last_value = value
1251 if filename and type is SyntaxError:
1251 if filename and type is SyntaxError:
1252 # Work hard to stuff the correct filename in the exception
1252 # Work hard to stuff the correct filename in the exception
1253 try:
1253 try:
1254 msg, (dummy_filename, lineno, offset, line) = value
1254 msg, (dummy_filename, lineno, offset, line) = value
1255 except:
1255 except:
1256 # Not the format we expect; leave it alone
1256 # Not the format we expect; leave it alone
1257 pass
1257 pass
1258 else:
1258 else:
1259 # Stuff in the right filename
1259 # Stuff in the right filename
1260 try:
1260 try:
1261 # Assume SyntaxError is a class exception
1261 # Assume SyntaxError is a class exception
1262 value = SyntaxError(msg, (filename, lineno, offset, line))
1262 value = SyntaxError(msg, (filename, lineno, offset, line))
1263 except:
1263 except:
1264 # If that failed, assume SyntaxError is a string
1264 # If that failed, assume SyntaxError is a string
1265 value = msg, (filename, lineno, offset, line)
1265 value = msg, (filename, lineno, offset, line)
1266 self.SyntaxTB(type,value,[])
1266 self.SyntaxTB(type,value,[])
1267
1267
1268 def debugger(self):
1268 def debugger(self):
1269 """Call the pdb debugger."""
1269 """Call the pdb debugger."""
1270
1270
1271 if not self.rc.pdb:
1271 if not self.rc.pdb:
1272 return
1272 return
1273 pdb.pm()
1273 pdb.pm()
1274
1274
1275 def showtraceback(self,exc_tuple = None):
1275 def showtraceback(self,exc_tuple = None):
1276 """Display the exception that just occurred."""
1276 """Display the exception that just occurred."""
1277
1277
1278 # Though this won't be called by syntax errors in the input line,
1278 # Though this won't be called by syntax errors in the input line,
1279 # there may be SyntaxError cases whith imported code.
1279 # there may be SyntaxError cases whith imported code.
1280 if exc_tuple is None:
1280 if exc_tuple is None:
1281 type, value, tb = sys.exc_info()
1281 type, value, tb = sys.exc_info()
1282 else:
1282 else:
1283 type, value, tb = exc_tuple
1283 type, value, tb = exc_tuple
1284 if type is SyntaxError:
1284 if type is SyntaxError:
1285 self.showsyntaxerror()
1285 self.showsyntaxerror()
1286 else:
1286 else:
1287 sys.last_type = type
1287 sys.last_type = type
1288 sys.last_value = value
1288 sys.last_value = value
1289 sys.last_traceback = tb
1289 sys.last_traceback = tb
1290 self.InteractiveTB()
1290 self.InteractiveTB()
1291 if self.InteractiveTB.call_pdb and self.has_readline:
1291 if self.InteractiveTB.call_pdb and self.has_readline:
1292 # pdb mucks up readline, fix it back
1292 # pdb mucks up readline, fix it back
1293 self.readline.set_completer(self.Completer.complete)
1293 self.readline.set_completer(self.Completer.complete)
1294
1294
1295 def update_cache(self, line):
1295 def update_cache(self, line):
1296 """puts line into cache"""
1296 """puts line into cache"""
1297 self.inputcache.insert(0, line) # This copies the cache every time ... :-(
1297 self.inputcache.insert(0, line) # This copies the cache every time ... :-(
1298 if len(self.inputcache) >= self.CACHELENGTH:
1298 if len(self.inputcache) >= self.CACHELENGTH:
1299 self.inputcache.pop() # This not :-)
1299 self.inputcache.pop() # This not :-)
1300
1300
1301 def name_space_init(self):
1301 def name_space_init(self):
1302 """Create local namespace."""
1302 """Create local namespace."""
1303 # We want this to be a method to facilitate embedded initialization.
1303 # We want this to be a method to facilitate embedded initialization.
1304 code.InteractiveConsole.__init__(self,self.user_ns)
1304 code.InteractiveConsole.__init__(self,self.user_ns)
1305
1305
1306 def mainloop(self,banner=None):
1306 def mainloop(self,banner=None):
1307 """Creates the local namespace and starts the mainloop.
1307 """Creates the local namespace and starts the mainloop.
1308
1308
1309 If an optional banner argument is given, it will override the
1309 If an optional banner argument is given, it will override the
1310 internally created default banner."""
1310 internally created default banner."""
1311
1311
1312 self.name_space_init()
1312 self.name_space_init()
1313 if self.rc.c: # Emulate Python's -c option
1313 if self.rc.c: # Emulate Python's -c option
1314 self.exec_init_cmd()
1314 self.exec_init_cmd()
1315 if banner is None:
1315 if banner is None:
1316 if self.rc.banner:
1316 if self.rc.banner:
1317 banner = self.BANNER+self.banner2
1317 banner = self.BANNER+self.banner2
1318 else:
1318 else:
1319 banner = ''
1319 banner = ''
1320 self.interact(banner)
1320 self.interact(banner)
1321
1321
1322 def exec_init_cmd(self):
1322 def exec_init_cmd(self):
1323 """Execute a command given at the command line.
1323 """Execute a command given at the command line.
1324
1324
1325 This emulates Python's -c option."""
1325 This emulates Python's -c option."""
1326
1326
1327 sys.argv = ['-c']
1327 sys.argv = ['-c']
1328 self.push(self.rc.c)
1328 self.push(self.rc.c)
1329
1329
1330 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1330 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1331 """Embeds IPython into a running python program.
1331 """Embeds IPython into a running python program.
1332
1332
1333 Input:
1333 Input:
1334
1334
1335 - header: An optional header message can be specified.
1335 - header: An optional header message can be specified.
1336
1336
1337 - local_ns, global_ns: working namespaces. If given as None, the
1337 - local_ns, global_ns: working namespaces. If given as None, the
1338 IPython-initialized one is updated with __main__.__dict__, so that
1338 IPython-initialized one is updated with __main__.__dict__, so that
1339 program variables become visible but user-specific configuration
1339 program variables become visible but user-specific configuration
1340 remains possible.
1340 remains possible.
1341
1341
1342 - stack_depth: specifies how many levels in the stack to go to
1342 - stack_depth: specifies how many levels in the stack to go to
1343 looking for namespaces (when local_ns and global_ns are None). This
1343 looking for namespaces (when local_ns and global_ns are None). This
1344 allows an intermediate caller to make sure that this function gets
1344 allows an intermediate caller to make sure that this function gets
1345 the namespace from the intended level in the stack. By default (0)
1345 the namespace from the intended level in the stack. By default (0)
1346 it will get its locals and globals from the immediate caller.
1346 it will get its locals and globals from the immediate caller.
1347
1347
1348 Warning: it's possible to use this in a program which is being run by
1348 Warning: it's possible to use this in a program which is being run by
1349 IPython itself (via %run), but some funny things will happen (a few
1349 IPython itself (via %run), but some funny things will happen (a few
1350 globals get overwritten). In the future this will be cleaned up, as
1350 globals get overwritten). In the future this will be cleaned up, as
1351 there is no fundamental reason why it can't work perfectly."""
1351 there is no fundamental reason why it can't work perfectly."""
1352
1352
1353 # Patch for global embedding to make sure that things don't overwrite
1353 # Patch for global embedding to make sure that things don't overwrite
1354 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1354 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1355 # FIXME. Test this a bit more carefully (the if.. is new)
1355 # FIXME. Test this a bit more carefully (the if.. is new)
1356 if local_ns is None and global_ns is None:
1356 if local_ns is None and global_ns is None:
1357 self.user_ns.update(__main__.__dict__)
1357 self.user_ns.update(__main__.__dict__)
1358
1358
1359 # Get locals and globals from caller
1359 # Get locals and globals from caller
1360 if local_ns is None or global_ns is None:
1360 if local_ns is None or global_ns is None:
1361 call_frame = sys._getframe(stack_depth).f_back
1361 call_frame = sys._getframe(stack_depth).f_back
1362
1362
1363 if local_ns is None:
1363 if local_ns is None:
1364 local_ns = call_frame.f_locals
1364 local_ns = call_frame.f_locals
1365 if global_ns is None:
1365 if global_ns is None:
1366 global_ns = call_frame.f_globals
1366 global_ns = call_frame.f_globals
1367
1367
1368 # Update namespaces and fire up interpreter
1368 # Update namespaces and fire up interpreter
1369 self.user_ns.update(local_ns)
1369 self.user_ns.update(local_ns)
1370 self.interact(header)
1370 self.interact(header)
1371
1371
1372 # Remove locals from namespace
1372 # Remove locals from namespace
1373 for k in local_ns:
1373 for k in local_ns:
1374 del self.user_ns[k]
1374 del self.user_ns[k]
1375
1375
1376 def interact(self, banner=None):
1376 def interact(self, banner=None):
1377 """Closely emulate the interactive Python console.
1377 """Closely emulate the interactive Python console.
1378
1378
1379 The optional banner argument specify the banner to print
1379 The optional banner argument specify the banner to print
1380 before the first interaction; by default it prints a banner
1380 before the first interaction; by default it prints a banner
1381 similar to the one printed by the real Python interpreter,
1381 similar to the one printed by the real Python interpreter,
1382 followed by the current class name in parentheses (so as not
1382 followed by the current class name in parentheses (so as not
1383 to confuse this with the real interpreter -- since it's so
1383 to confuse this with the real interpreter -- since it's so
1384 close!).
1384 close!).
1385
1385
1386 """
1386 """
1387 cprt = 'Type "copyright", "credits" or "license" for more information.'
1387 cprt = 'Type "copyright", "credits" or "license" for more information.'
1388 if banner is None:
1388 if banner is None:
1389 self.write("Python %s on %s\n%s\n(%s)\n" %
1389 self.write("Python %s on %s\n%s\n(%s)\n" %
1390 (sys.version, sys.platform, cprt,
1390 (sys.version, sys.platform, cprt,
1391 self.__class__.__name__))
1391 self.__class__.__name__))
1392 else:
1392 else:
1393 self.write(banner)
1393 self.write(banner)
1394
1394
1395 more = 0
1395 more = 0
1396
1396
1397 # Mark activity in the builtins
1397 # Mark activity in the builtins
1398 __builtin__.__dict__['__IPYTHON__active'] += 1
1398 __builtin__.__dict__['__IPYTHON__active'] += 1
1399
1399
1400 # exit_now is set by a call to %Exit or %Quit
1400 # exit_now is set by a call to %Exit or %Quit
1401 while not self.exit_now:
1401 while not self.exit_now:
1402 try:
1402 try:
1403 if more:
1403 if more:
1404 prompt = self.outputcache.prompt2
1404 prompt = self.outputcache.prompt2
1405 if self.autoindent:
1405 if self.autoindent:
1406 self.readline_startup_hook(self.pre_readline)
1406 self.readline_startup_hook(self.pre_readline)
1407 else:
1407 else:
1408 prompt = self.outputcache.prompt1
1408 prompt = self.outputcache.prompt1
1409 try:
1409 try:
1410 line = self.raw_input(prompt)
1410 line = self.raw_input(prompt)
1411 if self.autoindent:
1411 if self.autoindent:
1412 self.readline_startup_hook(None)
1412 self.readline_startup_hook(None)
1413 except EOFError:
1413 except EOFError:
1414 if self.autoindent:
1414 if self.autoindent:
1415 self.readline_startup_hook(None)
1415 self.readline_startup_hook(None)
1416 self.write("\n")
1416 self.write("\n")
1417 if self.rc.confirm_exit:
1417 if self.rc.confirm_exit:
1418 if ask_yes_no('Do you really want to exit ([y]/n)?','y'):
1418 if ask_yes_no('Do you really want to exit ([y]/n)?','y'):
1419 break
1419 break
1420 else:
1420 else:
1421 break
1421 break
1422 else:
1422 else:
1423 more = self.push(line)
1423 more = self.push(line)
1424 # Auto-indent management
1424 # Auto-indent management
1425 if self.autoindent:
1425 if self.autoindent:
1426 if line:
1426 if line:
1427 ini_spaces = re.match('^(\s+)',line)
1427 ini_spaces = re.match('^(\s+)',line)
1428 if ini_spaces:
1428 if ini_spaces:
1429 nspaces = ini_spaces.end()
1429 nspaces = ini_spaces.end()
1430 else:
1430 else:
1431 nspaces = 0
1431 nspaces = 0
1432 self.readline_indent = nspaces
1432 self.readline_indent = nspaces
1433
1433
1434 if line[-1] == ':':
1434 if line[-1] == ':':
1435 self.readline_indent += 4
1435 self.readline_indent += 4
1436 elif re.match(r'^\s+raise|^\s+return',line):
1436 elif re.match(r'^\s+raise|^\s+return',line):
1437 self.readline_indent -= 4
1437 self.readline_indent -= 4
1438 else:
1438 else:
1439 self.readline_indent = 0
1439 self.readline_indent = 0
1440
1440
1441 except KeyboardInterrupt:
1441 except KeyboardInterrupt:
1442 self.write("\nKeyboardInterrupt\n")
1442 self.write("\nKeyboardInterrupt\n")
1443 self.resetbuffer()
1443 self.resetbuffer()
1444 more = 0
1444 more = 0
1445 # keep cache in sync with the prompt counter:
1445 # keep cache in sync with the prompt counter:
1446 self.outputcache.prompt_count -= 1
1446 self.outputcache.prompt_count -= 1
1447
1447
1448 if self.autoindent:
1448 if self.autoindent:
1449 self.readline_indent = 0
1449 self.readline_indent = 0
1450
1450
1451 except bdb.BdbQuit:
1451 except bdb.BdbQuit:
1452 warn("The Python debugger has exited with a BdbQuit exception.\n"
1452 warn("The Python debugger has exited with a BdbQuit exception.\n"
1453 "Because of how pdb handles the stack, it is impossible\n"
1453 "Because of how pdb handles the stack, it is impossible\n"
1454 "for IPython to properly format this particular exception.\n"
1454 "for IPython to properly format this particular exception.\n"
1455 "IPython will resume normal operation.")
1455 "IPython will resume normal operation.")
1456
1456
1457 # We are off again...
1457 # We are off again...
1458 __builtin__.__dict__['__IPYTHON__active'] -= 1
1458 __builtin__.__dict__['__IPYTHON__active'] -= 1
1459
1459
1460 def excepthook(self, type, value, tb):
1460 def excepthook(self, type, value, tb):
1461 """One more defense for GUI apps that call sys.excepthook.
1461 """One more defense for GUI apps that call sys.excepthook.
1462
1462
1463 GUI frameworks like wxPython trap exceptions and call
1463 GUI frameworks like wxPython trap exceptions and call
1464 sys.excepthook themselves. I guess this is a feature that
1464 sys.excepthook themselves. I guess this is a feature that
1465 enables them to keep running after exceptions that would
1465 enables them to keep running after exceptions that would
1466 otherwise kill their mainloop. This is a bother for IPython
1466 otherwise kill their mainloop. This is a bother for IPython
1467 which excepts to catch all of the program exceptions with a try:
1467 which excepts to catch all of the program exceptions with a try:
1468 except: statement.
1468 except: statement.
1469
1469
1470 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1470 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1471 any app directly invokes sys.excepthook, it will look to the user like
1471 any app directly invokes sys.excepthook, it will look to the user like
1472 IPython crashed. In order to work around this, we can disable the
1472 IPython crashed. In order to work around this, we can disable the
1473 CrashHandler and replace it with this excepthook instead, which prints a
1473 CrashHandler and replace it with this excepthook instead, which prints a
1474 regular traceback using our InteractiveTB. In this fashion, apps which
1474 regular traceback using our InteractiveTB. In this fashion, apps which
1475 call sys.excepthook will generate a regular-looking exception from
1475 call sys.excepthook will generate a regular-looking exception from
1476 IPython, and the CrashHandler will only be triggered by real IPython
1476 IPython, and the CrashHandler will only be triggered by real IPython
1477 crashes.
1477 crashes.
1478
1478
1479 This hook should be used sparingly, only in places which are not likely
1479 This hook should be used sparingly, only in places which are not likely
1480 to be true IPython errors.
1480 to be true IPython errors.
1481 """
1481 """
1482
1482
1483 self.InteractiveTB(type, value, tb, tb_offset=0)
1483 self.InteractiveTB(type, value, tb, tb_offset=0)
1484 if self.InteractiveTB.call_pdb and self.has_readline:
1484 if self.InteractiveTB.call_pdb and self.has_readline:
1485 self.readline.set_completer(self.Completer.complete)
1485 self.readline.set_completer(self.Completer.complete)
1486
1486
1487 def call_alias(self,alias,rest=''):
1487 def call_alias(self,alias,rest=''):
1488 """Call an alias given its name and the rest of the line.
1488 """Call an alias given its name and the rest of the line.
1489
1489
1490 This function MUST be given a proper alias, because it doesn't make
1490 This function MUST be given a proper alias, because it doesn't make
1491 any checks when looking up into the alias table. The caller is
1491 any checks when looking up into the alias table. The caller is
1492 responsible for invoking it only with a valid alias."""
1492 responsible for invoking it only with a valid alias."""
1493
1493
1494 #print 'ALIAS: <%s>+<%s>' % (alias,rest) # dbg
1494 #print 'ALIAS: <%s>+<%s>' % (alias,rest) # dbg
1495 nargs,cmd = self.alias_table[alias]
1495 nargs,cmd = self.alias_table[alias]
1496 # Expand the %l special to be the user's input line
1496 # Expand the %l special to be the user's input line
1497 if cmd.find('%l') >= 0:
1497 if cmd.find('%l') >= 0:
1498 cmd = cmd.replace('%l',rest)
1498 cmd = cmd.replace('%l',rest)
1499 rest = ''
1499 rest = ''
1500 if nargs==0:
1500 if nargs==0:
1501 # Simple, argument-less aliases
1501 # Simple, argument-less aliases
1502 cmd = '%s %s' % (cmd,rest)
1502 cmd = '%s %s' % (cmd,rest)
1503 else:
1503 else:
1504 # Handle aliases with positional arguments
1504 # Handle aliases with positional arguments
1505 args = rest.split(None,nargs)
1505 args = rest.split(None,nargs)
1506 if len(args)< nargs:
1506 if len(args)< nargs:
1507 error('Alias <%s> requires %s arguments, %s given.' %
1507 error('Alias <%s> requires %s arguments, %s given.' %
1508 (alias,nargs,len(args)))
1508 (alias,nargs,len(args)))
1509 return
1509 return
1510 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1510 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1511 # Now call the macro, evaluating in the user's namespace
1511 # Now call the macro, evaluating in the user's namespace
1512 try:
1512 try:
1513 self.system(cmd)
1513 self.system(cmd)
1514 except:
1514 except:
1515 self.showtraceback()
1515 self.showtraceback()
1516
1516
1517 def runlines(self,lines):
1517 def runlines(self,lines):
1518 """Run a string of one or more lines of source.
1518 """Run a string of one or more lines of source.
1519
1519
1520 This method is capable of running a string containing multiple source
1520 This method is capable of running a string containing multiple source
1521 lines, as if they had been entered at the IPython prompt. Since it
1521 lines, as if they had been entered at the IPython prompt. Since it
1522 exposes IPython's processing machinery, the given strings can contain
1522 exposes IPython's processing machinery, the given strings can contain
1523 magic calls (%magic), special shell access (!cmd), etc."""
1523 magic calls (%magic), special shell access (!cmd), etc."""
1524
1524
1525 # We must start with a clean buffer, in case this is run from an
1525 # We must start with a clean buffer, in case this is run from an
1526 # interactive IPython session (via a magic, for example).
1526 # interactive IPython session (via a magic, for example).
1527 self.resetbuffer()
1527 self.resetbuffer()
1528 lines = lines.split('\n')
1528 lines = lines.split('\n')
1529 more = 0
1529 more = 0
1530 for line in lines:
1530 for line in lines:
1531 # skip blank lines so we don't mess up the prompt counter, but do
1531 # skip blank lines so we don't mess up the prompt counter, but do
1532 # NOT skip even a blank line if we are in a code block (more is
1532 # NOT skip even a blank line if we are in a code block (more is
1533 # true)
1533 # true)
1534 if line or more:
1534 if line or more:
1535 more = self.push((self.prefilter(line,more)))
1535 more = self.push((self.prefilter(line,more)))
1536 # IPython's runsource returns None if there was an error
1536 # IPython's runsource returns None if there was an error
1537 # compiling the code. This allows us to stop processing right
1537 # compiling the code. This allows us to stop processing right
1538 # away, so the user gets the error message at the right place.
1538 # away, so the user gets the error message at the right place.
1539 if more is None:
1539 if more is None:
1540 break
1540 break
1541 # final newline in case the input didn't have it, so that the code
1541 # final newline in case the input didn't have it, so that the code
1542 # actually does get executed
1542 # actually does get executed
1543 if more:
1543 if more:
1544 self.push('\n')
1544 self.push('\n')
1545
1545
1546 def runsource(self, source, filename="<input>", symbol="single"):
1546 def runsource(self, source, filename="<input>", symbol="single"):
1547 """Compile and run some source in the interpreter.
1547 """Compile and run some source in the interpreter.
1548
1548
1549 Arguments are as for compile_command().
1549 Arguments are as for compile_command().
1550
1550
1551 One several things can happen:
1551 One several things can happen:
1552
1552
1553 1) The input is incorrect; compile_command() raised an
1553 1) The input is incorrect; compile_command() raised an
1554 exception (SyntaxError or OverflowError). A syntax traceback
1554 exception (SyntaxError or OverflowError). A syntax traceback
1555 will be printed by calling the showsyntaxerror() method.
1555 will be printed by calling the showsyntaxerror() method.
1556
1556
1557 2) The input is incomplete, and more input is required;
1557 2) The input is incomplete, and more input is required;
1558 compile_command() returned None. Nothing happens.
1558 compile_command() returned None. Nothing happens.
1559
1559
1560 3) The input is complete; compile_command() returned a code
1560 3) The input is complete; compile_command() returned a code
1561 object. The code is executed by calling self.runcode() (which
1561 object. The code is executed by calling self.runcode() (which
1562 also handles run-time exceptions, except for SystemExit).
1562 also handles run-time exceptions, except for SystemExit).
1563
1563
1564 The return value is:
1564 The return value is:
1565
1565
1566 - True in case 2
1566 - True in case 2
1567
1567
1568 - False in the other cases, unless an exception is raised, where
1568 - False in the other cases, unless an exception is raised, where
1569 None is returned instead. This can be used by external callers to
1569 None is returned instead. This can be used by external callers to
1570 know whether to continue feeding input or not.
1570 know whether to continue feeding input or not.
1571
1571
1572 The return value can be used to decide whether to use sys.ps1 or
1572 The return value can be used to decide whether to use sys.ps1 or
1573 sys.ps2 to prompt the next line."""
1573 sys.ps2 to prompt the next line."""
1574
1574
1575 try:
1575 try:
1576 code = self.compile(source, filename, symbol)
1576 code = self.compile(source, filename, symbol)
1577 except (OverflowError, SyntaxError, ValueError):
1577 except (OverflowError, SyntaxError, ValueError):
1578 # Case 1
1578 # Case 1
1579 self.showsyntaxerror(filename)
1579 self.showsyntaxerror(filename)
1580 return None
1580 return None
1581
1581
1582 if code is None:
1582 if code is None:
1583 # Case 2
1583 # Case 2
1584 return True
1584 return True
1585
1585
1586 # Case 3
1586 # Case 3
1587 # We store the code object so that threaded shells and
1587 # We store the code object so that threaded shells and
1588 # custom exception handlers can access all this info if needed.
1588 # custom exception handlers can access all this info if needed.
1589 # The source corresponding to this can be obtained from the
1589 # The source corresponding to this can be obtained from the
1590 # buffer attribute as '\n'.join(self.buffer).
1590 # buffer attribute as '\n'.join(self.buffer).
1591 self.code_to_run = code
1591 self.code_to_run = code
1592 # now actually execute the code object
1592 # now actually execute the code object
1593 if self.runcode(code) == 0:
1593 if self.runcode(code) == 0:
1594 return False
1594 return False
1595 else:
1595 else:
1596 return None
1596 return None
1597
1597
1598 def runcode(self,code_obj):
1598 def runcode(self,code_obj):
1599 """Execute a code object.
1599 """Execute a code object.
1600
1600
1601 When an exception occurs, self.showtraceback() is called to display a
1601 When an exception occurs, self.showtraceback() is called to display a
1602 traceback.
1602 traceback.
1603
1603
1604 Return value: a flag indicating whether the code to be run completed
1604 Return value: a flag indicating whether the code to be run completed
1605 successfully:
1605 successfully:
1606
1606
1607 - 0: successful execution.
1607 - 0: successful execution.
1608 - 1: an error occurred.
1608 - 1: an error occurred.
1609 """
1609 """
1610
1610
1611 # Set our own excepthook in case the user code tries to call it
1611 # Set our own excepthook in case the user code tries to call it
1612 # directly, so that the IPython crash handler doesn't get triggered
1612 # directly, so that the IPython crash handler doesn't get triggered
1613 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1613 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1614 outflag = 1 # happens in more places, so it's easier as default
1614 outflag = 1 # happens in more places, so it's easier as default
1615 try:
1615 try:
1616 try:
1616 try:
1617 exec code_obj in self.locals
1617 exec code_obj in self.locals
1618 finally:
1618 finally:
1619 # Reset our crash handler in place
1619 # Reset our crash handler in place
1620 sys.excepthook = old_excepthook
1620 sys.excepthook = old_excepthook
1621 except SystemExit:
1621 except SystemExit:
1622 self.resetbuffer()
1622 self.resetbuffer()
1623 self.showtraceback()
1623 self.showtraceback()
1624 warn( __builtin__.exit,level=1)
1624 warn( __builtin__.exit,level=1)
1625 except self.custom_exceptions:
1625 except self.custom_exceptions:
1626 etype,value,tb = sys.exc_info()
1626 etype,value,tb = sys.exc_info()
1627 self.CustomTB(etype,value,tb)
1627 self.CustomTB(etype,value,tb)
1628 except:
1628 except:
1629 self.showtraceback()
1629 self.showtraceback()
1630 else:
1630 else:
1631 outflag = 0
1631 outflag = 0
1632 if code.softspace(sys.stdout, 0):
1632 if code.softspace(sys.stdout, 0):
1633 print
1633 print
1634 # Flush out code object which has been run (and source)
1634 # Flush out code object which has been run (and source)
1635 self.code_to_run = None
1635 self.code_to_run = None
1636 return outflag
1636 return outflag
1637
1637
1638 def raw_input(self, prompt=""):
1638 def raw_input(self, prompt=""):
1639 """Write a prompt and read a line.
1639 """Write a prompt and read a line.
1640
1640
1641 The returned line does not include the trailing newline.
1641 The returned line does not include the trailing newline.
1642 When the user enters the EOF key sequence, EOFError is raised.
1642 When the user enters the EOF key sequence, EOFError is raised.
1643
1643
1644 The base implementation uses the built-in function
1644 The base implementation uses the built-in function
1645 raw_input(); a subclass may replace this with a different
1645 raw_input(); a subclass may replace this with a different
1646 implementation.
1646 implementation.
1647 """
1647 """
1648 return self.prefilter(raw_input_original(prompt),
1648 return self.prefilter(raw_input_original(prompt),
1649 prompt==self.outputcache.prompt2)
1649 prompt==self.outputcache.prompt2)
1650
1650
1651 def split_user_input(self,line):
1651 def split_user_input(self,line):
1652 """Split user input into pre-char, function part and rest."""
1652 """Split user input into pre-char, function part and rest."""
1653
1653
1654 lsplit = self.line_split.match(line)
1654 lsplit = self.line_split.match(line)
1655 if lsplit is None: # no regexp match returns None
1655 if lsplit is None: # no regexp match returns None
1656 try:
1656 try:
1657 iFun,theRest = line.split(None,1)
1657 iFun,theRest = line.split(None,1)
1658 except ValueError:
1658 except ValueError:
1659 iFun,theRest = line,''
1659 iFun,theRest = line,''
1660 pre = re.match('^(\s*)(.*)',line).groups()[0]
1660 pre = re.match('^(\s*)(.*)',line).groups()[0]
1661 else:
1661 else:
1662 pre,iFun,theRest = lsplit.groups()
1662 pre,iFun,theRest = lsplit.groups()
1663
1663
1664 #print 'line:<%s>' % line # dbg
1664 #print 'line:<%s>' % line # dbg
1665 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1665 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1666 return pre,iFun.strip(),theRest
1666 return pre,iFun.strip(),theRest
1667
1667
1668 def _prefilter(self, line, continue_prompt):
1668 def _prefilter(self, line, continue_prompt):
1669 """Calls different preprocessors, depending on the form of line."""
1669 """Calls different preprocessors, depending on the form of line."""
1670
1670
1671 # All handlers *must* return a value, even if it's blank ('').
1671 # All handlers *must* return a value, even if it's blank ('').
1672
1672
1673 # Lines are NOT logged here. Handlers should process the line as
1673 # Lines are NOT logged here. Handlers should process the line as
1674 # needed, update the cache AND log it (so that the input cache array
1674 # needed, update the cache AND log it (so that the input cache array
1675 # stays synced).
1675 # stays synced).
1676
1676
1677 # This function is _very_ delicate, and since it's also the one which
1677 # This function is _very_ delicate, and since it's also the one which
1678 # determines IPython's response to user input, it must be as efficient
1678 # determines IPython's response to user input, it must be as efficient
1679 # as possible. For this reason it has _many_ returns in it, trying
1679 # as possible. For this reason it has _many_ returns in it, trying
1680 # always to exit as quickly as it can figure out what it needs to do.
1680 # always to exit as quickly as it can figure out what it needs to do.
1681
1681
1682 # This function is the main responsible for maintaining IPython's
1682 # This function is the main responsible for maintaining IPython's
1683 # behavior respectful of Python's semantics. So be _very_ careful if
1683 # behavior respectful of Python's semantics. So be _very_ careful if
1684 # making changes to anything here.
1684 # making changes to anything here.
1685
1685
1686 #.....................................................................
1686 #.....................................................................
1687 # Code begins
1687 # Code begins
1688
1688
1689 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1689 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1690
1690
1691 # save the line away in case we crash, so the post-mortem handler can
1691 # save the line away in case we crash, so the post-mortem handler can
1692 # record it
1692 # record it
1693 self._last_input_line = line
1693 self._last_input_line = line
1694
1694
1695 #print '***line: <%s>' % line # dbg
1695 #print '***line: <%s>' % line # dbg
1696
1696
1697 # the input history needs to track even empty lines
1697 # the input history needs to track even empty lines
1698 if not line.strip():
1698 if not line.strip():
1699 if not continue_prompt:
1699 if not continue_prompt:
1700 self.outputcache.prompt_count -= 1
1700 self.outputcache.prompt_count -= 1
1701 return self.handle_normal('',continue_prompt)
1701 return self.handle_normal('',continue_prompt)
1702
1702
1703 # print '***cont',continue_prompt # dbg
1703 # print '***cont',continue_prompt # dbg
1704 # special handlers are only allowed for single line statements
1704 # special handlers are only allowed for single line statements
1705 if continue_prompt and not self.rc.multi_line_specials:
1705 if continue_prompt and not self.rc.multi_line_specials:
1706 return self.handle_normal(line,continue_prompt)
1706 return self.handle_normal(line,continue_prompt)
1707
1707
1708 # For the rest, we need the structure of the input
1708 # For the rest, we need the structure of the input
1709 pre,iFun,theRest = self.split_user_input(line)
1709 pre,iFun,theRest = self.split_user_input(line)
1710 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1710 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1711
1711
1712 # First check for explicit escapes in the last/first character
1712 # First check for explicit escapes in the last/first character
1713 handler = None
1713 handler = None
1714 if line[-1] == self.ESC_HELP:
1714 if line[-1] == self.ESC_HELP:
1715 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
1715 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
1716 if handler is None:
1716 if handler is None:
1717 # look at the first character of iFun, NOT of line, so we skip
1717 # look at the first character of iFun, NOT of line, so we skip
1718 # leading whitespace in multiline input
1718 # leading whitespace in multiline input
1719 handler = self.esc_handlers.get(iFun[0:1])
1719 handler = self.esc_handlers.get(iFun[0:1])
1720 if handler is not None:
1720 if handler is not None:
1721 return handler(line,continue_prompt,pre,iFun,theRest)
1721 return handler(line,continue_prompt,pre,iFun,theRest)
1722 # Emacs ipython-mode tags certain input lines
1722 # Emacs ipython-mode tags certain input lines
1723 if line.endswith('# PYTHON-MODE'):
1723 if line.endswith('# PYTHON-MODE'):
1724 return self.handle_emacs(line,continue_prompt)
1724 return self.handle_emacs(line,continue_prompt)
1725
1725
1726 # Next, check if we can automatically execute this thing
1726 # Next, check if we can automatically execute this thing
1727
1727
1728 # Allow ! in multi-line statements if multi_line_specials is on:
1728 # Allow ! in multi-line statements if multi_line_specials is on:
1729 if continue_prompt and self.rc.multi_line_specials and \
1729 if continue_prompt and self.rc.multi_line_specials and \
1730 iFun.startswith(self.ESC_SHELL):
1730 iFun.startswith(self.ESC_SHELL):
1731 return self.handle_shell_escape(line,continue_prompt,
1731 return self.handle_shell_escape(line,continue_prompt,
1732 pre=pre,iFun=iFun,
1732 pre=pre,iFun=iFun,
1733 theRest=theRest)
1733 theRest=theRest)
1734
1734
1735 # Let's try to find if the input line is a magic fn
1735 # Let's try to find if the input line is a magic fn
1736 oinfo = None
1736 oinfo = None
1737 if hasattr(self,'magic_'+iFun):
1737 if hasattr(self,'magic_'+iFun):
1738 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1738 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1739 if oinfo['ismagic']:
1739 if oinfo['ismagic']:
1740 # Be careful not to call magics when a variable assignment is
1740 # Be careful not to call magics when a variable assignment is
1741 # being made (ls='hi', for example)
1741 # being made (ls='hi', for example)
1742 if self.rc.automagic and \
1742 if self.rc.automagic and \
1743 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
1743 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
1744 (self.rc.multi_line_specials or not continue_prompt):
1744 (self.rc.multi_line_specials or not continue_prompt):
1745 return self.handle_magic(line,continue_prompt,
1745 return self.handle_magic(line,continue_prompt,
1746 pre,iFun,theRest)
1746 pre,iFun,theRest)
1747 else:
1747 else:
1748 return self.handle_normal(line,continue_prompt)
1748 return self.handle_normal(line,continue_prompt)
1749
1749
1750 # If the rest of the line begins with an (in)equality, assginment or
1750 # If the rest of the line begins with an (in)equality, assginment or
1751 # function call, we should not call _ofind but simply execute it.
1751 # function call, we should not call _ofind but simply execute it.
1752 # This avoids spurious geattr() accesses on objects upon assignment.
1752 # This avoids spurious geattr() accesses on objects upon assignment.
1753 #
1753 #
1754 # It also allows users to assign to either alias or magic names true
1754 # It also allows users to assign to either alias or magic names true
1755 # python variables (the magic/alias systems always take second seat to
1755 # python variables (the magic/alias systems always take second seat to
1756 # true python code).
1756 # true python code).
1757 if theRest and theRest[0] in '!=()':
1757 if theRest and theRest[0] in '!=()':
1758 return self.handle_normal(line,continue_prompt)
1758 return self.handle_normal(line,continue_prompt)
1759
1759
1760 if oinfo is None:
1760 if oinfo is None:
1761 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1761 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1762
1762
1763 if not oinfo['found']:
1763 if not oinfo['found']:
1764 return self.handle_normal(line,continue_prompt)
1764 return self.handle_normal(line,continue_prompt)
1765 else:
1765 else:
1766 #print 'iFun <%s> rest <%s>' % (iFun,theRest) # dbg
1766 #print 'iFun <%s> rest <%s>' % (iFun,theRest) # dbg
1767 if oinfo['isalias']:
1767 if oinfo['isalias']:
1768 return self.handle_alias(line,continue_prompt,
1768 return self.handle_alias(line,continue_prompt,
1769 pre,iFun,theRest)
1769 pre,iFun,theRest)
1770
1770
1771 if self.rc.autocall and \
1771 if self.rc.autocall and \
1772 not self.re_exclude_auto.match(theRest) and \
1772 not self.re_exclude_auto.match(theRest) and \
1773 self.re_fun_name.match(iFun) and \
1773 self.re_fun_name.match(iFun) and \
1774 callable(oinfo['obj']) :
1774 callable(oinfo['obj']) :
1775 #print 'going auto' # dbg
1775 #print 'going auto' # dbg
1776 return self.handle_auto(line,continue_prompt,pre,iFun,theRest)
1776 return self.handle_auto(line,continue_prompt,pre,iFun,theRest)
1777 else:
1777 else:
1778 #print 'was callable?', callable(oinfo['obj']) # dbg
1778 #print 'was callable?', callable(oinfo['obj']) # dbg
1779 return self.handle_normal(line,continue_prompt)
1779 return self.handle_normal(line,continue_prompt)
1780
1780
1781 # If we get here, we have a normal Python line. Log and return.
1781 # If we get here, we have a normal Python line. Log and return.
1782 return self.handle_normal(line,continue_prompt)
1782 return self.handle_normal(line,continue_prompt)
1783
1783
1784 def _prefilter_dumb(self, line, continue_prompt):
1784 def _prefilter_dumb(self, line, continue_prompt):
1785 """simple prefilter function, for debugging"""
1785 """simple prefilter function, for debugging"""
1786 return self.handle_normal(line,continue_prompt)
1786 return self.handle_normal(line,continue_prompt)
1787
1787
1788 # Set the default prefilter() function (this can be user-overridden)
1788 # Set the default prefilter() function (this can be user-overridden)
1789 prefilter = _prefilter
1789 prefilter = _prefilter
1790
1790
1791 def handle_normal(self,line,continue_prompt=None,
1791 def handle_normal(self,line,continue_prompt=None,
1792 pre=None,iFun=None,theRest=None):
1792 pre=None,iFun=None,theRest=None):
1793 """Handle normal input lines. Use as a template for handlers."""
1793 """Handle normal input lines. Use as a template for handlers."""
1794
1794
1795 self.log(line,continue_prompt)
1795 self.log(line,continue_prompt)
1796 self.update_cache(line)
1796 self.update_cache(line)
1797 return line
1797 return line
1798
1798
1799 def handle_alias(self,line,continue_prompt=None,
1799 def handle_alias(self,line,continue_prompt=None,
1800 pre=None,iFun=None,theRest=None):
1800 pre=None,iFun=None,theRest=None):
1801 """Handle alias input lines. """
1801 """Handle alias input lines. """
1802
1802
1803 theRest = esc_quotes(theRest)
1803 theRest = esc_quotes(theRest)
1804 line_out = "%s%s.call_alias('%s','%s')" % (pre,self.name,iFun,theRest)
1804 line_out = "%s%s.call_alias('%s','%s')" % (pre,self.name,iFun,theRest)
1805 self.log(line_out,continue_prompt)
1805 self.log(line_out,continue_prompt)
1806 self.update_cache(line_out)
1806 self.update_cache(line_out)
1807 return line_out
1807 return line_out
1808
1808
1809 def handle_shell_escape(self, line, continue_prompt=None,
1809 def handle_shell_escape(self, line, continue_prompt=None,
1810 pre=None,iFun=None,theRest=None):
1810 pre=None,iFun=None,theRest=None):
1811 """Execute the line in a shell, empty return value"""
1811 """Execute the line in a shell, empty return value"""
1812
1812
1813 #print 'line in :', `line` # dbg
1813 #print 'line in :', `line` # dbg
1814 # Example of a special handler. Others follow a similar pattern.
1814 # Example of a special handler. Others follow a similar pattern.
1815 if continue_prompt: # multi-line statements
1815 if continue_prompt: # multi-line statements
1816 if iFun.startswith('!!'):
1816 if iFun.startswith('!!'):
1817 print 'SyntaxError: !! is not allowed in multiline statements'
1817 print 'SyntaxError: !! is not allowed in multiline statements'
1818 return pre
1818 return pre
1819 else:
1819 else:
1820 cmd = ("%s %s" % (iFun[1:],theRest)).replace('"','\\"')
1820 cmd = ("%s %s" % (iFun[1:],theRest)).replace('"','\\"')
1821 line_out = '%s%s.system("%s")' % (pre,self.name,cmd)
1821 line_out = '%s%s.system("%s")' % (pre,self.name,cmd)
1822 #line_out = ('%s%s.system(' % (pre,self.name)) + repr(cmd) + ')'
1822 #line_out = ('%s%s.system(' % (pre,self.name)) + repr(cmd) + ')'
1823 else: # single-line input
1823 else: # single-line input
1824 if line.startswith('!!'):
1824 if line.startswith('!!'):
1825 # rewrite iFun/theRest to properly hold the call to %sx and
1825 # rewrite iFun/theRest to properly hold the call to %sx and
1826 # the actual command to be executed, so handle_magic can work
1826 # the actual command to be executed, so handle_magic can work
1827 # correctly
1827 # correctly
1828 theRest = '%s %s' % (iFun[2:],theRest)
1828 theRest = '%s %s' % (iFun[2:],theRest)
1829 iFun = 'sx'
1829 iFun = 'sx'
1830 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,line[2:]),
1830 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,line[2:]),
1831 continue_prompt,pre,iFun,theRest)
1831 continue_prompt,pre,iFun,theRest)
1832 else:
1832 else:
1833 cmd = esc_quotes(line[1:])
1833 cmd = esc_quotes(line[1:])
1834 line_out = '%s.system("%s")' % (self.name,cmd)
1834 line_out = '%s.system("%s")' % (self.name,cmd)
1835 #line_out = ('%s.system(' % self.name) + repr(cmd)+ ')'
1835 #line_out = ('%s.system(' % self.name) + repr(cmd)+ ')'
1836 # update cache/log and return
1836 # update cache/log and return
1837 self.log(line_out,continue_prompt)
1837 self.log(line_out,continue_prompt)
1838 self.update_cache(line_out) # readline cache gets normal line
1838 self.update_cache(line_out) # readline cache gets normal line
1839 #print 'line out r:', `line_out` # dbg
1839 #print 'line out r:', `line_out` # dbg
1840 #print 'line out s:', line_out # dbg
1840 #print 'line out s:', line_out # dbg
1841 return line_out
1841 return line_out
1842
1842
1843 def handle_magic(self, line, continue_prompt=None,
1843 def handle_magic(self, line, continue_prompt=None,
1844 pre=None,iFun=None,theRest=None):
1844 pre=None,iFun=None,theRest=None):
1845 """Execute magic functions.
1845 """Execute magic functions.
1846
1846
1847 Also log them with a prepended # so the log is clean Python."""
1847 Also log them with a prepended # so the log is clean Python."""
1848
1848
1849 cmd = '%sipmagic("%s")' % (pre,esc_quotes('%s %s' % (iFun,theRest)))
1849 cmd = '%sipmagic("%s")' % (pre,esc_quotes('%s %s' % (iFun,theRest)))
1850 self.log(cmd,continue_prompt)
1850 self.log(cmd,continue_prompt)
1851 self.update_cache(line)
1851 self.update_cache(line)
1852 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
1852 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
1853 return cmd
1853 return cmd
1854
1854
1855 def handle_auto(self, line, continue_prompt=None,
1855 def handle_auto(self, line, continue_prompt=None,
1856 pre=None,iFun=None,theRest=None):
1856 pre=None,iFun=None,theRest=None):
1857 """Hande lines which can be auto-executed, quoting if requested."""
1857 """Hande lines which can be auto-executed, quoting if requested."""
1858
1858
1859 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1859 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1860
1860
1861 # This should only be active for single-line input!
1861 # This should only be active for single-line input!
1862 if continue_prompt:
1862 if continue_prompt:
1863 return line
1863 return line
1864
1864
1865 if pre == self.ESC_QUOTE:
1865 if pre == self.ESC_QUOTE:
1866 # Auto-quote splitting on whitespace
1866 # Auto-quote splitting on whitespace
1867 newcmd = '%s("%s")\n' % (iFun,'", "'.join(theRest.split()) )
1867 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
1868 elif pre == self.ESC_QUOTE2:
1868 elif pre == self.ESC_QUOTE2:
1869 # Auto-quote whole string
1869 # Auto-quote whole string
1870 newcmd = '%s("%s")\n' % (iFun,theRest)
1870 newcmd = '%s("%s")' % (iFun,theRest)
1871 else:
1871 else:
1872 # Auto-paren
1872 # Auto-paren
1873 if theRest[0:1] in ('=','['):
1873 if theRest[0:1] in ('=','['):
1874 # Don't autocall in these cases. They can be either
1874 # Don't autocall in these cases. They can be either
1875 # rebindings of an existing callable's name, or item access
1875 # rebindings of an existing callable's name, or item access
1876 # for an object which is BOTH callable and implements
1876 # for an object which is BOTH callable and implements
1877 # __getitem__.
1877 # __getitem__.
1878 return '%s %s\n' % (iFun,theRest)
1878 return '%s %s' % (iFun,theRest)
1879 if theRest.endswith(';'):
1879 if theRest.endswith(';'):
1880 newcmd = '%s(%s);\n' % (iFun.rstrip(),theRest[:-1])
1880 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
1881 else:
1881 else:
1882 newcmd = '%s(%s)\n' % (iFun.rstrip(),theRest)
1882 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
1883
1883
1884 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd,
1884 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
1885 # log what is now valid Python, not the actual user input (without the
1885 # log what is now valid Python, not the actual user input (without the
1886 # final newline)
1886 # final newline)
1887 self.log(newcmd.strip(),continue_prompt)
1887 self.log(newcmd,continue_prompt)
1888 return newcmd
1888 return newcmd
1889
1889
1890 def handle_help(self, line, continue_prompt=None,
1890 def handle_help(self, line, continue_prompt=None,
1891 pre=None,iFun=None,theRest=None):
1891 pre=None,iFun=None,theRest=None):
1892 """Try to get some help for the object.
1892 """Try to get some help for the object.
1893
1893
1894 obj? or ?obj -> basic information.
1894 obj? or ?obj -> basic information.
1895 obj?? or ??obj -> more details.
1895 obj?? or ??obj -> more details.
1896 """
1896 """
1897
1897
1898 # We need to make sure that we don't process lines which would be
1898 # We need to make sure that we don't process lines which would be
1899 # otherwise valid python, such as "x=1 # what?"
1899 # otherwise valid python, such as "x=1 # what?"
1900 try:
1900 try:
1901 code.compile_command(line)
1901 code.compile_command(line)
1902 except SyntaxError:
1902 except SyntaxError:
1903 # We should only handle as help stuff which is NOT valid syntax
1903 # We should only handle as help stuff which is NOT valid syntax
1904 if line[0]==self.ESC_HELP:
1904 if line[0]==self.ESC_HELP:
1905 line = line[1:]
1905 line = line[1:]
1906 elif line[-1]==self.ESC_HELP:
1906 elif line[-1]==self.ESC_HELP:
1907 line = line[:-1]
1907 line = line[:-1]
1908 self.log('#?'+line)
1908 self.log('#?'+line)
1909 self.update_cache(line)
1909 self.update_cache(line)
1910 if line:
1910 if line:
1911 self.magic_pinfo(line)
1911 self.magic_pinfo(line)
1912 else:
1912 else:
1913 page(self.usage,screen_lines=self.rc.screen_length)
1913 page(self.usage,screen_lines=self.rc.screen_length)
1914 return '' # Empty string is needed here!
1914 return '' # Empty string is needed here!
1915 except:
1915 except:
1916 # Pass any other exceptions through to the normal handler
1916 # Pass any other exceptions through to the normal handler
1917 return self.handle_normal(line,continue_prompt)
1917 return self.handle_normal(line,continue_prompt)
1918 else:
1918 else:
1919 # If the code compiles ok, we should handle it normally
1919 # If the code compiles ok, we should handle it normally
1920 return self.handle_normal(line,continue_prompt)
1920 return self.handle_normal(line,continue_prompt)
1921
1921
1922 def handle_emacs(self,line,continue_prompt=None,
1922 def handle_emacs(self,line,continue_prompt=None,
1923 pre=None,iFun=None,theRest=None):
1923 pre=None,iFun=None,theRest=None):
1924 """Handle input lines marked by python-mode."""
1924 """Handle input lines marked by python-mode."""
1925
1925
1926 # Currently, nothing is done. Later more functionality can be added
1926 # Currently, nothing is done. Later more functionality can be added
1927 # here if needed.
1927 # here if needed.
1928
1928
1929 # The input cache shouldn't be updated
1929 # The input cache shouldn't be updated
1930
1930
1931 return line
1931 return line
1932
1932
1933 def write(self,data):
1933 def write(self,data):
1934 """Write a string to the default output"""
1934 """Write a string to the default output"""
1935 Term.cout.write(data)
1935 Term.cout.write(data)
1936
1936
1937 def write_err(self,data):
1937 def write_err(self,data):
1938 """Write a string to the default error output"""
1938 """Write a string to the default error output"""
1939 Term.cerr.write(data)
1939 Term.cerr.write(data)
1940
1940
1941 def safe_execfile(self,fname,*where,**kw):
1941 def safe_execfile(self,fname,*where,**kw):
1942 fname = os.path.expanduser(fname)
1942 fname = os.path.expanduser(fname)
1943
1943
1944 # find things also in current directory
1944 # find things also in current directory
1945 dname = os.path.dirname(fname)
1945 dname = os.path.dirname(fname)
1946 if not sys.path.count(dname):
1946 if not sys.path.count(dname):
1947 sys.path.append(dname)
1947 sys.path.append(dname)
1948
1948
1949 try:
1949 try:
1950 xfile = open(fname)
1950 xfile = open(fname)
1951 except:
1951 except:
1952 print >> Term.cerr, \
1952 print >> Term.cerr, \
1953 'Could not open file <%s> for safe execution.' % fname
1953 'Could not open file <%s> for safe execution.' % fname
1954 return None
1954 return None
1955
1955
1956 kw.setdefault('islog',0)
1956 kw.setdefault('islog',0)
1957 kw.setdefault('quiet',1)
1957 kw.setdefault('quiet',1)
1958 kw.setdefault('exit_ignore',0)
1958 kw.setdefault('exit_ignore',0)
1959 first = xfile.readline()
1959 first = xfile.readline()
1960 _LOGHEAD = str(self.LOGHEAD).split('\n',1)[0].strip()
1960 _LOGHEAD = str(self.LOGHEAD).split('\n',1)[0].strip()
1961 xfile.close()
1961 xfile.close()
1962 # line by line execution
1962 # line by line execution
1963 if first.startswith(_LOGHEAD) or kw['islog']:
1963 if first.startswith(_LOGHEAD) or kw['islog']:
1964 print 'Loading log file <%s> one line at a time...' % fname
1964 print 'Loading log file <%s> one line at a time...' % fname
1965 if kw['quiet']:
1965 if kw['quiet']:
1966 stdout_save = sys.stdout
1966 stdout_save = sys.stdout
1967 sys.stdout = StringIO.StringIO()
1967 sys.stdout = StringIO.StringIO()
1968 try:
1968 try:
1969 globs,locs = where[0:2]
1969 globs,locs = where[0:2]
1970 except:
1970 except:
1971 try:
1971 try:
1972 globs = locs = where[0]
1972 globs = locs = where[0]
1973 except:
1973 except:
1974 globs = locs = globals()
1974 globs = locs = globals()
1975 badblocks = []
1975 badblocks = []
1976
1976
1977 # we also need to identify indented blocks of code when replaying
1977 # we also need to identify indented blocks of code when replaying
1978 # logs and put them together before passing them to an exec
1978 # logs and put them together before passing them to an exec
1979 # statement. This takes a bit of regexp and look-ahead work in the
1979 # statement. This takes a bit of regexp and look-ahead work in the
1980 # file. It's easiest if we swallow the whole thing in memory
1980 # file. It's easiest if we swallow the whole thing in memory
1981 # first, and manually walk through the lines list moving the
1981 # first, and manually walk through the lines list moving the
1982 # counter ourselves.
1982 # counter ourselves.
1983 indent_re = re.compile('\s+\S')
1983 indent_re = re.compile('\s+\S')
1984 xfile = open(fname)
1984 xfile = open(fname)
1985 filelines = xfile.readlines()
1985 filelines = xfile.readlines()
1986 xfile.close()
1986 xfile.close()
1987 nlines = len(filelines)
1987 nlines = len(filelines)
1988 lnum = 0
1988 lnum = 0
1989 while lnum < nlines:
1989 while lnum < nlines:
1990 line = filelines[lnum]
1990 line = filelines[lnum]
1991 lnum += 1
1991 lnum += 1
1992 # don't re-insert logger status info into cache
1992 # don't re-insert logger status info into cache
1993 if line.startswith('#log#'):
1993 if line.startswith('#log#'):
1994 continue
1994 continue
1995 elif line.startswith('#%s'% self.ESC_MAGIC):
1995 elif line.startswith('#%s'% self.ESC_MAGIC):
1996 self.update_cache(line[1:])
1996 self.update_cache(line[1:])
1997 line = magic2python(line)
1997 line = magic2python(line)
1998 elif line.startswith('#!'):
1998 elif line.startswith('#!'):
1999 self.update_cache(line[1:])
1999 self.update_cache(line[1:])
2000 else:
2000 else:
2001 # build a block of code (maybe a single line) for execution
2001 # build a block of code (maybe a single line) for execution
2002 block = line
2002 block = line
2003 try:
2003 try:
2004 next = filelines[lnum] # lnum has already incremented
2004 next = filelines[lnum] # lnum has already incremented
2005 except:
2005 except:
2006 next = None
2006 next = None
2007 while next and indent_re.match(next):
2007 while next and indent_re.match(next):
2008 block += next
2008 block += next
2009 lnum += 1
2009 lnum += 1
2010 try:
2010 try:
2011 next = filelines[lnum]
2011 next = filelines[lnum]
2012 except:
2012 except:
2013 next = None
2013 next = None
2014 # now execute the block of one or more lines
2014 # now execute the block of one or more lines
2015 try:
2015 try:
2016 exec block in globs,locs
2016 exec block in globs,locs
2017 self.update_cache(block.rstrip())
2017 self.update_cache(block.rstrip())
2018 except SystemExit:
2018 except SystemExit:
2019 pass
2019 pass
2020 except:
2020 except:
2021 badblocks.append(block.rstrip())
2021 badblocks.append(block.rstrip())
2022 if kw['quiet']: # restore stdout
2022 if kw['quiet']: # restore stdout
2023 sys.stdout.close()
2023 sys.stdout.close()
2024 sys.stdout = stdout_save
2024 sys.stdout = stdout_save
2025 print 'Finished replaying log file <%s>' % fname
2025 print 'Finished replaying log file <%s>' % fname
2026 if badblocks:
2026 if badblocks:
2027 print >> sys.stderr, \
2027 print >> sys.stderr, \
2028 '\nThe following lines/blocks in file <%s> reported errors:' \
2028 '\nThe following lines/blocks in file <%s> reported errors:' \
2029 % fname
2029 % fname
2030 for badline in badblocks:
2030 for badline in badblocks:
2031 print >> sys.stderr, badline
2031 print >> sys.stderr, badline
2032 else: # regular file execution
2032 else: # regular file execution
2033 try:
2033 try:
2034 execfile(fname,*where)
2034 execfile(fname,*where)
2035 except SyntaxError:
2035 except SyntaxError:
2036 etype, evalue = sys.exc_info()[0:2]
2036 etype, evalue = sys.exc_info()[0:2]
2037 self.SyntaxTB(etype,evalue,[])
2037 self.SyntaxTB(etype,evalue,[])
2038 warn('Failure executing file: <%s>' % fname)
2038 warn('Failure executing file: <%s>' % fname)
2039 except SystemExit,status:
2039 except SystemExit,status:
2040 if not kw['exit_ignore']:
2040 if not kw['exit_ignore']:
2041 self.InteractiveTB()
2041 self.InteractiveTB()
2042 warn('Failure executing file: <%s>' % fname)
2042 warn('Failure executing file: <%s>' % fname)
2043 except:
2043 except:
2044 self.InteractiveTB()
2044 self.InteractiveTB()
2045 warn('Failure executing file: <%s>' % fname)
2045 warn('Failure executing file: <%s>' % fname)
2046
2046
2047 #************************* end of file <iplib.py> *****************************
2047 #************************* end of file <iplib.py> *****************************
@@ -1,4351 +1,4357 b''
1 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
4 spurious newlines added by this routine. After a report by
5 F. Mantegazza.
6
1 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
7 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
2
8
3 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
9 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
4 calls. These were a leftover from the GTK 1.x days, and can cause
10 calls. These were a leftover from the GTK 1.x days, and can cause
5 problems in certain cases (after a report by John Hunter).
11 problems in certain cases (after a report by John Hunter).
6
12
7 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
13 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
8 os.getcwd() fails at init time. Thanks to patch from David Remahl
14 os.getcwd() fails at init time. Thanks to patch from David Remahl
9 <chmod007 AT mac.com>.
15 <chmod007 AT mac.com>.
10 (InteractiveShell.__init__): prevent certain special magics from
16 (InteractiveShell.__init__): prevent certain special magics from
11 being shadowed by aliases. Closes
17 being shadowed by aliases. Closes
12 http://www.scipy.net/roundup/ipython/issue41.
18 http://www.scipy.net/roundup/ipython/issue41.
13
19
14 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
20 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
15
21
16 * IPython/iplib.py (InteractiveShell.complete): Added new
22 * IPython/iplib.py (InteractiveShell.complete): Added new
17 top-level completion method to expose the completion mechanism
23 top-level completion method to expose the completion mechanism
18 beyond readline-based environments.
24 beyond readline-based environments.
19
25
20 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
26 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
21
27
22 * tools/ipsvnc (svnversion): fix svnversion capture.
28 * tools/ipsvnc (svnversion): fix svnversion capture.
23
29
24 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
30 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
25 attribute to self, which was missing. Before, it was set by a
31 attribute to self, which was missing. Before, it was set by a
26 routine which in certain cases wasn't being called, so the
32 routine which in certain cases wasn't being called, so the
27 instance could end up missing the attribute. This caused a crash.
33 instance could end up missing the attribute. This caused a crash.
28 Closes http://www.scipy.net/roundup/ipython/issue40.
34 Closes http://www.scipy.net/roundup/ipython/issue40.
29
35
30 2005-08-16 Fernando Perez <fperez@colorado.edu>
36 2005-08-16 Fernando Perez <fperez@colorado.edu>
31
37
32 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
38 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
33 contains non-string attribute. Closes
39 contains non-string attribute. Closes
34 http://www.scipy.net/roundup/ipython/issue38.
40 http://www.scipy.net/roundup/ipython/issue38.
35
41
36 2005-08-14 Fernando Perez <fperez@colorado.edu>
42 2005-08-14 Fernando Perez <fperez@colorado.edu>
37
43
38 * tools/ipsvnc: Minor improvements, to add changeset info.
44 * tools/ipsvnc: Minor improvements, to add changeset info.
39
45
40 2005-08-12 Fernando Perez <fperez@colorado.edu>
46 2005-08-12 Fernando Perez <fperez@colorado.edu>
41
47
42 * IPython/iplib.py (runsource): remove self.code_to_run_src
48 * IPython/iplib.py (runsource): remove self.code_to_run_src
43 attribute. I realized this is nothing more than
49 attribute. I realized this is nothing more than
44 '\n'.join(self.buffer), and having the same data in two different
50 '\n'.join(self.buffer), and having the same data in two different
45 places is just asking for synchronization bugs. This may impact
51 places is just asking for synchronization bugs. This may impact
46 people who have custom exception handlers, so I need to warn
52 people who have custom exception handlers, so I need to warn
47 ipython-dev about it (F. Mantegazza may use them).
53 ipython-dev about it (F. Mantegazza may use them).
48
54
49 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
55 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
50
56
51 * IPython/genutils.py: fix 2.2 compatibility (generators)
57 * IPython/genutils.py: fix 2.2 compatibility (generators)
52
58
53 2005-07-18 Fernando Perez <fperez@colorado.edu>
59 2005-07-18 Fernando Perez <fperez@colorado.edu>
54
60
55 * IPython/genutils.py (get_home_dir): fix to help users with
61 * IPython/genutils.py (get_home_dir): fix to help users with
56 invalid $HOME under win32.
62 invalid $HOME under win32.
57
63
58 2005-07-17 Fernando Perez <fperez@colorado.edu>
64 2005-07-17 Fernando Perez <fperez@colorado.edu>
59
65
60 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
66 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
61 some old hacks and clean up a bit other routines; code should be
67 some old hacks and clean up a bit other routines; code should be
62 simpler and a bit faster.
68 simpler and a bit faster.
63
69
64 * IPython/iplib.py (interact): removed some last-resort attempts
70 * IPython/iplib.py (interact): removed some last-resort attempts
65 to survive broken stdout/stderr. That code was only making it
71 to survive broken stdout/stderr. That code was only making it
66 harder to abstract out the i/o (necessary for gui integration),
72 harder to abstract out the i/o (necessary for gui integration),
67 and the crashes it could prevent were extremely rare in practice
73 and the crashes it could prevent were extremely rare in practice
68 (besides being fully user-induced in a pretty violent manner).
74 (besides being fully user-induced in a pretty violent manner).
69
75
70 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
76 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
71 Nothing major yet, but the code is simpler to read; this should
77 Nothing major yet, but the code is simpler to read; this should
72 make it easier to do more serious modifications in the future.
78 make it easier to do more serious modifications in the future.
73
79
74 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
80 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
75 which broke in .15 (thanks to a report by Ville).
81 which broke in .15 (thanks to a report by Ville).
76
82
77 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
83 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
78 be quite correct, I know next to nothing about unicode). This
84 be quite correct, I know next to nothing about unicode). This
79 will allow unicode strings to be used in prompts, amongst other
85 will allow unicode strings to be used in prompts, amongst other
80 cases. It also will prevent ipython from crashing when unicode
86 cases. It also will prevent ipython from crashing when unicode
81 shows up unexpectedly in many places. If ascii encoding fails, we
87 shows up unexpectedly in many places. If ascii encoding fails, we
82 assume utf_8. Currently the encoding is not a user-visible
88 assume utf_8. Currently the encoding is not a user-visible
83 setting, though it could be made so if there is demand for it.
89 setting, though it could be made so if there is demand for it.
84
90
85 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
91 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
86
92
87 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
93 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
88
94
89 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
95 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
90
96
91 * IPython/genutils.py: Add 2.2 compatibility here, so all other
97 * IPython/genutils.py: Add 2.2 compatibility here, so all other
92 code can work transparently for 2.2/2.3.
98 code can work transparently for 2.2/2.3.
93
99
94 2005-07-16 Fernando Perez <fperez@colorado.edu>
100 2005-07-16 Fernando Perez <fperez@colorado.edu>
95
101
96 * IPython/ultraTB.py (ExceptionColors): Make a global variable
102 * IPython/ultraTB.py (ExceptionColors): Make a global variable
97 out of the color scheme table used for coloring exception
103 out of the color scheme table used for coloring exception
98 tracebacks. This allows user code to add new schemes at runtime.
104 tracebacks. This allows user code to add new schemes at runtime.
99 This is a minimally modified version of the patch at
105 This is a minimally modified version of the patch at
100 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
106 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
101 for the contribution.
107 for the contribution.
102
108
103 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
109 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
104 slightly modified version of the patch in
110 slightly modified version of the patch in
105 http://www.scipy.net/roundup/ipython/issue34, which also allows me
111 http://www.scipy.net/roundup/ipython/issue34, which also allows me
106 to remove the previous try/except solution (which was costlier).
112 to remove the previous try/except solution (which was costlier).
107 Thanks to Gaetan Lehmann <gaetan.lehmann AT jouy.inra.fr> for the fix.
113 Thanks to Gaetan Lehmann <gaetan.lehmann AT jouy.inra.fr> for the fix.
108
114
109 2005-06-08 Fernando Perez <fperez@colorado.edu>
115 2005-06-08 Fernando Perez <fperez@colorado.edu>
110
116
111 * IPython/iplib.py (write/write_err): Add methods to abstract all
117 * IPython/iplib.py (write/write_err): Add methods to abstract all
112 I/O a bit more.
118 I/O a bit more.
113
119
114 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
120 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
115 warning, reported by Aric Hagberg, fix by JD Hunter.
121 warning, reported by Aric Hagberg, fix by JD Hunter.
116
122
117 2005-06-02 *** Released version 0.6.15
123 2005-06-02 *** Released version 0.6.15
118
124
119 2005-06-01 Fernando Perez <fperez@colorado.edu>
125 2005-06-01 Fernando Perez <fperez@colorado.edu>
120
126
121 * IPython/iplib.py (MagicCompleter.file_matches): Fix
127 * IPython/iplib.py (MagicCompleter.file_matches): Fix
122 tab-completion of filenames within open-quoted strings. Note that
128 tab-completion of filenames within open-quoted strings. Note that
123 this requires that in ~/.ipython/ipythonrc, users change the
129 this requires that in ~/.ipython/ipythonrc, users change the
124 readline delimiters configuration to read:
130 readline delimiters configuration to read:
125
131
126 readline_remove_delims -/~
132 readline_remove_delims -/~
127
133
128
134
129 2005-05-31 *** Released version 0.6.14
135 2005-05-31 *** Released version 0.6.14
130
136
131 2005-05-29 Fernando Perez <fperez@colorado.edu>
137 2005-05-29 Fernando Perez <fperez@colorado.edu>
132
138
133 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
139 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
134 with files not on the filesystem. Reported by Eliyahu Sandler
140 with files not on the filesystem. Reported by Eliyahu Sandler
135 <eli@gondolin.net>
141 <eli@gondolin.net>
136
142
137 2005-05-22 Fernando Perez <fperez@colorado.edu>
143 2005-05-22 Fernando Perez <fperez@colorado.edu>
138
144
139 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
145 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
140 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
146 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
141
147
142 2005-05-19 Fernando Perez <fperez@colorado.edu>
148 2005-05-19 Fernando Perez <fperez@colorado.edu>
143
149
144 * IPython/iplib.py (safe_execfile): close a file which could be
150 * IPython/iplib.py (safe_execfile): close a file which could be
145 left open (causing problems in win32, which locks open files).
151 left open (causing problems in win32, which locks open files).
146 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
152 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
147
153
148 2005-05-18 Fernando Perez <fperez@colorado.edu>
154 2005-05-18 Fernando Perez <fperez@colorado.edu>
149
155
150 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
156 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
151 keyword arguments correctly to safe_execfile().
157 keyword arguments correctly to safe_execfile().
152
158
153 2005-05-13 Fernando Perez <fperez@colorado.edu>
159 2005-05-13 Fernando Perez <fperez@colorado.edu>
154
160
155 * ipython.1: Added info about Qt to manpage, and threads warning
161 * ipython.1: Added info about Qt to manpage, and threads warning
156 to usage page (invoked with --help).
162 to usage page (invoked with --help).
157
163
158 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
164 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
159 new matcher (it goes at the end of the priority list) to do
165 new matcher (it goes at the end of the priority list) to do
160 tab-completion on named function arguments. Submitted by George
166 tab-completion on named function arguments. Submitted by George
161 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
167 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
162 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
168 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
163 for more details.
169 for more details.
164
170
165 * IPython/Magic.py (magic_run): Added new -e flag to ignore
171 * IPython/Magic.py (magic_run): Added new -e flag to ignore
166 SystemExit exceptions in the script being run. Thanks to a report
172 SystemExit exceptions in the script being run. Thanks to a report
167 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
173 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
168 producing very annoying behavior when running unit tests.
174 producing very annoying behavior when running unit tests.
169
175
170 2005-05-12 Fernando Perez <fperez@colorado.edu>
176 2005-05-12 Fernando Perez <fperez@colorado.edu>
171
177
172 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
178 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
173 which I'd broken (again) due to a changed regexp. In the process,
179 which I'd broken (again) due to a changed regexp. In the process,
174 added ';' as an escape to auto-quote the whole line without
180 added ';' as an escape to auto-quote the whole line without
175 splitting its arguments. Thanks to a report by Jerry McRae
181 splitting its arguments. Thanks to a report by Jerry McRae
176 <qrs0xyc02-AT-sneakemail.com>.
182 <qrs0xyc02-AT-sneakemail.com>.
177
183
178 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
184 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
179 possible crashes caused by a TokenError. Reported by Ed Schofield
185 possible crashes caused by a TokenError. Reported by Ed Schofield
180 <schofield-AT-ftw.at>.
186 <schofield-AT-ftw.at>.
181
187
182 2005-05-06 Fernando Perez <fperez@colorado.edu>
188 2005-05-06 Fernando Perez <fperez@colorado.edu>
183
189
184 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
190 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
185
191
186 2005-04-29 Fernando Perez <fperez@colorado.edu>
192 2005-04-29 Fernando Perez <fperez@colorado.edu>
187
193
188 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
194 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
189 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
195 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
190 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
196 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
191 which provides support for Qt interactive usage (similar to the
197 which provides support for Qt interactive usage (similar to the
192 existing one for WX and GTK). This had been often requested.
198 existing one for WX and GTK). This had been often requested.
193
199
194 2005-04-14 *** Released version 0.6.13
200 2005-04-14 *** Released version 0.6.13
195
201
196 2005-04-08 Fernando Perez <fperez@colorado.edu>
202 2005-04-08 Fernando Perez <fperez@colorado.edu>
197
203
198 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
204 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
199 from _ofind, which gets called on almost every input line. Now,
205 from _ofind, which gets called on almost every input line. Now,
200 we only try to get docstrings if they are actually going to be
206 we only try to get docstrings if they are actually going to be
201 used (the overhead of fetching unnecessary docstrings can be
207 used (the overhead of fetching unnecessary docstrings can be
202 noticeable for certain objects, such as Pyro proxies).
208 noticeable for certain objects, such as Pyro proxies).
203
209
204 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
210 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
205 for completers. For some reason I had been passing them the state
211 for completers. For some reason I had been passing them the state
206 variable, which completers never actually need, and was in
212 variable, which completers never actually need, and was in
207 conflict with the rlcompleter API. Custom completers ONLY need to
213 conflict with the rlcompleter API. Custom completers ONLY need to
208 take the text parameter.
214 take the text parameter.
209
215
210 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
216 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
211 work correctly in pysh. I've also moved all the logic which used
217 work correctly in pysh. I've also moved all the logic which used
212 to be in pysh.py here, which will prevent problems with future
218 to be in pysh.py here, which will prevent problems with future
213 upgrades. However, this time I must warn users to update their
219 upgrades. However, this time I must warn users to update their
214 pysh profile to include the line
220 pysh profile to include the line
215
221
216 import_all IPython.Extensions.InterpreterExec
222 import_all IPython.Extensions.InterpreterExec
217
223
218 because otherwise things won't work for them. They MUST also
224 because otherwise things won't work for them. They MUST also
219 delete pysh.py and the line
225 delete pysh.py and the line
220
226
221 execfile pysh.py
227 execfile pysh.py
222
228
223 from their ipythonrc-pysh.
229 from their ipythonrc-pysh.
224
230
225 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
231 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
226 robust in the face of objects whose dir() returns non-strings
232 robust in the face of objects whose dir() returns non-strings
227 (which it shouldn't, but some broken libs like ITK do). Thanks to
233 (which it shouldn't, but some broken libs like ITK do). Thanks to
228 a patch by John Hunter (implemented differently, though). Also
234 a patch by John Hunter (implemented differently, though). Also
229 minor improvements by using .extend instead of + on lists.
235 minor improvements by using .extend instead of + on lists.
230
236
231 * pysh.py:
237 * pysh.py:
232
238
233 2005-04-06 Fernando Perez <fperez@colorado.edu>
239 2005-04-06 Fernando Perez <fperez@colorado.edu>
234
240
235 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
241 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
236 by default, so that all users benefit from it. Those who don't
242 by default, so that all users benefit from it. Those who don't
237 want it can still turn it off.
243 want it can still turn it off.
238
244
239 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
245 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
240 config file, I'd forgotten about this, so users were getting it
246 config file, I'd forgotten about this, so users were getting it
241 off by default.
247 off by default.
242
248
243 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
249 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
244 consistency. Now magics can be called in multiline statements,
250 consistency. Now magics can be called in multiline statements,
245 and python variables can be expanded in magic calls via $var.
251 and python variables can be expanded in magic calls via $var.
246 This makes the magic system behave just like aliases or !system
252 This makes the magic system behave just like aliases or !system
247 calls.
253 calls.
248
254
249 2005-03-28 Fernando Perez <fperez@colorado.edu>
255 2005-03-28 Fernando Perez <fperez@colorado.edu>
250
256
251 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
257 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
252 expensive string additions for building command. Add support for
258 expensive string additions for building command. Add support for
253 trailing ';' when autocall is used.
259 trailing ';' when autocall is used.
254
260
255 2005-03-26 Fernando Perez <fperez@colorado.edu>
261 2005-03-26 Fernando Perez <fperez@colorado.edu>
256
262
257 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
263 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
258 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
264 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
259 ipython.el robust against prompts with any number of spaces
265 ipython.el robust against prompts with any number of spaces
260 (including 0) after the ':' character.
266 (including 0) after the ':' character.
261
267
262 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
268 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
263 continuation prompt, which misled users to think the line was
269 continuation prompt, which misled users to think the line was
264 already indented. Closes debian Bug#300847, reported to me by
270 already indented. Closes debian Bug#300847, reported to me by
265 Norbert Tretkowski <tretkowski-AT-inittab.de>.
271 Norbert Tretkowski <tretkowski-AT-inittab.de>.
266
272
267 2005-03-23 Fernando Perez <fperez@colorado.edu>
273 2005-03-23 Fernando Perez <fperez@colorado.edu>
268
274
269 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
275 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
270 properly aligned if they have embedded newlines.
276 properly aligned if they have embedded newlines.
271
277
272 * IPython/iplib.py (runlines): Add a public method to expose
278 * IPython/iplib.py (runlines): Add a public method to expose
273 IPython's code execution machinery, so that users can run strings
279 IPython's code execution machinery, so that users can run strings
274 as if they had been typed at the prompt interactively.
280 as if they had been typed at the prompt interactively.
275 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
281 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
276 methods which can call the system shell, but with python variable
282 methods which can call the system shell, but with python variable
277 expansion. The three such methods are: __IPYTHON__.system,
283 expansion. The three such methods are: __IPYTHON__.system,
278 .getoutput and .getoutputerror. These need to be documented in a
284 .getoutput and .getoutputerror. These need to be documented in a
279 'public API' section (to be written) of the manual.
285 'public API' section (to be written) of the manual.
280
286
281 2005-03-20 Fernando Perez <fperez@colorado.edu>
287 2005-03-20 Fernando Perez <fperez@colorado.edu>
282
288
283 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
289 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
284 for custom exception handling. This is quite powerful, and it
290 for custom exception handling. This is quite powerful, and it
285 allows for user-installable exception handlers which can trap
291 allows for user-installable exception handlers which can trap
286 custom exceptions at runtime and treat them separately from
292 custom exceptions at runtime and treat them separately from
287 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
293 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
288 Mantegazza <mantegazza-AT-ill.fr>.
294 Mantegazza <mantegazza-AT-ill.fr>.
289 (InteractiveShell.set_custom_completer): public API function to
295 (InteractiveShell.set_custom_completer): public API function to
290 add new completers at runtime.
296 add new completers at runtime.
291
297
292 2005-03-19 Fernando Perez <fperez@colorado.edu>
298 2005-03-19 Fernando Perez <fperez@colorado.edu>
293
299
294 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
300 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
295 allow objects which provide their docstrings via non-standard
301 allow objects which provide their docstrings via non-standard
296 mechanisms (like Pyro proxies) to still be inspected by ipython's
302 mechanisms (like Pyro proxies) to still be inspected by ipython's
297 ? system.
303 ? system.
298
304
299 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
305 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
300 automatic capture system. I tried quite hard to make it work
306 automatic capture system. I tried quite hard to make it work
301 reliably, and simply failed. I tried many combinations with the
307 reliably, and simply failed. I tried many combinations with the
302 subprocess module, but eventually nothing worked in all needed
308 subprocess module, but eventually nothing worked in all needed
303 cases (not blocking stdin for the child, duplicating stdout
309 cases (not blocking stdin for the child, duplicating stdout
304 without blocking, etc). The new %sc/%sx still do capture to these
310 without blocking, etc). The new %sc/%sx still do capture to these
305 magical list/string objects which make shell use much more
311 magical list/string objects which make shell use much more
306 conveninent, so not all is lost.
312 conveninent, so not all is lost.
307
313
308 XXX - FIX MANUAL for the change above!
314 XXX - FIX MANUAL for the change above!
309
315
310 (runsource): I copied code.py's runsource() into ipython to modify
316 (runsource): I copied code.py's runsource() into ipython to modify
311 it a bit. Now the code object and source to be executed are
317 it a bit. Now the code object and source to be executed are
312 stored in ipython. This makes this info accessible to third-party
318 stored in ipython. This makes this info accessible to third-party
313 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
319 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
314 Mantegazza <mantegazza-AT-ill.fr>.
320 Mantegazza <mantegazza-AT-ill.fr>.
315
321
316 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
322 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
317 history-search via readline (like C-p/C-n). I'd wanted this for a
323 history-search via readline (like C-p/C-n). I'd wanted this for a
318 long time, but only recently found out how to do it. For users
324 long time, but only recently found out how to do it. For users
319 who already have their ipythonrc files made and want this, just
325 who already have their ipythonrc files made and want this, just
320 add:
326 add:
321
327
322 readline_parse_and_bind "\e[A": history-search-backward
328 readline_parse_and_bind "\e[A": history-search-backward
323 readline_parse_and_bind "\e[B": history-search-forward
329 readline_parse_and_bind "\e[B": history-search-forward
324
330
325 2005-03-18 Fernando Perez <fperez@colorado.edu>
331 2005-03-18 Fernando Perez <fperez@colorado.edu>
326
332
327 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
333 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
328 LSString and SList classes which allow transparent conversions
334 LSString and SList classes which allow transparent conversions
329 between list mode and whitespace-separated string.
335 between list mode and whitespace-separated string.
330 (magic_r): Fix recursion problem in %r.
336 (magic_r): Fix recursion problem in %r.
331
337
332 * IPython/genutils.py (LSString): New class to be used for
338 * IPython/genutils.py (LSString): New class to be used for
333 automatic storage of the results of all alias/system calls in _o
339 automatic storage of the results of all alias/system calls in _o
334 and _e (stdout/err). These provide a .l/.list attribute which
340 and _e (stdout/err). These provide a .l/.list attribute which
335 does automatic splitting on newlines. This means that for most
341 does automatic splitting on newlines. This means that for most
336 uses, you'll never need to do capturing of output with %sc/%sx
342 uses, you'll never need to do capturing of output with %sc/%sx
337 anymore, since ipython keeps this always done for you. Note that
343 anymore, since ipython keeps this always done for you. Note that
338 only the LAST results are stored, the _o/e variables are
344 only the LAST results are stored, the _o/e variables are
339 overwritten on each call. If you need to save their contents
345 overwritten on each call. If you need to save their contents
340 further, simply bind them to any other name.
346 further, simply bind them to any other name.
341
347
342 2005-03-17 Fernando Perez <fperez@colorado.edu>
348 2005-03-17 Fernando Perez <fperez@colorado.edu>
343
349
344 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
350 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
345 prompt namespace handling.
351 prompt namespace handling.
346
352
347 2005-03-16 Fernando Perez <fperez@colorado.edu>
353 2005-03-16 Fernando Perez <fperez@colorado.edu>
348
354
349 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
355 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
350 classic prompts to be '>>> ' (final space was missing, and it
356 classic prompts to be '>>> ' (final space was missing, and it
351 trips the emacs python mode).
357 trips the emacs python mode).
352 (BasePrompt.__str__): Added safe support for dynamic prompt
358 (BasePrompt.__str__): Added safe support for dynamic prompt
353 strings. Now you can set your prompt string to be '$x', and the
359 strings. Now you can set your prompt string to be '$x', and the
354 value of x will be printed from your interactive namespace. The
360 value of x will be printed from your interactive namespace. The
355 interpolation syntax includes the full Itpl support, so
361 interpolation syntax includes the full Itpl support, so
356 ${foo()+x+bar()} is a valid prompt string now, and the function
362 ${foo()+x+bar()} is a valid prompt string now, and the function
357 calls will be made at runtime.
363 calls will be made at runtime.
358
364
359 2005-03-15 Fernando Perez <fperez@colorado.edu>
365 2005-03-15 Fernando Perez <fperez@colorado.edu>
360
366
361 * IPython/Magic.py (magic_history): renamed %hist to %history, to
367 * IPython/Magic.py (magic_history): renamed %hist to %history, to
362 avoid name clashes in pylab. %hist still works, it just forwards
368 avoid name clashes in pylab. %hist still works, it just forwards
363 the call to %history.
369 the call to %history.
364
370
365 2005-03-02 *** Released version 0.6.12
371 2005-03-02 *** Released version 0.6.12
366
372
367 2005-03-02 Fernando Perez <fperez@colorado.edu>
373 2005-03-02 Fernando Perez <fperez@colorado.edu>
368
374
369 * IPython/iplib.py (handle_magic): log magic calls properly as
375 * IPython/iplib.py (handle_magic): log magic calls properly as
370 ipmagic() function calls.
376 ipmagic() function calls.
371
377
372 * IPython/Magic.py (magic_time): Improved %time to support
378 * IPython/Magic.py (magic_time): Improved %time to support
373 statements and provide wall-clock as well as CPU time.
379 statements and provide wall-clock as well as CPU time.
374
380
375 2005-02-27 Fernando Perez <fperez@colorado.edu>
381 2005-02-27 Fernando Perez <fperez@colorado.edu>
376
382
377 * IPython/hooks.py: New hooks module, to expose user-modifiable
383 * IPython/hooks.py: New hooks module, to expose user-modifiable
378 IPython functionality in a clean manner. For now only the editor
384 IPython functionality in a clean manner. For now only the editor
379 hook is actually written, and other thigns which I intend to turn
385 hook is actually written, and other thigns which I intend to turn
380 into proper hooks aren't yet there. The display and prefilter
386 into proper hooks aren't yet there. The display and prefilter
381 stuff, for example, should be hooks. But at least now the
387 stuff, for example, should be hooks. But at least now the
382 framework is in place, and the rest can be moved here with more
388 framework is in place, and the rest can be moved here with more
383 time later. IPython had had a .hooks variable for a long time for
389 time later. IPython had had a .hooks variable for a long time for
384 this purpose, but I'd never actually used it for anything.
390 this purpose, but I'd never actually used it for anything.
385
391
386 2005-02-26 Fernando Perez <fperez@colorado.edu>
392 2005-02-26 Fernando Perez <fperez@colorado.edu>
387
393
388 * IPython/ipmaker.py (make_IPython): make the default ipython
394 * IPython/ipmaker.py (make_IPython): make the default ipython
389 directory be called _ipython under win32, to follow more the
395 directory be called _ipython under win32, to follow more the
390 naming peculiarities of that platform (where buggy software like
396 naming peculiarities of that platform (where buggy software like
391 Visual Sourcesafe breaks with .named directories). Reported by
397 Visual Sourcesafe breaks with .named directories). Reported by
392 Ville Vainio.
398 Ville Vainio.
393
399
394 2005-02-23 Fernando Perez <fperez@colorado.edu>
400 2005-02-23 Fernando Perez <fperez@colorado.edu>
395
401
396 * IPython/iplib.py (InteractiveShell.__init__): removed a few
402 * IPython/iplib.py (InteractiveShell.__init__): removed a few
397 auto_aliases for win32 which were causing problems. Users can
403 auto_aliases for win32 which were causing problems. Users can
398 define the ones they personally like.
404 define the ones they personally like.
399
405
400 2005-02-21 Fernando Perez <fperez@colorado.edu>
406 2005-02-21 Fernando Perez <fperez@colorado.edu>
401
407
402 * IPython/Magic.py (magic_time): new magic to time execution of
408 * IPython/Magic.py (magic_time): new magic to time execution of
403 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
409 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
404
410
405 2005-02-19 Fernando Perez <fperez@colorado.edu>
411 2005-02-19 Fernando Perez <fperez@colorado.edu>
406
412
407 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
413 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
408 into keys (for prompts, for example).
414 into keys (for prompts, for example).
409
415
410 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
416 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
411 prompts in case users want them. This introduces a small behavior
417 prompts in case users want them. This introduces a small behavior
412 change: ipython does not automatically add a space to all prompts
418 change: ipython does not automatically add a space to all prompts
413 anymore. To get the old prompts with a space, users should add it
419 anymore. To get the old prompts with a space, users should add it
414 manually to their ipythonrc file, so for example prompt_in1 should
420 manually to their ipythonrc file, so for example prompt_in1 should
415 now read 'In [\#]: ' instead of 'In [\#]:'.
421 now read 'In [\#]: ' instead of 'In [\#]:'.
416 (BasePrompt.__init__): New option prompts_pad_left (only in rc
422 (BasePrompt.__init__): New option prompts_pad_left (only in rc
417 file) to control left-padding of secondary prompts.
423 file) to control left-padding of secondary prompts.
418
424
419 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
425 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
420 the profiler can't be imported. Fix for Debian, which removed
426 the profiler can't be imported. Fix for Debian, which removed
421 profile.py because of License issues. I applied a slightly
427 profile.py because of License issues. I applied a slightly
422 modified version of the original Debian patch at
428 modified version of the original Debian patch at
423 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
429 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
424
430
425 2005-02-17 Fernando Perez <fperez@colorado.edu>
431 2005-02-17 Fernando Perez <fperez@colorado.edu>
426
432
427 * IPython/genutils.py (native_line_ends): Fix bug which would
433 * IPython/genutils.py (native_line_ends): Fix bug which would
428 cause improper line-ends under win32 b/c I was not opening files
434 cause improper line-ends under win32 b/c I was not opening files
429 in binary mode. Bug report and fix thanks to Ville.
435 in binary mode. Bug report and fix thanks to Ville.
430
436
431 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
437 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
432 trying to catch spurious foo[1] autocalls. My fix actually broke
438 trying to catch spurious foo[1] autocalls. My fix actually broke
433 ',/' autoquote/call with explicit escape (bad regexp).
439 ',/' autoquote/call with explicit escape (bad regexp).
434
440
435 2005-02-15 *** Released version 0.6.11
441 2005-02-15 *** Released version 0.6.11
436
442
437 2005-02-14 Fernando Perez <fperez@colorado.edu>
443 2005-02-14 Fernando Perez <fperez@colorado.edu>
438
444
439 * IPython/background_jobs.py: New background job management
445 * IPython/background_jobs.py: New background job management
440 subsystem. This is implemented via a new set of classes, and
446 subsystem. This is implemented via a new set of classes, and
441 IPython now provides a builtin 'jobs' object for background job
447 IPython now provides a builtin 'jobs' object for background job
442 execution. A convenience %bg magic serves as a lightweight
448 execution. A convenience %bg magic serves as a lightweight
443 frontend for starting the more common type of calls. This was
449 frontend for starting the more common type of calls. This was
444 inspired by discussions with B. Granger and the BackgroundCommand
450 inspired by discussions with B. Granger and the BackgroundCommand
445 class described in the book Python Scripting for Computational
451 class described in the book Python Scripting for Computational
446 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
452 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
447 (although ultimately no code from this text was used, as IPython's
453 (although ultimately no code from this text was used, as IPython's
448 system is a separate implementation).
454 system is a separate implementation).
449
455
450 * IPython/iplib.py (MagicCompleter.python_matches): add new option
456 * IPython/iplib.py (MagicCompleter.python_matches): add new option
451 to control the completion of single/double underscore names
457 to control the completion of single/double underscore names
452 separately. As documented in the example ipytonrc file, the
458 separately. As documented in the example ipytonrc file, the
453 readline_omit__names variable can now be set to 2, to omit even
459 readline_omit__names variable can now be set to 2, to omit even
454 single underscore names. Thanks to a patch by Brian Wong
460 single underscore names. Thanks to a patch by Brian Wong
455 <BrianWong-AT-AirgoNetworks.Com>.
461 <BrianWong-AT-AirgoNetworks.Com>.
456 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
462 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
457 be autocalled as foo([1]) if foo were callable. A problem for
463 be autocalled as foo([1]) if foo were callable. A problem for
458 things which are both callable and implement __getitem__.
464 things which are both callable and implement __getitem__.
459 (init_readline): Fix autoindentation for win32. Thanks to a patch
465 (init_readline): Fix autoindentation for win32. Thanks to a patch
460 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
466 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
461
467
462 2005-02-12 Fernando Perez <fperez@colorado.edu>
468 2005-02-12 Fernando Perez <fperez@colorado.edu>
463
469
464 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
470 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
465 which I had written long ago to sort out user error messages which
471 which I had written long ago to sort out user error messages which
466 may occur during startup. This seemed like a good idea initially,
472 may occur during startup. This seemed like a good idea initially,
467 but it has proven a disaster in retrospect. I don't want to
473 but it has proven a disaster in retrospect. I don't want to
468 change much code for now, so my fix is to set the internal 'debug'
474 change much code for now, so my fix is to set the internal 'debug'
469 flag to true everywhere, whose only job was precisely to control
475 flag to true everywhere, whose only job was precisely to control
470 this subsystem. This closes issue 28 (as well as avoiding all
476 this subsystem. This closes issue 28 (as well as avoiding all
471 sorts of strange hangups which occur from time to time).
477 sorts of strange hangups which occur from time to time).
472
478
473 2005-02-07 Fernando Perez <fperez@colorado.edu>
479 2005-02-07 Fernando Perez <fperez@colorado.edu>
474
480
475 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
481 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
476 previous call produced a syntax error.
482 previous call produced a syntax error.
477
483
478 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
484 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
479 classes without constructor.
485 classes without constructor.
480
486
481 2005-02-06 Fernando Perez <fperez@colorado.edu>
487 2005-02-06 Fernando Perez <fperez@colorado.edu>
482
488
483 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
489 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
484 completions with the results of each matcher, so we return results
490 completions with the results of each matcher, so we return results
485 to the user from all namespaces. This breaks with ipython
491 to the user from all namespaces. This breaks with ipython
486 tradition, but I think it's a nicer behavior. Now you get all
492 tradition, but I think it's a nicer behavior. Now you get all
487 possible completions listed, from all possible namespaces (python,
493 possible completions listed, from all possible namespaces (python,
488 filesystem, magics...) After a request by John Hunter
494 filesystem, magics...) After a request by John Hunter
489 <jdhunter-AT-nitace.bsd.uchicago.edu>.
495 <jdhunter-AT-nitace.bsd.uchicago.edu>.
490
496
491 2005-02-05 Fernando Perez <fperez@colorado.edu>
497 2005-02-05 Fernando Perez <fperez@colorado.edu>
492
498
493 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
499 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
494 the call had quote characters in it (the quotes were stripped).
500 the call had quote characters in it (the quotes were stripped).
495
501
496 2005-01-31 Fernando Perez <fperez@colorado.edu>
502 2005-01-31 Fernando Perez <fperez@colorado.edu>
497
503
498 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
504 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
499 Itpl.itpl() to make the code more robust against psyco
505 Itpl.itpl() to make the code more robust against psyco
500 optimizations.
506 optimizations.
501
507
502 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
508 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
503 of causing an exception. Quicker, cleaner.
509 of causing an exception. Quicker, cleaner.
504
510
505 2005-01-28 Fernando Perez <fperez@colorado.edu>
511 2005-01-28 Fernando Perez <fperez@colorado.edu>
506
512
507 * scripts/ipython_win_post_install.py (install): hardcode
513 * scripts/ipython_win_post_install.py (install): hardcode
508 sys.prefix+'python.exe' as the executable path. It turns out that
514 sys.prefix+'python.exe' as the executable path. It turns out that
509 during the post-installation run, sys.executable resolves to the
515 during the post-installation run, sys.executable resolves to the
510 name of the binary installer! I should report this as a distutils
516 name of the binary installer! I should report this as a distutils
511 bug, I think. I updated the .10 release with this tiny fix, to
517 bug, I think. I updated the .10 release with this tiny fix, to
512 avoid annoying the lists further.
518 avoid annoying the lists further.
513
519
514 2005-01-27 *** Released version 0.6.10
520 2005-01-27 *** Released version 0.6.10
515
521
516 2005-01-27 Fernando Perez <fperez@colorado.edu>
522 2005-01-27 Fernando Perez <fperez@colorado.edu>
517
523
518 * IPython/numutils.py (norm): Added 'inf' as optional name for
524 * IPython/numutils.py (norm): Added 'inf' as optional name for
519 L-infinity norm, included references to mathworld.com for vector
525 L-infinity norm, included references to mathworld.com for vector
520 norm definitions.
526 norm definitions.
521 (amin/amax): added amin/amax for array min/max. Similar to what
527 (amin/amax): added amin/amax for array min/max. Similar to what
522 pylab ships with after the recent reorganization of names.
528 pylab ships with after the recent reorganization of names.
523 (spike/spike_odd): removed deprecated spike/spike_odd functions.
529 (spike/spike_odd): removed deprecated spike/spike_odd functions.
524
530
525 * ipython.el: committed Alex's recent fixes and improvements.
531 * ipython.el: committed Alex's recent fixes and improvements.
526 Tested with python-mode from CVS, and it looks excellent. Since
532 Tested with python-mode from CVS, and it looks excellent. Since
527 python-mode hasn't released anything in a while, I'm temporarily
533 python-mode hasn't released anything in a while, I'm temporarily
528 putting a copy of today's CVS (v 4.70) of python-mode in:
534 putting a copy of today's CVS (v 4.70) of python-mode in:
529 http://ipython.scipy.org/tmp/python-mode.el
535 http://ipython.scipy.org/tmp/python-mode.el
530
536
531 * scripts/ipython_win_post_install.py (install): Win32 fix to use
537 * scripts/ipython_win_post_install.py (install): Win32 fix to use
532 sys.executable for the executable name, instead of assuming it's
538 sys.executable for the executable name, instead of assuming it's
533 called 'python.exe' (the post-installer would have produced broken
539 called 'python.exe' (the post-installer would have produced broken
534 setups on systems with a differently named python binary).
540 setups on systems with a differently named python binary).
535
541
536 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
542 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
537 references to os.linesep, to make the code more
543 references to os.linesep, to make the code more
538 platform-independent. This is also part of the win32 coloring
544 platform-independent. This is also part of the win32 coloring
539 fixes.
545 fixes.
540
546
541 * IPython/genutils.py (page_dumb): Remove attempts to chop long
547 * IPython/genutils.py (page_dumb): Remove attempts to chop long
542 lines, which actually cause coloring bugs because the length of
548 lines, which actually cause coloring bugs because the length of
543 the line is very difficult to correctly compute with embedded
549 the line is very difficult to correctly compute with embedded
544 escapes. This was the source of all the coloring problems under
550 escapes. This was the source of all the coloring problems under
545 Win32. I think that _finally_, Win32 users have a properly
551 Win32. I think that _finally_, Win32 users have a properly
546 working ipython in all respects. This would never have happened
552 working ipython in all respects. This would never have happened
547 if not for Gary Bishop and Viktor Ransmayr's great help and work.
553 if not for Gary Bishop and Viktor Ransmayr's great help and work.
548
554
549 2005-01-26 *** Released version 0.6.9
555 2005-01-26 *** Released version 0.6.9
550
556
551 2005-01-25 Fernando Perez <fperez@colorado.edu>
557 2005-01-25 Fernando Perez <fperez@colorado.edu>
552
558
553 * setup.py: finally, we have a true Windows installer, thanks to
559 * setup.py: finally, we have a true Windows installer, thanks to
554 the excellent work of Viktor Ransmayr
560 the excellent work of Viktor Ransmayr
555 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
561 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
556 Windows users. The setup routine is quite a bit cleaner thanks to
562 Windows users. The setup routine is quite a bit cleaner thanks to
557 this, and the post-install script uses the proper functions to
563 this, and the post-install script uses the proper functions to
558 allow a clean de-installation using the standard Windows Control
564 allow a clean de-installation using the standard Windows Control
559 Panel.
565 Panel.
560
566
561 * IPython/genutils.py (get_home_dir): changed to use the $HOME
567 * IPython/genutils.py (get_home_dir): changed to use the $HOME
562 environment variable under all OSes (including win32) if
568 environment variable under all OSes (including win32) if
563 available. This will give consistency to win32 users who have set
569 available. This will give consistency to win32 users who have set
564 this variable for any reason. If os.environ['HOME'] fails, the
570 this variable for any reason. If os.environ['HOME'] fails, the
565 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
571 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
566
572
567 2005-01-24 Fernando Perez <fperez@colorado.edu>
573 2005-01-24 Fernando Perez <fperez@colorado.edu>
568
574
569 * IPython/numutils.py (empty_like): add empty_like(), similar to
575 * IPython/numutils.py (empty_like): add empty_like(), similar to
570 zeros_like() but taking advantage of the new empty() Numeric routine.
576 zeros_like() but taking advantage of the new empty() Numeric routine.
571
577
572 2005-01-23 *** Released version 0.6.8
578 2005-01-23 *** Released version 0.6.8
573
579
574 2005-01-22 Fernando Perez <fperez@colorado.edu>
580 2005-01-22 Fernando Perez <fperez@colorado.edu>
575
581
576 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
582 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
577 automatic show() calls. After discussing things with JDH, it
583 automatic show() calls. After discussing things with JDH, it
578 turns out there are too many corner cases where this can go wrong.
584 turns out there are too many corner cases where this can go wrong.
579 It's best not to try to be 'too smart', and simply have ipython
585 It's best not to try to be 'too smart', and simply have ipython
580 reproduce as much as possible the default behavior of a normal
586 reproduce as much as possible the default behavior of a normal
581 python shell.
587 python shell.
582
588
583 * IPython/iplib.py (InteractiveShell.__init__): Modified the
589 * IPython/iplib.py (InteractiveShell.__init__): Modified the
584 line-splitting regexp and _prefilter() to avoid calling getattr()
590 line-splitting regexp and _prefilter() to avoid calling getattr()
585 on assignments. This closes
591 on assignments. This closes
586 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
592 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
587 readline uses getattr(), so a simple <TAB> keypress is still
593 readline uses getattr(), so a simple <TAB> keypress is still
588 enough to trigger getattr() calls on an object.
594 enough to trigger getattr() calls on an object.
589
595
590 2005-01-21 Fernando Perez <fperez@colorado.edu>
596 2005-01-21 Fernando Perez <fperez@colorado.edu>
591
597
592 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
598 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
593 docstring under pylab so it doesn't mask the original.
599 docstring under pylab so it doesn't mask the original.
594
600
595 2005-01-21 *** Released version 0.6.7
601 2005-01-21 *** Released version 0.6.7
596
602
597 2005-01-21 Fernando Perez <fperez@colorado.edu>
603 2005-01-21 Fernando Perez <fperez@colorado.edu>
598
604
599 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
605 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
600 signal handling for win32 users in multithreaded mode.
606 signal handling for win32 users in multithreaded mode.
601
607
602 2005-01-17 Fernando Perez <fperez@colorado.edu>
608 2005-01-17 Fernando Perez <fperez@colorado.edu>
603
609
604 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
610 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
605 instances with no __init__. After a crash report by Norbert Nemec
611 instances with no __init__. After a crash report by Norbert Nemec
606 <Norbert-AT-nemec-online.de>.
612 <Norbert-AT-nemec-online.de>.
607
613
608 2005-01-14 Fernando Perez <fperez@colorado.edu>
614 2005-01-14 Fernando Perez <fperez@colorado.edu>
609
615
610 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
616 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
611 names for verbose exceptions, when multiple dotted names and the
617 names for verbose exceptions, when multiple dotted names and the
612 'parent' object were present on the same line.
618 'parent' object were present on the same line.
613
619
614 2005-01-11 Fernando Perez <fperez@colorado.edu>
620 2005-01-11 Fernando Perez <fperez@colorado.edu>
615
621
616 * IPython/genutils.py (flag_calls): new utility to trap and flag
622 * IPython/genutils.py (flag_calls): new utility to trap and flag
617 calls in functions. I need it to clean up matplotlib support.
623 calls in functions. I need it to clean up matplotlib support.
618 Also removed some deprecated code in genutils.
624 Also removed some deprecated code in genutils.
619
625
620 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
626 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
621 that matplotlib scripts called with %run, which don't call show()
627 that matplotlib scripts called with %run, which don't call show()
622 themselves, still have their plotting windows open.
628 themselves, still have their plotting windows open.
623
629
624 2005-01-05 Fernando Perez <fperez@colorado.edu>
630 2005-01-05 Fernando Perez <fperez@colorado.edu>
625
631
626 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
632 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
627 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
633 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
628
634
629 2004-12-19 Fernando Perez <fperez@colorado.edu>
635 2004-12-19 Fernando Perez <fperez@colorado.edu>
630
636
631 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
637 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
632 parent_runcode, which was an eyesore. The same result can be
638 parent_runcode, which was an eyesore. The same result can be
633 obtained with Python's regular superclass mechanisms.
639 obtained with Python's regular superclass mechanisms.
634
640
635 2004-12-17 Fernando Perez <fperez@colorado.edu>
641 2004-12-17 Fernando Perez <fperez@colorado.edu>
636
642
637 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
643 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
638 reported by Prabhu.
644 reported by Prabhu.
639 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
645 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
640 sys.stderr) instead of explicitly calling sys.stderr. This helps
646 sys.stderr) instead of explicitly calling sys.stderr. This helps
641 maintain our I/O abstractions clean, for future GUI embeddings.
647 maintain our I/O abstractions clean, for future GUI embeddings.
642
648
643 * IPython/genutils.py (info): added new utility for sys.stderr
649 * IPython/genutils.py (info): added new utility for sys.stderr
644 unified info message handling (thin wrapper around warn()).
650 unified info message handling (thin wrapper around warn()).
645
651
646 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
652 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
647 composite (dotted) names on verbose exceptions.
653 composite (dotted) names on verbose exceptions.
648 (VerboseTB.nullrepr): harden against another kind of errors which
654 (VerboseTB.nullrepr): harden against another kind of errors which
649 Python's inspect module can trigger, and which were crashing
655 Python's inspect module can trigger, and which were crashing
650 IPython. Thanks to a report by Marco Lombardi
656 IPython. Thanks to a report by Marco Lombardi
651 <mlombard-AT-ma010192.hq.eso.org>.
657 <mlombard-AT-ma010192.hq.eso.org>.
652
658
653 2004-12-13 *** Released version 0.6.6
659 2004-12-13 *** Released version 0.6.6
654
660
655 2004-12-12 Fernando Perez <fperez@colorado.edu>
661 2004-12-12 Fernando Perez <fperez@colorado.edu>
656
662
657 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
663 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
658 generated by pygtk upon initialization if it was built without
664 generated by pygtk upon initialization if it was built without
659 threads (for matplotlib users). After a crash reported by
665 threads (for matplotlib users). After a crash reported by
660 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
666 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
661
667
662 * IPython/ipmaker.py (make_IPython): fix small bug in the
668 * IPython/ipmaker.py (make_IPython): fix small bug in the
663 import_some parameter for multiple imports.
669 import_some parameter for multiple imports.
664
670
665 * IPython/iplib.py (ipmagic): simplified the interface of
671 * IPython/iplib.py (ipmagic): simplified the interface of
666 ipmagic() to take a single string argument, just as it would be
672 ipmagic() to take a single string argument, just as it would be
667 typed at the IPython cmd line.
673 typed at the IPython cmd line.
668 (ipalias): Added new ipalias() with an interface identical to
674 (ipalias): Added new ipalias() with an interface identical to
669 ipmagic(). This completes exposing a pure python interface to the
675 ipmagic(). This completes exposing a pure python interface to the
670 alias and magic system, which can be used in loops or more complex
676 alias and magic system, which can be used in loops or more complex
671 code where IPython's automatic line mangling is not active.
677 code where IPython's automatic line mangling is not active.
672
678
673 * IPython/genutils.py (timing): changed interface of timing to
679 * IPython/genutils.py (timing): changed interface of timing to
674 simply run code once, which is the most common case. timings()
680 simply run code once, which is the most common case. timings()
675 remains unchanged, for the cases where you want multiple runs.
681 remains unchanged, for the cases where you want multiple runs.
676
682
677 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
683 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
678 bug where Python2.2 crashes with exec'ing code which does not end
684 bug where Python2.2 crashes with exec'ing code which does not end
679 in a single newline. Python 2.3 is OK, so I hadn't noticed this
685 in a single newline. Python 2.3 is OK, so I hadn't noticed this
680 before.
686 before.
681
687
682 2004-12-10 Fernando Perez <fperez@colorado.edu>
688 2004-12-10 Fernando Perez <fperez@colorado.edu>
683
689
684 * IPython/Magic.py (Magic.magic_prun): changed name of option from
690 * IPython/Magic.py (Magic.magic_prun): changed name of option from
685 -t to -T, to accomodate the new -t flag in %run (the %run and
691 -t to -T, to accomodate the new -t flag in %run (the %run and
686 %prun options are kind of intermixed, and it's not easy to change
692 %prun options are kind of intermixed, and it's not easy to change
687 this with the limitations of python's getopt).
693 this with the limitations of python's getopt).
688
694
689 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
695 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
690 the execution of scripts. It's not as fine-tuned as timeit.py,
696 the execution of scripts. It's not as fine-tuned as timeit.py,
691 but it works from inside ipython (and under 2.2, which lacks
697 but it works from inside ipython (and under 2.2, which lacks
692 timeit.py). Optionally a number of runs > 1 can be given for
698 timeit.py). Optionally a number of runs > 1 can be given for
693 timing very short-running code.
699 timing very short-running code.
694
700
695 * IPython/genutils.py (uniq_stable): new routine which returns a
701 * IPython/genutils.py (uniq_stable): new routine which returns a
696 list of unique elements in any iterable, but in stable order of
702 list of unique elements in any iterable, but in stable order of
697 appearance. I needed this for the ultraTB fixes, and it's a handy
703 appearance. I needed this for the ultraTB fixes, and it's a handy
698 utility.
704 utility.
699
705
700 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
706 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
701 dotted names in Verbose exceptions. This had been broken since
707 dotted names in Verbose exceptions. This had been broken since
702 the very start, now x.y will properly be printed in a Verbose
708 the very start, now x.y will properly be printed in a Verbose
703 traceback, instead of x being shown and y appearing always as an
709 traceback, instead of x being shown and y appearing always as an
704 'undefined global'. Getting this to work was a bit tricky,
710 'undefined global'. Getting this to work was a bit tricky,
705 because by default python tokenizers are stateless. Saved by
711 because by default python tokenizers are stateless. Saved by
706 python's ability to easily add a bit of state to an arbitrary
712 python's ability to easily add a bit of state to an arbitrary
707 function (without needing to build a full-blown callable object).
713 function (without needing to build a full-blown callable object).
708
714
709 Also big cleanup of this code, which had horrendous runtime
715 Also big cleanup of this code, which had horrendous runtime
710 lookups of zillions of attributes for colorization. Moved all
716 lookups of zillions of attributes for colorization. Moved all
711 this code into a few templates, which make it cleaner and quicker.
717 this code into a few templates, which make it cleaner and quicker.
712
718
713 Printout quality was also improved for Verbose exceptions: one
719 Printout quality was also improved for Verbose exceptions: one
714 variable per line, and memory addresses are printed (this can be
720 variable per line, and memory addresses are printed (this can be
715 quite handy in nasty debugging situations, which is what Verbose
721 quite handy in nasty debugging situations, which is what Verbose
716 is for).
722 is for).
717
723
718 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
724 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
719 the command line as scripts to be loaded by embedded instances.
725 the command line as scripts to be loaded by embedded instances.
720 Doing so has the potential for an infinite recursion if there are
726 Doing so has the potential for an infinite recursion if there are
721 exceptions thrown in the process. This fixes a strange crash
727 exceptions thrown in the process. This fixes a strange crash
722 reported by Philippe MULLER <muller-AT-irit.fr>.
728 reported by Philippe MULLER <muller-AT-irit.fr>.
723
729
724 2004-12-09 Fernando Perez <fperez@colorado.edu>
730 2004-12-09 Fernando Perez <fperez@colorado.edu>
725
731
726 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
732 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
727 to reflect new names in matplotlib, which now expose the
733 to reflect new names in matplotlib, which now expose the
728 matlab-compatible interface via a pylab module instead of the
734 matlab-compatible interface via a pylab module instead of the
729 'matlab' name. The new code is backwards compatible, so users of
735 'matlab' name. The new code is backwards compatible, so users of
730 all matplotlib versions are OK. Patch by J. Hunter.
736 all matplotlib versions are OK. Patch by J. Hunter.
731
737
732 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
738 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
733 of __init__ docstrings for instances (class docstrings are already
739 of __init__ docstrings for instances (class docstrings are already
734 automatically printed). Instances with customized docstrings
740 automatically printed). Instances with customized docstrings
735 (indep. of the class) are also recognized and all 3 separate
741 (indep. of the class) are also recognized and all 3 separate
736 docstrings are printed (instance, class, constructor). After some
742 docstrings are printed (instance, class, constructor). After some
737 comments/suggestions by J. Hunter.
743 comments/suggestions by J. Hunter.
738
744
739 2004-12-05 Fernando Perez <fperez@colorado.edu>
745 2004-12-05 Fernando Perez <fperez@colorado.edu>
740
746
741 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
747 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
742 warnings when tab-completion fails and triggers an exception.
748 warnings when tab-completion fails and triggers an exception.
743
749
744 2004-12-03 Fernando Perez <fperez@colorado.edu>
750 2004-12-03 Fernando Perez <fperez@colorado.edu>
745
751
746 * IPython/Magic.py (magic_prun): Fix bug where an exception would
752 * IPython/Magic.py (magic_prun): Fix bug where an exception would
747 be triggered when using 'run -p'. An incorrect option flag was
753 be triggered when using 'run -p'. An incorrect option flag was
748 being set ('d' instead of 'D').
754 being set ('d' instead of 'D').
749 (manpage): fix missing escaped \- sign.
755 (manpage): fix missing escaped \- sign.
750
756
751 2004-11-30 *** Released version 0.6.5
757 2004-11-30 *** Released version 0.6.5
752
758
753 2004-11-30 Fernando Perez <fperez@colorado.edu>
759 2004-11-30 Fernando Perez <fperez@colorado.edu>
754
760
755 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
761 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
756 setting with -d option.
762 setting with -d option.
757
763
758 * setup.py (docfiles): Fix problem where the doc glob I was using
764 * setup.py (docfiles): Fix problem where the doc glob I was using
759 was COMPLETELY BROKEN. It was giving the right files by pure
765 was COMPLETELY BROKEN. It was giving the right files by pure
760 accident, but failed once I tried to include ipython.el. Note:
766 accident, but failed once I tried to include ipython.el. Note:
761 glob() does NOT allow you to do exclusion on multiple endings!
767 glob() does NOT allow you to do exclusion on multiple endings!
762
768
763 2004-11-29 Fernando Perez <fperez@colorado.edu>
769 2004-11-29 Fernando Perez <fperez@colorado.edu>
764
770
765 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
771 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
766 the manpage as the source. Better formatting & consistency.
772 the manpage as the source. Better formatting & consistency.
767
773
768 * IPython/Magic.py (magic_run): Added new -d option, to run
774 * IPython/Magic.py (magic_run): Added new -d option, to run
769 scripts under the control of the python pdb debugger. Note that
775 scripts under the control of the python pdb debugger. Note that
770 this required changing the %prun option -d to -D, to avoid a clash
776 this required changing the %prun option -d to -D, to avoid a clash
771 (since %run must pass options to %prun, and getopt is too dumb to
777 (since %run must pass options to %prun, and getopt is too dumb to
772 handle options with string values with embedded spaces). Thanks
778 handle options with string values with embedded spaces). Thanks
773 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
779 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
774 (magic_who_ls): added type matching to %who and %whos, so that one
780 (magic_who_ls): added type matching to %who and %whos, so that one
775 can filter their output to only include variables of certain
781 can filter their output to only include variables of certain
776 types. Another suggestion by Matthew.
782 types. Another suggestion by Matthew.
777 (magic_whos): Added memory summaries in kb and Mb for arrays.
783 (magic_whos): Added memory summaries in kb and Mb for arrays.
778 (magic_who): Improve formatting (break lines every 9 vars).
784 (magic_who): Improve formatting (break lines every 9 vars).
779
785
780 2004-11-28 Fernando Perez <fperez@colorado.edu>
786 2004-11-28 Fernando Perez <fperez@colorado.edu>
781
787
782 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
788 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
783 cache when empty lines were present.
789 cache when empty lines were present.
784
790
785 2004-11-24 Fernando Perez <fperez@colorado.edu>
791 2004-11-24 Fernando Perez <fperez@colorado.edu>
786
792
787 * IPython/usage.py (__doc__): document the re-activated threading
793 * IPython/usage.py (__doc__): document the re-activated threading
788 options for WX and GTK.
794 options for WX and GTK.
789
795
790 2004-11-23 Fernando Perez <fperez@colorado.edu>
796 2004-11-23 Fernando Perez <fperez@colorado.edu>
791
797
792 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
798 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
793 the -wthread and -gthread options, along with a new -tk one to try
799 the -wthread and -gthread options, along with a new -tk one to try
794 and coordinate Tk threading with wx/gtk. The tk support is very
800 and coordinate Tk threading with wx/gtk. The tk support is very
795 platform dependent, since it seems to require Tcl and Tk to be
801 platform dependent, since it seems to require Tcl and Tk to be
796 built with threads (Fedora1/2 appears NOT to have it, but in
802 built with threads (Fedora1/2 appears NOT to have it, but in
797 Prabhu's Debian boxes it works OK). But even with some Tk
803 Prabhu's Debian boxes it works OK). But even with some Tk
798 limitations, this is a great improvement.
804 limitations, this is a great improvement.
799
805
800 * IPython/Prompts.py (prompt_specials_color): Added \t for time
806 * IPython/Prompts.py (prompt_specials_color): Added \t for time
801 info in user prompts. Patch by Prabhu.
807 info in user prompts. Patch by Prabhu.
802
808
803 2004-11-18 Fernando Perez <fperez@colorado.edu>
809 2004-11-18 Fernando Perez <fperez@colorado.edu>
804
810
805 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
811 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
806 EOFErrors and bail, to avoid infinite loops if a non-terminating
812 EOFErrors and bail, to avoid infinite loops if a non-terminating
807 file is fed into ipython. Patch submitted in issue 19 by user,
813 file is fed into ipython. Patch submitted in issue 19 by user,
808 many thanks.
814 many thanks.
809
815
810 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
816 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
811 autoquote/parens in continuation prompts, which can cause lots of
817 autoquote/parens in continuation prompts, which can cause lots of
812 problems. Closes roundup issue 20.
818 problems. Closes roundup issue 20.
813
819
814 2004-11-17 Fernando Perez <fperez@colorado.edu>
820 2004-11-17 Fernando Perez <fperez@colorado.edu>
815
821
816 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
822 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
817 reported as debian bug #280505. I'm not sure my local changelog
823 reported as debian bug #280505. I'm not sure my local changelog
818 entry has the proper debian format (Jack?).
824 entry has the proper debian format (Jack?).
819
825
820 2004-11-08 *** Released version 0.6.4
826 2004-11-08 *** Released version 0.6.4
821
827
822 2004-11-08 Fernando Perez <fperez@colorado.edu>
828 2004-11-08 Fernando Perez <fperez@colorado.edu>
823
829
824 * IPython/iplib.py (init_readline): Fix exit message for Windows
830 * IPython/iplib.py (init_readline): Fix exit message for Windows
825 when readline is active. Thanks to a report by Eric Jones
831 when readline is active. Thanks to a report by Eric Jones
826 <eric-AT-enthought.com>.
832 <eric-AT-enthought.com>.
827
833
828 2004-11-07 Fernando Perez <fperez@colorado.edu>
834 2004-11-07 Fernando Perez <fperez@colorado.edu>
829
835
830 * IPython/genutils.py (page): Add a trap for OSError exceptions,
836 * IPython/genutils.py (page): Add a trap for OSError exceptions,
831 sometimes seen by win2k/cygwin users.
837 sometimes seen by win2k/cygwin users.
832
838
833 2004-11-06 Fernando Perez <fperez@colorado.edu>
839 2004-11-06 Fernando Perez <fperez@colorado.edu>
834
840
835 * IPython/iplib.py (interact): Change the handling of %Exit from
841 * IPython/iplib.py (interact): Change the handling of %Exit from
836 trying to propagate a SystemExit to an internal ipython flag.
842 trying to propagate a SystemExit to an internal ipython flag.
837 This is less elegant than using Python's exception mechanism, but
843 This is less elegant than using Python's exception mechanism, but
838 I can't get that to work reliably with threads, so under -pylab
844 I can't get that to work reliably with threads, so under -pylab
839 %Exit was hanging IPython. Cross-thread exception handling is
845 %Exit was hanging IPython. Cross-thread exception handling is
840 really a bitch. Thaks to a bug report by Stephen Walton
846 really a bitch. Thaks to a bug report by Stephen Walton
841 <stephen.walton-AT-csun.edu>.
847 <stephen.walton-AT-csun.edu>.
842
848
843 2004-11-04 Fernando Perez <fperez@colorado.edu>
849 2004-11-04 Fernando Perez <fperez@colorado.edu>
844
850
845 * IPython/iplib.py (raw_input_original): store a pointer to the
851 * IPython/iplib.py (raw_input_original): store a pointer to the
846 true raw_input to harden against code which can modify it
852 true raw_input to harden against code which can modify it
847 (wx.py.PyShell does this and would otherwise crash ipython).
853 (wx.py.PyShell does this and would otherwise crash ipython).
848 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
854 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
849
855
850 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
856 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
851 Ctrl-C problem, which does not mess up the input line.
857 Ctrl-C problem, which does not mess up the input line.
852
858
853 2004-11-03 Fernando Perez <fperez@colorado.edu>
859 2004-11-03 Fernando Perez <fperez@colorado.edu>
854
860
855 * IPython/Release.py: Changed licensing to BSD, in all files.
861 * IPython/Release.py: Changed licensing to BSD, in all files.
856 (name): lowercase name for tarball/RPM release.
862 (name): lowercase name for tarball/RPM release.
857
863
858 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
864 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
859 use throughout ipython.
865 use throughout ipython.
860
866
861 * IPython/Magic.py (Magic._ofind): Switch to using the new
867 * IPython/Magic.py (Magic._ofind): Switch to using the new
862 OInspect.getdoc() function.
868 OInspect.getdoc() function.
863
869
864 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
870 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
865 of the line currently being canceled via Ctrl-C. It's extremely
871 of the line currently being canceled via Ctrl-C. It's extremely
866 ugly, but I don't know how to do it better (the problem is one of
872 ugly, but I don't know how to do it better (the problem is one of
867 handling cross-thread exceptions).
873 handling cross-thread exceptions).
868
874
869 2004-10-28 Fernando Perez <fperez@colorado.edu>
875 2004-10-28 Fernando Perez <fperez@colorado.edu>
870
876
871 * IPython/Shell.py (signal_handler): add signal handlers to trap
877 * IPython/Shell.py (signal_handler): add signal handlers to trap
872 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
878 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
873 report by Francesc Alted.
879 report by Francesc Alted.
874
880
875 2004-10-21 Fernando Perez <fperez@colorado.edu>
881 2004-10-21 Fernando Perez <fperez@colorado.edu>
876
882
877 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
883 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
878 to % for pysh syntax extensions.
884 to % for pysh syntax extensions.
879
885
880 2004-10-09 Fernando Perez <fperez@colorado.edu>
886 2004-10-09 Fernando Perez <fperez@colorado.edu>
881
887
882 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
888 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
883 arrays to print a more useful summary, without calling str(arr).
889 arrays to print a more useful summary, without calling str(arr).
884 This avoids the problem of extremely lengthy computations which
890 This avoids the problem of extremely lengthy computations which
885 occur if arr is large, and appear to the user as a system lockup
891 occur if arr is large, and appear to the user as a system lockup
886 with 100% cpu activity. After a suggestion by Kristian Sandberg
892 with 100% cpu activity. After a suggestion by Kristian Sandberg
887 <Kristian.Sandberg@colorado.edu>.
893 <Kristian.Sandberg@colorado.edu>.
888 (Magic.__init__): fix bug in global magic escapes not being
894 (Magic.__init__): fix bug in global magic escapes not being
889 correctly set.
895 correctly set.
890
896
891 2004-10-08 Fernando Perez <fperez@colorado.edu>
897 2004-10-08 Fernando Perez <fperez@colorado.edu>
892
898
893 * IPython/Magic.py (__license__): change to absolute imports of
899 * IPython/Magic.py (__license__): change to absolute imports of
894 ipython's own internal packages, to start adapting to the absolute
900 ipython's own internal packages, to start adapting to the absolute
895 import requirement of PEP-328.
901 import requirement of PEP-328.
896
902
897 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
903 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
898 files, and standardize author/license marks through the Release
904 files, and standardize author/license marks through the Release
899 module instead of having per/file stuff (except for files with
905 module instead of having per/file stuff (except for files with
900 particular licenses, like the MIT/PSF-licensed codes).
906 particular licenses, like the MIT/PSF-licensed codes).
901
907
902 * IPython/Debugger.py: remove dead code for python 2.1
908 * IPython/Debugger.py: remove dead code for python 2.1
903
909
904 2004-10-04 Fernando Perez <fperez@colorado.edu>
910 2004-10-04 Fernando Perez <fperez@colorado.edu>
905
911
906 * IPython/iplib.py (ipmagic): New function for accessing magics
912 * IPython/iplib.py (ipmagic): New function for accessing magics
907 via a normal python function call.
913 via a normal python function call.
908
914
909 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
915 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
910 from '@' to '%', to accomodate the new @decorator syntax of python
916 from '@' to '%', to accomodate the new @decorator syntax of python
911 2.4.
917 2.4.
912
918
913 2004-09-29 Fernando Perez <fperez@colorado.edu>
919 2004-09-29 Fernando Perez <fperez@colorado.edu>
914
920
915 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
921 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
916 matplotlib.use to prevent running scripts which try to switch
922 matplotlib.use to prevent running scripts which try to switch
917 interactive backends from within ipython. This will just crash
923 interactive backends from within ipython. This will just crash
918 the python interpreter, so we can't allow it (but a detailed error
924 the python interpreter, so we can't allow it (but a detailed error
919 is given to the user).
925 is given to the user).
920
926
921 2004-09-28 Fernando Perez <fperez@colorado.edu>
927 2004-09-28 Fernando Perez <fperez@colorado.edu>
922
928
923 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
929 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
924 matplotlib-related fixes so that using @run with non-matplotlib
930 matplotlib-related fixes so that using @run with non-matplotlib
925 scripts doesn't pop up spurious plot windows. This requires
931 scripts doesn't pop up spurious plot windows. This requires
926 matplotlib >= 0.63, where I had to make some changes as well.
932 matplotlib >= 0.63, where I had to make some changes as well.
927
933
928 * IPython/ipmaker.py (make_IPython): update version requirement to
934 * IPython/ipmaker.py (make_IPython): update version requirement to
929 python 2.2.
935 python 2.2.
930
936
931 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
937 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
932 banner arg for embedded customization.
938 banner arg for embedded customization.
933
939
934 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
940 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
935 explicit uses of __IP as the IPython's instance name. Now things
941 explicit uses of __IP as the IPython's instance name. Now things
936 are properly handled via the shell.name value. The actual code
942 are properly handled via the shell.name value. The actual code
937 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
943 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
938 is much better than before. I'll clean things completely when the
944 is much better than before. I'll clean things completely when the
939 magic stuff gets a real overhaul.
945 magic stuff gets a real overhaul.
940
946
941 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
947 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
942 minor changes to debian dir.
948 minor changes to debian dir.
943
949
944 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
950 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
945 pointer to the shell itself in the interactive namespace even when
951 pointer to the shell itself in the interactive namespace even when
946 a user-supplied dict is provided. This is needed for embedding
952 a user-supplied dict is provided. This is needed for embedding
947 purposes (found by tests with Michel Sanner).
953 purposes (found by tests with Michel Sanner).
948
954
949 2004-09-27 Fernando Perez <fperez@colorado.edu>
955 2004-09-27 Fernando Perez <fperez@colorado.edu>
950
956
951 * IPython/UserConfig/ipythonrc: remove []{} from
957 * IPython/UserConfig/ipythonrc: remove []{} from
952 readline_remove_delims, so that things like [modname.<TAB> do
958 readline_remove_delims, so that things like [modname.<TAB> do
953 proper completion. This disables [].TAB, but that's a less common
959 proper completion. This disables [].TAB, but that's a less common
954 case than module names in list comprehensions, for example.
960 case than module names in list comprehensions, for example.
955 Thanks to a report by Andrea Riciputi.
961 Thanks to a report by Andrea Riciputi.
956
962
957 2004-09-09 Fernando Perez <fperez@colorado.edu>
963 2004-09-09 Fernando Perez <fperez@colorado.edu>
958
964
959 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
965 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
960 blocking problems in win32 and osx. Fix by John.
966 blocking problems in win32 and osx. Fix by John.
961
967
962 2004-09-08 Fernando Perez <fperez@colorado.edu>
968 2004-09-08 Fernando Perez <fperez@colorado.edu>
963
969
964 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
970 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
965 for Win32 and OSX. Fix by John Hunter.
971 for Win32 and OSX. Fix by John Hunter.
966
972
967 2004-08-30 *** Released version 0.6.3
973 2004-08-30 *** Released version 0.6.3
968
974
969 2004-08-30 Fernando Perez <fperez@colorado.edu>
975 2004-08-30 Fernando Perez <fperez@colorado.edu>
970
976
971 * setup.py (isfile): Add manpages to list of dependent files to be
977 * setup.py (isfile): Add manpages to list of dependent files to be
972 updated.
978 updated.
973
979
974 2004-08-27 Fernando Perez <fperez@colorado.edu>
980 2004-08-27 Fernando Perez <fperez@colorado.edu>
975
981
976 * IPython/Shell.py (start): I've disabled -wthread and -gthread
982 * IPython/Shell.py (start): I've disabled -wthread and -gthread
977 for now. They don't really work with standalone WX/GTK code
983 for now. They don't really work with standalone WX/GTK code
978 (though matplotlib IS working fine with both of those backends).
984 (though matplotlib IS working fine with both of those backends).
979 This will neeed much more testing. I disabled most things with
985 This will neeed much more testing. I disabled most things with
980 comments, so turning it back on later should be pretty easy.
986 comments, so turning it back on later should be pretty easy.
981
987
982 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
988 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
983 autocalling of expressions like r'foo', by modifying the line
989 autocalling of expressions like r'foo', by modifying the line
984 split regexp. Closes
990 split regexp. Closes
985 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
991 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
986 Riley <ipythonbugs-AT-sabi.net>.
992 Riley <ipythonbugs-AT-sabi.net>.
987 (InteractiveShell.mainloop): honor --nobanner with banner
993 (InteractiveShell.mainloop): honor --nobanner with banner
988 extensions.
994 extensions.
989
995
990 * IPython/Shell.py: Significant refactoring of all classes, so
996 * IPython/Shell.py: Significant refactoring of all classes, so
991 that we can really support ALL matplotlib backends and threading
997 that we can really support ALL matplotlib backends and threading
992 models (John spotted a bug with Tk which required this). Now we
998 models (John spotted a bug with Tk which required this). Now we
993 should support single-threaded, WX-threads and GTK-threads, both
999 should support single-threaded, WX-threads and GTK-threads, both
994 for generic code and for matplotlib.
1000 for generic code and for matplotlib.
995
1001
996 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1002 * IPython/ipmaker.py (__call__): Changed -mpthread option to
997 -pylab, to simplify things for users. Will also remove the pylab
1003 -pylab, to simplify things for users. Will also remove the pylab
998 profile, since now all of matplotlib configuration is directly
1004 profile, since now all of matplotlib configuration is directly
999 handled here. This also reduces startup time.
1005 handled here. This also reduces startup time.
1000
1006
1001 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1007 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1002 shell wasn't being correctly called. Also in IPShellWX.
1008 shell wasn't being correctly called. Also in IPShellWX.
1003
1009
1004 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1010 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1005 fine-tune banner.
1011 fine-tune banner.
1006
1012
1007 * IPython/numutils.py (spike): Deprecate these spike functions,
1013 * IPython/numutils.py (spike): Deprecate these spike functions,
1008 delete (long deprecated) gnuplot_exec handler.
1014 delete (long deprecated) gnuplot_exec handler.
1009
1015
1010 2004-08-26 Fernando Perez <fperez@colorado.edu>
1016 2004-08-26 Fernando Perez <fperez@colorado.edu>
1011
1017
1012 * ipython.1: Update for threading options, plus some others which
1018 * ipython.1: Update for threading options, plus some others which
1013 were missing.
1019 were missing.
1014
1020
1015 * IPython/ipmaker.py (__call__): Added -wthread option for
1021 * IPython/ipmaker.py (__call__): Added -wthread option for
1016 wxpython thread handling. Make sure threading options are only
1022 wxpython thread handling. Make sure threading options are only
1017 valid at the command line.
1023 valid at the command line.
1018
1024
1019 * scripts/ipython: moved shell selection into a factory function
1025 * scripts/ipython: moved shell selection into a factory function
1020 in Shell.py, to keep the starter script to a minimum.
1026 in Shell.py, to keep the starter script to a minimum.
1021
1027
1022 2004-08-25 Fernando Perez <fperez@colorado.edu>
1028 2004-08-25 Fernando Perez <fperez@colorado.edu>
1023
1029
1024 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1030 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1025 John. Along with some recent changes he made to matplotlib, the
1031 John. Along with some recent changes he made to matplotlib, the
1026 next versions of both systems should work very well together.
1032 next versions of both systems should work very well together.
1027
1033
1028 2004-08-24 Fernando Perez <fperez@colorado.edu>
1034 2004-08-24 Fernando Perez <fperez@colorado.edu>
1029
1035
1030 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1036 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1031 tried to switch the profiling to using hotshot, but I'm getting
1037 tried to switch the profiling to using hotshot, but I'm getting
1032 strange errors from prof.runctx() there. I may be misreading the
1038 strange errors from prof.runctx() there. I may be misreading the
1033 docs, but it looks weird. For now the profiling code will
1039 docs, but it looks weird. For now the profiling code will
1034 continue to use the standard profiler.
1040 continue to use the standard profiler.
1035
1041
1036 2004-08-23 Fernando Perez <fperez@colorado.edu>
1042 2004-08-23 Fernando Perez <fperez@colorado.edu>
1037
1043
1038 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1044 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1039 threaded shell, by John Hunter. It's not quite ready yet, but
1045 threaded shell, by John Hunter. It's not quite ready yet, but
1040 close.
1046 close.
1041
1047
1042 2004-08-22 Fernando Perez <fperez@colorado.edu>
1048 2004-08-22 Fernando Perez <fperez@colorado.edu>
1043
1049
1044 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1050 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1045 in Magic and ultraTB.
1051 in Magic and ultraTB.
1046
1052
1047 * ipython.1: document threading options in manpage.
1053 * ipython.1: document threading options in manpage.
1048
1054
1049 * scripts/ipython: Changed name of -thread option to -gthread,
1055 * scripts/ipython: Changed name of -thread option to -gthread,
1050 since this is GTK specific. I want to leave the door open for a
1056 since this is GTK specific. I want to leave the door open for a
1051 -wthread option for WX, which will most likely be necessary. This
1057 -wthread option for WX, which will most likely be necessary. This
1052 change affects usage and ipmaker as well.
1058 change affects usage and ipmaker as well.
1053
1059
1054 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1060 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1055 handle the matplotlib shell issues. Code by John Hunter
1061 handle the matplotlib shell issues. Code by John Hunter
1056 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1062 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1057 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1063 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1058 broken (and disabled for end users) for now, but it puts the
1064 broken (and disabled for end users) for now, but it puts the
1059 infrastructure in place.
1065 infrastructure in place.
1060
1066
1061 2004-08-21 Fernando Perez <fperez@colorado.edu>
1067 2004-08-21 Fernando Perez <fperez@colorado.edu>
1062
1068
1063 * ipythonrc-pylab: Add matplotlib support.
1069 * ipythonrc-pylab: Add matplotlib support.
1064
1070
1065 * matplotlib_config.py: new files for matplotlib support, part of
1071 * matplotlib_config.py: new files for matplotlib support, part of
1066 the pylab profile.
1072 the pylab profile.
1067
1073
1068 * IPython/usage.py (__doc__): documented the threading options.
1074 * IPython/usage.py (__doc__): documented the threading options.
1069
1075
1070 2004-08-20 Fernando Perez <fperez@colorado.edu>
1076 2004-08-20 Fernando Perez <fperez@colorado.edu>
1071
1077
1072 * ipython: Modified the main calling routine to handle the -thread
1078 * ipython: Modified the main calling routine to handle the -thread
1073 and -mpthread options. This needs to be done as a top-level hack,
1079 and -mpthread options. This needs to be done as a top-level hack,
1074 because it determines which class to instantiate for IPython
1080 because it determines which class to instantiate for IPython
1075 itself.
1081 itself.
1076
1082
1077 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1083 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1078 classes to support multithreaded GTK operation without blocking,
1084 classes to support multithreaded GTK operation without blocking,
1079 and matplotlib with all backends. This is a lot of still very
1085 and matplotlib with all backends. This is a lot of still very
1080 experimental code, and threads are tricky. So it may still have a
1086 experimental code, and threads are tricky. So it may still have a
1081 few rough edges... This code owes a lot to
1087 few rough edges... This code owes a lot to
1082 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1088 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1083 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1089 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1084 to John Hunter for all the matplotlib work.
1090 to John Hunter for all the matplotlib work.
1085
1091
1086 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1092 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1087 options for gtk thread and matplotlib support.
1093 options for gtk thread and matplotlib support.
1088
1094
1089 2004-08-16 Fernando Perez <fperez@colorado.edu>
1095 2004-08-16 Fernando Perez <fperez@colorado.edu>
1090
1096
1091 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1097 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1092 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1098 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1093 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1099 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1094
1100
1095 2004-08-11 Fernando Perez <fperez@colorado.edu>
1101 2004-08-11 Fernando Perez <fperez@colorado.edu>
1096
1102
1097 * setup.py (isfile): Fix build so documentation gets updated for
1103 * setup.py (isfile): Fix build so documentation gets updated for
1098 rpms (it was only done for .tgz builds).
1104 rpms (it was only done for .tgz builds).
1099
1105
1100 2004-08-10 Fernando Perez <fperez@colorado.edu>
1106 2004-08-10 Fernando Perez <fperez@colorado.edu>
1101
1107
1102 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1108 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1103
1109
1104 * iplib.py : Silence syntax error exceptions in tab-completion.
1110 * iplib.py : Silence syntax error exceptions in tab-completion.
1105
1111
1106 2004-08-05 Fernando Perez <fperez@colorado.edu>
1112 2004-08-05 Fernando Perez <fperez@colorado.edu>
1107
1113
1108 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1114 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1109 'color off' mark for continuation prompts. This was causing long
1115 'color off' mark for continuation prompts. This was causing long
1110 continuation lines to mis-wrap.
1116 continuation lines to mis-wrap.
1111
1117
1112 2004-08-01 Fernando Perez <fperez@colorado.edu>
1118 2004-08-01 Fernando Perez <fperez@colorado.edu>
1113
1119
1114 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1120 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1115 for building ipython to be a parameter. All this is necessary
1121 for building ipython to be a parameter. All this is necessary
1116 right now to have a multithreaded version, but this insane
1122 right now to have a multithreaded version, but this insane
1117 non-design will be cleaned up soon. For now, it's a hack that
1123 non-design will be cleaned up soon. For now, it's a hack that
1118 works.
1124 works.
1119
1125
1120 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1126 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1121 args in various places. No bugs so far, but it's a dangerous
1127 args in various places. No bugs so far, but it's a dangerous
1122 practice.
1128 practice.
1123
1129
1124 2004-07-31 Fernando Perez <fperez@colorado.edu>
1130 2004-07-31 Fernando Perez <fperez@colorado.edu>
1125
1131
1126 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1132 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1127 fix completion of files with dots in their names under most
1133 fix completion of files with dots in their names under most
1128 profiles (pysh was OK because the completion order is different).
1134 profiles (pysh was OK because the completion order is different).
1129
1135
1130 2004-07-27 Fernando Perez <fperez@colorado.edu>
1136 2004-07-27 Fernando Perez <fperez@colorado.edu>
1131
1137
1132 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1138 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1133 keywords manually, b/c the one in keyword.py was removed in python
1139 keywords manually, b/c the one in keyword.py was removed in python
1134 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1140 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1135 This is NOT a bug under python 2.3 and earlier.
1141 This is NOT a bug under python 2.3 and earlier.
1136
1142
1137 2004-07-26 Fernando Perez <fperez@colorado.edu>
1143 2004-07-26 Fernando Perez <fperez@colorado.edu>
1138
1144
1139 * IPython/ultraTB.py (VerboseTB.text): Add another
1145 * IPython/ultraTB.py (VerboseTB.text): Add another
1140 linecache.checkcache() call to try to prevent inspect.py from
1146 linecache.checkcache() call to try to prevent inspect.py from
1141 crashing under python 2.3. I think this fixes
1147 crashing under python 2.3. I think this fixes
1142 http://www.scipy.net/roundup/ipython/issue17.
1148 http://www.scipy.net/roundup/ipython/issue17.
1143
1149
1144 2004-07-26 *** Released version 0.6.2
1150 2004-07-26 *** Released version 0.6.2
1145
1151
1146 2004-07-26 Fernando Perez <fperez@colorado.edu>
1152 2004-07-26 Fernando Perez <fperez@colorado.edu>
1147
1153
1148 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1154 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1149 fail for any number.
1155 fail for any number.
1150 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1156 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1151 empty bookmarks.
1157 empty bookmarks.
1152
1158
1153 2004-07-26 *** Released version 0.6.1
1159 2004-07-26 *** Released version 0.6.1
1154
1160
1155 2004-07-26 Fernando Perez <fperez@colorado.edu>
1161 2004-07-26 Fernando Perez <fperez@colorado.edu>
1156
1162
1157 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1163 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1158
1164
1159 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1165 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1160 escaping '()[]{}' in filenames.
1166 escaping '()[]{}' in filenames.
1161
1167
1162 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1168 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1163 Python 2.2 users who lack a proper shlex.split.
1169 Python 2.2 users who lack a proper shlex.split.
1164
1170
1165 2004-07-19 Fernando Perez <fperez@colorado.edu>
1171 2004-07-19 Fernando Perez <fperez@colorado.edu>
1166
1172
1167 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1173 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1168 for reading readline's init file. I follow the normal chain:
1174 for reading readline's init file. I follow the normal chain:
1169 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1175 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1170 report by Mike Heeter. This closes
1176 report by Mike Heeter. This closes
1171 http://www.scipy.net/roundup/ipython/issue16.
1177 http://www.scipy.net/roundup/ipython/issue16.
1172
1178
1173 2004-07-18 Fernando Perez <fperez@colorado.edu>
1179 2004-07-18 Fernando Perez <fperez@colorado.edu>
1174
1180
1175 * IPython/iplib.py (__init__): Add better handling of '\' under
1181 * IPython/iplib.py (__init__): Add better handling of '\' under
1176 Win32 for filenames. After a patch by Ville.
1182 Win32 for filenames. After a patch by Ville.
1177
1183
1178 2004-07-17 Fernando Perez <fperez@colorado.edu>
1184 2004-07-17 Fernando Perez <fperez@colorado.edu>
1179
1185
1180 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1186 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1181 autocalling would be triggered for 'foo is bar' if foo is
1187 autocalling would be triggered for 'foo is bar' if foo is
1182 callable. I also cleaned up the autocall detection code to use a
1188 callable. I also cleaned up the autocall detection code to use a
1183 regexp, which is faster. Bug reported by Alexander Schmolck.
1189 regexp, which is faster. Bug reported by Alexander Schmolck.
1184
1190
1185 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1191 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1186 '?' in them would confuse the help system. Reported by Alex
1192 '?' in them would confuse the help system. Reported by Alex
1187 Schmolck.
1193 Schmolck.
1188
1194
1189 2004-07-16 Fernando Perez <fperez@colorado.edu>
1195 2004-07-16 Fernando Perez <fperez@colorado.edu>
1190
1196
1191 * IPython/GnuplotInteractive.py (__all__): added plot2.
1197 * IPython/GnuplotInteractive.py (__all__): added plot2.
1192
1198
1193 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1199 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1194 plotting dictionaries, lists or tuples of 1d arrays.
1200 plotting dictionaries, lists or tuples of 1d arrays.
1195
1201
1196 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1202 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1197 optimizations.
1203 optimizations.
1198
1204
1199 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1205 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1200 the information which was there from Janko's original IPP code:
1206 the information which was there from Janko's original IPP code:
1201
1207
1202 03.05.99 20:53 porto.ifm.uni-kiel.de
1208 03.05.99 20:53 porto.ifm.uni-kiel.de
1203 --Started changelog.
1209 --Started changelog.
1204 --make clear do what it say it does
1210 --make clear do what it say it does
1205 --added pretty output of lines from inputcache
1211 --added pretty output of lines from inputcache
1206 --Made Logger a mixin class, simplifies handling of switches
1212 --Made Logger a mixin class, simplifies handling of switches
1207 --Added own completer class. .string<TAB> expands to last history
1213 --Added own completer class. .string<TAB> expands to last history
1208 line which starts with string. The new expansion is also present
1214 line which starts with string. The new expansion is also present
1209 with Ctrl-r from the readline library. But this shows, who this
1215 with Ctrl-r from the readline library. But this shows, who this
1210 can be done for other cases.
1216 can be done for other cases.
1211 --Added convention that all shell functions should accept a
1217 --Added convention that all shell functions should accept a
1212 parameter_string This opens the door for different behaviour for
1218 parameter_string This opens the door for different behaviour for
1213 each function. @cd is a good example of this.
1219 each function. @cd is a good example of this.
1214
1220
1215 04.05.99 12:12 porto.ifm.uni-kiel.de
1221 04.05.99 12:12 porto.ifm.uni-kiel.de
1216 --added logfile rotation
1222 --added logfile rotation
1217 --added new mainloop method which freezes first the namespace
1223 --added new mainloop method which freezes first the namespace
1218
1224
1219 07.05.99 21:24 porto.ifm.uni-kiel.de
1225 07.05.99 21:24 porto.ifm.uni-kiel.de
1220 --added the docreader classes. Now there is a help system.
1226 --added the docreader classes. Now there is a help system.
1221 -This is only a first try. Currently it's not easy to put new
1227 -This is only a first try. Currently it's not easy to put new
1222 stuff in the indices. But this is the way to go. Info would be
1228 stuff in the indices. But this is the way to go. Info would be
1223 better, but HTML is every where and not everybody has an info
1229 better, but HTML is every where and not everybody has an info
1224 system installed and it's not so easy to change html-docs to info.
1230 system installed and it's not so easy to change html-docs to info.
1225 --added global logfile option
1231 --added global logfile option
1226 --there is now a hook for object inspection method pinfo needs to
1232 --there is now a hook for object inspection method pinfo needs to
1227 be provided for this. Can be reached by two '??'.
1233 be provided for this. Can be reached by two '??'.
1228
1234
1229 08.05.99 20:51 porto.ifm.uni-kiel.de
1235 08.05.99 20:51 porto.ifm.uni-kiel.de
1230 --added a README
1236 --added a README
1231 --bug in rc file. Something has changed so functions in the rc
1237 --bug in rc file. Something has changed so functions in the rc
1232 file need to reference the shell and not self. Not clear if it's a
1238 file need to reference the shell and not self. Not clear if it's a
1233 bug or feature.
1239 bug or feature.
1234 --changed rc file for new behavior
1240 --changed rc file for new behavior
1235
1241
1236 2004-07-15 Fernando Perez <fperez@colorado.edu>
1242 2004-07-15 Fernando Perez <fperez@colorado.edu>
1237
1243
1238 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1244 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1239 cache was falling out of sync in bizarre manners when multi-line
1245 cache was falling out of sync in bizarre manners when multi-line
1240 input was present. Minor optimizations and cleanup.
1246 input was present. Minor optimizations and cleanup.
1241
1247
1242 (Logger): Remove old Changelog info for cleanup. This is the
1248 (Logger): Remove old Changelog info for cleanup. This is the
1243 information which was there from Janko's original code:
1249 information which was there from Janko's original code:
1244
1250
1245 Changes to Logger: - made the default log filename a parameter
1251 Changes to Logger: - made the default log filename a parameter
1246
1252
1247 - put a check for lines beginning with !@? in log(). Needed
1253 - put a check for lines beginning with !@? in log(). Needed
1248 (even if the handlers properly log their lines) for mid-session
1254 (even if the handlers properly log their lines) for mid-session
1249 logging activation to work properly. Without this, lines logged
1255 logging activation to work properly. Without this, lines logged
1250 in mid session, which get read from the cache, would end up
1256 in mid session, which get read from the cache, would end up
1251 'bare' (with !@? in the open) in the log. Now they are caught
1257 'bare' (with !@? in the open) in the log. Now they are caught
1252 and prepended with a #.
1258 and prepended with a #.
1253
1259
1254 * IPython/iplib.py (InteractiveShell.init_readline): added check
1260 * IPython/iplib.py (InteractiveShell.init_readline): added check
1255 in case MagicCompleter fails to be defined, so we don't crash.
1261 in case MagicCompleter fails to be defined, so we don't crash.
1256
1262
1257 2004-07-13 Fernando Perez <fperez@colorado.edu>
1263 2004-07-13 Fernando Perez <fperez@colorado.edu>
1258
1264
1259 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1265 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1260 of EPS if the requested filename ends in '.eps'.
1266 of EPS if the requested filename ends in '.eps'.
1261
1267
1262 2004-07-04 Fernando Perez <fperez@colorado.edu>
1268 2004-07-04 Fernando Perez <fperez@colorado.edu>
1263
1269
1264 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1270 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1265 escaping of quotes when calling the shell.
1271 escaping of quotes when calling the shell.
1266
1272
1267 2004-07-02 Fernando Perez <fperez@colorado.edu>
1273 2004-07-02 Fernando Perez <fperez@colorado.edu>
1268
1274
1269 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1275 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1270 gettext not working because we were clobbering '_'. Fixes
1276 gettext not working because we were clobbering '_'. Fixes
1271 http://www.scipy.net/roundup/ipython/issue6.
1277 http://www.scipy.net/roundup/ipython/issue6.
1272
1278
1273 2004-07-01 Fernando Perez <fperez@colorado.edu>
1279 2004-07-01 Fernando Perez <fperez@colorado.edu>
1274
1280
1275 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1281 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1276 into @cd. Patch by Ville.
1282 into @cd. Patch by Ville.
1277
1283
1278 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1284 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1279 new function to store things after ipmaker runs. Patch by Ville.
1285 new function to store things after ipmaker runs. Patch by Ville.
1280 Eventually this will go away once ipmaker is removed and the class
1286 Eventually this will go away once ipmaker is removed and the class
1281 gets cleaned up, but for now it's ok. Key functionality here is
1287 gets cleaned up, but for now it's ok. Key functionality here is
1282 the addition of the persistent storage mechanism, a dict for
1288 the addition of the persistent storage mechanism, a dict for
1283 keeping data across sessions (for now just bookmarks, but more can
1289 keeping data across sessions (for now just bookmarks, but more can
1284 be implemented later).
1290 be implemented later).
1285
1291
1286 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1292 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1287 persistent across sections. Patch by Ville, I modified it
1293 persistent across sections. Patch by Ville, I modified it
1288 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1294 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1289 added a '-l' option to list all bookmarks.
1295 added a '-l' option to list all bookmarks.
1290
1296
1291 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1297 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1292 center for cleanup. Registered with atexit.register(). I moved
1298 center for cleanup. Registered with atexit.register(). I moved
1293 here the old exit_cleanup(). After a patch by Ville.
1299 here the old exit_cleanup(). After a patch by Ville.
1294
1300
1295 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1301 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1296 characters in the hacked shlex_split for python 2.2.
1302 characters in the hacked shlex_split for python 2.2.
1297
1303
1298 * IPython/iplib.py (file_matches): more fixes to filenames with
1304 * IPython/iplib.py (file_matches): more fixes to filenames with
1299 whitespace in them. It's not perfect, but limitations in python's
1305 whitespace in them. It's not perfect, but limitations in python's
1300 readline make it impossible to go further.
1306 readline make it impossible to go further.
1301
1307
1302 2004-06-29 Fernando Perez <fperez@colorado.edu>
1308 2004-06-29 Fernando Perez <fperez@colorado.edu>
1303
1309
1304 * IPython/iplib.py (file_matches): escape whitespace correctly in
1310 * IPython/iplib.py (file_matches): escape whitespace correctly in
1305 filename completions. Bug reported by Ville.
1311 filename completions. Bug reported by Ville.
1306
1312
1307 2004-06-28 Fernando Perez <fperez@colorado.edu>
1313 2004-06-28 Fernando Perez <fperez@colorado.edu>
1308
1314
1309 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1315 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1310 the history file will be called 'history-PROFNAME' (or just
1316 the history file will be called 'history-PROFNAME' (or just
1311 'history' if no profile is loaded). I was getting annoyed at
1317 'history' if no profile is loaded). I was getting annoyed at
1312 getting my Numerical work history clobbered by pysh sessions.
1318 getting my Numerical work history clobbered by pysh sessions.
1313
1319
1314 * IPython/iplib.py (InteractiveShell.__init__): Internal
1320 * IPython/iplib.py (InteractiveShell.__init__): Internal
1315 getoutputerror() function so that we can honor the system_verbose
1321 getoutputerror() function so that we can honor the system_verbose
1316 flag for _all_ system calls. I also added escaping of #
1322 flag for _all_ system calls. I also added escaping of #
1317 characters here to avoid confusing Itpl.
1323 characters here to avoid confusing Itpl.
1318
1324
1319 * IPython/Magic.py (shlex_split): removed call to shell in
1325 * IPython/Magic.py (shlex_split): removed call to shell in
1320 parse_options and replaced it with shlex.split(). The annoying
1326 parse_options and replaced it with shlex.split(). The annoying
1321 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1327 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1322 to backport it from 2.3, with several frail hacks (the shlex
1328 to backport it from 2.3, with several frail hacks (the shlex
1323 module is rather limited in 2.2). Thanks to a suggestion by Ville
1329 module is rather limited in 2.2). Thanks to a suggestion by Ville
1324 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1330 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1325 problem.
1331 problem.
1326
1332
1327 (Magic.magic_system_verbose): new toggle to print the actual
1333 (Magic.magic_system_verbose): new toggle to print the actual
1328 system calls made by ipython. Mainly for debugging purposes.
1334 system calls made by ipython. Mainly for debugging purposes.
1329
1335
1330 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1336 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1331 doesn't support persistence. Reported (and fix suggested) by
1337 doesn't support persistence. Reported (and fix suggested) by
1332 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1338 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1333
1339
1334 2004-06-26 Fernando Perez <fperez@colorado.edu>
1340 2004-06-26 Fernando Perez <fperez@colorado.edu>
1335
1341
1336 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1342 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1337 continue prompts.
1343 continue prompts.
1338
1344
1339 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1345 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1340 function (basically a big docstring) and a few more things here to
1346 function (basically a big docstring) and a few more things here to
1341 speedup startup. pysh.py is now very lightweight. We want because
1347 speedup startup. pysh.py is now very lightweight. We want because
1342 it gets execfile'd, while InterpreterExec gets imported, so
1348 it gets execfile'd, while InterpreterExec gets imported, so
1343 byte-compilation saves time.
1349 byte-compilation saves time.
1344
1350
1345 2004-06-25 Fernando Perez <fperez@colorado.edu>
1351 2004-06-25 Fernando Perez <fperez@colorado.edu>
1346
1352
1347 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1353 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1348 -NUM', which was recently broken.
1354 -NUM', which was recently broken.
1349
1355
1350 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1356 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1351 in multi-line input (but not !!, which doesn't make sense there).
1357 in multi-line input (but not !!, which doesn't make sense there).
1352
1358
1353 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1359 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1354 It's just too useful, and people can turn it off in the less
1360 It's just too useful, and people can turn it off in the less
1355 common cases where it's a problem.
1361 common cases where it's a problem.
1356
1362
1357 2004-06-24 Fernando Perez <fperez@colorado.edu>
1363 2004-06-24 Fernando Perez <fperez@colorado.edu>
1358
1364
1359 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1365 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1360 special syntaxes (like alias calling) is now allied in multi-line
1366 special syntaxes (like alias calling) is now allied in multi-line
1361 input. This is still _very_ experimental, but it's necessary for
1367 input. This is still _very_ experimental, but it's necessary for
1362 efficient shell usage combining python looping syntax with system
1368 efficient shell usage combining python looping syntax with system
1363 calls. For now it's restricted to aliases, I don't think it
1369 calls. For now it's restricted to aliases, I don't think it
1364 really even makes sense to have this for magics.
1370 really even makes sense to have this for magics.
1365
1371
1366 2004-06-23 Fernando Perez <fperez@colorado.edu>
1372 2004-06-23 Fernando Perez <fperez@colorado.edu>
1367
1373
1368 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1374 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1369 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1375 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1370
1376
1371 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1377 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1372 extensions under Windows (after code sent by Gary Bishop). The
1378 extensions under Windows (after code sent by Gary Bishop). The
1373 extensions considered 'executable' are stored in IPython's rc
1379 extensions considered 'executable' are stored in IPython's rc
1374 structure as win_exec_ext.
1380 structure as win_exec_ext.
1375
1381
1376 * IPython/genutils.py (shell): new function, like system() but
1382 * IPython/genutils.py (shell): new function, like system() but
1377 without return value. Very useful for interactive shell work.
1383 without return value. Very useful for interactive shell work.
1378
1384
1379 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1385 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1380 delete aliases.
1386 delete aliases.
1381
1387
1382 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1388 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1383 sure that the alias table doesn't contain python keywords.
1389 sure that the alias table doesn't contain python keywords.
1384
1390
1385 2004-06-21 Fernando Perez <fperez@colorado.edu>
1391 2004-06-21 Fernando Perez <fperez@colorado.edu>
1386
1392
1387 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1393 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1388 non-existent items are found in $PATH. Reported by Thorsten.
1394 non-existent items are found in $PATH. Reported by Thorsten.
1389
1395
1390 2004-06-20 Fernando Perez <fperez@colorado.edu>
1396 2004-06-20 Fernando Perez <fperez@colorado.edu>
1391
1397
1392 * IPython/iplib.py (complete): modified the completer so that the
1398 * IPython/iplib.py (complete): modified the completer so that the
1393 order of priorities can be easily changed at runtime.
1399 order of priorities can be easily changed at runtime.
1394
1400
1395 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1401 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1396 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1402 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1397
1403
1398 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1404 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1399 expand Python variables prepended with $ in all system calls. The
1405 expand Python variables prepended with $ in all system calls. The
1400 same was done to InteractiveShell.handle_shell_escape. Now all
1406 same was done to InteractiveShell.handle_shell_escape. Now all
1401 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1407 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1402 expansion of python variables and expressions according to the
1408 expansion of python variables and expressions according to the
1403 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1409 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1404
1410
1405 Though PEP-215 has been rejected, a similar (but simpler) one
1411 Though PEP-215 has been rejected, a similar (but simpler) one
1406 seems like it will go into Python 2.4, PEP-292 -
1412 seems like it will go into Python 2.4, PEP-292 -
1407 http://www.python.org/peps/pep-0292.html.
1413 http://www.python.org/peps/pep-0292.html.
1408
1414
1409 I'll keep the full syntax of PEP-215, since IPython has since the
1415 I'll keep the full syntax of PEP-215, since IPython has since the
1410 start used Ka-Ping Yee's reference implementation discussed there
1416 start used Ka-Ping Yee's reference implementation discussed there
1411 (Itpl), and I actually like the powerful semantics it offers.
1417 (Itpl), and I actually like the powerful semantics it offers.
1412
1418
1413 In order to access normal shell variables, the $ has to be escaped
1419 In order to access normal shell variables, the $ has to be escaped
1414 via an extra $. For example:
1420 via an extra $. For example:
1415
1421
1416 In [7]: PATH='a python variable'
1422 In [7]: PATH='a python variable'
1417
1423
1418 In [8]: !echo $PATH
1424 In [8]: !echo $PATH
1419 a python variable
1425 a python variable
1420
1426
1421 In [9]: !echo $$PATH
1427 In [9]: !echo $$PATH
1422 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1428 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1423
1429
1424 (Magic.parse_options): escape $ so the shell doesn't evaluate
1430 (Magic.parse_options): escape $ so the shell doesn't evaluate
1425 things prematurely.
1431 things prematurely.
1426
1432
1427 * IPython/iplib.py (InteractiveShell.call_alias): added the
1433 * IPython/iplib.py (InteractiveShell.call_alias): added the
1428 ability for aliases to expand python variables via $.
1434 ability for aliases to expand python variables via $.
1429
1435
1430 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1436 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1431 system, now there's a @rehash/@rehashx pair of magics. These work
1437 system, now there's a @rehash/@rehashx pair of magics. These work
1432 like the csh rehash command, and can be invoked at any time. They
1438 like the csh rehash command, and can be invoked at any time. They
1433 build a table of aliases to everything in the user's $PATH
1439 build a table of aliases to everything in the user's $PATH
1434 (@rehash uses everything, @rehashx is slower but only adds
1440 (@rehash uses everything, @rehashx is slower but only adds
1435 executable files). With this, the pysh.py-based shell profile can
1441 executable files). With this, the pysh.py-based shell profile can
1436 now simply call rehash upon startup, and full access to all
1442 now simply call rehash upon startup, and full access to all
1437 programs in the user's path is obtained.
1443 programs in the user's path is obtained.
1438
1444
1439 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1445 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1440 functionality is now fully in place. I removed the old dynamic
1446 functionality is now fully in place. I removed the old dynamic
1441 code generation based approach, in favor of a much lighter one
1447 code generation based approach, in favor of a much lighter one
1442 based on a simple dict. The advantage is that this allows me to
1448 based on a simple dict. The advantage is that this allows me to
1443 now have thousands of aliases with negligible cost (unthinkable
1449 now have thousands of aliases with negligible cost (unthinkable
1444 with the old system).
1450 with the old system).
1445
1451
1446 2004-06-19 Fernando Perez <fperez@colorado.edu>
1452 2004-06-19 Fernando Perez <fperez@colorado.edu>
1447
1453
1448 * IPython/iplib.py (__init__): extended MagicCompleter class to
1454 * IPython/iplib.py (__init__): extended MagicCompleter class to
1449 also complete (last in priority) on user aliases.
1455 also complete (last in priority) on user aliases.
1450
1456
1451 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1457 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1452 call to eval.
1458 call to eval.
1453 (ItplNS.__init__): Added a new class which functions like Itpl,
1459 (ItplNS.__init__): Added a new class which functions like Itpl,
1454 but allows configuring the namespace for the evaluation to occur
1460 but allows configuring the namespace for the evaluation to occur
1455 in.
1461 in.
1456
1462
1457 2004-06-18 Fernando Perez <fperez@colorado.edu>
1463 2004-06-18 Fernando Perez <fperez@colorado.edu>
1458
1464
1459 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1465 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1460 better message when 'exit' or 'quit' are typed (a common newbie
1466 better message when 'exit' or 'quit' are typed (a common newbie
1461 confusion).
1467 confusion).
1462
1468
1463 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1469 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1464 check for Windows users.
1470 check for Windows users.
1465
1471
1466 * IPython/iplib.py (InteractiveShell.user_setup): removed
1472 * IPython/iplib.py (InteractiveShell.user_setup): removed
1467 disabling of colors for Windows. I'll test at runtime and issue a
1473 disabling of colors for Windows. I'll test at runtime and issue a
1468 warning if Gary's readline isn't found, as to nudge users to
1474 warning if Gary's readline isn't found, as to nudge users to
1469 download it.
1475 download it.
1470
1476
1471 2004-06-16 Fernando Perez <fperez@colorado.edu>
1477 2004-06-16 Fernando Perez <fperez@colorado.edu>
1472
1478
1473 * IPython/genutils.py (Stream.__init__): changed to print errors
1479 * IPython/genutils.py (Stream.__init__): changed to print errors
1474 to sys.stderr. I had a circular dependency here. Now it's
1480 to sys.stderr. I had a circular dependency here. Now it's
1475 possible to run ipython as IDLE's shell (consider this pre-alpha,
1481 possible to run ipython as IDLE's shell (consider this pre-alpha,
1476 since true stdout things end up in the starting terminal instead
1482 since true stdout things end up in the starting terminal instead
1477 of IDLE's out).
1483 of IDLE's out).
1478
1484
1479 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1485 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1480 users who haven't # updated their prompt_in2 definitions. Remove
1486 users who haven't # updated their prompt_in2 definitions. Remove
1481 eventually.
1487 eventually.
1482 (multiple_replace): added credit to original ASPN recipe.
1488 (multiple_replace): added credit to original ASPN recipe.
1483
1489
1484 2004-06-15 Fernando Perez <fperez@colorado.edu>
1490 2004-06-15 Fernando Perez <fperez@colorado.edu>
1485
1491
1486 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1492 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1487 list of auto-defined aliases.
1493 list of auto-defined aliases.
1488
1494
1489 2004-06-13 Fernando Perez <fperez@colorado.edu>
1495 2004-06-13 Fernando Perez <fperez@colorado.edu>
1490
1496
1491 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1497 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1492 install was really requested (so setup.py can be used for other
1498 install was really requested (so setup.py can be used for other
1493 things under Windows).
1499 things under Windows).
1494
1500
1495 2004-06-10 Fernando Perez <fperez@colorado.edu>
1501 2004-06-10 Fernando Perez <fperez@colorado.edu>
1496
1502
1497 * IPython/Logger.py (Logger.create_log): Manually remove any old
1503 * IPython/Logger.py (Logger.create_log): Manually remove any old
1498 backup, since os.remove may fail under Windows. Fixes bug
1504 backup, since os.remove may fail under Windows. Fixes bug
1499 reported by Thorsten.
1505 reported by Thorsten.
1500
1506
1501 2004-06-09 Fernando Perez <fperez@colorado.edu>
1507 2004-06-09 Fernando Perez <fperez@colorado.edu>
1502
1508
1503 * examples/example-embed.py: fixed all references to %n (replaced
1509 * examples/example-embed.py: fixed all references to %n (replaced
1504 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1510 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1505 for all examples and the manual as well.
1511 for all examples and the manual as well.
1506
1512
1507 2004-06-08 Fernando Perez <fperez@colorado.edu>
1513 2004-06-08 Fernando Perez <fperez@colorado.edu>
1508
1514
1509 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1515 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1510 alignment and color management. All 3 prompt subsystems now
1516 alignment and color management. All 3 prompt subsystems now
1511 inherit from BasePrompt.
1517 inherit from BasePrompt.
1512
1518
1513 * tools/release: updates for windows installer build and tag rpms
1519 * tools/release: updates for windows installer build and tag rpms
1514 with python version (since paths are fixed).
1520 with python version (since paths are fixed).
1515
1521
1516 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1522 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1517 which will become eventually obsolete. Also fixed the default
1523 which will become eventually obsolete. Also fixed the default
1518 prompt_in2 to use \D, so at least new users start with the correct
1524 prompt_in2 to use \D, so at least new users start with the correct
1519 defaults.
1525 defaults.
1520 WARNING: Users with existing ipythonrc files will need to apply
1526 WARNING: Users with existing ipythonrc files will need to apply
1521 this fix manually!
1527 this fix manually!
1522
1528
1523 * setup.py: make windows installer (.exe). This is finally the
1529 * setup.py: make windows installer (.exe). This is finally the
1524 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1530 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1525 which I hadn't included because it required Python 2.3 (or recent
1531 which I hadn't included because it required Python 2.3 (or recent
1526 distutils).
1532 distutils).
1527
1533
1528 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1534 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1529 usage of new '\D' escape.
1535 usage of new '\D' escape.
1530
1536
1531 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1537 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1532 lacks os.getuid())
1538 lacks os.getuid())
1533 (CachedOutput.set_colors): Added the ability to turn coloring
1539 (CachedOutput.set_colors): Added the ability to turn coloring
1534 on/off with @colors even for manually defined prompt colors. It
1540 on/off with @colors even for manually defined prompt colors. It
1535 uses a nasty global, but it works safely and via the generic color
1541 uses a nasty global, but it works safely and via the generic color
1536 handling mechanism.
1542 handling mechanism.
1537 (Prompt2.__init__): Introduced new escape '\D' for continuation
1543 (Prompt2.__init__): Introduced new escape '\D' for continuation
1538 prompts. It represents the counter ('\#') as dots.
1544 prompts. It represents the counter ('\#') as dots.
1539 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1545 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1540 need to update their ipythonrc files and replace '%n' with '\D' in
1546 need to update their ipythonrc files and replace '%n' with '\D' in
1541 their prompt_in2 settings everywhere. Sorry, but there's
1547 their prompt_in2 settings everywhere. Sorry, but there's
1542 otherwise no clean way to get all prompts to properly align. The
1548 otherwise no clean way to get all prompts to properly align. The
1543 ipythonrc shipped with IPython has been updated.
1549 ipythonrc shipped with IPython has been updated.
1544
1550
1545 2004-06-07 Fernando Perez <fperez@colorado.edu>
1551 2004-06-07 Fernando Perez <fperez@colorado.edu>
1546
1552
1547 * setup.py (isfile): Pass local_icons option to latex2html, so the
1553 * setup.py (isfile): Pass local_icons option to latex2html, so the
1548 resulting HTML file is self-contained. Thanks to
1554 resulting HTML file is self-contained. Thanks to
1549 dryice-AT-liu.com.cn for the tip.
1555 dryice-AT-liu.com.cn for the tip.
1550
1556
1551 * pysh.py: I created a new profile 'shell', which implements a
1557 * pysh.py: I created a new profile 'shell', which implements a
1552 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1558 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1553 system shell, nor will it become one anytime soon. It's mainly
1559 system shell, nor will it become one anytime soon. It's mainly
1554 meant to illustrate the use of the new flexible bash-like prompts.
1560 meant to illustrate the use of the new flexible bash-like prompts.
1555 I guess it could be used by hardy souls for true shell management,
1561 I guess it could be used by hardy souls for true shell management,
1556 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
1562 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
1557 profile. This uses the InterpreterExec extension provided by
1563 profile. This uses the InterpreterExec extension provided by
1558 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
1564 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
1559
1565
1560 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
1566 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
1561 auto-align itself with the length of the previous input prompt
1567 auto-align itself with the length of the previous input prompt
1562 (taking into account the invisible color escapes).
1568 (taking into account the invisible color escapes).
1563 (CachedOutput.__init__): Large restructuring of this class. Now
1569 (CachedOutput.__init__): Large restructuring of this class. Now
1564 all three prompts (primary1, primary2, output) are proper objects,
1570 all three prompts (primary1, primary2, output) are proper objects,
1565 managed by the 'parent' CachedOutput class. The code is still a
1571 managed by the 'parent' CachedOutput class. The code is still a
1566 bit hackish (all prompts share state via a pointer to the cache),
1572 bit hackish (all prompts share state via a pointer to the cache),
1567 but it's overall far cleaner than before.
1573 but it's overall far cleaner than before.
1568
1574
1569 * IPython/genutils.py (getoutputerror): modified to add verbose,
1575 * IPython/genutils.py (getoutputerror): modified to add verbose,
1570 debug and header options. This makes the interface of all getout*
1576 debug and header options. This makes the interface of all getout*
1571 functions uniform.
1577 functions uniform.
1572 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
1578 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
1573
1579
1574 * IPython/Magic.py (Magic.default_option): added a function to
1580 * IPython/Magic.py (Magic.default_option): added a function to
1575 allow registering default options for any magic command. This
1581 allow registering default options for any magic command. This
1576 makes it easy to have profiles which customize the magics globally
1582 makes it easy to have profiles which customize the magics globally
1577 for a certain use. The values set through this function are
1583 for a certain use. The values set through this function are
1578 picked up by the parse_options() method, which all magics should
1584 picked up by the parse_options() method, which all magics should
1579 use to parse their options.
1585 use to parse their options.
1580
1586
1581 * IPython/genutils.py (warn): modified the warnings framework to
1587 * IPython/genutils.py (warn): modified the warnings framework to
1582 use the Term I/O class. I'm trying to slowly unify all of
1588 use the Term I/O class. I'm trying to slowly unify all of
1583 IPython's I/O operations to pass through Term.
1589 IPython's I/O operations to pass through Term.
1584
1590
1585 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
1591 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
1586 the secondary prompt to correctly match the length of the primary
1592 the secondary prompt to correctly match the length of the primary
1587 one for any prompt. Now multi-line code will properly line up
1593 one for any prompt. Now multi-line code will properly line up
1588 even for path dependent prompts, such as the new ones available
1594 even for path dependent prompts, such as the new ones available
1589 via the prompt_specials.
1595 via the prompt_specials.
1590
1596
1591 2004-06-06 Fernando Perez <fperez@colorado.edu>
1597 2004-06-06 Fernando Perez <fperez@colorado.edu>
1592
1598
1593 * IPython/Prompts.py (prompt_specials): Added the ability to have
1599 * IPython/Prompts.py (prompt_specials): Added the ability to have
1594 bash-like special sequences in the prompts, which get
1600 bash-like special sequences in the prompts, which get
1595 automatically expanded. Things like hostname, current working
1601 automatically expanded. Things like hostname, current working
1596 directory and username are implemented already, but it's easy to
1602 directory and username are implemented already, but it's easy to
1597 add more in the future. Thanks to a patch by W.J. van der Laan
1603 add more in the future. Thanks to a patch by W.J. van der Laan
1598 <gnufnork-AT-hetdigitalegat.nl>
1604 <gnufnork-AT-hetdigitalegat.nl>
1599 (prompt_specials): Added color support for prompt strings, so
1605 (prompt_specials): Added color support for prompt strings, so
1600 users can define arbitrary color setups for their prompts.
1606 users can define arbitrary color setups for their prompts.
1601
1607
1602 2004-06-05 Fernando Perez <fperez@colorado.edu>
1608 2004-06-05 Fernando Perez <fperez@colorado.edu>
1603
1609
1604 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
1610 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
1605 code to load Gary Bishop's readline and configure it
1611 code to load Gary Bishop's readline and configure it
1606 automatically. Thanks to Gary for help on this.
1612 automatically. Thanks to Gary for help on this.
1607
1613
1608 2004-06-01 Fernando Perez <fperez@colorado.edu>
1614 2004-06-01 Fernando Perez <fperez@colorado.edu>
1609
1615
1610 * IPython/Logger.py (Logger.create_log): fix bug for logging
1616 * IPython/Logger.py (Logger.create_log): fix bug for logging
1611 with no filename (previous fix was incomplete).
1617 with no filename (previous fix was incomplete).
1612
1618
1613 2004-05-25 Fernando Perez <fperez@colorado.edu>
1619 2004-05-25 Fernando Perez <fperez@colorado.edu>
1614
1620
1615 * IPython/Magic.py (Magic.parse_options): fix bug where naked
1621 * IPython/Magic.py (Magic.parse_options): fix bug where naked
1616 parens would get passed to the shell.
1622 parens would get passed to the shell.
1617
1623
1618 2004-05-20 Fernando Perez <fperez@colorado.edu>
1624 2004-05-20 Fernando Perez <fperez@colorado.edu>
1619
1625
1620 * IPython/Magic.py (Magic.magic_prun): changed default profile
1626 * IPython/Magic.py (Magic.magic_prun): changed default profile
1621 sort order to 'time' (the more common profiling need).
1627 sort order to 'time' (the more common profiling need).
1622
1628
1623 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
1629 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
1624 so that source code shown is guaranteed in sync with the file on
1630 so that source code shown is guaranteed in sync with the file on
1625 disk (also changed in psource). Similar fix to the one for
1631 disk (also changed in psource). Similar fix to the one for
1626 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
1632 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
1627 <yann.ledu-AT-noos.fr>.
1633 <yann.ledu-AT-noos.fr>.
1628
1634
1629 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
1635 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
1630 with a single option would not be correctly parsed. Closes
1636 with a single option would not be correctly parsed. Closes
1631 http://www.scipy.net/roundup/ipython/issue14. This bug had been
1637 http://www.scipy.net/roundup/ipython/issue14. This bug had been
1632 introduced in 0.6.0 (on 2004-05-06).
1638 introduced in 0.6.0 (on 2004-05-06).
1633
1639
1634 2004-05-13 *** Released version 0.6.0
1640 2004-05-13 *** Released version 0.6.0
1635
1641
1636 2004-05-13 Fernando Perez <fperez@colorado.edu>
1642 2004-05-13 Fernando Perez <fperez@colorado.edu>
1637
1643
1638 * debian/: Added debian/ directory to CVS, so that debian support
1644 * debian/: Added debian/ directory to CVS, so that debian support
1639 is publicly accessible. The debian package is maintained by Jack
1645 is publicly accessible. The debian package is maintained by Jack
1640 Moffit <jack-AT-xiph.org>.
1646 Moffit <jack-AT-xiph.org>.
1641
1647
1642 * Documentation: included the notes about an ipython-based system
1648 * Documentation: included the notes about an ipython-based system
1643 shell (the hypothetical 'pysh') into the new_design.pdf document,
1649 shell (the hypothetical 'pysh') into the new_design.pdf document,
1644 so that these ideas get distributed to users along with the
1650 so that these ideas get distributed to users along with the
1645 official documentation.
1651 official documentation.
1646
1652
1647 2004-05-10 Fernando Perez <fperez@colorado.edu>
1653 2004-05-10 Fernando Perez <fperez@colorado.edu>
1648
1654
1649 * IPython/Logger.py (Logger.create_log): fix recently introduced
1655 * IPython/Logger.py (Logger.create_log): fix recently introduced
1650 bug (misindented line) where logstart would fail when not given an
1656 bug (misindented line) where logstart would fail when not given an
1651 explicit filename.
1657 explicit filename.
1652
1658
1653 2004-05-09 Fernando Perez <fperez@colorado.edu>
1659 2004-05-09 Fernando Perez <fperez@colorado.edu>
1654
1660
1655 * IPython/Magic.py (Magic.parse_options): skip system call when
1661 * IPython/Magic.py (Magic.parse_options): skip system call when
1656 there are no options to look for. Faster, cleaner for the common
1662 there are no options to look for. Faster, cleaner for the common
1657 case.
1663 case.
1658
1664
1659 * Documentation: many updates to the manual: describing Windows
1665 * Documentation: many updates to the manual: describing Windows
1660 support better, Gnuplot updates, credits, misc small stuff. Also
1666 support better, Gnuplot updates, credits, misc small stuff. Also
1661 updated the new_design doc a bit.
1667 updated the new_design doc a bit.
1662
1668
1663 2004-05-06 *** Released version 0.6.0.rc1
1669 2004-05-06 *** Released version 0.6.0.rc1
1664
1670
1665 2004-05-06 Fernando Perez <fperez@colorado.edu>
1671 2004-05-06 Fernando Perez <fperez@colorado.edu>
1666
1672
1667 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
1673 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
1668 operations to use the vastly more efficient list/''.join() method.
1674 operations to use the vastly more efficient list/''.join() method.
1669 (FormattedTB.text): Fix
1675 (FormattedTB.text): Fix
1670 http://www.scipy.net/roundup/ipython/issue12 - exception source
1676 http://www.scipy.net/roundup/ipython/issue12 - exception source
1671 extract not updated after reload. Thanks to Mike Salib
1677 extract not updated after reload. Thanks to Mike Salib
1672 <msalib-AT-mit.edu> for pinning the source of the problem.
1678 <msalib-AT-mit.edu> for pinning the source of the problem.
1673 Fortunately, the solution works inside ipython and doesn't require
1679 Fortunately, the solution works inside ipython and doesn't require
1674 any changes to python proper.
1680 any changes to python proper.
1675
1681
1676 * IPython/Magic.py (Magic.parse_options): Improved to process the
1682 * IPython/Magic.py (Magic.parse_options): Improved to process the
1677 argument list as a true shell would (by actually using the
1683 argument list as a true shell would (by actually using the
1678 underlying system shell). This way, all @magics automatically get
1684 underlying system shell). This way, all @magics automatically get
1679 shell expansion for variables. Thanks to a comment by Alex
1685 shell expansion for variables. Thanks to a comment by Alex
1680 Schmolck.
1686 Schmolck.
1681
1687
1682 2004-04-04 Fernando Perez <fperez@colorado.edu>
1688 2004-04-04 Fernando Perez <fperez@colorado.edu>
1683
1689
1684 * IPython/iplib.py (InteractiveShell.interact): Added a special
1690 * IPython/iplib.py (InteractiveShell.interact): Added a special
1685 trap for a debugger quit exception, which is basically impossible
1691 trap for a debugger quit exception, which is basically impossible
1686 to handle by normal mechanisms, given what pdb does to the stack.
1692 to handle by normal mechanisms, given what pdb does to the stack.
1687 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
1693 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
1688
1694
1689 2004-04-03 Fernando Perez <fperez@colorado.edu>
1695 2004-04-03 Fernando Perez <fperez@colorado.edu>
1690
1696
1691 * IPython/genutils.py (Term): Standardized the names of the Term
1697 * IPython/genutils.py (Term): Standardized the names of the Term
1692 class streams to cin/cout/cerr, following C++ naming conventions
1698 class streams to cin/cout/cerr, following C++ naming conventions
1693 (I can't use in/out/err because 'in' is not a valid attribute
1699 (I can't use in/out/err because 'in' is not a valid attribute
1694 name).
1700 name).
1695
1701
1696 * IPython/iplib.py (InteractiveShell.interact): don't increment
1702 * IPython/iplib.py (InteractiveShell.interact): don't increment
1697 the prompt if there's no user input. By Daniel 'Dang' Griffith
1703 the prompt if there's no user input. By Daniel 'Dang' Griffith
1698 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
1704 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
1699 Francois Pinard.
1705 Francois Pinard.
1700
1706
1701 2004-04-02 Fernando Perez <fperez@colorado.edu>
1707 2004-04-02 Fernando Perez <fperez@colorado.edu>
1702
1708
1703 * IPython/genutils.py (Stream.__init__): Modified to survive at
1709 * IPython/genutils.py (Stream.__init__): Modified to survive at
1704 least importing in contexts where stdin/out/err aren't true file
1710 least importing in contexts where stdin/out/err aren't true file
1705 objects, such as PyCrust (they lack fileno() and mode). However,
1711 objects, such as PyCrust (they lack fileno() and mode). However,
1706 the recovery facilities which rely on these things existing will
1712 the recovery facilities which rely on these things existing will
1707 not work.
1713 not work.
1708
1714
1709 2004-04-01 Fernando Perez <fperez@colorado.edu>
1715 2004-04-01 Fernando Perez <fperez@colorado.edu>
1710
1716
1711 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
1717 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
1712 use the new getoutputerror() function, so it properly
1718 use the new getoutputerror() function, so it properly
1713 distinguishes stdout/err.
1719 distinguishes stdout/err.
1714
1720
1715 * IPython/genutils.py (getoutputerror): added a function to
1721 * IPython/genutils.py (getoutputerror): added a function to
1716 capture separately the standard output and error of a command.
1722 capture separately the standard output and error of a command.
1717 After a comment from dang on the mailing lists. This code is
1723 After a comment from dang on the mailing lists. This code is
1718 basically a modified version of commands.getstatusoutput(), from
1724 basically a modified version of commands.getstatusoutput(), from
1719 the standard library.
1725 the standard library.
1720
1726
1721 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
1727 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
1722 '!!' as a special syntax (shorthand) to access @sx.
1728 '!!' as a special syntax (shorthand) to access @sx.
1723
1729
1724 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
1730 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
1725 command and return its output as a list split on '\n'.
1731 command and return its output as a list split on '\n'.
1726
1732
1727 2004-03-31 Fernando Perez <fperez@colorado.edu>
1733 2004-03-31 Fernando Perez <fperez@colorado.edu>
1728
1734
1729 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
1735 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
1730 method to dictionaries used as FakeModule instances if they lack
1736 method to dictionaries used as FakeModule instances if they lack
1731 it. At least pydoc in python2.3 breaks for runtime-defined
1737 it. At least pydoc in python2.3 breaks for runtime-defined
1732 functions without this hack. At some point I need to _really_
1738 functions without this hack. At some point I need to _really_
1733 understand what FakeModule is doing, because it's a gross hack.
1739 understand what FakeModule is doing, because it's a gross hack.
1734 But it solves Arnd's problem for now...
1740 But it solves Arnd's problem for now...
1735
1741
1736 2004-02-27 Fernando Perez <fperez@colorado.edu>
1742 2004-02-27 Fernando Perez <fperez@colorado.edu>
1737
1743
1738 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
1744 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
1739 mode would behave erratically. Also increased the number of
1745 mode would behave erratically. Also increased the number of
1740 possible logs in rotate mod to 999. Thanks to Rod Holland
1746 possible logs in rotate mod to 999. Thanks to Rod Holland
1741 <rhh@StructureLABS.com> for the report and fixes.
1747 <rhh@StructureLABS.com> for the report and fixes.
1742
1748
1743 2004-02-26 Fernando Perez <fperez@colorado.edu>
1749 2004-02-26 Fernando Perez <fperez@colorado.edu>
1744
1750
1745 * IPython/genutils.py (page): Check that the curses module really
1751 * IPython/genutils.py (page): Check that the curses module really
1746 has the initscr attribute before trying to use it. For some
1752 has the initscr attribute before trying to use it. For some
1747 reason, the Solaris curses module is missing this. I think this
1753 reason, the Solaris curses module is missing this. I think this
1748 should be considered a Solaris python bug, but I'm not sure.
1754 should be considered a Solaris python bug, but I'm not sure.
1749
1755
1750 2004-01-17 Fernando Perez <fperez@colorado.edu>
1756 2004-01-17 Fernando Perez <fperez@colorado.edu>
1751
1757
1752 * IPython/genutils.py (Stream.__init__): Changes to try to make
1758 * IPython/genutils.py (Stream.__init__): Changes to try to make
1753 ipython robust against stdin/out/err being closed by the user.
1759 ipython robust against stdin/out/err being closed by the user.
1754 This is 'user error' (and blocks a normal python session, at least
1760 This is 'user error' (and blocks a normal python session, at least
1755 the stdout case). However, Ipython should be able to survive such
1761 the stdout case). However, Ipython should be able to survive such
1756 instances of abuse as gracefully as possible. To simplify the
1762 instances of abuse as gracefully as possible. To simplify the
1757 coding and maintain compatibility with Gary Bishop's Term
1763 coding and maintain compatibility with Gary Bishop's Term
1758 contributions, I've made use of classmethods for this. I think
1764 contributions, I've made use of classmethods for this. I think
1759 this introduces a dependency on python 2.2.
1765 this introduces a dependency on python 2.2.
1760
1766
1761 2004-01-13 Fernando Perez <fperez@colorado.edu>
1767 2004-01-13 Fernando Perez <fperez@colorado.edu>
1762
1768
1763 * IPython/numutils.py (exp_safe): simplified the code a bit and
1769 * IPython/numutils.py (exp_safe): simplified the code a bit and
1764 removed the need for importing the kinds module altogether.
1770 removed the need for importing the kinds module altogether.
1765
1771
1766 2004-01-06 Fernando Perez <fperez@colorado.edu>
1772 2004-01-06 Fernando Perez <fperez@colorado.edu>
1767
1773
1768 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
1774 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
1769 a magic function instead, after some community feedback. No
1775 a magic function instead, after some community feedback. No
1770 special syntax will exist for it, but its name is deliberately
1776 special syntax will exist for it, but its name is deliberately
1771 very short.
1777 very short.
1772
1778
1773 2003-12-20 Fernando Perez <fperez@colorado.edu>
1779 2003-12-20 Fernando Perez <fperez@colorado.edu>
1774
1780
1775 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
1781 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
1776 new functionality, to automagically assign the result of a shell
1782 new functionality, to automagically assign the result of a shell
1777 command to a variable. I'll solicit some community feedback on
1783 command to a variable. I'll solicit some community feedback on
1778 this before making it permanent.
1784 this before making it permanent.
1779
1785
1780 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
1786 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
1781 requested about callables for which inspect couldn't obtain a
1787 requested about callables for which inspect couldn't obtain a
1782 proper argspec. Thanks to a crash report sent by Etienne
1788 proper argspec. Thanks to a crash report sent by Etienne
1783 Posthumus <etienne-AT-apple01.cs.vu.nl>.
1789 Posthumus <etienne-AT-apple01.cs.vu.nl>.
1784
1790
1785 2003-12-09 Fernando Perez <fperez@colorado.edu>
1791 2003-12-09 Fernando Perez <fperez@colorado.edu>
1786
1792
1787 * IPython/genutils.py (page): patch for the pager to work across
1793 * IPython/genutils.py (page): patch for the pager to work across
1788 various versions of Windows. By Gary Bishop.
1794 various versions of Windows. By Gary Bishop.
1789
1795
1790 2003-12-04 Fernando Perez <fperez@colorado.edu>
1796 2003-12-04 Fernando Perez <fperez@colorado.edu>
1791
1797
1792 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
1798 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
1793 Gnuplot.py version 1.7, whose internal names changed quite a bit.
1799 Gnuplot.py version 1.7, whose internal names changed quite a bit.
1794 While I tested this and it looks ok, there may still be corner
1800 While I tested this and it looks ok, there may still be corner
1795 cases I've missed.
1801 cases I've missed.
1796
1802
1797 2003-12-01 Fernando Perez <fperez@colorado.edu>
1803 2003-12-01 Fernando Perez <fperez@colorado.edu>
1798
1804
1799 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
1805 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
1800 where a line like 'p,q=1,2' would fail because the automagic
1806 where a line like 'p,q=1,2' would fail because the automagic
1801 system would be triggered for @p.
1807 system would be triggered for @p.
1802
1808
1803 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
1809 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
1804 cleanups, code unmodified.
1810 cleanups, code unmodified.
1805
1811
1806 * IPython/genutils.py (Term): added a class for IPython to handle
1812 * IPython/genutils.py (Term): added a class for IPython to handle
1807 output. In most cases it will just be a proxy for stdout/err, but
1813 output. In most cases it will just be a proxy for stdout/err, but
1808 having this allows modifications to be made for some platforms,
1814 having this allows modifications to be made for some platforms,
1809 such as handling color escapes under Windows. All of this code
1815 such as handling color escapes under Windows. All of this code
1810 was contributed by Gary Bishop, with minor modifications by me.
1816 was contributed by Gary Bishop, with minor modifications by me.
1811 The actual changes affect many files.
1817 The actual changes affect many files.
1812
1818
1813 2003-11-30 Fernando Perez <fperez@colorado.edu>
1819 2003-11-30 Fernando Perez <fperez@colorado.edu>
1814
1820
1815 * IPython/iplib.py (file_matches): new completion code, courtesy
1821 * IPython/iplib.py (file_matches): new completion code, courtesy
1816 of Jeff Collins. This enables filename completion again under
1822 of Jeff Collins. This enables filename completion again under
1817 python 2.3, which disabled it at the C level.
1823 python 2.3, which disabled it at the C level.
1818
1824
1819 2003-11-11 Fernando Perez <fperez@colorado.edu>
1825 2003-11-11 Fernando Perez <fperez@colorado.edu>
1820
1826
1821 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
1827 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
1822 for Numeric.array(map(...)), but often convenient.
1828 for Numeric.array(map(...)), but often convenient.
1823
1829
1824 2003-11-05 Fernando Perez <fperez@colorado.edu>
1830 2003-11-05 Fernando Perez <fperez@colorado.edu>
1825
1831
1826 * IPython/numutils.py (frange): Changed a call from int() to
1832 * IPython/numutils.py (frange): Changed a call from int() to
1827 int(round()) to prevent a problem reported with arange() in the
1833 int(round()) to prevent a problem reported with arange() in the
1828 numpy list.
1834 numpy list.
1829
1835
1830 2003-10-06 Fernando Perez <fperez@colorado.edu>
1836 2003-10-06 Fernando Perez <fperez@colorado.edu>
1831
1837
1832 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
1838 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
1833 prevent crashes if sys lacks an argv attribute (it happens with
1839 prevent crashes if sys lacks an argv attribute (it happens with
1834 embedded interpreters which build a bare-bones sys module).
1840 embedded interpreters which build a bare-bones sys module).
1835 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
1841 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
1836
1842
1837 2003-09-24 Fernando Perez <fperez@colorado.edu>
1843 2003-09-24 Fernando Perez <fperez@colorado.edu>
1838
1844
1839 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
1845 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
1840 to protect against poorly written user objects where __getattr__
1846 to protect against poorly written user objects where __getattr__
1841 raises exceptions other than AttributeError. Thanks to a bug
1847 raises exceptions other than AttributeError. Thanks to a bug
1842 report by Oliver Sander <osander-AT-gmx.de>.
1848 report by Oliver Sander <osander-AT-gmx.de>.
1843
1849
1844 * IPython/FakeModule.py (FakeModule.__repr__): this method was
1850 * IPython/FakeModule.py (FakeModule.__repr__): this method was
1845 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
1851 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
1846
1852
1847 2003-09-09 Fernando Perez <fperez@colorado.edu>
1853 2003-09-09 Fernando Perez <fperez@colorado.edu>
1848
1854
1849 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1855 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1850 unpacking a list whith a callable as first element would
1856 unpacking a list whith a callable as first element would
1851 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
1857 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
1852 Collins.
1858 Collins.
1853
1859
1854 2003-08-25 *** Released version 0.5.0
1860 2003-08-25 *** Released version 0.5.0
1855
1861
1856 2003-08-22 Fernando Perez <fperez@colorado.edu>
1862 2003-08-22 Fernando Perez <fperez@colorado.edu>
1857
1863
1858 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
1864 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
1859 improperly defined user exceptions. Thanks to feedback from Mark
1865 improperly defined user exceptions. Thanks to feedback from Mark
1860 Russell <mrussell-AT-verio.net>.
1866 Russell <mrussell-AT-verio.net>.
1861
1867
1862 2003-08-20 Fernando Perez <fperez@colorado.edu>
1868 2003-08-20 Fernando Perez <fperez@colorado.edu>
1863
1869
1864 * IPython/OInspect.py (Inspector.pinfo): changed String Form
1870 * IPython/OInspect.py (Inspector.pinfo): changed String Form
1865 printing so that it would print multi-line string forms starting
1871 printing so that it would print multi-line string forms starting
1866 with a new line. This way the formatting is better respected for
1872 with a new line. This way the formatting is better respected for
1867 objects which work hard to make nice string forms.
1873 objects which work hard to make nice string forms.
1868
1874
1869 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
1875 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
1870 autocall would overtake data access for objects with both
1876 autocall would overtake data access for objects with both
1871 __getitem__ and __call__.
1877 __getitem__ and __call__.
1872
1878
1873 2003-08-19 *** Released version 0.5.0-rc1
1879 2003-08-19 *** Released version 0.5.0-rc1
1874
1880
1875 2003-08-19 Fernando Perez <fperez@colorado.edu>
1881 2003-08-19 Fernando Perez <fperez@colorado.edu>
1876
1882
1877 * IPython/deep_reload.py (load_tail): single tiny change here
1883 * IPython/deep_reload.py (load_tail): single tiny change here
1878 seems to fix the long-standing bug of dreload() failing to work
1884 seems to fix the long-standing bug of dreload() failing to work
1879 for dotted names. But this module is pretty tricky, so I may have
1885 for dotted names. But this module is pretty tricky, so I may have
1880 missed some subtlety. Needs more testing!.
1886 missed some subtlety. Needs more testing!.
1881
1887
1882 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
1888 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
1883 exceptions which have badly implemented __str__ methods.
1889 exceptions which have badly implemented __str__ methods.
1884 (VerboseTB.text): harden against inspect.getinnerframes crashing,
1890 (VerboseTB.text): harden against inspect.getinnerframes crashing,
1885 which I've been getting reports about from Python 2.3 users. I
1891 which I've been getting reports about from Python 2.3 users. I
1886 wish I had a simple test case to reproduce the problem, so I could
1892 wish I had a simple test case to reproduce the problem, so I could
1887 either write a cleaner workaround or file a bug report if
1893 either write a cleaner workaround or file a bug report if
1888 necessary.
1894 necessary.
1889
1895
1890 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
1896 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
1891 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
1897 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
1892 a bug report by Tjabo Kloppenburg.
1898 a bug report by Tjabo Kloppenburg.
1893
1899
1894 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
1900 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
1895 crashes. Wrapped the pdb call in a blanket try/except, since pdb
1901 crashes. Wrapped the pdb call in a blanket try/except, since pdb
1896 seems rather unstable. Thanks to a bug report by Tjabo
1902 seems rather unstable. Thanks to a bug report by Tjabo
1897 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
1903 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
1898
1904
1899 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
1905 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
1900 this out soon because of the critical fixes in the inner loop for
1906 this out soon because of the critical fixes in the inner loop for
1901 generators.
1907 generators.
1902
1908
1903 * IPython/Magic.py (Magic.getargspec): removed. This (and
1909 * IPython/Magic.py (Magic.getargspec): removed. This (and
1904 _get_def) have been obsoleted by OInspect for a long time, I
1910 _get_def) have been obsoleted by OInspect for a long time, I
1905 hadn't noticed that they were dead code.
1911 hadn't noticed that they were dead code.
1906 (Magic._ofind): restored _ofind functionality for a few literals
1912 (Magic._ofind): restored _ofind functionality for a few literals
1907 (those in ["''",'""','[]','{}','()']). But it won't work anymore
1913 (those in ["''",'""','[]','{}','()']). But it won't work anymore
1908 for things like "hello".capitalize?, since that would require a
1914 for things like "hello".capitalize?, since that would require a
1909 potentially dangerous eval() again.
1915 potentially dangerous eval() again.
1910
1916
1911 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
1917 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
1912 logic a bit more to clean up the escapes handling and minimize the
1918 logic a bit more to clean up the escapes handling and minimize the
1913 use of _ofind to only necessary cases. The interactive 'feel' of
1919 use of _ofind to only necessary cases. The interactive 'feel' of
1914 IPython should have improved quite a bit with the changes in
1920 IPython should have improved quite a bit with the changes in
1915 _prefilter and _ofind (besides being far safer than before).
1921 _prefilter and _ofind (besides being far safer than before).
1916
1922
1917 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
1923 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
1918 obscure, never reported). Edit would fail to find the object to
1924 obscure, never reported). Edit would fail to find the object to
1919 edit under some circumstances.
1925 edit under some circumstances.
1920 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
1926 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
1921 which were causing double-calling of generators. Those eval calls
1927 which were causing double-calling of generators. Those eval calls
1922 were _very_ dangerous, since code with side effects could be
1928 were _very_ dangerous, since code with side effects could be
1923 triggered. As they say, 'eval is evil'... These were the
1929 triggered. As they say, 'eval is evil'... These were the
1924 nastiest evals in IPython. Besides, _ofind is now far simpler,
1930 nastiest evals in IPython. Besides, _ofind is now far simpler,
1925 and it should also be quite a bit faster. Its use of inspect is
1931 and it should also be quite a bit faster. Its use of inspect is
1926 also safer, so perhaps some of the inspect-related crashes I've
1932 also safer, so perhaps some of the inspect-related crashes I've
1927 seen lately with Python 2.3 might be taken care of. That will
1933 seen lately with Python 2.3 might be taken care of. That will
1928 need more testing.
1934 need more testing.
1929
1935
1930 2003-08-17 Fernando Perez <fperez@colorado.edu>
1936 2003-08-17 Fernando Perez <fperez@colorado.edu>
1931
1937
1932 * IPython/iplib.py (InteractiveShell._prefilter): significant
1938 * IPython/iplib.py (InteractiveShell._prefilter): significant
1933 simplifications to the logic for handling user escapes. Faster
1939 simplifications to the logic for handling user escapes. Faster
1934 and simpler code.
1940 and simpler code.
1935
1941
1936 2003-08-14 Fernando Perez <fperez@colorado.edu>
1942 2003-08-14 Fernando Perez <fperez@colorado.edu>
1937
1943
1938 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
1944 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
1939 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
1945 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
1940 but it should be quite a bit faster. And the recursive version
1946 but it should be quite a bit faster. And the recursive version
1941 generated O(log N) intermediate storage for all rank>1 arrays,
1947 generated O(log N) intermediate storage for all rank>1 arrays,
1942 even if they were contiguous.
1948 even if they were contiguous.
1943 (l1norm): Added this function.
1949 (l1norm): Added this function.
1944 (norm): Added this function for arbitrary norms (including
1950 (norm): Added this function for arbitrary norms (including
1945 l-infinity). l1 and l2 are still special cases for convenience
1951 l-infinity). l1 and l2 are still special cases for convenience
1946 and speed.
1952 and speed.
1947
1953
1948 2003-08-03 Fernando Perez <fperez@colorado.edu>
1954 2003-08-03 Fernando Perez <fperez@colorado.edu>
1949
1955
1950 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
1956 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
1951 exceptions, which now raise PendingDeprecationWarnings in Python
1957 exceptions, which now raise PendingDeprecationWarnings in Python
1952 2.3. There were some in Magic and some in Gnuplot2.
1958 2.3. There were some in Magic and some in Gnuplot2.
1953
1959
1954 2003-06-30 Fernando Perez <fperez@colorado.edu>
1960 2003-06-30 Fernando Perez <fperez@colorado.edu>
1955
1961
1956 * IPython/genutils.py (page): modified to call curses only for
1962 * IPython/genutils.py (page): modified to call curses only for
1957 terminals where TERM=='xterm'. After problems under many other
1963 terminals where TERM=='xterm'. After problems under many other
1958 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
1964 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
1959
1965
1960 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
1966 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
1961 would be triggered when readline was absent. This was just an old
1967 would be triggered when readline was absent. This was just an old
1962 debugging statement I'd forgotten to take out.
1968 debugging statement I'd forgotten to take out.
1963
1969
1964 2003-06-20 Fernando Perez <fperez@colorado.edu>
1970 2003-06-20 Fernando Perez <fperez@colorado.edu>
1965
1971
1966 * IPython/genutils.py (clock): modified to return only user time
1972 * IPython/genutils.py (clock): modified to return only user time
1967 (not counting system time), after a discussion on scipy. While
1973 (not counting system time), after a discussion on scipy. While
1968 system time may be a useful quantity occasionally, it may much
1974 system time may be a useful quantity occasionally, it may much
1969 more easily be skewed by occasional swapping or other similar
1975 more easily be skewed by occasional swapping or other similar
1970 activity.
1976 activity.
1971
1977
1972 2003-06-05 Fernando Perez <fperez@colorado.edu>
1978 2003-06-05 Fernando Perez <fperez@colorado.edu>
1973
1979
1974 * IPython/numutils.py (identity): new function, for building
1980 * IPython/numutils.py (identity): new function, for building
1975 arbitrary rank Kronecker deltas (mostly backwards compatible with
1981 arbitrary rank Kronecker deltas (mostly backwards compatible with
1976 Numeric.identity)
1982 Numeric.identity)
1977
1983
1978 2003-06-03 Fernando Perez <fperez@colorado.edu>
1984 2003-06-03 Fernando Perez <fperez@colorado.edu>
1979
1985
1980 * IPython/iplib.py (InteractiveShell.handle_magic): protect
1986 * IPython/iplib.py (InteractiveShell.handle_magic): protect
1981 arguments passed to magics with spaces, to allow trailing '\' to
1987 arguments passed to magics with spaces, to allow trailing '\' to
1982 work normally (mainly for Windows users).
1988 work normally (mainly for Windows users).
1983
1989
1984 2003-05-29 Fernando Perez <fperez@colorado.edu>
1990 2003-05-29 Fernando Perez <fperez@colorado.edu>
1985
1991
1986 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
1992 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
1987 instead of pydoc.help. This fixes a bizarre behavior where
1993 instead of pydoc.help. This fixes a bizarre behavior where
1988 printing '%s' % locals() would trigger the help system. Now
1994 printing '%s' % locals() would trigger the help system. Now
1989 ipython behaves like normal python does.
1995 ipython behaves like normal python does.
1990
1996
1991 Note that if one does 'from pydoc import help', the bizarre
1997 Note that if one does 'from pydoc import help', the bizarre
1992 behavior returns, but this will also happen in normal python, so
1998 behavior returns, but this will also happen in normal python, so
1993 it's not an ipython bug anymore (it has to do with how pydoc.help
1999 it's not an ipython bug anymore (it has to do with how pydoc.help
1994 is implemented).
2000 is implemented).
1995
2001
1996 2003-05-22 Fernando Perez <fperez@colorado.edu>
2002 2003-05-22 Fernando Perez <fperez@colorado.edu>
1997
2003
1998 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2004 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
1999 return [] instead of None when nothing matches, also match to end
2005 return [] instead of None when nothing matches, also match to end
2000 of line. Patch by Gary Bishop.
2006 of line. Patch by Gary Bishop.
2001
2007
2002 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2008 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2003 protection as before, for files passed on the command line. This
2009 protection as before, for files passed on the command line. This
2004 prevents the CrashHandler from kicking in if user files call into
2010 prevents the CrashHandler from kicking in if user files call into
2005 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2011 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2006 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2012 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2007
2013
2008 2003-05-20 *** Released version 0.4.0
2014 2003-05-20 *** Released version 0.4.0
2009
2015
2010 2003-05-20 Fernando Perez <fperez@colorado.edu>
2016 2003-05-20 Fernando Perez <fperez@colorado.edu>
2011
2017
2012 * setup.py: added support for manpages. It's a bit hackish b/c of
2018 * setup.py: added support for manpages. It's a bit hackish b/c of
2013 a bug in the way the bdist_rpm distutils target handles gzipped
2019 a bug in the way the bdist_rpm distutils target handles gzipped
2014 manpages, but it works. After a patch by Jack.
2020 manpages, but it works. After a patch by Jack.
2015
2021
2016 2003-05-19 Fernando Perez <fperez@colorado.edu>
2022 2003-05-19 Fernando Perez <fperez@colorado.edu>
2017
2023
2018 * IPython/numutils.py: added a mockup of the kinds module, since
2024 * IPython/numutils.py: added a mockup of the kinds module, since
2019 it was recently removed from Numeric. This way, numutils will
2025 it was recently removed from Numeric. This way, numutils will
2020 work for all users even if they are missing kinds.
2026 work for all users even if they are missing kinds.
2021
2027
2022 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2028 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2023 failure, which can occur with SWIG-wrapped extensions. After a
2029 failure, which can occur with SWIG-wrapped extensions. After a
2024 crash report from Prabhu.
2030 crash report from Prabhu.
2025
2031
2026 2003-05-16 Fernando Perez <fperez@colorado.edu>
2032 2003-05-16 Fernando Perez <fperez@colorado.edu>
2027
2033
2028 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2034 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2029 protect ipython from user code which may call directly
2035 protect ipython from user code which may call directly
2030 sys.excepthook (this looks like an ipython crash to the user, even
2036 sys.excepthook (this looks like an ipython crash to the user, even
2031 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2037 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2032 This is especially important to help users of WxWindows, but may
2038 This is especially important to help users of WxWindows, but may
2033 also be useful in other cases.
2039 also be useful in other cases.
2034
2040
2035 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2041 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2036 an optional tb_offset to be specified, and to preserve exception
2042 an optional tb_offset to be specified, and to preserve exception
2037 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2043 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2038
2044
2039 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2045 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2040
2046
2041 2003-05-15 Fernando Perez <fperez@colorado.edu>
2047 2003-05-15 Fernando Perez <fperez@colorado.edu>
2042
2048
2043 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2049 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2044 installing for a new user under Windows.
2050 installing for a new user under Windows.
2045
2051
2046 2003-05-12 Fernando Perez <fperez@colorado.edu>
2052 2003-05-12 Fernando Perez <fperez@colorado.edu>
2047
2053
2048 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2054 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2049 handler for Emacs comint-based lines. Currently it doesn't do
2055 handler for Emacs comint-based lines. Currently it doesn't do
2050 much (but importantly, it doesn't update the history cache). In
2056 much (but importantly, it doesn't update the history cache). In
2051 the future it may be expanded if Alex needs more functionality
2057 the future it may be expanded if Alex needs more functionality
2052 there.
2058 there.
2053
2059
2054 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2060 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2055 info to crash reports.
2061 info to crash reports.
2056
2062
2057 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2063 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2058 just like Python's -c. Also fixed crash with invalid -color
2064 just like Python's -c. Also fixed crash with invalid -color
2059 option value at startup. Thanks to Will French
2065 option value at startup. Thanks to Will French
2060 <wfrench-AT-bestweb.net> for the bug report.
2066 <wfrench-AT-bestweb.net> for the bug report.
2061
2067
2062 2003-05-09 Fernando Perez <fperez@colorado.edu>
2068 2003-05-09 Fernando Perez <fperez@colorado.edu>
2063
2069
2064 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2070 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2065 to EvalDict (it's a mapping, after all) and simplified its code
2071 to EvalDict (it's a mapping, after all) and simplified its code
2066 quite a bit, after a nice discussion on c.l.py where Gustavo
2072 quite a bit, after a nice discussion on c.l.py where Gustavo
2067 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
2073 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
2068
2074
2069 2003-04-30 Fernando Perez <fperez@colorado.edu>
2075 2003-04-30 Fernando Perez <fperez@colorado.edu>
2070
2076
2071 * IPython/genutils.py (timings_out): modified it to reduce its
2077 * IPython/genutils.py (timings_out): modified it to reduce its
2072 overhead in the common reps==1 case.
2078 overhead in the common reps==1 case.
2073
2079
2074 2003-04-29 Fernando Perez <fperez@colorado.edu>
2080 2003-04-29 Fernando Perez <fperez@colorado.edu>
2075
2081
2076 * IPython/genutils.py (timings_out): Modified to use the resource
2082 * IPython/genutils.py (timings_out): Modified to use the resource
2077 module, which avoids the wraparound problems of time.clock().
2083 module, which avoids the wraparound problems of time.clock().
2078
2084
2079 2003-04-17 *** Released version 0.2.15pre4
2085 2003-04-17 *** Released version 0.2.15pre4
2080
2086
2081 2003-04-17 Fernando Perez <fperez@colorado.edu>
2087 2003-04-17 Fernando Perez <fperez@colorado.edu>
2082
2088
2083 * setup.py (scriptfiles): Split windows-specific stuff over to a
2089 * setup.py (scriptfiles): Split windows-specific stuff over to a
2084 separate file, in an attempt to have a Windows GUI installer.
2090 separate file, in an attempt to have a Windows GUI installer.
2085 That didn't work, but part of the groundwork is done.
2091 That didn't work, but part of the groundwork is done.
2086
2092
2087 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2093 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2088 indent/unindent with 4 spaces. Particularly useful in combination
2094 indent/unindent with 4 spaces. Particularly useful in combination
2089 with the new auto-indent option.
2095 with the new auto-indent option.
2090
2096
2091 2003-04-16 Fernando Perez <fperez@colorado.edu>
2097 2003-04-16 Fernando Perez <fperez@colorado.edu>
2092
2098
2093 * IPython/Magic.py: various replacements of self.rc for
2099 * IPython/Magic.py: various replacements of self.rc for
2094 self.shell.rc. A lot more remains to be done to fully disentangle
2100 self.shell.rc. A lot more remains to be done to fully disentangle
2095 this class from the main Shell class.
2101 this class from the main Shell class.
2096
2102
2097 * IPython/GnuplotRuntime.py: added checks for mouse support so
2103 * IPython/GnuplotRuntime.py: added checks for mouse support so
2098 that we don't try to enable it if the current gnuplot doesn't
2104 that we don't try to enable it if the current gnuplot doesn't
2099 really support it. Also added checks so that we don't try to
2105 really support it. Also added checks so that we don't try to
2100 enable persist under Windows (where Gnuplot doesn't recognize the
2106 enable persist under Windows (where Gnuplot doesn't recognize the
2101 option).
2107 option).
2102
2108
2103 * IPython/iplib.py (InteractiveShell.interact): Added optional
2109 * IPython/iplib.py (InteractiveShell.interact): Added optional
2104 auto-indenting code, after a patch by King C. Shu
2110 auto-indenting code, after a patch by King C. Shu
2105 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2111 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2106 get along well with pasting indented code. If I ever figure out
2112 get along well with pasting indented code. If I ever figure out
2107 how to make that part go well, it will become on by default.
2113 how to make that part go well, it will become on by default.
2108
2114
2109 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2115 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2110 crash ipython if there was an unmatched '%' in the user's prompt
2116 crash ipython if there was an unmatched '%' in the user's prompt
2111 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2117 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2112
2118
2113 * IPython/iplib.py (InteractiveShell.interact): removed the
2119 * IPython/iplib.py (InteractiveShell.interact): removed the
2114 ability to ask the user whether he wants to crash or not at the
2120 ability to ask the user whether he wants to crash or not at the
2115 'last line' exception handler. Calling functions at that point
2121 'last line' exception handler. Calling functions at that point
2116 changes the stack, and the error reports would have incorrect
2122 changes the stack, and the error reports would have incorrect
2117 tracebacks.
2123 tracebacks.
2118
2124
2119 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2125 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2120 pass through a peger a pretty-printed form of any object. After a
2126 pass through a peger a pretty-printed form of any object. After a
2121 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2127 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2122
2128
2123 2003-04-14 Fernando Perez <fperez@colorado.edu>
2129 2003-04-14 Fernando Perez <fperez@colorado.edu>
2124
2130
2125 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2131 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2126 all files in ~ would be modified at first install (instead of
2132 all files in ~ would be modified at first install (instead of
2127 ~/.ipython). This could be potentially disastrous, as the
2133 ~/.ipython). This could be potentially disastrous, as the
2128 modification (make line-endings native) could damage binary files.
2134 modification (make line-endings native) could damage binary files.
2129
2135
2130 2003-04-10 Fernando Perez <fperez@colorado.edu>
2136 2003-04-10 Fernando Perez <fperez@colorado.edu>
2131
2137
2132 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2138 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2133 handle only lines which are invalid python. This now means that
2139 handle only lines which are invalid python. This now means that
2134 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2140 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2135 for the bug report.
2141 for the bug report.
2136
2142
2137 2003-04-01 Fernando Perez <fperez@colorado.edu>
2143 2003-04-01 Fernando Perez <fperez@colorado.edu>
2138
2144
2139 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2145 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2140 where failing to set sys.last_traceback would crash pdb.pm().
2146 where failing to set sys.last_traceback would crash pdb.pm().
2141 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2147 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2142 report.
2148 report.
2143
2149
2144 2003-03-25 Fernando Perez <fperez@colorado.edu>
2150 2003-03-25 Fernando Perez <fperez@colorado.edu>
2145
2151
2146 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2152 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2147 before printing it (it had a lot of spurious blank lines at the
2153 before printing it (it had a lot of spurious blank lines at the
2148 end).
2154 end).
2149
2155
2150 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2156 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2151 output would be sent 21 times! Obviously people don't use this
2157 output would be sent 21 times! Obviously people don't use this
2152 too often, or I would have heard about it.
2158 too often, or I would have heard about it.
2153
2159
2154 2003-03-24 Fernando Perez <fperez@colorado.edu>
2160 2003-03-24 Fernando Perez <fperez@colorado.edu>
2155
2161
2156 * setup.py (scriptfiles): renamed the data_files parameter from
2162 * setup.py (scriptfiles): renamed the data_files parameter from
2157 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2163 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2158 for the patch.
2164 for the patch.
2159
2165
2160 2003-03-20 Fernando Perez <fperez@colorado.edu>
2166 2003-03-20 Fernando Perez <fperez@colorado.edu>
2161
2167
2162 * IPython/genutils.py (error): added error() and fatal()
2168 * IPython/genutils.py (error): added error() and fatal()
2163 functions.
2169 functions.
2164
2170
2165 2003-03-18 *** Released version 0.2.15pre3
2171 2003-03-18 *** Released version 0.2.15pre3
2166
2172
2167 2003-03-18 Fernando Perez <fperez@colorado.edu>
2173 2003-03-18 Fernando Perez <fperez@colorado.edu>
2168
2174
2169 * setupext/install_data_ext.py
2175 * setupext/install_data_ext.py
2170 (install_data_ext.initialize_options): Class contributed by Jack
2176 (install_data_ext.initialize_options): Class contributed by Jack
2171 Moffit for fixing the old distutils hack. He is sending this to
2177 Moffit for fixing the old distutils hack. He is sending this to
2172 the distutils folks so in the future we may not need it as a
2178 the distutils folks so in the future we may not need it as a
2173 private fix.
2179 private fix.
2174
2180
2175 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2181 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2176 changes for Debian packaging. See his patch for full details.
2182 changes for Debian packaging. See his patch for full details.
2177 The old distutils hack of making the ipythonrc* files carry a
2183 The old distutils hack of making the ipythonrc* files carry a
2178 bogus .py extension is gone, at last. Examples were moved to a
2184 bogus .py extension is gone, at last. Examples were moved to a
2179 separate subdir under doc/, and the separate executable scripts
2185 separate subdir under doc/, and the separate executable scripts
2180 now live in their own directory. Overall a great cleanup. The
2186 now live in their own directory. Overall a great cleanup. The
2181 manual was updated to use the new files, and setup.py has been
2187 manual was updated to use the new files, and setup.py has been
2182 fixed for this setup.
2188 fixed for this setup.
2183
2189
2184 * IPython/PyColorize.py (Parser.usage): made non-executable and
2190 * IPython/PyColorize.py (Parser.usage): made non-executable and
2185 created a pycolor wrapper around it to be included as a script.
2191 created a pycolor wrapper around it to be included as a script.
2186
2192
2187 2003-03-12 *** Released version 0.2.15pre2
2193 2003-03-12 *** Released version 0.2.15pre2
2188
2194
2189 2003-03-12 Fernando Perez <fperez@colorado.edu>
2195 2003-03-12 Fernando Perez <fperez@colorado.edu>
2190
2196
2191 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2197 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2192 long-standing problem with garbage characters in some terminals.
2198 long-standing problem with garbage characters in some terminals.
2193 The issue was really that the \001 and \002 escapes must _only_ be
2199 The issue was really that the \001 and \002 escapes must _only_ be
2194 passed to input prompts (which call readline), but _never_ to
2200 passed to input prompts (which call readline), but _never_ to
2195 normal text to be printed on screen. I changed ColorANSI to have
2201 normal text to be printed on screen. I changed ColorANSI to have
2196 two classes: TermColors and InputTermColors, each with the
2202 two classes: TermColors and InputTermColors, each with the
2197 appropriate escapes for input prompts or normal text. The code in
2203 appropriate escapes for input prompts or normal text. The code in
2198 Prompts.py got slightly more complicated, but this very old and
2204 Prompts.py got slightly more complicated, but this very old and
2199 annoying bug is finally fixed.
2205 annoying bug is finally fixed.
2200
2206
2201 All the credit for nailing down the real origin of this problem
2207 All the credit for nailing down the real origin of this problem
2202 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2208 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2203 *Many* thanks to him for spending quite a bit of effort on this.
2209 *Many* thanks to him for spending quite a bit of effort on this.
2204
2210
2205 2003-03-05 *** Released version 0.2.15pre1
2211 2003-03-05 *** Released version 0.2.15pre1
2206
2212
2207 2003-03-03 Fernando Perez <fperez@colorado.edu>
2213 2003-03-03 Fernando Perez <fperez@colorado.edu>
2208
2214
2209 * IPython/FakeModule.py: Moved the former _FakeModule to a
2215 * IPython/FakeModule.py: Moved the former _FakeModule to a
2210 separate file, because it's also needed by Magic (to fix a similar
2216 separate file, because it's also needed by Magic (to fix a similar
2211 pickle-related issue in @run).
2217 pickle-related issue in @run).
2212
2218
2213 2003-03-02 Fernando Perez <fperez@colorado.edu>
2219 2003-03-02 Fernando Perez <fperez@colorado.edu>
2214
2220
2215 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2221 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2216 the autocall option at runtime.
2222 the autocall option at runtime.
2217 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2223 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2218 across Magic.py to start separating Magic from InteractiveShell.
2224 across Magic.py to start separating Magic from InteractiveShell.
2219 (Magic._ofind): Fixed to return proper namespace for dotted
2225 (Magic._ofind): Fixed to return proper namespace for dotted
2220 names. Before, a dotted name would always return 'not currently
2226 names. Before, a dotted name would always return 'not currently
2221 defined', because it would find the 'parent'. s.x would be found,
2227 defined', because it would find the 'parent'. s.x would be found,
2222 but since 'x' isn't defined by itself, it would get confused.
2228 but since 'x' isn't defined by itself, it would get confused.
2223 (Magic.magic_run): Fixed pickling problems reported by Ralf
2229 (Magic.magic_run): Fixed pickling problems reported by Ralf
2224 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2230 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2225 that I'd used when Mike Heeter reported similar issues at the
2231 that I'd used when Mike Heeter reported similar issues at the
2226 top-level, but now for @run. It boils down to injecting the
2232 top-level, but now for @run. It boils down to injecting the
2227 namespace where code is being executed with something that looks
2233 namespace where code is being executed with something that looks
2228 enough like a module to fool pickle.dump(). Since a pickle stores
2234 enough like a module to fool pickle.dump(). Since a pickle stores
2229 a named reference to the importing module, we need this for
2235 a named reference to the importing module, we need this for
2230 pickles to save something sensible.
2236 pickles to save something sensible.
2231
2237
2232 * IPython/ipmaker.py (make_IPython): added an autocall option.
2238 * IPython/ipmaker.py (make_IPython): added an autocall option.
2233
2239
2234 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2240 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2235 the auto-eval code. Now autocalling is an option, and the code is
2241 the auto-eval code. Now autocalling is an option, and the code is
2236 also vastly safer. There is no more eval() involved at all.
2242 also vastly safer. There is no more eval() involved at all.
2237
2243
2238 2003-03-01 Fernando Perez <fperez@colorado.edu>
2244 2003-03-01 Fernando Perez <fperez@colorado.edu>
2239
2245
2240 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2246 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2241 dict with named keys instead of a tuple.
2247 dict with named keys instead of a tuple.
2242
2248
2243 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2249 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2244
2250
2245 * setup.py (make_shortcut): Fixed message about directories
2251 * setup.py (make_shortcut): Fixed message about directories
2246 created during Windows installation (the directories were ok, just
2252 created during Windows installation (the directories were ok, just
2247 the printed message was misleading). Thanks to Chris Liechti
2253 the printed message was misleading). Thanks to Chris Liechti
2248 <cliechti-AT-gmx.net> for the heads up.
2254 <cliechti-AT-gmx.net> for the heads up.
2249
2255
2250 2003-02-21 Fernando Perez <fperez@colorado.edu>
2256 2003-02-21 Fernando Perez <fperez@colorado.edu>
2251
2257
2252 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2258 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2253 of ValueError exception when checking for auto-execution. This
2259 of ValueError exception when checking for auto-execution. This
2254 one is raised by things like Numeric arrays arr.flat when the
2260 one is raised by things like Numeric arrays arr.flat when the
2255 array is non-contiguous.
2261 array is non-contiguous.
2256
2262
2257 2003-01-31 Fernando Perez <fperez@colorado.edu>
2263 2003-01-31 Fernando Perez <fperez@colorado.edu>
2258
2264
2259 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2265 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2260 not return any value at all (even though the command would get
2266 not return any value at all (even though the command would get
2261 executed).
2267 executed).
2262 (xsys): Flush stdout right after printing the command to ensure
2268 (xsys): Flush stdout right after printing the command to ensure
2263 proper ordering of commands and command output in the total
2269 proper ordering of commands and command output in the total
2264 output.
2270 output.
2265 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2271 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2266 system/getoutput as defaults. The old ones are kept for
2272 system/getoutput as defaults. The old ones are kept for
2267 compatibility reasons, so no code which uses this library needs
2273 compatibility reasons, so no code which uses this library needs
2268 changing.
2274 changing.
2269
2275
2270 2003-01-27 *** Released version 0.2.14
2276 2003-01-27 *** Released version 0.2.14
2271
2277
2272 2003-01-25 Fernando Perez <fperez@colorado.edu>
2278 2003-01-25 Fernando Perez <fperez@colorado.edu>
2273
2279
2274 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2280 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2275 functions defined in previous edit sessions could not be re-edited
2281 functions defined in previous edit sessions could not be re-edited
2276 (because the temp files were immediately removed). Now temp files
2282 (because the temp files were immediately removed). Now temp files
2277 are removed only at IPython's exit.
2283 are removed only at IPython's exit.
2278 (Magic.magic_run): Improved @run to perform shell-like expansions
2284 (Magic.magic_run): Improved @run to perform shell-like expansions
2279 on its arguments (~users and $VARS). With this, @run becomes more
2285 on its arguments (~users and $VARS). With this, @run becomes more
2280 like a normal command-line.
2286 like a normal command-line.
2281
2287
2282 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2288 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2283 bugs related to embedding and cleaned up that code. A fairly
2289 bugs related to embedding and cleaned up that code. A fairly
2284 important one was the impossibility to access the global namespace
2290 important one was the impossibility to access the global namespace
2285 through the embedded IPython (only local variables were visible).
2291 through the embedded IPython (only local variables were visible).
2286
2292
2287 2003-01-14 Fernando Perez <fperez@colorado.edu>
2293 2003-01-14 Fernando Perez <fperez@colorado.edu>
2288
2294
2289 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2295 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2290 auto-calling to be a bit more conservative. Now it doesn't get
2296 auto-calling to be a bit more conservative. Now it doesn't get
2291 triggered if any of '!=()<>' are in the rest of the input line, to
2297 triggered if any of '!=()<>' are in the rest of the input line, to
2292 allow comparing callables. Thanks to Alex for the heads up.
2298 allow comparing callables. Thanks to Alex for the heads up.
2293
2299
2294 2003-01-07 Fernando Perez <fperez@colorado.edu>
2300 2003-01-07 Fernando Perez <fperez@colorado.edu>
2295
2301
2296 * IPython/genutils.py (page): fixed estimation of the number of
2302 * IPython/genutils.py (page): fixed estimation of the number of
2297 lines in a string to be paged to simply count newlines. This
2303 lines in a string to be paged to simply count newlines. This
2298 prevents over-guessing due to embedded escape sequences. A better
2304 prevents over-guessing due to embedded escape sequences. A better
2299 long-term solution would involve stripping out the control chars
2305 long-term solution would involve stripping out the control chars
2300 for the count, but it's potentially so expensive I just don't
2306 for the count, but it's potentially so expensive I just don't
2301 think it's worth doing.
2307 think it's worth doing.
2302
2308
2303 2002-12-19 *** Released version 0.2.14pre50
2309 2002-12-19 *** Released version 0.2.14pre50
2304
2310
2305 2002-12-19 Fernando Perez <fperez@colorado.edu>
2311 2002-12-19 Fernando Perez <fperez@colorado.edu>
2306
2312
2307 * tools/release (version): Changed release scripts to inform
2313 * tools/release (version): Changed release scripts to inform
2308 Andrea and build a NEWS file with a list of recent changes.
2314 Andrea and build a NEWS file with a list of recent changes.
2309
2315
2310 * IPython/ColorANSI.py (__all__): changed terminal detection
2316 * IPython/ColorANSI.py (__all__): changed terminal detection
2311 code. Seems to work better for xterms without breaking
2317 code. Seems to work better for xterms without breaking
2312 konsole. Will need more testing to determine if WinXP and Mac OSX
2318 konsole. Will need more testing to determine if WinXP and Mac OSX
2313 also work ok.
2319 also work ok.
2314
2320
2315 2002-12-18 *** Released version 0.2.14pre49
2321 2002-12-18 *** Released version 0.2.14pre49
2316
2322
2317 2002-12-18 Fernando Perez <fperez@colorado.edu>
2323 2002-12-18 Fernando Perez <fperez@colorado.edu>
2318
2324
2319 * Docs: added new info about Mac OSX, from Andrea.
2325 * Docs: added new info about Mac OSX, from Andrea.
2320
2326
2321 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2327 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2322 allow direct plotting of python strings whose format is the same
2328 allow direct plotting of python strings whose format is the same
2323 of gnuplot data files.
2329 of gnuplot data files.
2324
2330
2325 2002-12-16 Fernando Perez <fperez@colorado.edu>
2331 2002-12-16 Fernando Perez <fperez@colorado.edu>
2326
2332
2327 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2333 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2328 value of exit question to be acknowledged.
2334 value of exit question to be acknowledged.
2329
2335
2330 2002-12-03 Fernando Perez <fperez@colorado.edu>
2336 2002-12-03 Fernando Perez <fperez@colorado.edu>
2331
2337
2332 * IPython/ipmaker.py: removed generators, which had been added
2338 * IPython/ipmaker.py: removed generators, which had been added
2333 by mistake in an earlier debugging run. This was causing trouble
2339 by mistake in an earlier debugging run. This was causing trouble
2334 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2340 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2335 for pointing this out.
2341 for pointing this out.
2336
2342
2337 2002-11-17 Fernando Perez <fperez@colorado.edu>
2343 2002-11-17 Fernando Perez <fperez@colorado.edu>
2338
2344
2339 * Manual: updated the Gnuplot section.
2345 * Manual: updated the Gnuplot section.
2340
2346
2341 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2347 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2342 a much better split of what goes in Runtime and what goes in
2348 a much better split of what goes in Runtime and what goes in
2343 Interactive.
2349 Interactive.
2344
2350
2345 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2351 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2346 being imported from iplib.
2352 being imported from iplib.
2347
2353
2348 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2354 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2349 for command-passing. Now the global Gnuplot instance is called
2355 for command-passing. Now the global Gnuplot instance is called
2350 'gp' instead of 'g', which was really a far too fragile and
2356 'gp' instead of 'g', which was really a far too fragile and
2351 common name.
2357 common name.
2352
2358
2353 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2359 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2354 bounding boxes generated by Gnuplot for square plots.
2360 bounding boxes generated by Gnuplot for square plots.
2355
2361
2356 * IPython/genutils.py (popkey): new function added. I should
2362 * IPython/genutils.py (popkey): new function added. I should
2357 suggest this on c.l.py as a dict method, it seems useful.
2363 suggest this on c.l.py as a dict method, it seems useful.
2358
2364
2359 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2365 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2360 to transparently handle PostScript generation. MUCH better than
2366 to transparently handle PostScript generation. MUCH better than
2361 the previous plot_eps/replot_eps (which I removed now). The code
2367 the previous plot_eps/replot_eps (which I removed now). The code
2362 is also fairly clean and well documented now (including
2368 is also fairly clean and well documented now (including
2363 docstrings).
2369 docstrings).
2364
2370
2365 2002-11-13 Fernando Perez <fperez@colorado.edu>
2371 2002-11-13 Fernando Perez <fperez@colorado.edu>
2366
2372
2367 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2373 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2368 (inconsistent with options).
2374 (inconsistent with options).
2369
2375
2370 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2376 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2371 manually disabled, I don't know why. Fixed it.
2377 manually disabled, I don't know why. Fixed it.
2372 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2378 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2373 eps output.
2379 eps output.
2374
2380
2375 2002-11-12 Fernando Perez <fperez@colorado.edu>
2381 2002-11-12 Fernando Perez <fperez@colorado.edu>
2376
2382
2377 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2383 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2378 don't propagate up to caller. Fixes crash reported by François
2384 don't propagate up to caller. Fixes crash reported by François
2379 Pinard.
2385 Pinard.
2380
2386
2381 2002-11-09 Fernando Perez <fperez@colorado.edu>
2387 2002-11-09 Fernando Perez <fperez@colorado.edu>
2382
2388
2383 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2389 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2384 history file for new users.
2390 history file for new users.
2385 (make_IPython): fixed bug where initial install would leave the
2391 (make_IPython): fixed bug where initial install would leave the
2386 user running in the .ipython dir.
2392 user running in the .ipython dir.
2387 (make_IPython): fixed bug where config dir .ipython would be
2393 (make_IPython): fixed bug where config dir .ipython would be
2388 created regardless of the given -ipythondir option. Thanks to Cory
2394 created regardless of the given -ipythondir option. Thanks to Cory
2389 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2395 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2390
2396
2391 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2397 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2392 type confirmations. Will need to use it in all of IPython's code
2398 type confirmations. Will need to use it in all of IPython's code
2393 consistently.
2399 consistently.
2394
2400
2395 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2401 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2396 context to print 31 lines instead of the default 5. This will make
2402 context to print 31 lines instead of the default 5. This will make
2397 the crash reports extremely detailed in case the problem is in
2403 the crash reports extremely detailed in case the problem is in
2398 libraries I don't have access to.
2404 libraries I don't have access to.
2399
2405
2400 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2406 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2401 line of defense' code to still crash, but giving users fair
2407 line of defense' code to still crash, but giving users fair
2402 warning. I don't want internal errors to go unreported: if there's
2408 warning. I don't want internal errors to go unreported: if there's
2403 an internal problem, IPython should crash and generate a full
2409 an internal problem, IPython should crash and generate a full
2404 report.
2410 report.
2405
2411
2406 2002-11-08 Fernando Perez <fperez@colorado.edu>
2412 2002-11-08 Fernando Perez <fperez@colorado.edu>
2407
2413
2408 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2414 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2409 otherwise uncaught exceptions which can appear if people set
2415 otherwise uncaught exceptions which can appear if people set
2410 sys.stdout to something badly broken. Thanks to a crash report
2416 sys.stdout to something badly broken. Thanks to a crash report
2411 from henni-AT-mail.brainbot.com.
2417 from henni-AT-mail.brainbot.com.
2412
2418
2413 2002-11-04 Fernando Perez <fperez@colorado.edu>
2419 2002-11-04 Fernando Perez <fperez@colorado.edu>
2414
2420
2415 * IPython/iplib.py (InteractiveShell.interact): added
2421 * IPython/iplib.py (InteractiveShell.interact): added
2416 __IPYTHON__active to the builtins. It's a flag which goes on when
2422 __IPYTHON__active to the builtins. It's a flag which goes on when
2417 the interaction starts and goes off again when it stops. This
2423 the interaction starts and goes off again when it stops. This
2418 allows embedding code to detect being inside IPython. Before this
2424 allows embedding code to detect being inside IPython. Before this
2419 was done via __IPYTHON__, but that only shows that an IPython
2425 was done via __IPYTHON__, but that only shows that an IPython
2420 instance has been created.
2426 instance has been created.
2421
2427
2422 * IPython/Magic.py (Magic.magic_env): I realized that in a
2428 * IPython/Magic.py (Magic.magic_env): I realized that in a
2423 UserDict, instance.data holds the data as a normal dict. So I
2429 UserDict, instance.data holds the data as a normal dict. So I
2424 modified @env to return os.environ.data instead of rebuilding a
2430 modified @env to return os.environ.data instead of rebuilding a
2425 dict by hand.
2431 dict by hand.
2426
2432
2427 2002-11-02 Fernando Perez <fperez@colorado.edu>
2433 2002-11-02 Fernando Perez <fperez@colorado.edu>
2428
2434
2429 * IPython/genutils.py (warn): changed so that level 1 prints no
2435 * IPython/genutils.py (warn): changed so that level 1 prints no
2430 header. Level 2 is now the default (with 'WARNING' header, as
2436 header. Level 2 is now the default (with 'WARNING' header, as
2431 before). I think I tracked all places where changes were needed in
2437 before). I think I tracked all places where changes were needed in
2432 IPython, but outside code using the old level numbering may have
2438 IPython, but outside code using the old level numbering may have
2433 broken.
2439 broken.
2434
2440
2435 * IPython/iplib.py (InteractiveShell.runcode): added this to
2441 * IPython/iplib.py (InteractiveShell.runcode): added this to
2436 handle the tracebacks in SystemExit traps correctly. The previous
2442 handle the tracebacks in SystemExit traps correctly. The previous
2437 code (through interact) was printing more of the stack than
2443 code (through interact) was printing more of the stack than
2438 necessary, showing IPython internal code to the user.
2444 necessary, showing IPython internal code to the user.
2439
2445
2440 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2446 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2441 default. Now that the default at the confirmation prompt is yes,
2447 default. Now that the default at the confirmation prompt is yes,
2442 it's not so intrusive. François' argument that ipython sessions
2448 it's not so intrusive. François' argument that ipython sessions
2443 tend to be complex enough not to lose them from an accidental C-d,
2449 tend to be complex enough not to lose them from an accidental C-d,
2444 is a valid one.
2450 is a valid one.
2445
2451
2446 * IPython/iplib.py (InteractiveShell.interact): added a
2452 * IPython/iplib.py (InteractiveShell.interact): added a
2447 showtraceback() call to the SystemExit trap, and modified the exit
2453 showtraceback() call to the SystemExit trap, and modified the exit
2448 confirmation to have yes as the default.
2454 confirmation to have yes as the default.
2449
2455
2450 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2456 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2451 this file. It's been gone from the code for a long time, this was
2457 this file. It's been gone from the code for a long time, this was
2452 simply leftover junk.
2458 simply leftover junk.
2453
2459
2454 2002-11-01 Fernando Perez <fperez@colorado.edu>
2460 2002-11-01 Fernando Perez <fperez@colorado.edu>
2455
2461
2456 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2462 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2457 added. If set, IPython now traps EOF and asks for
2463 added. If set, IPython now traps EOF and asks for
2458 confirmation. After a request by François Pinard.
2464 confirmation. After a request by François Pinard.
2459
2465
2460 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2466 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2461 of @abort, and with a new (better) mechanism for handling the
2467 of @abort, and with a new (better) mechanism for handling the
2462 exceptions.
2468 exceptions.
2463
2469
2464 2002-10-27 Fernando Perez <fperez@colorado.edu>
2470 2002-10-27 Fernando Perez <fperez@colorado.edu>
2465
2471
2466 * IPython/usage.py (__doc__): updated the --help information and
2472 * IPython/usage.py (__doc__): updated the --help information and
2467 the ipythonrc file to indicate that -log generates
2473 the ipythonrc file to indicate that -log generates
2468 ./ipython.log. Also fixed the corresponding info in @logstart.
2474 ./ipython.log. Also fixed the corresponding info in @logstart.
2469 This and several other fixes in the manuals thanks to reports by
2475 This and several other fixes in the manuals thanks to reports by
2470 François Pinard <pinard-AT-iro.umontreal.ca>.
2476 François Pinard <pinard-AT-iro.umontreal.ca>.
2471
2477
2472 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2478 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2473 refer to @logstart (instead of @log, which doesn't exist).
2479 refer to @logstart (instead of @log, which doesn't exist).
2474
2480
2475 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2481 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2476 AttributeError crash. Thanks to Christopher Armstrong
2482 AttributeError crash. Thanks to Christopher Armstrong
2477 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2483 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2478 introduced recently (in 0.2.14pre37) with the fix to the eval
2484 introduced recently (in 0.2.14pre37) with the fix to the eval
2479 problem mentioned below.
2485 problem mentioned below.
2480
2486
2481 2002-10-17 Fernando Perez <fperez@colorado.edu>
2487 2002-10-17 Fernando Perez <fperez@colorado.edu>
2482
2488
2483 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2489 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2484 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2490 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2485
2491
2486 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2492 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2487 this function to fix a problem reported by Alex Schmolck. He saw
2493 this function to fix a problem reported by Alex Schmolck. He saw
2488 it with list comprehensions and generators, which were getting
2494 it with list comprehensions and generators, which were getting
2489 called twice. The real problem was an 'eval' call in testing for
2495 called twice. The real problem was an 'eval' call in testing for
2490 automagic which was evaluating the input line silently.
2496 automagic which was evaluating the input line silently.
2491
2497
2492 This is a potentially very nasty bug, if the input has side
2498 This is a potentially very nasty bug, if the input has side
2493 effects which must not be repeated. The code is much cleaner now,
2499 effects which must not be repeated. The code is much cleaner now,
2494 without any blanket 'except' left and with a regexp test for
2500 without any blanket 'except' left and with a regexp test for
2495 actual function names.
2501 actual function names.
2496
2502
2497 But an eval remains, which I'm not fully comfortable with. I just
2503 But an eval remains, which I'm not fully comfortable with. I just
2498 don't know how to find out if an expression could be a callable in
2504 don't know how to find out if an expression could be a callable in
2499 the user's namespace without doing an eval on the string. However
2505 the user's namespace without doing an eval on the string. However
2500 that string is now much more strictly checked so that no code
2506 that string is now much more strictly checked so that no code
2501 slips by, so the eval should only happen for things that can
2507 slips by, so the eval should only happen for things that can
2502 really be only function/method names.
2508 really be only function/method names.
2503
2509
2504 2002-10-15 Fernando Perez <fperez@colorado.edu>
2510 2002-10-15 Fernando Perez <fperez@colorado.edu>
2505
2511
2506 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2512 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2507 OSX information to main manual, removed README_Mac_OSX file from
2513 OSX information to main manual, removed README_Mac_OSX file from
2508 distribution. Also updated credits for recent additions.
2514 distribution. Also updated credits for recent additions.
2509
2515
2510 2002-10-10 Fernando Perez <fperez@colorado.edu>
2516 2002-10-10 Fernando Perez <fperez@colorado.edu>
2511
2517
2512 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2518 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2513 terminal-related issues. Many thanks to Andrea Riciputi
2519 terminal-related issues. Many thanks to Andrea Riciputi
2514 <andrea.riciputi-AT-libero.it> for writing it.
2520 <andrea.riciputi-AT-libero.it> for writing it.
2515
2521
2516 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2522 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2517 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2523 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2518
2524
2519 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2525 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2520 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2526 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2521 <syver-en-AT-online.no> who both submitted patches for this problem.
2527 <syver-en-AT-online.no> who both submitted patches for this problem.
2522
2528
2523 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2529 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2524 global embedding to make sure that things don't overwrite user
2530 global embedding to make sure that things don't overwrite user
2525 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2531 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2526
2532
2527 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2533 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2528 compatibility. Thanks to Hayden Callow
2534 compatibility. Thanks to Hayden Callow
2529 <h.callow-AT-elec.canterbury.ac.nz>
2535 <h.callow-AT-elec.canterbury.ac.nz>
2530
2536
2531 2002-10-04 Fernando Perez <fperez@colorado.edu>
2537 2002-10-04 Fernando Perez <fperez@colorado.edu>
2532
2538
2533 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2539 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2534 Gnuplot.File objects.
2540 Gnuplot.File objects.
2535
2541
2536 2002-07-23 Fernando Perez <fperez@colorado.edu>
2542 2002-07-23 Fernando Perez <fperez@colorado.edu>
2537
2543
2538 * IPython/genutils.py (timing): Added timings() and timing() for
2544 * IPython/genutils.py (timing): Added timings() and timing() for
2539 quick access to the most commonly needed data, the execution
2545 quick access to the most commonly needed data, the execution
2540 times. Old timing() renamed to timings_out().
2546 times. Old timing() renamed to timings_out().
2541
2547
2542 2002-07-18 Fernando Perez <fperez@colorado.edu>
2548 2002-07-18 Fernando Perez <fperez@colorado.edu>
2543
2549
2544 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2550 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2545 bug with nested instances disrupting the parent's tab completion.
2551 bug with nested instances disrupting the parent's tab completion.
2546
2552
2547 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2553 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2548 all_completions code to begin the emacs integration.
2554 all_completions code to begin the emacs integration.
2549
2555
2550 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2556 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2551 argument to allow titling individual arrays when plotting.
2557 argument to allow titling individual arrays when plotting.
2552
2558
2553 2002-07-15 Fernando Perez <fperez@colorado.edu>
2559 2002-07-15 Fernando Perez <fperez@colorado.edu>
2554
2560
2555 * setup.py (make_shortcut): changed to retrieve the value of
2561 * setup.py (make_shortcut): changed to retrieve the value of
2556 'Program Files' directory from the registry (this value changes in
2562 'Program Files' directory from the registry (this value changes in
2557 non-english versions of Windows). Thanks to Thomas Fanslau
2563 non-english versions of Windows). Thanks to Thomas Fanslau
2558 <tfanslau-AT-gmx.de> for the report.
2564 <tfanslau-AT-gmx.de> for the report.
2559
2565
2560 2002-07-10 Fernando Perez <fperez@colorado.edu>
2566 2002-07-10 Fernando Perez <fperez@colorado.edu>
2561
2567
2562 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
2568 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
2563 a bug in pdb, which crashes if a line with only whitespace is
2569 a bug in pdb, which crashes if a line with only whitespace is
2564 entered. Bug report submitted to sourceforge.
2570 entered. Bug report submitted to sourceforge.
2565
2571
2566 2002-07-09 Fernando Perez <fperez@colorado.edu>
2572 2002-07-09 Fernando Perez <fperez@colorado.edu>
2567
2573
2568 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
2574 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
2569 reporting exceptions (it's a bug in inspect.py, I just set a
2575 reporting exceptions (it's a bug in inspect.py, I just set a
2570 workaround).
2576 workaround).
2571
2577
2572 2002-07-08 Fernando Perez <fperez@colorado.edu>
2578 2002-07-08 Fernando Perez <fperez@colorado.edu>
2573
2579
2574 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
2580 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
2575 __IPYTHON__ in __builtins__ to show up in user_ns.
2581 __IPYTHON__ in __builtins__ to show up in user_ns.
2576
2582
2577 2002-07-03 Fernando Perez <fperez@colorado.edu>
2583 2002-07-03 Fernando Perez <fperez@colorado.edu>
2578
2584
2579 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
2585 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
2580 name from @gp_set_instance to @gp_set_default.
2586 name from @gp_set_instance to @gp_set_default.
2581
2587
2582 * IPython/ipmaker.py (make_IPython): default editor value set to
2588 * IPython/ipmaker.py (make_IPython): default editor value set to
2583 '0' (a string), to match the rc file. Otherwise will crash when
2589 '0' (a string), to match the rc file. Otherwise will crash when
2584 .strip() is called on it.
2590 .strip() is called on it.
2585
2591
2586
2592
2587 2002-06-28 Fernando Perez <fperez@colorado.edu>
2593 2002-06-28 Fernando Perez <fperez@colorado.edu>
2588
2594
2589 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
2595 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
2590 of files in current directory when a file is executed via
2596 of files in current directory when a file is executed via
2591 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
2597 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
2592
2598
2593 * setup.py (manfiles): fix for rpm builds, submitted by RA
2599 * setup.py (manfiles): fix for rpm builds, submitted by RA
2594 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
2600 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
2595
2601
2596 * IPython/ipmaker.py (make_IPython): fixed lookup of default
2602 * IPython/ipmaker.py (make_IPython): fixed lookup of default
2597 editor when set to '0'. Problem was, '0' evaluates to True (it's a
2603 editor when set to '0'. Problem was, '0' evaluates to True (it's a
2598 string!). A. Schmolck caught this one.
2604 string!). A. Schmolck caught this one.
2599
2605
2600 2002-06-27 Fernando Perez <fperez@colorado.edu>
2606 2002-06-27 Fernando Perez <fperez@colorado.edu>
2601
2607
2602 * IPython/ipmaker.py (make_IPython): fixed bug when running user
2608 * IPython/ipmaker.py (make_IPython): fixed bug when running user
2603 defined files at the cmd line. __name__ wasn't being set to
2609 defined files at the cmd line. __name__ wasn't being set to
2604 __main__.
2610 __main__.
2605
2611
2606 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
2612 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
2607 regular lists and tuples besides Numeric arrays.
2613 regular lists and tuples besides Numeric arrays.
2608
2614
2609 * IPython/Prompts.py (CachedOutput.__call__): Added output
2615 * IPython/Prompts.py (CachedOutput.__call__): Added output
2610 supression for input ending with ';'. Similar to Mathematica and
2616 supression for input ending with ';'. Similar to Mathematica and
2611 Matlab. The _* vars and Out[] list are still updated, just like
2617 Matlab. The _* vars and Out[] list are still updated, just like
2612 Mathematica behaves.
2618 Mathematica behaves.
2613
2619
2614 2002-06-25 Fernando Perez <fperez@colorado.edu>
2620 2002-06-25 Fernando Perez <fperez@colorado.edu>
2615
2621
2616 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
2622 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
2617 .ini extensions for profiels under Windows.
2623 .ini extensions for profiels under Windows.
2618
2624
2619 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
2625 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
2620 string form. Fix contributed by Alexander Schmolck
2626 string form. Fix contributed by Alexander Schmolck
2621 <a.schmolck-AT-gmx.net>
2627 <a.schmolck-AT-gmx.net>
2622
2628
2623 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
2629 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
2624 pre-configured Gnuplot instance.
2630 pre-configured Gnuplot instance.
2625
2631
2626 2002-06-21 Fernando Perez <fperez@colorado.edu>
2632 2002-06-21 Fernando Perez <fperez@colorado.edu>
2627
2633
2628 * IPython/numutils.py (exp_safe): new function, works around the
2634 * IPython/numutils.py (exp_safe): new function, works around the
2629 underflow problems in Numeric.
2635 underflow problems in Numeric.
2630 (log2): New fn. Safe log in base 2: returns exact integer answer
2636 (log2): New fn. Safe log in base 2: returns exact integer answer
2631 for exact integer powers of 2.
2637 for exact integer powers of 2.
2632
2638
2633 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
2639 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
2634 properly.
2640 properly.
2635
2641
2636 2002-06-20 Fernando Perez <fperez@colorado.edu>
2642 2002-06-20 Fernando Perez <fperez@colorado.edu>
2637
2643
2638 * IPython/genutils.py (timing): new function like
2644 * IPython/genutils.py (timing): new function like
2639 Mathematica's. Similar to time_test, but returns more info.
2645 Mathematica's. Similar to time_test, but returns more info.
2640
2646
2641 2002-06-18 Fernando Perez <fperez@colorado.edu>
2647 2002-06-18 Fernando Perez <fperez@colorado.edu>
2642
2648
2643 * IPython/Magic.py (Magic.magic_save): modified @save and @r
2649 * IPython/Magic.py (Magic.magic_save): modified @save and @r
2644 according to Mike Heeter's suggestions.
2650 according to Mike Heeter's suggestions.
2645
2651
2646 2002-06-16 Fernando Perez <fperez@colorado.edu>
2652 2002-06-16 Fernando Perez <fperez@colorado.edu>
2647
2653
2648 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
2654 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
2649 system. GnuplotMagic is gone as a user-directory option. New files
2655 system. GnuplotMagic is gone as a user-directory option. New files
2650 make it easier to use all the gnuplot stuff both from external
2656 make it easier to use all the gnuplot stuff both from external
2651 programs as well as from IPython. Had to rewrite part of
2657 programs as well as from IPython. Had to rewrite part of
2652 hardcopy() b/c of a strange bug: often the ps files simply don't
2658 hardcopy() b/c of a strange bug: often the ps files simply don't
2653 get created, and require a repeat of the command (often several
2659 get created, and require a repeat of the command (often several
2654 times).
2660 times).
2655
2661
2656 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
2662 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
2657 resolve output channel at call time, so that if sys.stderr has
2663 resolve output channel at call time, so that if sys.stderr has
2658 been redirected by user this gets honored.
2664 been redirected by user this gets honored.
2659
2665
2660 2002-06-13 Fernando Perez <fperez@colorado.edu>
2666 2002-06-13 Fernando Perez <fperez@colorado.edu>
2661
2667
2662 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
2668 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
2663 IPShell. Kept a copy with the old names to avoid breaking people's
2669 IPShell. Kept a copy with the old names to avoid breaking people's
2664 embedded code.
2670 embedded code.
2665
2671
2666 * IPython/ipython: simplified it to the bare minimum after
2672 * IPython/ipython: simplified it to the bare minimum after
2667 Holger's suggestions. Added info about how to use it in
2673 Holger's suggestions. Added info about how to use it in
2668 PYTHONSTARTUP.
2674 PYTHONSTARTUP.
2669
2675
2670 * IPython/Shell.py (IPythonShell): changed the options passing
2676 * IPython/Shell.py (IPythonShell): changed the options passing
2671 from a string with funky %s replacements to a straight list. Maybe
2677 from a string with funky %s replacements to a straight list. Maybe
2672 a bit more typing, but it follows sys.argv conventions, so there's
2678 a bit more typing, but it follows sys.argv conventions, so there's
2673 less special-casing to remember.
2679 less special-casing to remember.
2674
2680
2675 2002-06-12 Fernando Perez <fperez@colorado.edu>
2681 2002-06-12 Fernando Perez <fperez@colorado.edu>
2676
2682
2677 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
2683 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
2678 command. Thanks to a suggestion by Mike Heeter.
2684 command. Thanks to a suggestion by Mike Heeter.
2679 (Magic.magic_pfile): added behavior to look at filenames if given
2685 (Magic.magic_pfile): added behavior to look at filenames if given
2680 arg is not a defined object.
2686 arg is not a defined object.
2681 (Magic.magic_save): New @save function to save code snippets. Also
2687 (Magic.magic_save): New @save function to save code snippets. Also
2682 a Mike Heeter idea.
2688 a Mike Heeter idea.
2683
2689
2684 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
2690 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
2685 plot() and replot(). Much more convenient now, especially for
2691 plot() and replot(). Much more convenient now, especially for
2686 interactive use.
2692 interactive use.
2687
2693
2688 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
2694 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
2689 filenames.
2695 filenames.
2690
2696
2691 2002-06-02 Fernando Perez <fperez@colorado.edu>
2697 2002-06-02 Fernando Perez <fperez@colorado.edu>
2692
2698
2693 * IPython/Struct.py (Struct.__init__): modified to admit
2699 * IPython/Struct.py (Struct.__init__): modified to admit
2694 initialization via another struct.
2700 initialization via another struct.
2695
2701
2696 * IPython/genutils.py (SystemExec.__init__): New stateful
2702 * IPython/genutils.py (SystemExec.__init__): New stateful
2697 interface to xsys and bq. Useful for writing system scripts.
2703 interface to xsys and bq. Useful for writing system scripts.
2698
2704
2699 2002-05-30 Fernando Perez <fperez@colorado.edu>
2705 2002-05-30 Fernando Perez <fperez@colorado.edu>
2700
2706
2701 * MANIFEST.in: Changed docfile selection to exclude all the lyx
2707 * MANIFEST.in: Changed docfile selection to exclude all the lyx
2702 documents. This will make the user download smaller (it's getting
2708 documents. This will make the user download smaller (it's getting
2703 too big).
2709 too big).
2704
2710
2705 2002-05-29 Fernando Perez <fperez@colorado.edu>
2711 2002-05-29 Fernando Perez <fperez@colorado.edu>
2706
2712
2707 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
2713 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
2708 fix problems with shelve and pickle. Seems to work, but I don't
2714 fix problems with shelve and pickle. Seems to work, but I don't
2709 know if corner cases break it. Thanks to Mike Heeter
2715 know if corner cases break it. Thanks to Mike Heeter
2710 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
2716 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
2711
2717
2712 2002-05-24 Fernando Perez <fperez@colorado.edu>
2718 2002-05-24 Fernando Perez <fperez@colorado.edu>
2713
2719
2714 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
2720 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
2715 macros having broken.
2721 macros having broken.
2716
2722
2717 2002-05-21 Fernando Perez <fperez@colorado.edu>
2723 2002-05-21 Fernando Perez <fperez@colorado.edu>
2718
2724
2719 * IPython/Magic.py (Magic.magic_logstart): fixed recently
2725 * IPython/Magic.py (Magic.magic_logstart): fixed recently
2720 introduced logging bug: all history before logging started was
2726 introduced logging bug: all history before logging started was
2721 being written one character per line! This came from the redesign
2727 being written one character per line! This came from the redesign
2722 of the input history as a special list which slices to strings,
2728 of the input history as a special list which slices to strings,
2723 not to lists.
2729 not to lists.
2724
2730
2725 2002-05-20 Fernando Perez <fperez@colorado.edu>
2731 2002-05-20 Fernando Perez <fperez@colorado.edu>
2726
2732
2727 * IPython/Prompts.py (CachedOutput.__init__): made the color table
2733 * IPython/Prompts.py (CachedOutput.__init__): made the color table
2728 be an attribute of all classes in this module. The design of these
2734 be an attribute of all classes in this module. The design of these
2729 classes needs some serious overhauling.
2735 classes needs some serious overhauling.
2730
2736
2731 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
2737 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
2732 which was ignoring '_' in option names.
2738 which was ignoring '_' in option names.
2733
2739
2734 * IPython/ultraTB.py (FormattedTB.__init__): Changed
2740 * IPython/ultraTB.py (FormattedTB.__init__): Changed
2735 'Verbose_novars' to 'Context' and made it the new default. It's a
2741 'Verbose_novars' to 'Context' and made it the new default. It's a
2736 bit more readable and also safer than verbose.
2742 bit more readable and also safer than verbose.
2737
2743
2738 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
2744 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
2739 triple-quoted strings.
2745 triple-quoted strings.
2740
2746
2741 * IPython/OInspect.py (__all__): new module exposing the object
2747 * IPython/OInspect.py (__all__): new module exposing the object
2742 introspection facilities. Now the corresponding magics are dummy
2748 introspection facilities. Now the corresponding magics are dummy
2743 wrappers around this. Having this module will make it much easier
2749 wrappers around this. Having this module will make it much easier
2744 to put these functions into our modified pdb.
2750 to put these functions into our modified pdb.
2745 This new object inspector system uses the new colorizing module,
2751 This new object inspector system uses the new colorizing module,
2746 so source code and other things are nicely syntax highlighted.
2752 so source code and other things are nicely syntax highlighted.
2747
2753
2748 2002-05-18 Fernando Perez <fperez@colorado.edu>
2754 2002-05-18 Fernando Perez <fperez@colorado.edu>
2749
2755
2750 * IPython/ColorANSI.py: Split the coloring tools into a separate
2756 * IPython/ColorANSI.py: Split the coloring tools into a separate
2751 module so I can use them in other code easier (they were part of
2757 module so I can use them in other code easier (they were part of
2752 ultraTB).
2758 ultraTB).
2753
2759
2754 2002-05-17 Fernando Perez <fperez@colorado.edu>
2760 2002-05-17 Fernando Perez <fperez@colorado.edu>
2755
2761
2756 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
2762 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
2757 fixed it to set the global 'g' also to the called instance, as
2763 fixed it to set the global 'g' also to the called instance, as
2758 long as 'g' was still a gnuplot instance (so it doesn't overwrite
2764 long as 'g' was still a gnuplot instance (so it doesn't overwrite
2759 user's 'g' variables).
2765 user's 'g' variables).
2760
2766
2761 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
2767 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
2762 global variables (aliases to _ih,_oh) so that users which expect
2768 global variables (aliases to _ih,_oh) so that users which expect
2763 In[5] or Out[7] to work aren't unpleasantly surprised.
2769 In[5] or Out[7] to work aren't unpleasantly surprised.
2764 (InputList.__getslice__): new class to allow executing slices of
2770 (InputList.__getslice__): new class to allow executing slices of
2765 input history directly. Very simple class, complements the use of
2771 input history directly. Very simple class, complements the use of
2766 macros.
2772 macros.
2767
2773
2768 2002-05-16 Fernando Perez <fperez@colorado.edu>
2774 2002-05-16 Fernando Perez <fperez@colorado.edu>
2769
2775
2770 * setup.py (docdirbase): make doc directory be just doc/IPython
2776 * setup.py (docdirbase): make doc directory be just doc/IPython
2771 without version numbers, it will reduce clutter for users.
2777 without version numbers, it will reduce clutter for users.
2772
2778
2773 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
2779 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
2774 execfile call to prevent possible memory leak. See for details:
2780 execfile call to prevent possible memory leak. See for details:
2775 http://mail.python.org/pipermail/python-list/2002-February/088476.html
2781 http://mail.python.org/pipermail/python-list/2002-February/088476.html
2776
2782
2777 2002-05-15 Fernando Perez <fperez@colorado.edu>
2783 2002-05-15 Fernando Perez <fperez@colorado.edu>
2778
2784
2779 * IPython/Magic.py (Magic.magic_psource): made the object
2785 * IPython/Magic.py (Magic.magic_psource): made the object
2780 introspection names be more standard: pdoc, pdef, pfile and
2786 introspection names be more standard: pdoc, pdef, pfile and
2781 psource. They all print/page their output, and it makes
2787 psource. They all print/page their output, and it makes
2782 remembering them easier. Kept old names for compatibility as
2788 remembering them easier. Kept old names for compatibility as
2783 aliases.
2789 aliases.
2784
2790
2785 2002-05-14 Fernando Perez <fperez@colorado.edu>
2791 2002-05-14 Fernando Perez <fperez@colorado.edu>
2786
2792
2787 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
2793 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
2788 what the mouse problem was. The trick is to use gnuplot with temp
2794 what the mouse problem was. The trick is to use gnuplot with temp
2789 files and NOT with pipes (for data communication), because having
2795 files and NOT with pipes (for data communication), because having
2790 both pipes and the mouse on is bad news.
2796 both pipes and the mouse on is bad news.
2791
2797
2792 2002-05-13 Fernando Perez <fperez@colorado.edu>
2798 2002-05-13 Fernando Perez <fperez@colorado.edu>
2793
2799
2794 * IPython/Magic.py (Magic._ofind): fixed namespace order search
2800 * IPython/Magic.py (Magic._ofind): fixed namespace order search
2795 bug. Information would be reported about builtins even when
2801 bug. Information would be reported about builtins even when
2796 user-defined functions overrode them.
2802 user-defined functions overrode them.
2797
2803
2798 2002-05-11 Fernando Perez <fperez@colorado.edu>
2804 2002-05-11 Fernando Perez <fperez@colorado.edu>
2799
2805
2800 * IPython/__init__.py (__all__): removed FlexCompleter from
2806 * IPython/__init__.py (__all__): removed FlexCompleter from
2801 __all__ so that things don't fail in platforms without readline.
2807 __all__ so that things don't fail in platforms without readline.
2802
2808
2803 2002-05-10 Fernando Perez <fperez@colorado.edu>
2809 2002-05-10 Fernando Perez <fperez@colorado.edu>
2804
2810
2805 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
2811 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
2806 it requires Numeric, effectively making Numeric a dependency for
2812 it requires Numeric, effectively making Numeric a dependency for
2807 IPython.
2813 IPython.
2808
2814
2809 * Released 0.2.13
2815 * Released 0.2.13
2810
2816
2811 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
2817 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
2812 profiler interface. Now all the major options from the profiler
2818 profiler interface. Now all the major options from the profiler
2813 module are directly supported in IPython, both for single
2819 module are directly supported in IPython, both for single
2814 expressions (@prun) and for full programs (@run -p).
2820 expressions (@prun) and for full programs (@run -p).
2815
2821
2816 2002-05-09 Fernando Perez <fperez@colorado.edu>
2822 2002-05-09 Fernando Perez <fperez@colorado.edu>
2817
2823
2818 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
2824 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
2819 magic properly formatted for screen.
2825 magic properly formatted for screen.
2820
2826
2821 * setup.py (make_shortcut): Changed things to put pdf version in
2827 * setup.py (make_shortcut): Changed things to put pdf version in
2822 doc/ instead of doc/manual (had to change lyxport a bit).
2828 doc/ instead of doc/manual (had to change lyxport a bit).
2823
2829
2824 * IPython/Magic.py (Profile.string_stats): made profile runs go
2830 * IPython/Magic.py (Profile.string_stats): made profile runs go
2825 through pager (they are long and a pager allows searching, saving,
2831 through pager (they are long and a pager allows searching, saving,
2826 etc.)
2832 etc.)
2827
2833
2828 2002-05-08 Fernando Perez <fperez@colorado.edu>
2834 2002-05-08 Fernando Perez <fperez@colorado.edu>
2829
2835
2830 * Released 0.2.12
2836 * Released 0.2.12
2831
2837
2832 2002-05-06 Fernando Perez <fperez@colorado.edu>
2838 2002-05-06 Fernando Perez <fperez@colorado.edu>
2833
2839
2834 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
2840 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
2835 introduced); 'hist n1 n2' was broken.
2841 introduced); 'hist n1 n2' was broken.
2836 (Magic.magic_pdb): added optional on/off arguments to @pdb
2842 (Magic.magic_pdb): added optional on/off arguments to @pdb
2837 (Magic.magic_run): added option -i to @run, which executes code in
2843 (Magic.magic_run): added option -i to @run, which executes code in
2838 the IPython namespace instead of a clean one. Also added @irun as
2844 the IPython namespace instead of a clean one. Also added @irun as
2839 an alias to @run -i.
2845 an alias to @run -i.
2840
2846
2841 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
2847 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
2842 fixed (it didn't really do anything, the namespaces were wrong).
2848 fixed (it didn't really do anything, the namespaces were wrong).
2843
2849
2844 * IPython/Debugger.py (__init__): Added workaround for python 2.1
2850 * IPython/Debugger.py (__init__): Added workaround for python 2.1
2845
2851
2846 * IPython/__init__.py (__all__): Fixed package namespace, now
2852 * IPython/__init__.py (__all__): Fixed package namespace, now
2847 'import IPython' does give access to IPython.<all> as
2853 'import IPython' does give access to IPython.<all> as
2848 expected. Also renamed __release__ to Release.
2854 expected. Also renamed __release__ to Release.
2849
2855
2850 * IPython/Debugger.py (__license__): created new Pdb class which
2856 * IPython/Debugger.py (__license__): created new Pdb class which
2851 functions like a drop-in for the normal pdb.Pdb but does NOT
2857 functions like a drop-in for the normal pdb.Pdb but does NOT
2852 import readline by default. This way it doesn't muck up IPython's
2858 import readline by default. This way it doesn't muck up IPython's
2853 readline handling, and now tab-completion finally works in the
2859 readline handling, and now tab-completion finally works in the
2854 debugger -- sort of. It completes things globally visible, but the
2860 debugger -- sort of. It completes things globally visible, but the
2855 completer doesn't track the stack as pdb walks it. That's a bit
2861 completer doesn't track the stack as pdb walks it. That's a bit
2856 tricky, and I'll have to implement it later.
2862 tricky, and I'll have to implement it later.
2857
2863
2858 2002-05-05 Fernando Perez <fperez@colorado.edu>
2864 2002-05-05 Fernando Perez <fperez@colorado.edu>
2859
2865
2860 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
2866 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
2861 magic docstrings when printed via ? (explicit \'s were being
2867 magic docstrings when printed via ? (explicit \'s were being
2862 printed).
2868 printed).
2863
2869
2864 * IPython/ipmaker.py (make_IPython): fixed namespace
2870 * IPython/ipmaker.py (make_IPython): fixed namespace
2865 identification bug. Now variables loaded via logs or command-line
2871 identification bug. Now variables loaded via logs or command-line
2866 files are recognized in the interactive namespace by @who.
2872 files are recognized in the interactive namespace by @who.
2867
2873
2868 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
2874 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
2869 log replay system stemming from the string form of Structs.
2875 log replay system stemming from the string form of Structs.
2870
2876
2871 * IPython/Magic.py (Macro.__init__): improved macros to properly
2877 * IPython/Magic.py (Macro.__init__): improved macros to properly
2872 handle magic commands in them.
2878 handle magic commands in them.
2873 (Magic.magic_logstart): usernames are now expanded so 'logstart
2879 (Magic.magic_logstart): usernames are now expanded so 'logstart
2874 ~/mylog' now works.
2880 ~/mylog' now works.
2875
2881
2876 * IPython/iplib.py (complete): fixed bug where paths starting with
2882 * IPython/iplib.py (complete): fixed bug where paths starting with
2877 '/' would be completed as magic names.
2883 '/' would be completed as magic names.
2878
2884
2879 2002-05-04 Fernando Perez <fperez@colorado.edu>
2885 2002-05-04 Fernando Perez <fperez@colorado.edu>
2880
2886
2881 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
2887 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
2882 allow running full programs under the profiler's control.
2888 allow running full programs under the profiler's control.
2883
2889
2884 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
2890 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
2885 mode to report exceptions verbosely but without formatting
2891 mode to report exceptions verbosely but without formatting
2886 variables. This addresses the issue of ipython 'freezing' (it's
2892 variables. This addresses the issue of ipython 'freezing' (it's
2887 not frozen, but caught in an expensive formatting loop) when huge
2893 not frozen, but caught in an expensive formatting loop) when huge
2888 variables are in the context of an exception.
2894 variables are in the context of an exception.
2889 (VerboseTB.text): Added '--->' markers at line where exception was
2895 (VerboseTB.text): Added '--->' markers at line where exception was
2890 triggered. Much clearer to read, especially in NoColor modes.
2896 triggered. Much clearer to read, especially in NoColor modes.
2891
2897
2892 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
2898 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
2893 implemented in reverse when changing to the new parse_options().
2899 implemented in reverse when changing to the new parse_options().
2894
2900
2895 2002-05-03 Fernando Perez <fperez@colorado.edu>
2901 2002-05-03 Fernando Perez <fperez@colorado.edu>
2896
2902
2897 * IPython/Magic.py (Magic.parse_options): new function so that
2903 * IPython/Magic.py (Magic.parse_options): new function so that
2898 magics can parse options easier.
2904 magics can parse options easier.
2899 (Magic.magic_prun): new function similar to profile.run(),
2905 (Magic.magic_prun): new function similar to profile.run(),
2900 suggested by Chris Hart.
2906 suggested by Chris Hart.
2901 (Magic.magic_cd): fixed behavior so that it only changes if
2907 (Magic.magic_cd): fixed behavior so that it only changes if
2902 directory actually is in history.
2908 directory actually is in history.
2903
2909
2904 * IPython/usage.py (__doc__): added information about potential
2910 * IPython/usage.py (__doc__): added information about potential
2905 slowness of Verbose exception mode when there are huge data
2911 slowness of Verbose exception mode when there are huge data
2906 structures to be formatted (thanks to Archie Paulson).
2912 structures to be formatted (thanks to Archie Paulson).
2907
2913
2908 * IPython/ipmaker.py (make_IPython): Changed default logging
2914 * IPython/ipmaker.py (make_IPython): Changed default logging
2909 (when simply called with -log) to use curr_dir/ipython.log in
2915 (when simply called with -log) to use curr_dir/ipython.log in
2910 rotate mode. Fixed crash which was occuring with -log before
2916 rotate mode. Fixed crash which was occuring with -log before
2911 (thanks to Jim Boyle).
2917 (thanks to Jim Boyle).
2912
2918
2913 2002-05-01 Fernando Perez <fperez@colorado.edu>
2919 2002-05-01 Fernando Perez <fperez@colorado.edu>
2914
2920
2915 * Released 0.2.11 for these fixes (mainly the ultraTB one which
2921 * Released 0.2.11 for these fixes (mainly the ultraTB one which
2916 was nasty -- though somewhat of a corner case).
2922 was nasty -- though somewhat of a corner case).
2917
2923
2918 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
2924 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
2919 text (was a bug).
2925 text (was a bug).
2920
2926
2921 2002-04-30 Fernando Perez <fperez@colorado.edu>
2927 2002-04-30 Fernando Perez <fperez@colorado.edu>
2922
2928
2923 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
2929 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
2924 a print after ^D or ^C from the user so that the In[] prompt
2930 a print after ^D or ^C from the user so that the In[] prompt
2925 doesn't over-run the gnuplot one.
2931 doesn't over-run the gnuplot one.
2926
2932
2927 2002-04-29 Fernando Perez <fperez@colorado.edu>
2933 2002-04-29 Fernando Perez <fperez@colorado.edu>
2928
2934
2929 * Released 0.2.10
2935 * Released 0.2.10
2930
2936
2931 * IPython/__release__.py (version): get date dynamically.
2937 * IPython/__release__.py (version): get date dynamically.
2932
2938
2933 * Misc. documentation updates thanks to Arnd's comments. Also ran
2939 * Misc. documentation updates thanks to Arnd's comments. Also ran
2934 a full spellcheck on the manual (hadn't been done in a while).
2940 a full spellcheck on the manual (hadn't been done in a while).
2935
2941
2936 2002-04-27 Fernando Perez <fperez@colorado.edu>
2942 2002-04-27 Fernando Perez <fperez@colorado.edu>
2937
2943
2938 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
2944 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
2939 starting a log in mid-session would reset the input history list.
2945 starting a log in mid-session would reset the input history list.
2940
2946
2941 2002-04-26 Fernando Perez <fperez@colorado.edu>
2947 2002-04-26 Fernando Perez <fperez@colorado.edu>
2942
2948
2943 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
2949 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
2944 all files were being included in an update. Now anything in
2950 all files were being included in an update. Now anything in
2945 UserConfig that matches [A-Za-z]*.py will go (this excludes
2951 UserConfig that matches [A-Za-z]*.py will go (this excludes
2946 __init__.py)
2952 __init__.py)
2947
2953
2948 2002-04-25 Fernando Perez <fperez@colorado.edu>
2954 2002-04-25 Fernando Perez <fperez@colorado.edu>
2949
2955
2950 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
2956 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
2951 to __builtins__ so that any form of embedded or imported code can
2957 to __builtins__ so that any form of embedded or imported code can
2952 test for being inside IPython.
2958 test for being inside IPython.
2953
2959
2954 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
2960 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
2955 changed to GnuplotMagic because it's now an importable module,
2961 changed to GnuplotMagic because it's now an importable module,
2956 this makes the name follow that of the standard Gnuplot module.
2962 this makes the name follow that of the standard Gnuplot module.
2957 GnuplotMagic can now be loaded at any time in mid-session.
2963 GnuplotMagic can now be loaded at any time in mid-session.
2958
2964
2959 2002-04-24 Fernando Perez <fperez@colorado.edu>
2965 2002-04-24 Fernando Perez <fperez@colorado.edu>
2960
2966
2961 * IPython/numutils.py: removed SIUnits. It doesn't properly set
2967 * IPython/numutils.py: removed SIUnits. It doesn't properly set
2962 the globals (IPython has its own namespace) and the
2968 the globals (IPython has its own namespace) and the
2963 PhysicalQuantity stuff is much better anyway.
2969 PhysicalQuantity stuff is much better anyway.
2964
2970
2965 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
2971 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
2966 embedding example to standard user directory for
2972 embedding example to standard user directory for
2967 distribution. Also put it in the manual.
2973 distribution. Also put it in the manual.
2968
2974
2969 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
2975 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
2970 instance as first argument (so it doesn't rely on some obscure
2976 instance as first argument (so it doesn't rely on some obscure
2971 hidden global).
2977 hidden global).
2972
2978
2973 * IPython/UserConfig/ipythonrc.py: put () back in accepted
2979 * IPython/UserConfig/ipythonrc.py: put () back in accepted
2974 delimiters. While it prevents ().TAB from working, it allows
2980 delimiters. While it prevents ().TAB from working, it allows
2975 completions in open (... expressions. This is by far a more common
2981 completions in open (... expressions. This is by far a more common
2976 case.
2982 case.
2977
2983
2978 2002-04-23 Fernando Perez <fperez@colorado.edu>
2984 2002-04-23 Fernando Perez <fperez@colorado.edu>
2979
2985
2980 * IPython/Extensions/InterpreterPasteInput.py: new
2986 * IPython/Extensions/InterpreterPasteInput.py: new
2981 syntax-processing module for pasting lines with >>> or ... at the
2987 syntax-processing module for pasting lines with >>> or ... at the
2982 start.
2988 start.
2983
2989
2984 * IPython/Extensions/PhysicalQ_Interactive.py
2990 * IPython/Extensions/PhysicalQ_Interactive.py
2985 (PhysicalQuantityInteractive.__int__): fixed to work with either
2991 (PhysicalQuantityInteractive.__int__): fixed to work with either
2986 Numeric or math.
2992 Numeric or math.
2987
2993
2988 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
2994 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
2989 provided profiles. Now we have:
2995 provided profiles. Now we have:
2990 -math -> math module as * and cmath with its own namespace.
2996 -math -> math module as * and cmath with its own namespace.
2991 -numeric -> Numeric as *, plus gnuplot & grace
2997 -numeric -> Numeric as *, plus gnuplot & grace
2992 -physics -> same as before
2998 -physics -> same as before
2993
2999
2994 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3000 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
2995 user-defined magics wouldn't be found by @magic if they were
3001 user-defined magics wouldn't be found by @magic if they were
2996 defined as class methods. Also cleaned up the namespace search
3002 defined as class methods. Also cleaned up the namespace search
2997 logic and the string building (to use %s instead of many repeated
3003 logic and the string building (to use %s instead of many repeated
2998 string adds).
3004 string adds).
2999
3005
3000 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3006 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3001 of user-defined magics to operate with class methods (cleaner, in
3007 of user-defined magics to operate with class methods (cleaner, in
3002 line with the gnuplot code).
3008 line with the gnuplot code).
3003
3009
3004 2002-04-22 Fernando Perez <fperez@colorado.edu>
3010 2002-04-22 Fernando Perez <fperez@colorado.edu>
3005
3011
3006 * setup.py: updated dependency list so that manual is updated when
3012 * setup.py: updated dependency list so that manual is updated when
3007 all included files change.
3013 all included files change.
3008
3014
3009 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3015 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3010 the delimiter removal option (the fix is ugly right now).
3016 the delimiter removal option (the fix is ugly right now).
3011
3017
3012 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3018 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3013 all of the math profile (quicker loading, no conflict between
3019 all of the math profile (quicker loading, no conflict between
3014 g-9.8 and g-gnuplot).
3020 g-9.8 and g-gnuplot).
3015
3021
3016 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3022 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3017 name of post-mortem files to IPython_crash_report.txt.
3023 name of post-mortem files to IPython_crash_report.txt.
3018
3024
3019 * Cleanup/update of the docs. Added all the new readline info and
3025 * Cleanup/update of the docs. Added all the new readline info and
3020 formatted all lists as 'real lists'.
3026 formatted all lists as 'real lists'.
3021
3027
3022 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3028 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3023 tab-completion options, since the full readline parse_and_bind is
3029 tab-completion options, since the full readline parse_and_bind is
3024 now accessible.
3030 now accessible.
3025
3031
3026 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3032 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3027 handling of readline options. Now users can specify any string to
3033 handling of readline options. Now users can specify any string to
3028 be passed to parse_and_bind(), as well as the delimiters to be
3034 be passed to parse_and_bind(), as well as the delimiters to be
3029 removed.
3035 removed.
3030 (InteractiveShell.__init__): Added __name__ to the global
3036 (InteractiveShell.__init__): Added __name__ to the global
3031 namespace so that things like Itpl which rely on its existence
3037 namespace so that things like Itpl which rely on its existence
3032 don't crash.
3038 don't crash.
3033 (InteractiveShell._prefilter): Defined the default with a _ so
3039 (InteractiveShell._prefilter): Defined the default with a _ so
3034 that prefilter() is easier to override, while the default one
3040 that prefilter() is easier to override, while the default one
3035 remains available.
3041 remains available.
3036
3042
3037 2002-04-18 Fernando Perez <fperez@colorado.edu>
3043 2002-04-18 Fernando Perez <fperez@colorado.edu>
3038
3044
3039 * Added information about pdb in the docs.
3045 * Added information about pdb in the docs.
3040
3046
3041 2002-04-17 Fernando Perez <fperez@colorado.edu>
3047 2002-04-17 Fernando Perez <fperez@colorado.edu>
3042
3048
3043 * IPython/ipmaker.py (make_IPython): added rc_override option to
3049 * IPython/ipmaker.py (make_IPython): added rc_override option to
3044 allow passing config options at creation time which may override
3050 allow passing config options at creation time which may override
3045 anything set in the config files or command line. This is
3051 anything set in the config files or command line. This is
3046 particularly useful for configuring embedded instances.
3052 particularly useful for configuring embedded instances.
3047
3053
3048 2002-04-15 Fernando Perez <fperez@colorado.edu>
3054 2002-04-15 Fernando Perez <fperez@colorado.edu>
3049
3055
3050 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3056 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3051 crash embedded instances because of the input cache falling out of
3057 crash embedded instances because of the input cache falling out of
3052 sync with the output counter.
3058 sync with the output counter.
3053
3059
3054 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3060 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3055 mode which calls pdb after an uncaught exception in IPython itself.
3061 mode which calls pdb after an uncaught exception in IPython itself.
3056
3062
3057 2002-04-14 Fernando Perez <fperez@colorado.edu>
3063 2002-04-14 Fernando Perez <fperez@colorado.edu>
3058
3064
3059 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3065 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3060 readline, fix it back after each call.
3066 readline, fix it back after each call.
3061
3067
3062 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3068 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3063 method to force all access via __call__(), which guarantees that
3069 method to force all access via __call__(), which guarantees that
3064 traceback references are properly deleted.
3070 traceback references are properly deleted.
3065
3071
3066 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3072 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3067 improve printing when pprint is in use.
3073 improve printing when pprint is in use.
3068
3074
3069 2002-04-13 Fernando Perez <fperez@colorado.edu>
3075 2002-04-13 Fernando Perez <fperez@colorado.edu>
3070
3076
3071 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3077 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3072 exceptions aren't caught anymore. If the user triggers one, he
3078 exceptions aren't caught anymore. If the user triggers one, he
3073 should know why he's doing it and it should go all the way up,
3079 should know why he's doing it and it should go all the way up,
3074 just like any other exception. So now @abort will fully kill the
3080 just like any other exception. So now @abort will fully kill the
3075 embedded interpreter and the embedding code (unless that happens
3081 embedded interpreter and the embedding code (unless that happens
3076 to catch SystemExit).
3082 to catch SystemExit).
3077
3083
3078 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3084 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3079 and a debugger() method to invoke the interactive pdb debugger
3085 and a debugger() method to invoke the interactive pdb debugger
3080 after printing exception information. Also added the corresponding
3086 after printing exception information. Also added the corresponding
3081 -pdb option and @pdb magic to control this feature, and updated
3087 -pdb option and @pdb magic to control this feature, and updated
3082 the docs. After a suggestion from Christopher Hart
3088 the docs. After a suggestion from Christopher Hart
3083 (hart-AT-caltech.edu).
3089 (hart-AT-caltech.edu).
3084
3090
3085 2002-04-12 Fernando Perez <fperez@colorado.edu>
3091 2002-04-12 Fernando Perez <fperez@colorado.edu>
3086
3092
3087 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3093 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3088 the exception handlers defined by the user (not the CrashHandler)
3094 the exception handlers defined by the user (not the CrashHandler)
3089 so that user exceptions don't trigger an ipython bug report.
3095 so that user exceptions don't trigger an ipython bug report.
3090
3096
3091 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3097 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3092 configurable (it should have always been so).
3098 configurable (it should have always been so).
3093
3099
3094 2002-03-26 Fernando Perez <fperez@colorado.edu>
3100 2002-03-26 Fernando Perez <fperez@colorado.edu>
3095
3101
3096 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3102 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3097 and there to fix embedding namespace issues. This should all be
3103 and there to fix embedding namespace issues. This should all be
3098 done in a more elegant way.
3104 done in a more elegant way.
3099
3105
3100 2002-03-25 Fernando Perez <fperez@colorado.edu>
3106 2002-03-25 Fernando Perez <fperez@colorado.edu>
3101
3107
3102 * IPython/genutils.py (get_home_dir): Try to make it work under
3108 * IPython/genutils.py (get_home_dir): Try to make it work under
3103 win9x also.
3109 win9x also.
3104
3110
3105 2002-03-20 Fernando Perez <fperez@colorado.edu>
3111 2002-03-20 Fernando Perez <fperez@colorado.edu>
3106
3112
3107 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3113 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3108 sys.displayhook untouched upon __init__.
3114 sys.displayhook untouched upon __init__.
3109
3115
3110 2002-03-19 Fernando Perez <fperez@colorado.edu>
3116 2002-03-19 Fernando Perez <fperez@colorado.edu>
3111
3117
3112 * Released 0.2.9 (for embedding bug, basically).
3118 * Released 0.2.9 (for embedding bug, basically).
3113
3119
3114 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3120 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3115 exceptions so that enclosing shell's state can be restored.
3121 exceptions so that enclosing shell's state can be restored.
3116
3122
3117 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3123 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3118 naming conventions in the .ipython/ dir.
3124 naming conventions in the .ipython/ dir.
3119
3125
3120 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3126 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3121 from delimiters list so filenames with - in them get expanded.
3127 from delimiters list so filenames with - in them get expanded.
3122
3128
3123 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3129 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3124 sys.displayhook not being properly restored after an embedded call.
3130 sys.displayhook not being properly restored after an embedded call.
3125
3131
3126 2002-03-18 Fernando Perez <fperez@colorado.edu>
3132 2002-03-18 Fernando Perez <fperez@colorado.edu>
3127
3133
3128 * Released 0.2.8
3134 * Released 0.2.8
3129
3135
3130 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3136 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3131 some files weren't being included in a -upgrade.
3137 some files weren't being included in a -upgrade.
3132 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3138 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3133 on' so that the first tab completes.
3139 on' so that the first tab completes.
3134 (InteractiveShell.handle_magic): fixed bug with spaces around
3140 (InteractiveShell.handle_magic): fixed bug with spaces around
3135 quotes breaking many magic commands.
3141 quotes breaking many magic commands.
3136
3142
3137 * setup.py: added note about ignoring the syntax error messages at
3143 * setup.py: added note about ignoring the syntax error messages at
3138 installation.
3144 installation.
3139
3145
3140 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3146 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3141 streamlining the gnuplot interface, now there's only one magic @gp.
3147 streamlining the gnuplot interface, now there's only one magic @gp.
3142
3148
3143 2002-03-17 Fernando Perez <fperez@colorado.edu>
3149 2002-03-17 Fernando Perez <fperez@colorado.edu>
3144
3150
3145 * IPython/UserConfig/magic_gnuplot.py: new name for the
3151 * IPython/UserConfig/magic_gnuplot.py: new name for the
3146 example-magic_pm.py file. Much enhanced system, now with a shell
3152 example-magic_pm.py file. Much enhanced system, now with a shell
3147 for communicating directly with gnuplot, one command at a time.
3153 for communicating directly with gnuplot, one command at a time.
3148
3154
3149 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3155 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3150 setting __name__=='__main__'.
3156 setting __name__=='__main__'.
3151
3157
3152 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3158 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3153 mini-shell for accessing gnuplot from inside ipython. Should
3159 mini-shell for accessing gnuplot from inside ipython. Should
3154 extend it later for grace access too. Inspired by Arnd's
3160 extend it later for grace access too. Inspired by Arnd's
3155 suggestion.
3161 suggestion.
3156
3162
3157 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3163 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3158 calling magic functions with () in their arguments. Thanks to Arnd
3164 calling magic functions with () in their arguments. Thanks to Arnd
3159 Baecker for pointing this to me.
3165 Baecker for pointing this to me.
3160
3166
3161 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3167 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3162 infinitely for integer or complex arrays (only worked with floats).
3168 infinitely for integer or complex arrays (only worked with floats).
3163
3169
3164 2002-03-16 Fernando Perez <fperez@colorado.edu>
3170 2002-03-16 Fernando Perez <fperez@colorado.edu>
3165
3171
3166 * setup.py: Merged setup and setup_windows into a single script
3172 * setup.py: Merged setup and setup_windows into a single script
3167 which properly handles things for windows users.
3173 which properly handles things for windows users.
3168
3174
3169 2002-03-15 Fernando Perez <fperez@colorado.edu>
3175 2002-03-15 Fernando Perez <fperez@colorado.edu>
3170
3176
3171 * Big change to the manual: now the magics are all automatically
3177 * Big change to the manual: now the magics are all automatically
3172 documented. This information is generated from their docstrings
3178 documented. This information is generated from their docstrings
3173 and put in a latex file included by the manual lyx file. This way
3179 and put in a latex file included by the manual lyx file. This way
3174 we get always up to date information for the magics. The manual
3180 we get always up to date information for the magics. The manual
3175 now also has proper version information, also auto-synced.
3181 now also has proper version information, also auto-synced.
3176
3182
3177 For this to work, an undocumented --magic_docstrings option was added.
3183 For this to work, an undocumented --magic_docstrings option was added.
3178
3184
3179 2002-03-13 Fernando Perez <fperez@colorado.edu>
3185 2002-03-13 Fernando Perez <fperez@colorado.edu>
3180
3186
3181 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3187 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3182 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3188 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3183
3189
3184 2002-03-12 Fernando Perez <fperez@colorado.edu>
3190 2002-03-12 Fernando Perez <fperez@colorado.edu>
3185
3191
3186 * IPython/ultraTB.py (TermColors): changed color escapes again to
3192 * IPython/ultraTB.py (TermColors): changed color escapes again to
3187 fix the (old, reintroduced) line-wrapping bug. Basically, if
3193 fix the (old, reintroduced) line-wrapping bug. Basically, if
3188 \001..\002 aren't given in the color escapes, lines get wrapped
3194 \001..\002 aren't given in the color escapes, lines get wrapped
3189 weirdly. But giving those screws up old xterms and emacs terms. So
3195 weirdly. But giving those screws up old xterms and emacs terms. So
3190 I added some logic for emacs terms to be ok, but I can't identify old
3196 I added some logic for emacs terms to be ok, but I can't identify old
3191 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3197 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3192
3198
3193 2002-03-10 Fernando Perez <fperez@colorado.edu>
3199 2002-03-10 Fernando Perez <fperez@colorado.edu>
3194
3200
3195 * IPython/usage.py (__doc__): Various documentation cleanups and
3201 * IPython/usage.py (__doc__): Various documentation cleanups and
3196 updates, both in usage docstrings and in the manual.
3202 updates, both in usage docstrings and in the manual.
3197
3203
3198 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3204 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3199 handling of caching. Set minimum acceptabe value for having a
3205 handling of caching. Set minimum acceptabe value for having a
3200 cache at 20 values.
3206 cache at 20 values.
3201
3207
3202 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3208 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3203 install_first_time function to a method, renamed it and added an
3209 install_first_time function to a method, renamed it and added an
3204 'upgrade' mode. Now people can update their config directory with
3210 'upgrade' mode. Now people can update their config directory with
3205 a simple command line switch (-upgrade, also new).
3211 a simple command line switch (-upgrade, also new).
3206
3212
3207 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3213 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3208 @file (convenient for automagic users under Python >= 2.2).
3214 @file (convenient for automagic users under Python >= 2.2).
3209 Removed @files (it seemed more like a plural than an abbrev. of
3215 Removed @files (it seemed more like a plural than an abbrev. of
3210 'file show').
3216 'file show').
3211
3217
3212 * IPython/iplib.py (install_first_time): Fixed crash if there were
3218 * IPython/iplib.py (install_first_time): Fixed crash if there were
3213 backup files ('~') in .ipython/ install directory.
3219 backup files ('~') in .ipython/ install directory.
3214
3220
3215 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3221 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3216 system. Things look fine, but these changes are fairly
3222 system. Things look fine, but these changes are fairly
3217 intrusive. Test them for a few days.
3223 intrusive. Test them for a few days.
3218
3224
3219 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3225 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3220 the prompts system. Now all in/out prompt strings are user
3226 the prompts system. Now all in/out prompt strings are user
3221 controllable. This is particularly useful for embedding, as one
3227 controllable. This is particularly useful for embedding, as one
3222 can tag embedded instances with particular prompts.
3228 can tag embedded instances with particular prompts.
3223
3229
3224 Also removed global use of sys.ps1/2, which now allows nested
3230 Also removed global use of sys.ps1/2, which now allows nested
3225 embeddings without any problems. Added command-line options for
3231 embeddings without any problems. Added command-line options for
3226 the prompt strings.
3232 the prompt strings.
3227
3233
3228 2002-03-08 Fernando Perez <fperez@colorado.edu>
3234 2002-03-08 Fernando Perez <fperez@colorado.edu>
3229
3235
3230 * IPython/UserConfig/example-embed-short.py (ipshell): added
3236 * IPython/UserConfig/example-embed-short.py (ipshell): added
3231 example file with the bare minimum code for embedding.
3237 example file with the bare minimum code for embedding.
3232
3238
3233 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3239 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3234 functionality for the embeddable shell to be activated/deactivated
3240 functionality for the embeddable shell to be activated/deactivated
3235 either globally or at each call.
3241 either globally or at each call.
3236
3242
3237 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3243 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3238 rewriting the prompt with '--->' for auto-inputs with proper
3244 rewriting the prompt with '--->' for auto-inputs with proper
3239 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3245 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3240 this is handled by the prompts class itself, as it should.
3246 this is handled by the prompts class itself, as it should.
3241
3247
3242 2002-03-05 Fernando Perez <fperez@colorado.edu>
3248 2002-03-05 Fernando Perez <fperez@colorado.edu>
3243
3249
3244 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3250 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3245 @logstart to avoid name clashes with the math log function.
3251 @logstart to avoid name clashes with the math log function.
3246
3252
3247 * Big updates to X/Emacs section of the manual.
3253 * Big updates to X/Emacs section of the manual.
3248
3254
3249 * Removed ipython_emacs. Milan explained to me how to pass
3255 * Removed ipython_emacs. Milan explained to me how to pass
3250 arguments to ipython through Emacs. Some day I'm going to end up
3256 arguments to ipython through Emacs. Some day I'm going to end up
3251 learning some lisp...
3257 learning some lisp...
3252
3258
3253 2002-03-04 Fernando Perez <fperez@colorado.edu>
3259 2002-03-04 Fernando Perez <fperez@colorado.edu>
3254
3260
3255 * IPython/ipython_emacs: Created script to be used as the
3261 * IPython/ipython_emacs: Created script to be used as the
3256 py-python-command Emacs variable so we can pass IPython
3262 py-python-command Emacs variable so we can pass IPython
3257 parameters. I can't figure out how to tell Emacs directly to pass
3263 parameters. I can't figure out how to tell Emacs directly to pass
3258 parameters to IPython, so a dummy shell script will do it.
3264 parameters to IPython, so a dummy shell script will do it.
3259
3265
3260 Other enhancements made for things to work better under Emacs'
3266 Other enhancements made for things to work better under Emacs'
3261 various types of terminals. Many thanks to Milan Zamazal
3267 various types of terminals. Many thanks to Milan Zamazal
3262 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3268 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3263
3269
3264 2002-03-01 Fernando Perez <fperez@colorado.edu>
3270 2002-03-01 Fernando Perez <fperez@colorado.edu>
3265
3271
3266 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3272 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3267 that loading of readline is now optional. This gives better
3273 that loading of readline is now optional. This gives better
3268 control to emacs users.
3274 control to emacs users.
3269
3275
3270 * IPython/ultraTB.py (__date__): Modified color escape sequences
3276 * IPython/ultraTB.py (__date__): Modified color escape sequences
3271 and now things work fine under xterm and in Emacs' term buffers
3277 and now things work fine under xterm and in Emacs' term buffers
3272 (though not shell ones). Well, in emacs you get colors, but all
3278 (though not shell ones). Well, in emacs you get colors, but all
3273 seem to be 'light' colors (no difference between dark and light
3279 seem to be 'light' colors (no difference between dark and light
3274 ones). But the garbage chars are gone, and also in xterms. It
3280 ones). But the garbage chars are gone, and also in xterms. It
3275 seems that now I'm using 'cleaner' ansi sequences.
3281 seems that now I'm using 'cleaner' ansi sequences.
3276
3282
3277 2002-02-21 Fernando Perez <fperez@colorado.edu>
3283 2002-02-21 Fernando Perez <fperez@colorado.edu>
3278
3284
3279 * Released 0.2.7 (mainly to publish the scoping fix).
3285 * Released 0.2.7 (mainly to publish the scoping fix).
3280
3286
3281 * IPython/Logger.py (Logger.logstate): added. A corresponding
3287 * IPython/Logger.py (Logger.logstate): added. A corresponding
3282 @logstate magic was created.
3288 @logstate magic was created.
3283
3289
3284 * IPython/Magic.py: fixed nested scoping problem under Python
3290 * IPython/Magic.py: fixed nested scoping problem under Python
3285 2.1.x (automagic wasn't working).
3291 2.1.x (automagic wasn't working).
3286
3292
3287 2002-02-20 Fernando Perez <fperez@colorado.edu>
3293 2002-02-20 Fernando Perez <fperez@colorado.edu>
3288
3294
3289 * Released 0.2.6.
3295 * Released 0.2.6.
3290
3296
3291 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3297 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3292 option so that logs can come out without any headers at all.
3298 option so that logs can come out without any headers at all.
3293
3299
3294 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3300 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3295 SciPy.
3301 SciPy.
3296
3302
3297 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3303 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3298 that embedded IPython calls don't require vars() to be explicitly
3304 that embedded IPython calls don't require vars() to be explicitly
3299 passed. Now they are extracted from the caller's frame (code
3305 passed. Now they are extracted from the caller's frame (code
3300 snatched from Eric Jones' weave). Added better documentation to
3306 snatched from Eric Jones' weave). Added better documentation to
3301 the section on embedding and the example file.
3307 the section on embedding and the example file.
3302
3308
3303 * IPython/genutils.py (page): Changed so that under emacs, it just
3309 * IPython/genutils.py (page): Changed so that under emacs, it just
3304 prints the string. You can then page up and down in the emacs
3310 prints the string. You can then page up and down in the emacs
3305 buffer itself. This is how the builtin help() works.
3311 buffer itself. This is how the builtin help() works.
3306
3312
3307 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3313 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3308 macro scoping: macros need to be executed in the user's namespace
3314 macro scoping: macros need to be executed in the user's namespace
3309 to work as if they had been typed by the user.
3315 to work as if they had been typed by the user.
3310
3316
3311 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3317 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3312 execute automatically (no need to type 'exec...'). They then
3318 execute automatically (no need to type 'exec...'). They then
3313 behave like 'true macros'. The printing system was also modified
3319 behave like 'true macros'. The printing system was also modified
3314 for this to work.
3320 for this to work.
3315
3321
3316 2002-02-19 Fernando Perez <fperez@colorado.edu>
3322 2002-02-19 Fernando Perez <fperez@colorado.edu>
3317
3323
3318 * IPython/genutils.py (page_file): new function for paging files
3324 * IPython/genutils.py (page_file): new function for paging files
3319 in an OS-independent way. Also necessary for file viewing to work
3325 in an OS-independent way. Also necessary for file viewing to work
3320 well inside Emacs buffers.
3326 well inside Emacs buffers.
3321 (page): Added checks for being in an emacs buffer.
3327 (page): Added checks for being in an emacs buffer.
3322 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3328 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3323 same bug in iplib.
3329 same bug in iplib.
3324
3330
3325 2002-02-18 Fernando Perez <fperez@colorado.edu>
3331 2002-02-18 Fernando Perez <fperez@colorado.edu>
3326
3332
3327 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3333 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3328 of readline so that IPython can work inside an Emacs buffer.
3334 of readline so that IPython can work inside an Emacs buffer.
3329
3335
3330 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3336 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3331 method signatures (they weren't really bugs, but it looks cleaner
3337 method signatures (they weren't really bugs, but it looks cleaner
3332 and keeps PyChecker happy).
3338 and keeps PyChecker happy).
3333
3339
3334 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3340 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3335 for implementing various user-defined hooks. Currently only
3341 for implementing various user-defined hooks. Currently only
3336 display is done.
3342 display is done.
3337
3343
3338 * IPython/Prompts.py (CachedOutput._display): changed display
3344 * IPython/Prompts.py (CachedOutput._display): changed display
3339 functions so that they can be dynamically changed by users easily.
3345 functions so that they can be dynamically changed by users easily.
3340
3346
3341 * IPython/Extensions/numeric_formats.py (num_display): added an
3347 * IPython/Extensions/numeric_formats.py (num_display): added an
3342 extension for printing NumPy arrays in flexible manners. It
3348 extension for printing NumPy arrays in flexible manners. It
3343 doesn't do anything yet, but all the structure is in
3349 doesn't do anything yet, but all the structure is in
3344 place. Ultimately the plan is to implement output format control
3350 place. Ultimately the plan is to implement output format control
3345 like in Octave.
3351 like in Octave.
3346
3352
3347 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3353 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3348 methods are found at run-time by all the automatic machinery.
3354 methods are found at run-time by all the automatic machinery.
3349
3355
3350 2002-02-17 Fernando Perez <fperez@colorado.edu>
3356 2002-02-17 Fernando Perez <fperez@colorado.edu>
3351
3357
3352 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3358 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3353 whole file a little.
3359 whole file a little.
3354
3360
3355 * ToDo: closed this document. Now there's a new_design.lyx
3361 * ToDo: closed this document. Now there's a new_design.lyx
3356 document for all new ideas. Added making a pdf of it for the
3362 document for all new ideas. Added making a pdf of it for the
3357 end-user distro.
3363 end-user distro.
3358
3364
3359 * IPython/Logger.py (Logger.switch_log): Created this to replace
3365 * IPython/Logger.py (Logger.switch_log): Created this to replace
3360 logon() and logoff(). It also fixes a nasty crash reported by
3366 logon() and logoff(). It also fixes a nasty crash reported by
3361 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3367 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3362
3368
3363 * IPython/iplib.py (complete): got auto-completion to work with
3369 * IPython/iplib.py (complete): got auto-completion to work with
3364 automagic (I had wanted this for a long time).
3370 automagic (I had wanted this for a long time).
3365
3371
3366 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3372 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3367 to @file, since file() is now a builtin and clashes with automagic
3373 to @file, since file() is now a builtin and clashes with automagic
3368 for @file.
3374 for @file.
3369
3375
3370 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3376 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3371 of this was previously in iplib, which had grown to more than 2000
3377 of this was previously in iplib, which had grown to more than 2000
3372 lines, way too long. No new functionality, but it makes managing
3378 lines, way too long. No new functionality, but it makes managing
3373 the code a bit easier.
3379 the code a bit easier.
3374
3380
3375 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3381 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3376 information to crash reports.
3382 information to crash reports.
3377
3383
3378 2002-02-12 Fernando Perez <fperez@colorado.edu>
3384 2002-02-12 Fernando Perez <fperez@colorado.edu>
3379
3385
3380 * Released 0.2.5.
3386 * Released 0.2.5.
3381
3387
3382 2002-02-11 Fernando Perez <fperez@colorado.edu>
3388 2002-02-11 Fernando Perez <fperez@colorado.edu>
3383
3389
3384 * Wrote a relatively complete Windows installer. It puts
3390 * Wrote a relatively complete Windows installer. It puts
3385 everything in place, creates Start Menu entries and fixes the
3391 everything in place, creates Start Menu entries and fixes the
3386 color issues. Nothing fancy, but it works.
3392 color issues. Nothing fancy, but it works.
3387
3393
3388 2002-02-10 Fernando Perez <fperez@colorado.edu>
3394 2002-02-10 Fernando Perez <fperez@colorado.edu>
3389
3395
3390 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3396 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3391 os.path.expanduser() call so that we can type @run ~/myfile.py and
3397 os.path.expanduser() call so that we can type @run ~/myfile.py and
3392 have thigs work as expected.
3398 have thigs work as expected.
3393
3399
3394 * IPython/genutils.py (page): fixed exception handling so things
3400 * IPython/genutils.py (page): fixed exception handling so things
3395 work both in Unix and Windows correctly. Quitting a pager triggers
3401 work both in Unix and Windows correctly. Quitting a pager triggers
3396 an IOError/broken pipe in Unix, and in windows not finding a pager
3402 an IOError/broken pipe in Unix, and in windows not finding a pager
3397 is also an IOError, so I had to actually look at the return value
3403 is also an IOError, so I had to actually look at the return value
3398 of the exception, not just the exception itself. Should be ok now.
3404 of the exception, not just the exception itself. Should be ok now.
3399
3405
3400 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3406 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3401 modified to allow case-insensitive color scheme changes.
3407 modified to allow case-insensitive color scheme changes.
3402
3408
3403 2002-02-09 Fernando Perez <fperez@colorado.edu>
3409 2002-02-09 Fernando Perez <fperez@colorado.edu>
3404
3410
3405 * IPython/genutils.py (native_line_ends): new function to leave
3411 * IPython/genutils.py (native_line_ends): new function to leave
3406 user config files with os-native line-endings.
3412 user config files with os-native line-endings.
3407
3413
3408 * README and manual updates.
3414 * README and manual updates.
3409
3415
3410 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3416 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3411 instead of StringType to catch Unicode strings.
3417 instead of StringType to catch Unicode strings.
3412
3418
3413 * IPython/genutils.py (filefind): fixed bug for paths with
3419 * IPython/genutils.py (filefind): fixed bug for paths with
3414 embedded spaces (very common in Windows).
3420 embedded spaces (very common in Windows).
3415
3421
3416 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3422 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3417 files under Windows, so that they get automatically associated
3423 files under Windows, so that they get automatically associated
3418 with a text editor. Windows makes it a pain to handle
3424 with a text editor. Windows makes it a pain to handle
3419 extension-less files.
3425 extension-less files.
3420
3426
3421 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3427 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3422 warning about readline only occur for Posix. In Windows there's no
3428 warning about readline only occur for Posix. In Windows there's no
3423 way to get readline, so why bother with the warning.
3429 way to get readline, so why bother with the warning.
3424
3430
3425 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3431 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3426 for __str__ instead of dir(self), since dir() changed in 2.2.
3432 for __str__ instead of dir(self), since dir() changed in 2.2.
3427
3433
3428 * Ported to Windows! Tested on XP, I suspect it should work fine
3434 * Ported to Windows! Tested on XP, I suspect it should work fine
3429 on NT/2000, but I don't think it will work on 98 et al. That
3435 on NT/2000, but I don't think it will work on 98 et al. That
3430 series of Windows is such a piece of junk anyway that I won't try
3436 series of Windows is such a piece of junk anyway that I won't try
3431 porting it there. The XP port was straightforward, showed a few
3437 porting it there. The XP port was straightforward, showed a few
3432 bugs here and there (fixed all), in particular some string
3438 bugs here and there (fixed all), in particular some string
3433 handling stuff which required considering Unicode strings (which
3439 handling stuff which required considering Unicode strings (which
3434 Windows uses). This is good, but hasn't been too tested :) No
3440 Windows uses). This is good, but hasn't been too tested :) No
3435 fancy installer yet, I'll put a note in the manual so people at
3441 fancy installer yet, I'll put a note in the manual so people at
3436 least make manually a shortcut.
3442 least make manually a shortcut.
3437
3443
3438 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3444 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3439 into a single one, "colors". This now controls both prompt and
3445 into a single one, "colors". This now controls both prompt and
3440 exception color schemes, and can be changed both at startup
3446 exception color schemes, and can be changed both at startup
3441 (either via command-line switches or via ipythonrc files) and at
3447 (either via command-line switches or via ipythonrc files) and at
3442 runtime, with @colors.
3448 runtime, with @colors.
3443 (Magic.magic_run): renamed @prun to @run and removed the old
3449 (Magic.magic_run): renamed @prun to @run and removed the old
3444 @run. The two were too similar to warrant keeping both.
3450 @run. The two were too similar to warrant keeping both.
3445
3451
3446 2002-02-03 Fernando Perez <fperez@colorado.edu>
3452 2002-02-03 Fernando Perez <fperez@colorado.edu>
3447
3453
3448 * IPython/iplib.py (install_first_time): Added comment on how to
3454 * IPython/iplib.py (install_first_time): Added comment on how to
3449 configure the color options for first-time users. Put a <return>
3455 configure the color options for first-time users. Put a <return>
3450 request at the end so that small-terminal users get a chance to
3456 request at the end so that small-terminal users get a chance to
3451 read the startup info.
3457 read the startup info.
3452
3458
3453 2002-01-23 Fernando Perez <fperez@colorado.edu>
3459 2002-01-23 Fernando Perez <fperez@colorado.edu>
3454
3460
3455 * IPython/iplib.py (CachedOutput.update): Changed output memory
3461 * IPython/iplib.py (CachedOutput.update): Changed output memory
3456 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3462 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3457 input history we still use _i. Did this b/c these variable are
3463 input history we still use _i. Did this b/c these variable are
3458 very commonly used in interactive work, so the less we need to
3464 very commonly used in interactive work, so the less we need to
3459 type the better off we are.
3465 type the better off we are.
3460 (Magic.magic_prun): updated @prun to better handle the namespaces
3466 (Magic.magic_prun): updated @prun to better handle the namespaces
3461 the file will run in, including a fix for __name__ not being set
3467 the file will run in, including a fix for __name__ not being set
3462 before.
3468 before.
3463
3469
3464 2002-01-20 Fernando Perez <fperez@colorado.edu>
3470 2002-01-20 Fernando Perez <fperez@colorado.edu>
3465
3471
3466 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3472 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3467 extra garbage for Python 2.2. Need to look more carefully into
3473 extra garbage for Python 2.2. Need to look more carefully into
3468 this later.
3474 this later.
3469
3475
3470 2002-01-19 Fernando Perez <fperez@colorado.edu>
3476 2002-01-19 Fernando Perez <fperez@colorado.edu>
3471
3477
3472 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3478 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3473 display SyntaxError exceptions properly formatted when they occur
3479 display SyntaxError exceptions properly formatted when they occur
3474 (they can be triggered by imported code).
3480 (they can be triggered by imported code).
3475
3481
3476 2002-01-18 Fernando Perez <fperez@colorado.edu>
3482 2002-01-18 Fernando Perez <fperez@colorado.edu>
3477
3483
3478 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3484 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3479 SyntaxError exceptions are reported nicely formatted, instead of
3485 SyntaxError exceptions are reported nicely formatted, instead of
3480 spitting out only offset information as before.
3486 spitting out only offset information as before.
3481 (Magic.magic_prun): Added the @prun function for executing
3487 (Magic.magic_prun): Added the @prun function for executing
3482 programs with command line args inside IPython.
3488 programs with command line args inside IPython.
3483
3489
3484 2002-01-16 Fernando Perez <fperez@colorado.edu>
3490 2002-01-16 Fernando Perez <fperez@colorado.edu>
3485
3491
3486 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3492 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3487 to *not* include the last item given in a range. This brings their
3493 to *not* include the last item given in a range. This brings their
3488 behavior in line with Python's slicing:
3494 behavior in line with Python's slicing:
3489 a[n1:n2] -> a[n1]...a[n2-1]
3495 a[n1:n2] -> a[n1]...a[n2-1]
3490 It may be a bit less convenient, but I prefer to stick to Python's
3496 It may be a bit less convenient, but I prefer to stick to Python's
3491 conventions *everywhere*, so users never have to wonder.
3497 conventions *everywhere*, so users never have to wonder.
3492 (Magic.magic_macro): Added @macro function to ease the creation of
3498 (Magic.magic_macro): Added @macro function to ease the creation of
3493 macros.
3499 macros.
3494
3500
3495 2002-01-05 Fernando Perez <fperez@colorado.edu>
3501 2002-01-05 Fernando Perez <fperez@colorado.edu>
3496
3502
3497 * Released 0.2.4.
3503 * Released 0.2.4.
3498
3504
3499 * IPython/iplib.py (Magic.magic_pdef):
3505 * IPython/iplib.py (Magic.magic_pdef):
3500 (InteractiveShell.safe_execfile): report magic lines and error
3506 (InteractiveShell.safe_execfile): report magic lines and error
3501 lines without line numbers so one can easily copy/paste them for
3507 lines without line numbers so one can easily copy/paste them for
3502 re-execution.
3508 re-execution.
3503
3509
3504 * Updated manual with recent changes.
3510 * Updated manual with recent changes.
3505
3511
3506 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3512 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3507 docstring printing when class? is called. Very handy for knowing
3513 docstring printing when class? is called. Very handy for knowing
3508 how to create class instances (as long as __init__ is well
3514 how to create class instances (as long as __init__ is well
3509 documented, of course :)
3515 documented, of course :)
3510 (Magic.magic_doc): print both class and constructor docstrings.
3516 (Magic.magic_doc): print both class and constructor docstrings.
3511 (Magic.magic_pdef): give constructor info if passed a class and
3517 (Magic.magic_pdef): give constructor info if passed a class and
3512 __call__ info for callable object instances.
3518 __call__ info for callable object instances.
3513
3519
3514 2002-01-04 Fernando Perez <fperez@colorado.edu>
3520 2002-01-04 Fernando Perez <fperez@colorado.edu>
3515
3521
3516 * Made deep_reload() off by default. It doesn't always work
3522 * Made deep_reload() off by default. It doesn't always work
3517 exactly as intended, so it's probably safer to have it off. It's
3523 exactly as intended, so it's probably safer to have it off. It's
3518 still available as dreload() anyway, so nothing is lost.
3524 still available as dreload() anyway, so nothing is lost.
3519
3525
3520 2002-01-02 Fernando Perez <fperez@colorado.edu>
3526 2002-01-02 Fernando Perez <fperez@colorado.edu>
3521
3527
3522 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3528 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3523 so I wanted an updated release).
3529 so I wanted an updated release).
3524
3530
3525 2001-12-27 Fernando Perez <fperez@colorado.edu>
3531 2001-12-27 Fernando Perez <fperez@colorado.edu>
3526
3532
3527 * IPython/iplib.py (InteractiveShell.interact): Added the original
3533 * IPython/iplib.py (InteractiveShell.interact): Added the original
3528 code from 'code.py' for this module in order to change the
3534 code from 'code.py' for this module in order to change the
3529 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3535 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3530 the history cache would break when the user hit Ctrl-C, and
3536 the history cache would break when the user hit Ctrl-C, and
3531 interact() offers no way to add any hooks to it.
3537 interact() offers no way to add any hooks to it.
3532
3538
3533 2001-12-23 Fernando Perez <fperez@colorado.edu>
3539 2001-12-23 Fernando Perez <fperez@colorado.edu>
3534
3540
3535 * setup.py: added check for 'MANIFEST' before trying to remove
3541 * setup.py: added check for 'MANIFEST' before trying to remove
3536 it. Thanks to Sean Reifschneider.
3542 it. Thanks to Sean Reifschneider.
3537
3543
3538 2001-12-22 Fernando Perez <fperez@colorado.edu>
3544 2001-12-22 Fernando Perez <fperez@colorado.edu>
3539
3545
3540 * Released 0.2.2.
3546 * Released 0.2.2.
3541
3547
3542 * Finished (reasonably) writing the manual. Later will add the
3548 * Finished (reasonably) writing the manual. Later will add the
3543 python-standard navigation stylesheets, but for the time being
3549 python-standard navigation stylesheets, but for the time being
3544 it's fairly complete. Distribution will include html and pdf
3550 it's fairly complete. Distribution will include html and pdf
3545 versions.
3551 versions.
3546
3552
3547 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3553 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3548 (MayaVi author).
3554 (MayaVi author).
3549
3555
3550 2001-12-21 Fernando Perez <fperez@colorado.edu>
3556 2001-12-21 Fernando Perez <fperez@colorado.edu>
3551
3557
3552 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3558 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3553 good public release, I think (with the manual and the distutils
3559 good public release, I think (with the manual and the distutils
3554 installer). The manual can use some work, but that can go
3560 installer). The manual can use some work, but that can go
3555 slowly. Otherwise I think it's quite nice for end users. Next
3561 slowly. Otherwise I think it's quite nice for end users. Next
3556 summer, rewrite the guts of it...
3562 summer, rewrite the guts of it...
3557
3563
3558 * Changed format of ipythonrc files to use whitespace as the
3564 * Changed format of ipythonrc files to use whitespace as the
3559 separator instead of an explicit '='. Cleaner.
3565 separator instead of an explicit '='. Cleaner.
3560
3566
3561 2001-12-20 Fernando Perez <fperez@colorado.edu>
3567 2001-12-20 Fernando Perez <fperez@colorado.edu>
3562
3568
3563 * Started a manual in LyX. For now it's just a quick merge of the
3569 * Started a manual in LyX. For now it's just a quick merge of the
3564 various internal docstrings and READMEs. Later it may grow into a
3570 various internal docstrings and READMEs. Later it may grow into a
3565 nice, full-blown manual.
3571 nice, full-blown manual.
3566
3572
3567 * Set up a distutils based installer. Installation should now be
3573 * Set up a distutils based installer. Installation should now be
3568 trivially simple for end-users.
3574 trivially simple for end-users.
3569
3575
3570 2001-12-11 Fernando Perez <fperez@colorado.edu>
3576 2001-12-11 Fernando Perez <fperez@colorado.edu>
3571
3577
3572 * Released 0.2.0. First public release, announced it at
3578 * Released 0.2.0. First public release, announced it at
3573 comp.lang.python. From now on, just bugfixes...
3579 comp.lang.python. From now on, just bugfixes...
3574
3580
3575 * Went through all the files, set copyright/license notices and
3581 * Went through all the files, set copyright/license notices and
3576 cleaned up things. Ready for release.
3582 cleaned up things. Ready for release.
3577
3583
3578 2001-12-10 Fernando Perez <fperez@colorado.edu>
3584 2001-12-10 Fernando Perez <fperez@colorado.edu>
3579
3585
3580 * Changed the first-time installer not to use tarfiles. It's more
3586 * Changed the first-time installer not to use tarfiles. It's more
3581 robust now and less unix-dependent. Also makes it easier for
3587 robust now and less unix-dependent. Also makes it easier for
3582 people to later upgrade versions.
3588 people to later upgrade versions.
3583
3589
3584 * Changed @exit to @abort to reflect the fact that it's pretty
3590 * Changed @exit to @abort to reflect the fact that it's pretty
3585 brutal (a sys.exit()). The difference between @abort and Ctrl-D
3591 brutal (a sys.exit()). The difference between @abort and Ctrl-D
3586 becomes significant only when IPyhton is embedded: in that case,
3592 becomes significant only when IPyhton is embedded: in that case,
3587 C-D closes IPython only, but @abort kills the enclosing program
3593 C-D closes IPython only, but @abort kills the enclosing program
3588 too (unless it had called IPython inside a try catching
3594 too (unless it had called IPython inside a try catching
3589 SystemExit).
3595 SystemExit).
3590
3596
3591 * Created Shell module which exposes the actuall IPython Shell
3597 * Created Shell module which exposes the actuall IPython Shell
3592 classes, currently the normal and the embeddable one. This at
3598 classes, currently the normal and the embeddable one. This at
3593 least offers a stable interface we won't need to change when
3599 least offers a stable interface we won't need to change when
3594 (later) the internals are rewritten. That rewrite will be confined
3600 (later) the internals are rewritten. That rewrite will be confined
3595 to iplib and ipmaker, but the Shell interface should remain as is.
3601 to iplib and ipmaker, but the Shell interface should remain as is.
3596
3602
3597 * Added embed module which offers an embeddable IPShell object,
3603 * Added embed module which offers an embeddable IPShell object,
3598 useful to fire up IPython *inside* a running program. Great for
3604 useful to fire up IPython *inside* a running program. Great for
3599 debugging or dynamical data analysis.
3605 debugging or dynamical data analysis.
3600
3606
3601 2001-12-08 Fernando Perez <fperez@colorado.edu>
3607 2001-12-08 Fernando Perez <fperez@colorado.edu>
3602
3608
3603 * Fixed small bug preventing seeing info from methods of defined
3609 * Fixed small bug preventing seeing info from methods of defined
3604 objects (incorrect namespace in _ofind()).
3610 objects (incorrect namespace in _ofind()).
3605
3611
3606 * Documentation cleanup. Moved the main usage docstrings to a
3612 * Documentation cleanup. Moved the main usage docstrings to a
3607 separate file, usage.py (cleaner to maintain, and hopefully in the
3613 separate file, usage.py (cleaner to maintain, and hopefully in the
3608 future some perlpod-like way of producing interactive, man and
3614 future some perlpod-like way of producing interactive, man and
3609 html docs out of it will be found).
3615 html docs out of it will be found).
3610
3616
3611 * Added @profile to see your profile at any time.
3617 * Added @profile to see your profile at any time.
3612
3618
3613 * Added @p as an alias for 'print'. It's especially convenient if
3619 * Added @p as an alias for 'print'. It's especially convenient if
3614 using automagic ('p x' prints x).
3620 using automagic ('p x' prints x).
3615
3621
3616 * Small cleanups and fixes after a pychecker run.
3622 * Small cleanups and fixes after a pychecker run.
3617
3623
3618 * Changed the @cd command to handle @cd - and @cd -<n> for
3624 * Changed the @cd command to handle @cd - and @cd -<n> for
3619 visiting any directory in _dh.
3625 visiting any directory in _dh.
3620
3626
3621 * Introduced _dh, a history of visited directories. @dhist prints
3627 * Introduced _dh, a history of visited directories. @dhist prints
3622 it out with numbers.
3628 it out with numbers.
3623
3629
3624 2001-12-07 Fernando Perez <fperez@colorado.edu>
3630 2001-12-07 Fernando Perez <fperez@colorado.edu>
3625
3631
3626 * Released 0.1.22
3632 * Released 0.1.22
3627
3633
3628 * Made initialization a bit more robust against invalid color
3634 * Made initialization a bit more robust against invalid color
3629 options in user input (exit, not traceback-crash).
3635 options in user input (exit, not traceback-crash).
3630
3636
3631 * Changed the bug crash reporter to write the report only in the
3637 * Changed the bug crash reporter to write the report only in the
3632 user's .ipython directory. That way IPython won't litter people's
3638 user's .ipython directory. That way IPython won't litter people's
3633 hard disks with crash files all over the place. Also print on
3639 hard disks with crash files all over the place. Also print on
3634 screen the necessary mail command.
3640 screen the necessary mail command.
3635
3641
3636 * With the new ultraTB, implemented LightBG color scheme for light
3642 * With the new ultraTB, implemented LightBG color scheme for light
3637 background terminals. A lot of people like white backgrounds, so I
3643 background terminals. A lot of people like white backgrounds, so I
3638 guess we should at least give them something readable.
3644 guess we should at least give them something readable.
3639
3645
3640 2001-12-06 Fernando Perez <fperez@colorado.edu>
3646 2001-12-06 Fernando Perez <fperez@colorado.edu>
3641
3647
3642 * Modified the structure of ultraTB. Now there's a proper class
3648 * Modified the structure of ultraTB. Now there's a proper class
3643 for tables of color schemes which allow adding schemes easily and
3649 for tables of color schemes which allow adding schemes easily and
3644 switching the active scheme without creating a new instance every
3650 switching the active scheme without creating a new instance every
3645 time (which was ridiculous). The syntax for creating new schemes
3651 time (which was ridiculous). The syntax for creating new schemes
3646 is also cleaner. I think ultraTB is finally done, with a clean
3652 is also cleaner. I think ultraTB is finally done, with a clean
3647 class structure. Names are also much cleaner (now there's proper
3653 class structure. Names are also much cleaner (now there's proper
3648 color tables, no need for every variable to also have 'color' in
3654 color tables, no need for every variable to also have 'color' in
3649 its name).
3655 its name).
3650
3656
3651 * Broke down genutils into separate files. Now genutils only
3657 * Broke down genutils into separate files. Now genutils only
3652 contains utility functions, and classes have been moved to their
3658 contains utility functions, and classes have been moved to their
3653 own files (they had enough independent functionality to warrant
3659 own files (they had enough independent functionality to warrant
3654 it): ConfigLoader, OutputTrap, Struct.
3660 it): ConfigLoader, OutputTrap, Struct.
3655
3661
3656 2001-12-05 Fernando Perez <fperez@colorado.edu>
3662 2001-12-05 Fernando Perez <fperez@colorado.edu>
3657
3663
3658 * IPython turns 21! Released version 0.1.21, as a candidate for
3664 * IPython turns 21! Released version 0.1.21, as a candidate for
3659 public consumption. If all goes well, release in a few days.
3665 public consumption. If all goes well, release in a few days.
3660
3666
3661 * Fixed path bug (files in Extensions/ directory wouldn't be found
3667 * Fixed path bug (files in Extensions/ directory wouldn't be found
3662 unless IPython/ was explicitly in sys.path).
3668 unless IPython/ was explicitly in sys.path).
3663
3669
3664 * Extended the FlexCompleter class as MagicCompleter to allow
3670 * Extended the FlexCompleter class as MagicCompleter to allow
3665 completion of @-starting lines.
3671 completion of @-starting lines.
3666
3672
3667 * Created __release__.py file as a central repository for release
3673 * Created __release__.py file as a central repository for release
3668 info that other files can read from.
3674 info that other files can read from.
3669
3675
3670 * Fixed small bug in logging: when logging was turned on in
3676 * Fixed small bug in logging: when logging was turned on in
3671 mid-session, old lines with special meanings (!@?) were being
3677 mid-session, old lines with special meanings (!@?) were being
3672 logged without the prepended comment, which is necessary since
3678 logged without the prepended comment, which is necessary since
3673 they are not truly valid python syntax. This should make session
3679 they are not truly valid python syntax. This should make session
3674 restores produce less errors.
3680 restores produce less errors.
3675
3681
3676 * The namespace cleanup forced me to make a FlexCompleter class
3682 * The namespace cleanup forced me to make a FlexCompleter class
3677 which is nothing but a ripoff of rlcompleter, but with selectable
3683 which is nothing but a ripoff of rlcompleter, but with selectable
3678 namespace (rlcompleter only works in __main__.__dict__). I'll try
3684 namespace (rlcompleter only works in __main__.__dict__). I'll try
3679 to submit a note to the authors to see if this change can be
3685 to submit a note to the authors to see if this change can be
3680 incorporated in future rlcompleter releases (Dec.6: done)
3686 incorporated in future rlcompleter releases (Dec.6: done)
3681
3687
3682 * More fixes to namespace handling. It was a mess! Now all
3688 * More fixes to namespace handling. It was a mess! Now all
3683 explicit references to __main__.__dict__ are gone (except when
3689 explicit references to __main__.__dict__ are gone (except when
3684 really needed) and everything is handled through the namespace
3690 really needed) and everything is handled through the namespace
3685 dicts in the IPython instance. We seem to be getting somewhere
3691 dicts in the IPython instance. We seem to be getting somewhere
3686 with this, finally...
3692 with this, finally...
3687
3693
3688 * Small documentation updates.
3694 * Small documentation updates.
3689
3695
3690 * Created the Extensions directory under IPython (with an
3696 * Created the Extensions directory under IPython (with an
3691 __init__.py). Put the PhysicalQ stuff there. This directory should
3697 __init__.py). Put the PhysicalQ stuff there. This directory should
3692 be used for all special-purpose extensions.
3698 be used for all special-purpose extensions.
3693
3699
3694 * File renaming:
3700 * File renaming:
3695 ipythonlib --> ipmaker
3701 ipythonlib --> ipmaker
3696 ipplib --> iplib
3702 ipplib --> iplib
3697 This makes a bit more sense in terms of what these files actually do.
3703 This makes a bit more sense in terms of what these files actually do.
3698
3704
3699 * Moved all the classes and functions in ipythonlib to ipplib, so
3705 * Moved all the classes and functions in ipythonlib to ipplib, so
3700 now ipythonlib only has make_IPython(). This will ease up its
3706 now ipythonlib only has make_IPython(). This will ease up its
3701 splitting in smaller functional chunks later.
3707 splitting in smaller functional chunks later.
3702
3708
3703 * Cleaned up (done, I think) output of @whos. Better column
3709 * Cleaned up (done, I think) output of @whos. Better column
3704 formatting, and now shows str(var) for as much as it can, which is
3710 formatting, and now shows str(var) for as much as it can, which is
3705 typically what one gets with a 'print var'.
3711 typically what one gets with a 'print var'.
3706
3712
3707 2001-12-04 Fernando Perez <fperez@colorado.edu>
3713 2001-12-04 Fernando Perez <fperez@colorado.edu>
3708
3714
3709 * Fixed namespace problems. Now builtin/IPyhton/user names get
3715 * Fixed namespace problems. Now builtin/IPyhton/user names get
3710 properly reported in their namespace. Internal namespace handling
3716 properly reported in their namespace. Internal namespace handling
3711 is finally getting decent (not perfect yet, but much better than
3717 is finally getting decent (not perfect yet, but much better than
3712 the ad-hoc mess we had).
3718 the ad-hoc mess we had).
3713
3719
3714 * Removed -exit option. If people just want to run a python
3720 * Removed -exit option. If people just want to run a python
3715 script, that's what the normal interpreter is for. Less
3721 script, that's what the normal interpreter is for. Less
3716 unnecessary options, less chances for bugs.
3722 unnecessary options, less chances for bugs.
3717
3723
3718 * Added a crash handler which generates a complete post-mortem if
3724 * Added a crash handler which generates a complete post-mortem if
3719 IPython crashes. This will help a lot in tracking bugs down the
3725 IPython crashes. This will help a lot in tracking bugs down the
3720 road.
3726 road.
3721
3727
3722 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
3728 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
3723 which were boud to functions being reassigned would bypass the
3729 which were boud to functions being reassigned would bypass the
3724 logger, breaking the sync of _il with the prompt counter. This
3730 logger, breaking the sync of _il with the prompt counter. This
3725 would then crash IPython later when a new line was logged.
3731 would then crash IPython later when a new line was logged.
3726
3732
3727 2001-12-02 Fernando Perez <fperez@colorado.edu>
3733 2001-12-02 Fernando Perez <fperez@colorado.edu>
3728
3734
3729 * Made IPython a package. This means people don't have to clutter
3735 * Made IPython a package. This means people don't have to clutter
3730 their sys.path with yet another directory. Changed the INSTALL
3736 their sys.path with yet another directory. Changed the INSTALL
3731 file accordingly.
3737 file accordingly.
3732
3738
3733 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
3739 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
3734 sorts its output (so @who shows it sorted) and @whos formats the
3740 sorts its output (so @who shows it sorted) and @whos formats the
3735 table according to the width of the first column. Nicer, easier to
3741 table according to the width of the first column. Nicer, easier to
3736 read. Todo: write a generic table_format() which takes a list of
3742 read. Todo: write a generic table_format() which takes a list of
3737 lists and prints it nicely formatted, with optional row/column
3743 lists and prints it nicely formatted, with optional row/column
3738 separators and proper padding and justification.
3744 separators and proper padding and justification.
3739
3745
3740 * Released 0.1.20
3746 * Released 0.1.20
3741
3747
3742 * Fixed bug in @log which would reverse the inputcache list (a
3748 * Fixed bug in @log which would reverse the inputcache list (a
3743 copy operation was missing).
3749 copy operation was missing).
3744
3750
3745 * Code cleanup. @config was changed to use page(). Better, since
3751 * Code cleanup. @config was changed to use page(). Better, since
3746 its output is always quite long.
3752 its output is always quite long.
3747
3753
3748 * Itpl is back as a dependency. I was having too many problems
3754 * Itpl is back as a dependency. I was having too many problems
3749 getting the parametric aliases to work reliably, and it's just
3755 getting the parametric aliases to work reliably, and it's just
3750 easier to code weird string operations with it than playing %()s
3756 easier to code weird string operations with it than playing %()s
3751 games. It's only ~6k, so I don't think it's too big a deal.
3757 games. It's only ~6k, so I don't think it's too big a deal.
3752
3758
3753 * Found (and fixed) a very nasty bug with history. !lines weren't
3759 * Found (and fixed) a very nasty bug with history. !lines weren't
3754 getting cached, and the out of sync caches would crash
3760 getting cached, and the out of sync caches would crash
3755 IPython. Fixed it by reorganizing the prefilter/handlers/logger
3761 IPython. Fixed it by reorganizing the prefilter/handlers/logger
3756 division of labor a bit better. Bug fixed, cleaner structure.
3762 division of labor a bit better. Bug fixed, cleaner structure.
3757
3763
3758 2001-12-01 Fernando Perez <fperez@colorado.edu>
3764 2001-12-01 Fernando Perez <fperez@colorado.edu>
3759
3765
3760 * Released 0.1.19
3766 * Released 0.1.19
3761
3767
3762 * Added option -n to @hist to prevent line number printing. Much
3768 * Added option -n to @hist to prevent line number printing. Much
3763 easier to copy/paste code this way.
3769 easier to copy/paste code this way.
3764
3770
3765 * Created global _il to hold the input list. Allows easy
3771 * Created global _il to hold the input list. Allows easy
3766 re-execution of blocks of code by slicing it (inspired by Janko's
3772 re-execution of blocks of code by slicing it (inspired by Janko's
3767 comment on 'macros').
3773 comment on 'macros').
3768
3774
3769 * Small fixes and doc updates.
3775 * Small fixes and doc updates.
3770
3776
3771 * Rewrote @history function (was @h). Renamed it to @hist, @h is
3777 * Rewrote @history function (was @h). Renamed it to @hist, @h is
3772 much too fragile with automagic. Handles properly multi-line
3778 much too fragile with automagic. Handles properly multi-line
3773 statements and takes parameters.
3779 statements and takes parameters.
3774
3780
3775 2001-11-30 Fernando Perez <fperez@colorado.edu>
3781 2001-11-30 Fernando Perez <fperez@colorado.edu>
3776
3782
3777 * Version 0.1.18 released.
3783 * Version 0.1.18 released.
3778
3784
3779 * Fixed nasty namespace bug in initial module imports.
3785 * Fixed nasty namespace bug in initial module imports.
3780
3786
3781 * Added copyright/license notes to all code files (except
3787 * Added copyright/license notes to all code files (except
3782 DPyGetOpt). For the time being, LGPL. That could change.
3788 DPyGetOpt). For the time being, LGPL. That could change.
3783
3789
3784 * Rewrote a much nicer README, updated INSTALL, cleaned up
3790 * Rewrote a much nicer README, updated INSTALL, cleaned up
3785 ipythonrc-* samples.
3791 ipythonrc-* samples.
3786
3792
3787 * Overall code/documentation cleanup. Basically ready for
3793 * Overall code/documentation cleanup. Basically ready for
3788 release. Only remaining thing: licence decision (LGPL?).
3794 release. Only remaining thing: licence decision (LGPL?).
3789
3795
3790 * Converted load_config to a class, ConfigLoader. Now recursion
3796 * Converted load_config to a class, ConfigLoader. Now recursion
3791 control is better organized. Doesn't include the same file twice.
3797 control is better organized. Doesn't include the same file twice.
3792
3798
3793 2001-11-29 Fernando Perez <fperez@colorado.edu>
3799 2001-11-29 Fernando Perez <fperez@colorado.edu>
3794
3800
3795 * Got input history working. Changed output history variables from
3801 * Got input history working. Changed output history variables from
3796 _p to _o so that _i is for input and _o for output. Just cleaner
3802 _p to _o so that _i is for input and _o for output. Just cleaner
3797 convention.
3803 convention.
3798
3804
3799 * Implemented parametric aliases. This pretty much allows the
3805 * Implemented parametric aliases. This pretty much allows the
3800 alias system to offer full-blown shell convenience, I think.
3806 alias system to offer full-blown shell convenience, I think.
3801
3807
3802 * Version 0.1.17 released, 0.1.18 opened.
3808 * Version 0.1.17 released, 0.1.18 opened.
3803
3809
3804 * dot_ipython/ipythonrc (alias): added documentation.
3810 * dot_ipython/ipythonrc (alias): added documentation.
3805 (xcolor): Fixed small bug (xcolors -> xcolor)
3811 (xcolor): Fixed small bug (xcolors -> xcolor)
3806
3812
3807 * Changed the alias system. Now alias is a magic command to define
3813 * Changed the alias system. Now alias is a magic command to define
3808 aliases just like the shell. Rationale: the builtin magics should
3814 aliases just like the shell. Rationale: the builtin magics should
3809 be there for things deeply connected to IPython's
3815 be there for things deeply connected to IPython's
3810 architecture. And this is a much lighter system for what I think
3816 architecture. And this is a much lighter system for what I think
3811 is the really important feature: allowing users to define quickly
3817 is the really important feature: allowing users to define quickly
3812 magics that will do shell things for them, so they can customize
3818 magics that will do shell things for them, so they can customize
3813 IPython easily to match their work habits. If someone is really
3819 IPython easily to match their work habits. If someone is really
3814 desperate to have another name for a builtin alias, they can
3820 desperate to have another name for a builtin alias, they can
3815 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
3821 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
3816 works.
3822 works.
3817
3823
3818 2001-11-28 Fernando Perez <fperez@colorado.edu>
3824 2001-11-28 Fernando Perez <fperez@colorado.edu>
3819
3825
3820 * Changed @file so that it opens the source file at the proper
3826 * Changed @file so that it opens the source file at the proper
3821 line. Since it uses less, if your EDITOR environment is
3827 line. Since it uses less, if your EDITOR environment is
3822 configured, typing v will immediately open your editor of choice
3828 configured, typing v will immediately open your editor of choice
3823 right at the line where the object is defined. Not as quick as
3829 right at the line where the object is defined. Not as quick as
3824 having a direct @edit command, but for all intents and purposes it
3830 having a direct @edit command, but for all intents and purposes it
3825 works. And I don't have to worry about writing @edit to deal with
3831 works. And I don't have to worry about writing @edit to deal with
3826 all the editors, less does that.
3832 all the editors, less does that.
3827
3833
3828 * Version 0.1.16 released, 0.1.17 opened.
3834 * Version 0.1.16 released, 0.1.17 opened.
3829
3835
3830 * Fixed some nasty bugs in the page/page_dumb combo that could
3836 * Fixed some nasty bugs in the page/page_dumb combo that could
3831 crash IPython.
3837 crash IPython.
3832
3838
3833 2001-11-27 Fernando Perez <fperez@colorado.edu>
3839 2001-11-27 Fernando Perez <fperez@colorado.edu>
3834
3840
3835 * Version 0.1.15 released, 0.1.16 opened.
3841 * Version 0.1.15 released, 0.1.16 opened.
3836
3842
3837 * Finally got ? and ?? to work for undefined things: now it's
3843 * Finally got ? and ?? to work for undefined things: now it's
3838 possible to type {}.get? and get information about the get method
3844 possible to type {}.get? and get information about the get method
3839 of dicts, or os.path? even if only os is defined (so technically
3845 of dicts, or os.path? even if only os is defined (so technically
3840 os.path isn't). Works at any level. For example, after import os,
3846 os.path isn't). Works at any level. For example, after import os,
3841 os?, os.path?, os.path.abspath? all work. This is great, took some
3847 os?, os.path?, os.path.abspath? all work. This is great, took some
3842 work in _ofind.
3848 work in _ofind.
3843
3849
3844 * Fixed more bugs with logging. The sanest way to do it was to add
3850 * Fixed more bugs with logging. The sanest way to do it was to add
3845 to @log a 'mode' parameter. Killed two in one shot (this mode
3851 to @log a 'mode' parameter. Killed two in one shot (this mode
3846 option was a request of Janko's). I think it's finally clean
3852 option was a request of Janko's). I think it's finally clean
3847 (famous last words).
3853 (famous last words).
3848
3854
3849 * Added a page_dumb() pager which does a decent job of paging on
3855 * Added a page_dumb() pager which does a decent job of paging on
3850 screen, if better things (like less) aren't available. One less
3856 screen, if better things (like less) aren't available. One less
3851 unix dependency (someday maybe somebody will port this to
3857 unix dependency (someday maybe somebody will port this to
3852 windows).
3858 windows).
3853
3859
3854 * Fixed problem in magic_log: would lock of logging out if log
3860 * Fixed problem in magic_log: would lock of logging out if log
3855 creation failed (because it would still think it had succeeded).
3861 creation failed (because it would still think it had succeeded).
3856
3862
3857 * Improved the page() function using curses to auto-detect screen
3863 * Improved the page() function using curses to auto-detect screen
3858 size. Now it can make a much better decision on whether to print
3864 size. Now it can make a much better decision on whether to print
3859 or page a string. Option screen_length was modified: a value 0
3865 or page a string. Option screen_length was modified: a value 0
3860 means auto-detect, and that's the default now.
3866 means auto-detect, and that's the default now.
3861
3867
3862 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
3868 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
3863 go out. I'll test it for a few days, then talk to Janko about
3869 go out. I'll test it for a few days, then talk to Janko about
3864 licences and announce it.
3870 licences and announce it.
3865
3871
3866 * Fixed the length of the auto-generated ---> prompt which appears
3872 * Fixed the length of the auto-generated ---> prompt which appears
3867 for auto-parens and auto-quotes. Getting this right isn't trivial,
3873 for auto-parens and auto-quotes. Getting this right isn't trivial,
3868 with all the color escapes, different prompt types and optional
3874 with all the color escapes, different prompt types and optional
3869 separators. But it seems to be working in all the combinations.
3875 separators. But it seems to be working in all the combinations.
3870
3876
3871 2001-11-26 Fernando Perez <fperez@colorado.edu>
3877 2001-11-26 Fernando Perez <fperez@colorado.edu>
3872
3878
3873 * Wrote a regexp filter to get option types from the option names
3879 * Wrote a regexp filter to get option types from the option names
3874 string. This eliminates the need to manually keep two duplicate
3880 string. This eliminates the need to manually keep two duplicate
3875 lists.
3881 lists.
3876
3882
3877 * Removed the unneeded check_option_names. Now options are handled
3883 * Removed the unneeded check_option_names. Now options are handled
3878 in a much saner manner and it's easy to visually check that things
3884 in a much saner manner and it's easy to visually check that things
3879 are ok.
3885 are ok.
3880
3886
3881 * Updated version numbers on all files I modified to carry a
3887 * Updated version numbers on all files I modified to carry a
3882 notice so Janko and Nathan have clear version markers.
3888 notice so Janko and Nathan have clear version markers.
3883
3889
3884 * Updated docstring for ultraTB with my changes. I should send
3890 * Updated docstring for ultraTB with my changes. I should send
3885 this to Nathan.
3891 this to Nathan.
3886
3892
3887 * Lots of small fixes. Ran everything through pychecker again.
3893 * Lots of small fixes. Ran everything through pychecker again.
3888
3894
3889 * Made loading of deep_reload an cmd line option. If it's not too
3895 * Made loading of deep_reload an cmd line option. If it's not too
3890 kosher, now people can just disable it. With -nodeep_reload it's
3896 kosher, now people can just disable it. With -nodeep_reload it's
3891 still available as dreload(), it just won't overwrite reload().
3897 still available as dreload(), it just won't overwrite reload().
3892
3898
3893 * Moved many options to the no| form (-opt and -noopt
3899 * Moved many options to the no| form (-opt and -noopt
3894 accepted). Cleaner.
3900 accepted). Cleaner.
3895
3901
3896 * Changed magic_log so that if called with no parameters, it uses
3902 * Changed magic_log so that if called with no parameters, it uses
3897 'rotate' mode. That way auto-generated logs aren't automatically
3903 'rotate' mode. That way auto-generated logs aren't automatically
3898 over-written. For normal logs, now a backup is made if it exists
3904 over-written. For normal logs, now a backup is made if it exists
3899 (only 1 level of backups). A new 'backup' mode was added to the
3905 (only 1 level of backups). A new 'backup' mode was added to the
3900 Logger class to support this. This was a request by Janko.
3906 Logger class to support this. This was a request by Janko.
3901
3907
3902 * Added @logoff/@logon to stop/restart an active log.
3908 * Added @logoff/@logon to stop/restart an active log.
3903
3909
3904 * Fixed a lot of bugs in log saving/replay. It was pretty
3910 * Fixed a lot of bugs in log saving/replay. It was pretty
3905 broken. Now special lines (!@,/) appear properly in the command
3911 broken. Now special lines (!@,/) appear properly in the command
3906 history after a log replay.
3912 history after a log replay.
3907
3913
3908 * Tried and failed to implement full session saving via pickle. My
3914 * Tried and failed to implement full session saving via pickle. My
3909 idea was to pickle __main__.__dict__, but modules can't be
3915 idea was to pickle __main__.__dict__, but modules can't be
3910 pickled. This would be a better alternative to replaying logs, but
3916 pickled. This would be a better alternative to replaying logs, but
3911 seems quite tricky to get to work. Changed -session to be called
3917 seems quite tricky to get to work. Changed -session to be called
3912 -logplay, which more accurately reflects what it does. And if we
3918 -logplay, which more accurately reflects what it does. And if we
3913 ever get real session saving working, -session is now available.
3919 ever get real session saving working, -session is now available.
3914
3920
3915 * Implemented color schemes for prompts also. As for tracebacks,
3921 * Implemented color schemes for prompts also. As for tracebacks,
3916 currently only NoColor and Linux are supported. But now the
3922 currently only NoColor and Linux are supported. But now the
3917 infrastructure is in place, based on a generic ColorScheme
3923 infrastructure is in place, based on a generic ColorScheme
3918 class. So writing and activating new schemes both for the prompts
3924 class. So writing and activating new schemes both for the prompts
3919 and the tracebacks should be straightforward.
3925 and the tracebacks should be straightforward.
3920
3926
3921 * Version 0.1.13 released, 0.1.14 opened.
3927 * Version 0.1.13 released, 0.1.14 opened.
3922
3928
3923 * Changed handling of options for output cache. Now counter is
3929 * Changed handling of options for output cache. Now counter is
3924 hardwired starting at 1 and one specifies the maximum number of
3930 hardwired starting at 1 and one specifies the maximum number of
3925 entries *in the outcache* (not the max prompt counter). This is
3931 entries *in the outcache* (not the max prompt counter). This is
3926 much better, since many statements won't increase the cache
3932 much better, since many statements won't increase the cache
3927 count. It also eliminated some confusing options, now there's only
3933 count. It also eliminated some confusing options, now there's only
3928 one: cache_size.
3934 one: cache_size.
3929
3935
3930 * Added 'alias' magic function and magic_alias option in the
3936 * Added 'alias' magic function and magic_alias option in the
3931 ipythonrc file. Now the user can easily define whatever names he
3937 ipythonrc file. Now the user can easily define whatever names he
3932 wants for the magic functions without having to play weird
3938 wants for the magic functions without having to play weird
3933 namespace games. This gives IPython a real shell-like feel.
3939 namespace games. This gives IPython a real shell-like feel.
3934
3940
3935 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
3941 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
3936 @ or not).
3942 @ or not).
3937
3943
3938 This was one of the last remaining 'visible' bugs (that I know
3944 This was one of the last remaining 'visible' bugs (that I know
3939 of). I think if I can clean up the session loading so it works
3945 of). I think if I can clean up the session loading so it works
3940 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
3946 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
3941 about licensing).
3947 about licensing).
3942
3948
3943 2001-11-25 Fernando Perez <fperez@colorado.edu>
3949 2001-11-25 Fernando Perez <fperez@colorado.edu>
3944
3950
3945 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
3951 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
3946 there's a cleaner distinction between what ? and ?? show.
3952 there's a cleaner distinction between what ? and ?? show.
3947
3953
3948 * Added screen_length option. Now the user can define his own
3954 * Added screen_length option. Now the user can define his own
3949 screen size for page() operations.
3955 screen size for page() operations.
3950
3956
3951 * Implemented magic shell-like functions with automatic code
3957 * Implemented magic shell-like functions with automatic code
3952 generation. Now adding another function is just a matter of adding
3958 generation. Now adding another function is just a matter of adding
3953 an entry to a dict, and the function is dynamically generated at
3959 an entry to a dict, and the function is dynamically generated at
3954 run-time. Python has some really cool features!
3960 run-time. Python has some really cool features!
3955
3961
3956 * Renamed many options to cleanup conventions a little. Now all
3962 * Renamed many options to cleanup conventions a little. Now all
3957 are lowercase, and only underscores where needed. Also in the code
3963 are lowercase, and only underscores where needed. Also in the code
3958 option name tables are clearer.
3964 option name tables are clearer.
3959
3965
3960 * Changed prompts a little. Now input is 'In [n]:' instead of
3966 * Changed prompts a little. Now input is 'In [n]:' instead of
3961 'In[n]:='. This allows it the numbers to be aligned with the
3967 'In[n]:='. This allows it the numbers to be aligned with the
3962 Out[n] numbers, and removes usage of ':=' which doesn't exist in
3968 Out[n] numbers, and removes usage of ':=' which doesn't exist in
3963 Python (it was a Mathematica thing). The '...' continuation prompt
3969 Python (it was a Mathematica thing). The '...' continuation prompt
3964 was also changed a little to align better.
3970 was also changed a little to align better.
3965
3971
3966 * Fixed bug when flushing output cache. Not all _p<n> variables
3972 * Fixed bug when flushing output cache. Not all _p<n> variables
3967 exist, so their deletion needs to be wrapped in a try:
3973 exist, so their deletion needs to be wrapped in a try:
3968
3974
3969 * Figured out how to properly use inspect.formatargspec() (it
3975 * Figured out how to properly use inspect.formatargspec() (it
3970 requires the args preceded by *). So I removed all the code from
3976 requires the args preceded by *). So I removed all the code from
3971 _get_pdef in Magic, which was just replicating that.
3977 _get_pdef in Magic, which was just replicating that.
3972
3978
3973 * Added test to prefilter to allow redefining magic function names
3979 * Added test to prefilter to allow redefining magic function names
3974 as variables. This is ok, since the @ form is always available,
3980 as variables. This is ok, since the @ form is always available,
3975 but whe should allow the user to define a variable called 'ls' if
3981 but whe should allow the user to define a variable called 'ls' if
3976 he needs it.
3982 he needs it.
3977
3983
3978 * Moved the ToDo information from README into a separate ToDo.
3984 * Moved the ToDo information from README into a separate ToDo.
3979
3985
3980 * General code cleanup and small bugfixes. I think it's close to a
3986 * General code cleanup and small bugfixes. I think it's close to a
3981 state where it can be released, obviously with a big 'beta'
3987 state where it can be released, obviously with a big 'beta'
3982 warning on it.
3988 warning on it.
3983
3989
3984 * Got the magic function split to work. Now all magics are defined
3990 * Got the magic function split to work. Now all magics are defined
3985 in a separate class. It just organizes things a bit, and now
3991 in a separate class. It just organizes things a bit, and now
3986 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
3992 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
3987 was too long).
3993 was too long).
3988
3994
3989 * Changed @clear to @reset to avoid potential confusions with
3995 * Changed @clear to @reset to avoid potential confusions with
3990 the shell command clear. Also renamed @cl to @clear, which does
3996 the shell command clear. Also renamed @cl to @clear, which does
3991 exactly what people expect it to from their shell experience.
3997 exactly what people expect it to from their shell experience.
3992
3998
3993 Added a check to the @reset command (since it's so
3999 Added a check to the @reset command (since it's so
3994 destructive, it's probably a good idea to ask for confirmation).
4000 destructive, it's probably a good idea to ask for confirmation).
3995 But now reset only works for full namespace resetting. Since the
4001 But now reset only works for full namespace resetting. Since the
3996 del keyword is already there for deleting a few specific
4002 del keyword is already there for deleting a few specific
3997 variables, I don't see the point of having a redundant magic
4003 variables, I don't see the point of having a redundant magic
3998 function for the same task.
4004 function for the same task.
3999
4005
4000 2001-11-24 Fernando Perez <fperez@colorado.edu>
4006 2001-11-24 Fernando Perez <fperez@colorado.edu>
4001
4007
4002 * Updated the builtin docs (esp. the ? ones).
4008 * Updated the builtin docs (esp. the ? ones).
4003
4009
4004 * Ran all the code through pychecker. Not terribly impressed with
4010 * Ran all the code through pychecker. Not terribly impressed with
4005 it: lots of spurious warnings and didn't really find anything of
4011 it: lots of spurious warnings and didn't really find anything of
4006 substance (just a few modules being imported and not used).
4012 substance (just a few modules being imported and not used).
4007
4013
4008 * Implemented the new ultraTB functionality into IPython. New
4014 * Implemented the new ultraTB functionality into IPython. New
4009 option: xcolors. This chooses color scheme. xmode now only selects
4015 option: xcolors. This chooses color scheme. xmode now only selects
4010 between Plain and Verbose. Better orthogonality.
4016 between Plain and Verbose. Better orthogonality.
4011
4017
4012 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4018 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4013 mode and color scheme for the exception handlers. Now it's
4019 mode and color scheme for the exception handlers. Now it's
4014 possible to have the verbose traceback with no coloring.
4020 possible to have the verbose traceback with no coloring.
4015
4021
4016 2001-11-23 Fernando Perez <fperez@colorado.edu>
4022 2001-11-23 Fernando Perez <fperez@colorado.edu>
4017
4023
4018 * Version 0.1.12 released, 0.1.13 opened.
4024 * Version 0.1.12 released, 0.1.13 opened.
4019
4025
4020 * Removed option to set auto-quote and auto-paren escapes by
4026 * Removed option to set auto-quote and auto-paren escapes by
4021 user. The chances of breaking valid syntax are just too high. If
4027 user. The chances of breaking valid syntax are just too high. If
4022 someone *really* wants, they can always dig into the code.
4028 someone *really* wants, they can always dig into the code.
4023
4029
4024 * Made prompt separators configurable.
4030 * Made prompt separators configurable.
4025
4031
4026 2001-11-22 Fernando Perez <fperez@colorado.edu>
4032 2001-11-22 Fernando Perez <fperez@colorado.edu>
4027
4033
4028 * Small bugfixes in many places.
4034 * Small bugfixes in many places.
4029
4035
4030 * Removed the MyCompleter class from ipplib. It seemed redundant
4036 * Removed the MyCompleter class from ipplib. It seemed redundant
4031 with the C-p,C-n history search functionality. Less code to
4037 with the C-p,C-n history search functionality. Less code to
4032 maintain.
4038 maintain.
4033
4039
4034 * Moved all the original ipython.py code into ipythonlib.py. Right
4040 * Moved all the original ipython.py code into ipythonlib.py. Right
4035 now it's just one big dump into a function called make_IPython, so
4041 now it's just one big dump into a function called make_IPython, so
4036 no real modularity has been gained. But at least it makes the
4042 no real modularity has been gained. But at least it makes the
4037 wrapper script tiny, and since ipythonlib is a module, it gets
4043 wrapper script tiny, and since ipythonlib is a module, it gets
4038 compiled and startup is much faster.
4044 compiled and startup is much faster.
4039
4045
4040 This is a reasobably 'deep' change, so we should test it for a
4046 This is a reasobably 'deep' change, so we should test it for a
4041 while without messing too much more with the code.
4047 while without messing too much more with the code.
4042
4048
4043 2001-11-21 Fernando Perez <fperez@colorado.edu>
4049 2001-11-21 Fernando Perez <fperez@colorado.edu>
4044
4050
4045 * Version 0.1.11 released, 0.1.12 opened for further work.
4051 * Version 0.1.11 released, 0.1.12 opened for further work.
4046
4052
4047 * Removed dependency on Itpl. It was only needed in one place. It
4053 * Removed dependency on Itpl. It was only needed in one place. It
4048 would be nice if this became part of python, though. It makes life
4054 would be nice if this became part of python, though. It makes life
4049 *a lot* easier in some cases.
4055 *a lot* easier in some cases.
4050
4056
4051 * Simplified the prefilter code a bit. Now all handlers are
4057 * Simplified the prefilter code a bit. Now all handlers are
4052 expected to explicitly return a value (at least a blank string).
4058 expected to explicitly return a value (at least a blank string).
4053
4059
4054 * Heavy edits in ipplib. Removed the help system altogether. Now
4060 * Heavy edits in ipplib. Removed the help system altogether. Now
4055 obj?/?? is used for inspecting objects, a magic @doc prints
4061 obj?/?? is used for inspecting objects, a magic @doc prints
4056 docstrings, and full-blown Python help is accessed via the 'help'
4062 docstrings, and full-blown Python help is accessed via the 'help'
4057 keyword. This cleans up a lot of code (less to maintain) and does
4063 keyword. This cleans up a lot of code (less to maintain) and does
4058 the job. Since 'help' is now a standard Python component, might as
4064 the job. Since 'help' is now a standard Python component, might as
4059 well use it and remove duplicate functionality.
4065 well use it and remove duplicate functionality.
4060
4066
4061 Also removed the option to use ipplib as a standalone program. By
4067 Also removed the option to use ipplib as a standalone program. By
4062 now it's too dependent on other parts of IPython to function alone.
4068 now it's too dependent on other parts of IPython to function alone.
4063
4069
4064 * Fixed bug in genutils.pager. It would crash if the pager was
4070 * Fixed bug in genutils.pager. It would crash if the pager was
4065 exited immediately after opening (broken pipe).
4071 exited immediately after opening (broken pipe).
4066
4072
4067 * Trimmed down the VerboseTB reporting a little. The header is
4073 * Trimmed down the VerboseTB reporting a little. The header is
4068 much shorter now and the repeated exception arguments at the end
4074 much shorter now and the repeated exception arguments at the end
4069 have been removed. For interactive use the old header seemed a bit
4075 have been removed. For interactive use the old header seemed a bit
4070 excessive.
4076 excessive.
4071
4077
4072 * Fixed small bug in output of @whos for variables with multi-word
4078 * Fixed small bug in output of @whos for variables with multi-word
4073 types (only first word was displayed).
4079 types (only first word was displayed).
4074
4080
4075 2001-11-17 Fernando Perez <fperez@colorado.edu>
4081 2001-11-17 Fernando Perez <fperez@colorado.edu>
4076
4082
4077 * Version 0.1.10 released, 0.1.11 opened for further work.
4083 * Version 0.1.10 released, 0.1.11 opened for further work.
4078
4084
4079 * Modified dirs and friends. dirs now *returns* the stack (not
4085 * Modified dirs and friends. dirs now *returns* the stack (not
4080 prints), so one can manipulate it as a variable. Convenient to
4086 prints), so one can manipulate it as a variable. Convenient to
4081 travel along many directories.
4087 travel along many directories.
4082
4088
4083 * Fixed bug in magic_pdef: would only work with functions with
4089 * Fixed bug in magic_pdef: would only work with functions with
4084 arguments with default values.
4090 arguments with default values.
4085
4091
4086 2001-11-14 Fernando Perez <fperez@colorado.edu>
4092 2001-11-14 Fernando Perez <fperez@colorado.edu>
4087
4093
4088 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4094 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4089 example with IPython. Various other minor fixes and cleanups.
4095 example with IPython. Various other minor fixes and cleanups.
4090
4096
4091 * Version 0.1.9 released, 0.1.10 opened for further work.
4097 * Version 0.1.9 released, 0.1.10 opened for further work.
4092
4098
4093 * Added sys.path to the list of directories searched in the
4099 * Added sys.path to the list of directories searched in the
4094 execfile= option. It used to be the current directory and the
4100 execfile= option. It used to be the current directory and the
4095 user's IPYTHONDIR only.
4101 user's IPYTHONDIR only.
4096
4102
4097 2001-11-13 Fernando Perez <fperez@colorado.edu>
4103 2001-11-13 Fernando Perez <fperez@colorado.edu>
4098
4104
4099 * Reinstated the raw_input/prefilter separation that Janko had
4105 * Reinstated the raw_input/prefilter separation that Janko had
4100 initially. This gives a more convenient setup for extending the
4106 initially. This gives a more convenient setup for extending the
4101 pre-processor from the outside: raw_input always gets a string,
4107 pre-processor from the outside: raw_input always gets a string,
4102 and prefilter has to process it. We can then redefine prefilter
4108 and prefilter has to process it. We can then redefine prefilter
4103 from the outside and implement extensions for special
4109 from the outside and implement extensions for special
4104 purposes.
4110 purposes.
4105
4111
4106 Today I got one for inputting PhysicalQuantity objects
4112 Today I got one for inputting PhysicalQuantity objects
4107 (from Scientific) without needing any function calls at
4113 (from Scientific) without needing any function calls at
4108 all. Extremely convenient, and it's all done as a user-level
4114 all. Extremely convenient, and it's all done as a user-level
4109 extension (no IPython code was touched). Now instead of:
4115 extension (no IPython code was touched). Now instead of:
4110 a = PhysicalQuantity(4.2,'m/s**2')
4116 a = PhysicalQuantity(4.2,'m/s**2')
4111 one can simply say
4117 one can simply say
4112 a = 4.2 m/s**2
4118 a = 4.2 m/s**2
4113 or even
4119 or even
4114 a = 4.2 m/s^2
4120 a = 4.2 m/s^2
4115
4121
4116 I use this, but it's also a proof of concept: IPython really is
4122 I use this, but it's also a proof of concept: IPython really is
4117 fully user-extensible, even at the level of the parsing of the
4123 fully user-extensible, even at the level of the parsing of the
4118 command line. It's not trivial, but it's perfectly doable.
4124 command line. It's not trivial, but it's perfectly doable.
4119
4125
4120 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4126 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4121 the problem of modules being loaded in the inverse order in which
4127 the problem of modules being loaded in the inverse order in which
4122 they were defined in
4128 they were defined in
4123
4129
4124 * Version 0.1.8 released, 0.1.9 opened for further work.
4130 * Version 0.1.8 released, 0.1.9 opened for further work.
4125
4131
4126 * Added magics pdef, source and file. They respectively show the
4132 * Added magics pdef, source and file. They respectively show the
4127 definition line ('prototype' in C), source code and full python
4133 definition line ('prototype' in C), source code and full python
4128 file for any callable object. The object inspector oinfo uses
4134 file for any callable object. The object inspector oinfo uses
4129 these to show the same information.
4135 these to show the same information.
4130
4136
4131 * Version 0.1.7 released, 0.1.8 opened for further work.
4137 * Version 0.1.7 released, 0.1.8 opened for further work.
4132
4138
4133 * Separated all the magic functions into a class called Magic. The
4139 * Separated all the magic functions into a class called Magic. The
4134 InteractiveShell class was becoming too big for Xemacs to handle
4140 InteractiveShell class was becoming too big for Xemacs to handle
4135 (de-indenting a line would lock it up for 10 seconds while it
4141 (de-indenting a line would lock it up for 10 seconds while it
4136 backtracked on the whole class!)
4142 backtracked on the whole class!)
4137
4143
4138 FIXME: didn't work. It can be done, but right now namespaces are
4144 FIXME: didn't work. It can be done, but right now namespaces are
4139 all messed up. Do it later (reverted it for now, so at least
4145 all messed up. Do it later (reverted it for now, so at least
4140 everything works as before).
4146 everything works as before).
4141
4147
4142 * Got the object introspection system (magic_oinfo) working! I
4148 * Got the object introspection system (magic_oinfo) working! I
4143 think this is pretty much ready for release to Janko, so he can
4149 think this is pretty much ready for release to Janko, so he can
4144 test it for a while and then announce it. Pretty much 100% of what
4150 test it for a while and then announce it. Pretty much 100% of what
4145 I wanted for the 'phase 1' release is ready. Happy, tired.
4151 I wanted for the 'phase 1' release is ready. Happy, tired.
4146
4152
4147 2001-11-12 Fernando Perez <fperez@colorado.edu>
4153 2001-11-12 Fernando Perez <fperez@colorado.edu>
4148
4154
4149 * Version 0.1.6 released, 0.1.7 opened for further work.
4155 * Version 0.1.6 released, 0.1.7 opened for further work.
4150
4156
4151 * Fixed bug in printing: it used to test for truth before
4157 * Fixed bug in printing: it used to test for truth before
4152 printing, so 0 wouldn't print. Now checks for None.
4158 printing, so 0 wouldn't print. Now checks for None.
4153
4159
4154 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4160 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4155 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4161 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4156 reaches by hand into the outputcache. Think of a better way to do
4162 reaches by hand into the outputcache. Think of a better way to do
4157 this later.
4163 this later.
4158
4164
4159 * Various small fixes thanks to Nathan's comments.
4165 * Various small fixes thanks to Nathan's comments.
4160
4166
4161 * Changed magic_pprint to magic_Pprint. This way it doesn't
4167 * Changed magic_pprint to magic_Pprint. This way it doesn't
4162 collide with pprint() and the name is consistent with the command
4168 collide with pprint() and the name is consistent with the command
4163 line option.
4169 line option.
4164
4170
4165 * Changed prompt counter behavior to be fully like
4171 * Changed prompt counter behavior to be fully like
4166 Mathematica's. That is, even input that doesn't return a result
4172 Mathematica's. That is, even input that doesn't return a result
4167 raises the prompt counter. The old behavior was kind of confusing
4173 raises the prompt counter. The old behavior was kind of confusing
4168 (getting the same prompt number several times if the operation
4174 (getting the same prompt number several times if the operation
4169 didn't return a result).
4175 didn't return a result).
4170
4176
4171 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4177 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4172
4178
4173 * Fixed -Classic mode (wasn't working anymore).
4179 * Fixed -Classic mode (wasn't working anymore).
4174
4180
4175 * Added colored prompts using Nathan's new code. Colors are
4181 * Added colored prompts using Nathan's new code. Colors are
4176 currently hardwired, they can be user-configurable. For
4182 currently hardwired, they can be user-configurable. For
4177 developers, they can be chosen in file ipythonlib.py, at the
4183 developers, they can be chosen in file ipythonlib.py, at the
4178 beginning of the CachedOutput class def.
4184 beginning of the CachedOutput class def.
4179
4185
4180 2001-11-11 Fernando Perez <fperez@colorado.edu>
4186 2001-11-11 Fernando Perez <fperez@colorado.edu>
4181
4187
4182 * Version 0.1.5 released, 0.1.6 opened for further work.
4188 * Version 0.1.5 released, 0.1.6 opened for further work.
4183
4189
4184 * Changed magic_env to *return* the environment as a dict (not to
4190 * Changed magic_env to *return* the environment as a dict (not to
4185 print it). This way it prints, but it can also be processed.
4191 print it). This way it prints, but it can also be processed.
4186
4192
4187 * Added Verbose exception reporting to interactive
4193 * Added Verbose exception reporting to interactive
4188 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4194 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4189 traceback. Had to make some changes to the ultraTB file. This is
4195 traceback. Had to make some changes to the ultraTB file. This is
4190 probably the last 'big' thing in my mental todo list. This ties
4196 probably the last 'big' thing in my mental todo list. This ties
4191 in with the next entry:
4197 in with the next entry:
4192
4198
4193 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4199 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4194 has to specify is Plain, Color or Verbose for all exception
4200 has to specify is Plain, Color or Verbose for all exception
4195 handling.
4201 handling.
4196
4202
4197 * Removed ShellServices option. All this can really be done via
4203 * Removed ShellServices option. All this can really be done via
4198 the magic system. It's easier to extend, cleaner and has automatic
4204 the magic system. It's easier to extend, cleaner and has automatic
4199 namespace protection and documentation.
4205 namespace protection and documentation.
4200
4206
4201 2001-11-09 Fernando Perez <fperez@colorado.edu>
4207 2001-11-09 Fernando Perez <fperez@colorado.edu>
4202
4208
4203 * Fixed bug in output cache flushing (missing parameter to
4209 * Fixed bug in output cache flushing (missing parameter to
4204 __init__). Other small bugs fixed (found using pychecker).
4210 __init__). Other small bugs fixed (found using pychecker).
4205
4211
4206 * Version 0.1.4 opened for bugfixing.
4212 * Version 0.1.4 opened for bugfixing.
4207
4213
4208 2001-11-07 Fernando Perez <fperez@colorado.edu>
4214 2001-11-07 Fernando Perez <fperez@colorado.edu>
4209
4215
4210 * Version 0.1.3 released, mainly because of the raw_input bug.
4216 * Version 0.1.3 released, mainly because of the raw_input bug.
4211
4217
4212 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4218 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4213 and when testing for whether things were callable, a call could
4219 and when testing for whether things were callable, a call could
4214 actually be made to certain functions. They would get called again
4220 actually be made to certain functions. They would get called again
4215 once 'really' executed, with a resulting double call. A disaster
4221 once 'really' executed, with a resulting double call. A disaster
4216 in many cases (list.reverse() would never work!).
4222 in many cases (list.reverse() would never work!).
4217
4223
4218 * Removed prefilter() function, moved its code to raw_input (which
4224 * Removed prefilter() function, moved its code to raw_input (which
4219 after all was just a near-empty caller for prefilter). This saves
4225 after all was just a near-empty caller for prefilter). This saves
4220 a function call on every prompt, and simplifies the class a tiny bit.
4226 a function call on every prompt, and simplifies the class a tiny bit.
4221
4227
4222 * Fix _ip to __ip name in magic example file.
4228 * Fix _ip to __ip name in magic example file.
4223
4229
4224 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4230 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4225 work with non-gnu versions of tar.
4231 work with non-gnu versions of tar.
4226
4232
4227 2001-11-06 Fernando Perez <fperez@colorado.edu>
4233 2001-11-06 Fernando Perez <fperez@colorado.edu>
4228
4234
4229 * Version 0.1.2. Just to keep track of the recent changes.
4235 * Version 0.1.2. Just to keep track of the recent changes.
4230
4236
4231 * Fixed nasty bug in output prompt routine. It used to check 'if
4237 * Fixed nasty bug in output prompt routine. It used to check 'if
4232 arg != None...'. Problem is, this fails if arg implements a
4238 arg != None...'. Problem is, this fails if arg implements a
4233 special comparison (__cmp__) which disallows comparing to
4239 special comparison (__cmp__) which disallows comparing to
4234 None. Found it when trying to use the PhysicalQuantity module from
4240 None. Found it when trying to use the PhysicalQuantity module from
4235 ScientificPython.
4241 ScientificPython.
4236
4242
4237 2001-11-05 Fernando Perez <fperez@colorado.edu>
4243 2001-11-05 Fernando Perez <fperez@colorado.edu>
4238
4244
4239 * Also added dirs. Now the pushd/popd/dirs family functions
4245 * Also added dirs. Now the pushd/popd/dirs family functions
4240 basically like the shell, with the added convenience of going home
4246 basically like the shell, with the added convenience of going home
4241 when called with no args.
4247 when called with no args.
4242
4248
4243 * pushd/popd slightly modified to mimic shell behavior more
4249 * pushd/popd slightly modified to mimic shell behavior more
4244 closely.
4250 closely.
4245
4251
4246 * Added env,pushd,popd from ShellServices as magic functions. I
4252 * Added env,pushd,popd from ShellServices as magic functions. I
4247 think the cleanest will be to port all desired functions from
4253 think the cleanest will be to port all desired functions from
4248 ShellServices as magics and remove ShellServices altogether. This
4254 ShellServices as magics and remove ShellServices altogether. This
4249 will provide a single, clean way of adding functionality
4255 will provide a single, clean way of adding functionality
4250 (shell-type or otherwise) to IP.
4256 (shell-type or otherwise) to IP.
4251
4257
4252 2001-11-04 Fernando Perez <fperez@colorado.edu>
4258 2001-11-04 Fernando Perez <fperez@colorado.edu>
4253
4259
4254 * Added .ipython/ directory to sys.path. This way users can keep
4260 * Added .ipython/ directory to sys.path. This way users can keep
4255 customizations there and access them via import.
4261 customizations there and access them via import.
4256
4262
4257 2001-11-03 Fernando Perez <fperez@colorado.edu>
4263 2001-11-03 Fernando Perez <fperez@colorado.edu>
4258
4264
4259 * Opened version 0.1.1 for new changes.
4265 * Opened version 0.1.1 for new changes.
4260
4266
4261 * Changed version number to 0.1.0: first 'public' release, sent to
4267 * Changed version number to 0.1.0: first 'public' release, sent to
4262 Nathan and Janko.
4268 Nathan and Janko.
4263
4269
4264 * Lots of small fixes and tweaks.
4270 * Lots of small fixes and tweaks.
4265
4271
4266 * Minor changes to whos format. Now strings are shown, snipped if
4272 * Minor changes to whos format. Now strings are shown, snipped if
4267 too long.
4273 too long.
4268
4274
4269 * Changed ShellServices to work on __main__ so they show up in @who
4275 * Changed ShellServices to work on __main__ so they show up in @who
4270
4276
4271 * Help also works with ? at the end of a line:
4277 * Help also works with ? at the end of a line:
4272 ?sin and sin?
4278 ?sin and sin?
4273 both produce the same effect. This is nice, as often I use the
4279 both produce the same effect. This is nice, as often I use the
4274 tab-complete to find the name of a method, but I used to then have
4280 tab-complete to find the name of a method, but I used to then have
4275 to go to the beginning of the line to put a ? if I wanted more
4281 to go to the beginning of the line to put a ? if I wanted more
4276 info. Now I can just add the ? and hit return. Convenient.
4282 info. Now I can just add the ? and hit return. Convenient.
4277
4283
4278 2001-11-02 Fernando Perez <fperez@colorado.edu>
4284 2001-11-02 Fernando Perez <fperez@colorado.edu>
4279
4285
4280 * Python version check (>=2.1) added.
4286 * Python version check (>=2.1) added.
4281
4287
4282 * Added LazyPython documentation. At this point the docs are quite
4288 * Added LazyPython documentation. At this point the docs are quite
4283 a mess. A cleanup is in order.
4289 a mess. A cleanup is in order.
4284
4290
4285 * Auto-installer created. For some bizarre reason, the zipfiles
4291 * Auto-installer created. For some bizarre reason, the zipfiles
4286 module isn't working on my system. So I made a tar version
4292 module isn't working on my system. So I made a tar version
4287 (hopefully the command line options in various systems won't kill
4293 (hopefully the command line options in various systems won't kill
4288 me).
4294 me).
4289
4295
4290 * Fixes to Struct in genutils. Now all dictionary-like methods are
4296 * Fixes to Struct in genutils. Now all dictionary-like methods are
4291 protected (reasonably).
4297 protected (reasonably).
4292
4298
4293 * Added pager function to genutils and changed ? to print usage
4299 * Added pager function to genutils and changed ? to print usage
4294 note through it (it was too long).
4300 note through it (it was too long).
4295
4301
4296 * Added the LazyPython functionality. Works great! I changed the
4302 * Added the LazyPython functionality. Works great! I changed the
4297 auto-quote escape to ';', it's on home row and next to '. But
4303 auto-quote escape to ';', it's on home row and next to '. But
4298 both auto-quote and auto-paren (still /) escapes are command-line
4304 both auto-quote and auto-paren (still /) escapes are command-line
4299 parameters.
4305 parameters.
4300
4306
4301
4307
4302 2001-11-01 Fernando Perez <fperez@colorado.edu>
4308 2001-11-01 Fernando Perez <fperez@colorado.edu>
4303
4309
4304 * Version changed to 0.0.7. Fairly large change: configuration now
4310 * Version changed to 0.0.7. Fairly large change: configuration now
4305 is all stored in a directory, by default .ipython. There, all
4311 is all stored in a directory, by default .ipython. There, all
4306 config files have normal looking names (not .names)
4312 config files have normal looking names (not .names)
4307
4313
4308 * Version 0.0.6 Released first to Lucas and Archie as a test
4314 * Version 0.0.6 Released first to Lucas and Archie as a test
4309 run. Since it's the first 'semi-public' release, change version to
4315 run. Since it's the first 'semi-public' release, change version to
4310 > 0.0.6 for any changes now.
4316 > 0.0.6 for any changes now.
4311
4317
4312 * Stuff I had put in the ipplib.py changelog:
4318 * Stuff I had put in the ipplib.py changelog:
4313
4319
4314 Changes to InteractiveShell:
4320 Changes to InteractiveShell:
4315
4321
4316 - Made the usage message a parameter.
4322 - Made the usage message a parameter.
4317
4323
4318 - Require the name of the shell variable to be given. It's a bit
4324 - Require the name of the shell variable to be given. It's a bit
4319 of a hack, but allows the name 'shell' not to be hardwire in the
4325 of a hack, but allows the name 'shell' not to be hardwire in the
4320 magic (@) handler, which is problematic b/c it requires
4326 magic (@) handler, which is problematic b/c it requires
4321 polluting the global namespace with 'shell'. This in turn is
4327 polluting the global namespace with 'shell'. This in turn is
4322 fragile: if a user redefines a variable called shell, things
4328 fragile: if a user redefines a variable called shell, things
4323 break.
4329 break.
4324
4330
4325 - magic @: all functions available through @ need to be defined
4331 - magic @: all functions available through @ need to be defined
4326 as magic_<name>, even though they can be called simply as
4332 as magic_<name>, even though they can be called simply as
4327 @<name>. This allows the special command @magic to gather
4333 @<name>. This allows the special command @magic to gather
4328 information automatically about all existing magic functions,
4334 information automatically about all existing magic functions,
4329 even if they are run-time user extensions, by parsing the shell
4335 even if they are run-time user extensions, by parsing the shell
4330 instance __dict__ looking for special magic_ names.
4336 instance __dict__ looking for special magic_ names.
4331
4337
4332 - mainloop: added *two* local namespace parameters. This allows
4338 - mainloop: added *two* local namespace parameters. This allows
4333 the class to differentiate between parameters which were there
4339 the class to differentiate between parameters which were there
4334 before and after command line initialization was processed. This
4340 before and after command line initialization was processed. This
4335 way, later @who can show things loaded at startup by the
4341 way, later @who can show things loaded at startup by the
4336 user. This trick was necessary to make session saving/reloading
4342 user. This trick was necessary to make session saving/reloading
4337 really work: ideally after saving/exiting/reloading a session,
4343 really work: ideally after saving/exiting/reloading a session,
4338 *everythin* should look the same, including the output of @who. I
4344 *everythin* should look the same, including the output of @who. I
4339 was only able to make this work with this double namespace
4345 was only able to make this work with this double namespace
4340 trick.
4346 trick.
4341
4347
4342 - added a header to the logfile which allows (almost) full
4348 - added a header to the logfile which allows (almost) full
4343 session restoring.
4349 session restoring.
4344
4350
4345 - prepend lines beginning with @ or !, with a and log
4351 - prepend lines beginning with @ or !, with a and log
4346 them. Why? !lines: may be useful to know what you did @lines:
4352 them. Why? !lines: may be useful to know what you did @lines:
4347 they may affect session state. So when restoring a session, at
4353 they may affect session state. So when restoring a session, at
4348 least inform the user of their presence. I couldn't quite get
4354 least inform the user of their presence. I couldn't quite get
4349 them to properly re-execute, but at least the user is warned.
4355 them to properly re-execute, but at least the user is warned.
4350
4356
4351 * Started ChangeLog.
4357 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now